function GetXmlHttpObjectLayer()
{
	var xmlHttpLayer=null;
	// Firefox, Opera 8.0+, Safari
	try{
		xmlHttpLayer=new XMLHttpRequest();
	}
	catch (e){
		// Internet Explorer
		try{
			xmlHttpLayer=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			xmlHttpLayer=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	return xmlHttpLayer;
}

function stateChangedLayer() 
{ 
if (xmlHttpLayer.readyState==4 || xmlHttpLayer.readyState=="complete")
   { 
   document.getElementById("secondary_div").innerHTML=xmlHttpLayer.responseText 
   } 
} 

function getPageSizeWithScroll()
{
	if (window.innerHeight && window.scrollMaxY)
	{// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	}
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{// all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	}
	else
	{// works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight+20;
		xWithScroll = document.body.offsetWidth;
	}
	
	//arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	//return arrayPageSizeWithScroll;
	return yWithScroll;
}

function showHideLayer(str)
{
	//setting height
	document.getElementById("main_div").style.height = getPageSizeWithScroll() + "px";

	xmlHttpLayer=GetXmlHttpObjectLayer();
	if (xmlHttpLayer==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var myDiv = document.getElementById('main_div'); 
	var url=str + ".php";
	//url=url+"?sid="+Math.random()
	
	myDiv.style.display=(myDiv.style.display==''||myDiv.style.display=='none')?'block':'none';
	myDiv = document.getElementById('secondary_div'); 
	myDiv.style.display=(myDiv.style.display==''||myDiv.style.display=='none')?'block':'none';
	
	xmlHttpLayer.onreadystatechange=stateChangedLayer;
	xmlHttpLayer.open("GET",url,true);
	xmlHttpLayer.send(null);
}