// manipsterc_jslib.js by Chris Santala Feb. 14/2008

Image1 = new Image(32,32)
Image1.src = "img/left_hover.png"

Image2 = new Image(32,32)
Image2.src = "img/right_hover.png"

Image3 = new Image(32,32)
Image3.src = "img/left_gray.png"

Image4 = new Image(114, 32)
Image4.src = "img/logo_over.gif"

Image5 = new Image(153, 39)
Image5.src = "img/back_over.gif"


function erase()
{
	// erase lingering sort indicators
	document.getElementById('vind').innerHTML = '';
	 document.getElementById('sind').innerHTML = '';
}


function sortBy(type)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="scripts/sort_by.php?type="+type;
//alert(url);
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}


function showWinner()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="scripts/showWinner.php?";
//alert(url);
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

function showThread()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url="scripts/showThread.php?";
//alert(url);
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}


function update_ind(ind)
{
	// erase arrows
	if (ind != 'vind') document.getElementById('vind').innerHTML = '';
	if (ind != 'sind') document.getElementById('sind').innerHTML = '';

	// don't mess with arrow directions when user clicks Contest Leaders 
	if (ind == 'cind') return;
	
	// use dir var to control sort direction, if undefined then set to 1
	//	if set to one then set to -1 for consecutive clicks and use down arrow
	if (typeof(dir) == 'undefined') dir = 1;
	if (dir == 1) { dir = -1; arrow = '&#9660;'; } 
	else { dir = 1; arrow = '&#9650;'; }

	// no arrow-ajax if clicking 'contest winners'
	if (ind != 'cind') document.getElementById(ind).innerHTML = arrow;
}

