// JavaScript Document

var xmlhttp;


/*Retorna el objeto XMLHttp dependiendo del browser que se esté utilizando*/
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	  {
	 	 // code for IE7+, Firefox, Chrome, Opera, Safari
	  	return new XMLHttpRequest();
	  }
	
	if (window.ActiveXObject)
	  {
	  	// code for IE6, IE5
	  	return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
}

/*function loadMenu2()
{
	xmlhttp=GetXmlHttpObject();
	var aleatorio=Math.random();
	if (xmlhttp==null)
	{
		  alert ("Su navegador no soporta XMLHTTP!");
		  return;
	}
	var url="loadmenu.php?nocache="+aleatorio;
		
	xmlhttp.onreadystatechange = function(){
		//alert(xmlhttp.readyState+"menu");
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("menuicons").innerHTML=xmlhttp.responseText;
		//	showPictures(first,type);
					//alert(xmlhttp.responseText);							
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);	
}



function loadMenu()
{
	xmlhttp=GetXmlHttpObject();
	var aleatorio=Math.random();
	if (xmlhttp==null)
	{
		  alert ("Su navegador no soporta XMLHTTP!");
		  return;
	}
	var url="loadmenu.php?nocache="+aleatorio;
		
	xmlhttp.onreadystatechange = function(){
		//alert(xmlhttp.readyState+"menu");
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("menuicons").innerHTML=xmlhttp.responseText;
			loadLayout();
						//alert(xmlhttp.responseText);							
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);	
}
*/
function loadLayout()
{
	xmlhttp=GetXmlHttpObject();
	var aleatorio=Math.random();
	if (xmlhttp==null)
	{
		  alert ("Su navegador no soporta XMLHTTP!");
		  return;
	}
	var url="loadlayout.php?nocache="+aleatorio;
		
	xmlhttp.onreadystatechange = function(){
		//(xmlhttp.readyState);
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("setlayout").innerHTML=xmlhttp.responseText;
						//alert(xmlhttp.responseText);							
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);	
}




function showPictures(id,type)
{
		xmlhttp=GetXmlHttpObject();
		var aleatorio=Math.random();
	if (xmlhttp==null)
	{
		  alert ("Su navegador no soporta XMLHTTP!");
		  return;
	}
	var url="loadpictures.php";
	url=url+"?id="+id+"&t="+type+"&nocache="+aleatorio;
	
		
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("imgshow").innerHTML=xmlhttp.responseText;
			 
			 //	alert(xmlhttp.responseText);							
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);	
}

