// JavaScript Document

var xmlHttp;

function sendMain(hId)
{
	document.location="agent_maison_info.php?hId=" + hId;
}

function sendMain1(picId,tag)
{
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="phpFuncs.php";
	url=url+"?picId="+picId+"&tag="+tag;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedPic;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function getNextPage(page,mId)
{
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="phpFuncs.php";
	url=url+"?page="+page+"&mId="+mId;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function getNextAgnt(pagAgnt, zerar)
{
	if (pagAgnt == zerar-1) {agnt=0;}else{agnt++;}
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="phpFuncs.php";
	url=url+"?pagAgnt="+pagAgnt;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedAgnt;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function restart(){
agnt = 0;
}

function getNextMais(pagMais)
{
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="phpFuncs.php";
	url=url+"?pagMais="+pagMais;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChangedMais;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChangedPage() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("morePictures").innerHTML=xmlHttp.responseText;
	} 
}

function stateChangedAgnt() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById("box_agent_home").innerHTML=""
		if (xmlHttp.status==200) { 
			document.getElementById("box_agent_home").innerHTML=xmlHttp.responseText
		}
	} 
}

function stateChangedMais() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("box_maison_home").innerHTML=xmlHttp.responseText;
	} 
}

function stateChangedPic() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("showPic").innerHTML=xmlHttp.responseText;
	} 
}

function stateChangedSubPic() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("morePictures").innerHTML=xmlHttp3.responseText;
	} 
}

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;
}
