﻿// JScript File
var getsec="";
var oldsec="";
var xmlHTTP;
var playlisthtml;
var plTitle;
function gethttp()
{
    try
    {
        xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
        try
        {
	        xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(e1)
        {
	        xmlHTTP = null;
        }
    }	
    // Mozilla then?
    if (!xmlHTTP && typeof XMLHttpRequest!='undefined')
    {
        xmlHTTP = new XMLHttpRequest();
    }							  

}
function GetPlayList(section)
{		

    gethttp();
    if(xmlHTTP!=null)
    {				
        var url = null;
        xmlHTTP.onreadystatechange = GotPlayList;
        oldsec=getsec;
        getsec=section;
        var bust="";
        bust = queryString('bust');
        if ((bust != "") && (bust != "false"))
            bust = "&bust=" + bust;
        else
            bust="";
        url  = "./pl.aspx?section=" + section + bust;
	    xmlHTTP.open("GET", url,  true);				    
	    xmlHTTP.send(null);                                                                                
    }
	
}
function GotPlayList()
{
    var rtnValue;
    if(xmlHTTP.readyState == 4)
    {			
	    if(xmlHTTP.status == 200)
	    {
		    rtnValue = xmlHTTP.responseText;
		    if (rtnValue != "")
		    {
		        var indx;
		        
		        indx=rtnValue.indexOf(":");
		        playlisthtml = rtnValue.substr(indx+1);
		        plTitle = rtnValue.substr(0,indx)
		        
		        document.getElementById("set"+getsec).setAttribute("title",plTitle);
		        window.setTimeout('setplisthtml()',25);

            }
       }
   }
}

function setplisthtml()
{
    
    document.getElementById("set"+getsec).visible=false;
    document.getElementById("set"+getsec).innerHTML = playlisthtml;
    var savetop = document.getElementById("set"+getsec).scrollTop;
    document.getElementById("set"+getsec).scrollTop = document.getElementById("set"+getsec).scrollHeight - 10;
    document.getElementById("set"+getsec).innerHTML = playlisthtml;
    document.getElementById("set"+getsec).scrollTop = savetop ;
    document.getElementById("set"+getsec).visible=true;
    document.getElementById("set"+getsec).className=browserplaylistclass();

}
function getbannervid(index)
{
   gethttp();
    if(xmlHTTP!=null)
    {				
        var url;
        xmlHTTP.onreadystatechange = gotbannervid;
        url  = "./sweetpicture.aspx/?v=" + index
	    xmlHTTP.open("GET", url,  true);				    
	    xmlHTTP.send(null);                                                                                
    }
}
function gotbannervid()
{
    var rtnValue;
    if(xmlHTTP.readyState == 4)
    {			
	    if(xmlHTTP.status == 200)
	    {
		    rtnValue = xmlHTTP.responseText;
		    if (rtnValue != "")
		    {
		        vidsecs = rtnValue.split(':');
                getset(vidsecs[0],vidsecs[1]+ ":"+ vidsecs[2]);
            }
         }
     }
}
/*
    var oImages;

    if (oldsec != "") 
    {
    document.getElementById("set"+oldsec).style.visibility='hidden';
    
    oImages = document.getElementById("set"+oldsec).getElementsByTagName("IMG");
    if (oImages.length) {
        for (var iImg = 0; iImg < oImages.length; iImg++) {
            var oImg = oImages(iImg);
            oImg.style.visibility = "hidden";
            }
    }
    }

    oImages = document.getElementById("set"+getsec).getElementsByTagName("IMG");
    if (oImages.length) {
        for (var iImg = 0; iImg < oImages.length; iImg++) {
            var oImg = oImages(iImg);
            oImg.style.visibility = "visible";
            }
    }
   
  


*/