var xmlHttp

function showSearch(str)
{
	if (str.length<=1)
	{ 
		document.getElementById("result_div").innerHTML="";
		document.getElementById("result_div").style.visibility="hidden";
		return;
	}
	else if (document.getElementById("result_div").innerHTML == "")
	{
		document.getElementById("result_div").style.visibility="visible";
		document.getElementById("result_div").innerHTML = '<div id="inner_result_div">searching...</div>';
	}
	else
	{
		document.getElementById("result_div").style.visibility="visible";
		if(document.getElementById("inner_result_div").innerHTML.indexOf("searching...") == -1)
			document.getElementById("inner_result_div").innerHTML += "searching...";
	}

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) { return; } 

	var url="/new_temp/search.asp?s="+str+"&rnd="+Math.random();
	xmlHttp.onreadystatechange=function() { 
		if (xmlHttp.readyState==4)
			document.getElementById('inner_result_div').innerHTML = xmlHttp.responseText
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

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;
}

function getPageSize() {

  	var scrollX, scrollY;

  	if (window.innerHeight && window.scrollMaxY) {
  		scrollX = document.body.scrollWidth;
  		scrollY = window.innerHeight + window.scrollMaxY;
  	} else if (document.body.scrollHeight > document.body.offsetHeight){
  		scrollX = document.body.scrollWidth;
  		scrollY = document.body.scrollHeight;
  	} else {
  		scrollX = document.body.offsetWidth;
  		scrollY = document.body.offsetHeight;
  	}

  	var windowWidth, windowHeight;
  	if (self.innerHeight) {
  		windowWidth = self.innerWidth;
  		windowHeight = self.innerHeight;
  	} else if (document.documentElement && document.documentElement.clientHeight) {
  		windowWidth = document.documentElement.clientWidth;
  		windowHeight = document.documentElement.clientHeight;
  	} else if (document.body) {
  		windowWidth = document.body.clientWidth;
  		windowHeight = document.body.clientHeight;
  	}

  	// if viewport > height
  	if(scrollY < windowHeight){
  		pageHeight = windowHeight;
  	} else {
  		pageHeight = scrollY;
  	}

  	// if viewport > width
  	if(scrollX < windowWidth){
  		pageWidth = windowWidth;
  	} else {
  		pageWidth = scrollX;
  	}


  	return [pageWidth,pageHeight,windowWidth,windowHeight]
}
