var xmlHttp;

function getRandomList()
{ 
	
    if(xmlHttp){
        xmlHttp.abort();
    }
    // Create the object each time a call is about to be made

	xmlHttp = createXMLHttpRequest();
	var url="js/randomRingtoneList.php";
	//url=url+"?q="+str
	//url=url+"&sid="+Math.random()
	
	//need the random query string for IE...
	url=url+"?"+Math.random();
	xmlHttp.open("GET",url,true);
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.send(null);

}

function stateChanged() 
{ 
	//if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	if (xmlHttp && xmlHttp.readyState == 4)
 	{ 
		 document.getElementById("rndList").innerHTML=xmlHttp.responseText;
		 // Delete the object after the call is done
		 xmlHttp = null;
 	} 

}

function createXMLHttpRequest(){
    var xmlHttp = null;
    if(typeof XMLHttpRequest != "undefined"){
        xmlHttp = new XMLHttpRequest();
		//alert ("Browser does not support HTTP Request 0");
    }
    else if(typeof window.ActiveXObject != "undefined"){
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
			//alert ("Browser does not support HTTP Request 1");
        }
        catch(e){
            try {
                xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
            	//alert ("Browser does not support HTTP Request 2");
				}
            catch(e){
                try {
                    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					//alert ("Browser does not support HTTP Request 3");
                }
                catch(e){
                    xmlHttp = null;
					 //alert ("Browser does not support HTTP Request 4");
                }
            }
        }
    }
    return xmlHttp;
}


/*

var xmlHttp

//AJAXy js function
function getRandomList()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="js/randomRingtoneList.php"
	//url=url+"?q="+str
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("rndList").innerHTML=xmlHttp.responseText 
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

*/