var xmlHttp, trailReq;
function loadflash() {
	document.getElementById("menu").style.visibility="visible";
	document.getElementById("load").style.visibility="visible";
	document.getElementById("queda").style.visibility="visible";
}
function unloadflash() {
	document.getElementById("menu").style.visibility="hidden";
	document.getElementById("load").style.visibility="hidden";
	document.getElementById("queda").style.visibility="hidden";
}
function menu_DoFSCommand(command,args) {
	if(command=="ajaxload") {
		if(args=="trailer") loadtrailer();
		else loadSection(args);
	}
	return true;
}
function loadtrailer() {
	trailReq=GetXmlHttpObject();
	if (trailReq==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	trailReq.onreadystatechange=trailerloader;
	trailReq.open("GET","trailerload.php",true);
	trailReq.send(null);
}
function trailerloader() {
	if (trailReq.readyState==4 || trailReq.readyState=="complete") {
		unloadflash();
		document.getElementById("load").innerHTML="";
		document.getElementById("foto").innerHTML=trailReq.responseText;
	}
}
function loadPhoto(str) {
	if (str.length==0) { 
		return;
	}
	unloadflash();
	document.getElementById("foto").innerHTML='<div class="foto-fondo"><div class="foto"><img src="'+str+'" class="clickeable" onclick="backPhoto()"></img><br/>Click en la foto para regresar.</div></div>';
}
function backPhoto() {
	document.getElementById("foto").innerHTML="";
	loadflash();
}
function loadSection(str) {
	if (str.length==0) {
		return;
	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET","info.php?"+str,true);
	xmlHttp.send(null);
}
function stateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("load").innerHTML=xmlHttp.responseText;
	}
}
function GetXmlHttpObject() {
	var xmlHttp=null;
	if(navigator.appName=="Microsoft Internet Explorer"){
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
 	else xmlHttp=new XMLHttpRequest();
	return xmlHttp;
}