var selectedRec;
var selectedSurah;

			
function runAudio(){

      selectedRec = document.getElementById("reciter").selectedIndex;
      selectedSurah = document.getElementById("surah").selectedIndex;
     var link = "get.php?r="+ reciter.options[selectedRec].value+"&s="+surah.options[selectedSurah].value;
     
     getInfo(link);
     

}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=365,height=210,left = 590,top = 284');");
}



var http = getHTTPObject();
var link;
 function getHTTPObject()

 {       var xmlhttp;  

          if (window.XMLHttpRequest) {       

              xmlhttp = new XMLHttpRequest();       
              
            }

          else if (window.ActiveXObject) {   

               xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
           }
           
          else{
                window.location = "other.htm";
           }

          return xmlhttp;}

         

 function getInfo(url){

		  link = url;
		 
		 
		    	 http.open("GET", link , true);
		    	 http.onreadystatechange = handleHttpResponse;
		    	 http.send(null);
    	    }

   

function handleHttpResponse() {
	document.getElementById("links").innerHTML = "<center><img border=0 src=ima/ajax-loader.gif width=32 height=32>";
    
    if (http.readyState == 4) { 
        
        
        if (http.status == 200) {
               
                 document.getElementById("links").innerHTML = http.responseText;
               

        } else {

            alert ( "Not able to retrieve Data ... please contact Administrator alagr@alagr.com" );

        }

    }   

}

function openTorrent()
{
		  document.getElementById("Torrent").className ="button";
		  document.getElementById("PDF").className ="empty"; 
		  document.getElementById("Audio").className ="empty"; 
		  getInfo("torrent.htm");

}

function openAudio()
{
		  document.getElementById("Audio").className ="button";
		  document.getElementById("Torrent").className ="empty"; 
		  document.getElementById("PDF").className ="empty"; 
		  getInfo("get.php");

}

function openPDF(){

		document.getElementById("PDF").className ="button";
	    document.getElementById("Torrent").className ="empty"; 
		document.getElementById("Audio").className ="empty"; 
	    getInfo("pdf.htm");
}