﻿// Description: Methods needed to open player pop-up and pass song id
//              Consolodated from inline scripts on various modules
// Created: 2009-04-30
// Created by:  Conan
var popupWin = null;
var itCount = 0;

function openPopup() 
{
    var url = "common/gtPlayer/player_proto_v1.aspx";	
	
    popupWin = open("", "popupWin", "width=500,height=500,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0" );
    if( !popupWin || popupWin.closed || !popupWin.setTrack ) 
    {
        popupWin = window.open( url, "popupWin", "width=500,height=500,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0" );
		
    } 
    else 
        popupWin.focus();
}

function initPlayTrack(strType, strName) 
{    
    openPopup();   
    
    try
    {     
        // need to check that window is loaded before attempting to play track    	    
        popupWin.setTrack(strType, strName);	    	    		    
    }
    catch(ex)
    {	
        // if can't load then reload with id in url
        popupWin.location = "common/gtPlayer/player_proto_v1.aspx?trackID=" + strName + "&loadtype=" + strType;
    }
	
}

function initPlaylist(strType, strName, strPlayListID) {
    openPopup();

    try {
        // need to check that window is loaded before attempting to play track
        popupWin.setPlaylistTrack(strType, strPlayListID);
    }
    catch (ex) {
        // if can't load then reload with id in url
        popupWin.location = "common/gtPlayer/player_proto_v1.aspx?trackID=" + strName + "&loadtype=" + strType + "&playlistID=" + strPlayListID;
    }

}
