function GetXmlHttpObject(){
	var xmlHttp=null;
	try{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e){
		try{	
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}


var xmlHttp;
function showBox(page){
	xmlHttp=GetXmlHttpObject();		
	if (xmlHttp==null){
		document.getElementById('boxContent').innerHTML = "Browser does not support AJAX.  Please make sure that your browser is up to date and that JavaScript is enabled.";
		return;
	}
	
	//Set URL
	var url="scripts/ajax/showPage.php?page="+page+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=getPage
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)			
}

function getPage(){	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById('boxContent').innerHTML=xmlHttp.responseText
	}
	else{
		document.getElementById('boxContent').innerHTML="<center><br /><br /><img src='assets/images/loading.gif' /><br /><br /></center>"
	}
}



/* Show Winner */
function showWinner(id){
		xmlHttp=GetXmlHttpObject();		
	if (xmlHttp==null){
		document.getElementById('boxContent').innerHTML = "Browser does not support AJAX.  Please make sure that your browser is up to date and that JavaScript is enabled.";
		return;
	}
	
	//Set URL
	var url="scripts/ajax/showWinner.php?id="+id+"&sid="+Math.random()
	
	xmlHttp.onreadystatechange=getWinner
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)			
}

function getWinner(){	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById('boxContent').innerHTML=xmlHttp.responseText
	}
	else{
		document.getElementById('boxContent').innerHTML="<center><br /><br /><img src='assets/images/loading.gif' /><br /><br /></center>"
	}
}



/* Show Alphabetically */
function showAlphabetically(){
		xmlHttp=GetXmlHttpObject();		
	if (xmlHttp==null){
		document.getElementById('winners').innerHTML = "<p>Browser does not support AJAX.  Please make sure that your browser is up to date and that JavaScript is enabled.</p>";
		return;
	}
	
	//clear right rail
	//document.getElementById('boxContent').innerHTML=""
	
	//Set URL
	var url="scripts/ajax/showAlpha.php?sid="+Math.random()
	
	xmlHttp.onreadystatechange=getAlphabetically
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)			
}

function getAlphabetically(){	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById('winners').innerHTML=xmlHttp.responseText
	}
	else{
		document.getElementById('winners').innerHTML="<center><br /><br /><img src='assets/images/loading.gif' /><br /><br /></center>"
	}
}


/* Show Categories */
function showCategories(){
		xmlHttp=GetXmlHttpObject();		
	if (xmlHttp==null){
		document.getElementById('winners').innerHTML = "<p>Browser does not support AJAX.  Please make sure that your browser is up to date and that JavaScript is enabled.</p>";
		return;
	}
	
	//clear right rail
	//document.getElementById('boxContent').innerHTML=""	
	
	//Set URL
	var url="scripts/ajax/showCategories.php?&sid="+Math.random()
	
	xmlHttp.onreadystatechange=getCategories
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)			
}

function getCategories(){	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		document.getElementById('winners').innerHTML=xmlHttp.responseText
	}
	else{
		document.getElementById('winners').innerHTML="<center><br /><br /><img src='assets/images/loading.gif' /><br /><br /></center>"
	}
}
	