// JavaScript Document
function map(that)
{
	if($("#mapa iframe").attr("src")==undefined)
	{
		$("#mapa iframe").attr("src", "http://maps.google.pt/maps?hl=pt-pt&ie=UTF8&t=h&ll=38.714805,-9.232056&spn=0.000732,0.00114&z=19&output=embed");
	}
	moveCont(that);
}

function moveCont(that)
{
	closeGal();
	closeArt();
	that=that.toString();
	//document.title="Lifetime|"+that.innerHTML.toLowerCase();
	var move=that.split("_");
	var offSetX=parseInt(move[0]);
	var offSetY=(move.length>1)?parseInt(move[1]):0;
	
	offSetX=offX*offSetX;
	offSetY=offY*offSetY;
	
	$("#bgCont").animate( {"opacity": "0.85"}, 1000);
	$("#content").stop();
	$("#content").animate( {"left":-offSetX, "top":-offSetY}, 1000);
	
	if(bgAnim)
	{
		window.removeEventListener("mousemove", canvasMove);
	}
}
function moveLife()
{
	closeGal();
	closeArt();
	
	$("#bgCont").animate( {"opacity": "0"}, 1000);
	
	$("#content").stop();
	$("#content").animate( {"left":0, "top":0}, 1000);
	
	if(bgAnim)
	{
		window.addEventListener("mousemove", canvasMove);
	}
}

function getPar(that)
{	
	if(jsonPar==undefined)
	{
		$("#parceiros").find(".resumeCont").append(makeGal());
		jsonReq="par";
		jsonData = {tipo : "1", tituloPt : "1", data : "1", img : "1"};
		switch(lang)
		{
			case "pt":
				jsonData.textoPt="1";
			break;
			case "sp":
				jsonData.textoSp="1";
			break;
			case "en":
				jsonData.textoEn="1";
			break;
		}
		getJson("php/htmlObj/getCliPar.php", jsonData);
	}
	moveCont(that);
}

function getCli(that)
{
	if(jsonCli==undefined)
	{
		$("#clientes").find(".resumeCont").append(makeGal());
		jsonReq="cli";
		jsonData = {tipo : "0", tituloPt : "1", data : "1", img : "1", links : "1"};

		getJson("php/htmlObj/getCliPar.php", jsonData);
	}
	moveCont(that);
}

function getNews(that)
{	
	if(jsonNews==undefined)
	{
		$("#noticias").find(".resumeCont").append(makeGal());
		jsonReq="new";
		jsonData = { tempo : "1", data : "1", img : "1"};
		switch(lang)
		{
			case "pt":
				jsonData.tituloPt="1";
				jsonData.excertoPt="1";
			break;
			case "sp":
				jsonData.tituloSp="1";
				jsonData.excertoSp="1";
			break;
			case "en":
				jsonData.tituloEn="1";
				jsonData.excertoEn="1";
			break;
		}
		getJson("php/htmlObj/getNews.php", jsonData);
	}
	moveCont(that);
}

function getCase0(that)
{
	if(jsonCase0==undefined)
	{
		$("#CSholo").find(".resumeCont").append(makeGal());
		jsonReq="case0";
		jsonData = {data : "1", img : "1", catg : "4", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCase1(that)
{
	if(jsonCase1==undefined)
	{
		$("#CSmobile").find(".resumeCont").append(makeGal());
		jsonReq="case1";
		jsonData = {data : "1", img : "1", catg : "5", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCase2(that)
{
	if(jsonCase2==undefined)
	{
		$("#CSprint").find(".resumeCont").append(makeGal());
		jsonReq="case2";
		jsonData = {data : "1", img : "1", catg : "6", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCase3(that)
{
	if(jsonCase3==undefined)
	{
		$("#CSproj").find(".resumeCont").append(makeGal());
		jsonReq="case3";
		jsonData = {data : "1", img : "1", catg : "7", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCase4(that)
{
	if(jsonCase4==undefined)
	{
		$("#CSaug").find(".resumeCont").append(makeGal());
		jsonReq="case4";
		jsonData = {data : "1", img : "1", catg : "8", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCase5(that)
{
	if(jsonCase5==undefined)
	{
		$("#CSevents").find(".resumeCont").append(makeGal());
		jsonReq="case5";
		jsonData = {data : "1", img : "1", catg : "9", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCase6(that)
{
	if(jsonCase6==undefined)
	{
		$("#CSsecreen").find(".resumeCont").append(makeGal());
		jsonReq="case6";
		jsonData = {data : "1", img : "1", catg : "10", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCase7(that)
{
	if(jsonCase7==undefined)
	{
		$("#CSsurface").find(".resumeCont").append(makeGal());
		jsonReq="case7";
		jsonData = {data : "1", img : "1", catg : "11", tituloPt:"1", tempo :"1"};
		getCases();
	}
	moveCont(that);
}
function getCases()
{
	switch(lang)
	{
		case "pt":
			jsonData.brifPt="1";
		break;
		case "sp":
			jsonData.brifSp="1";
		break;
		case "en":
			jsonData.brifEn="1";
		break;
	}
	getJson("php/htmlObj/getCase.php", jsonData);	
}
function getBusNM(that)
{
	if(jsonBusNM==undefined)
	{
		$("#new").find(".busModuleShow").append(makeGal());
		jsonReq="busNM";
		jsonData = {data : "1", img : "1", tipo:"1", catg:"0", tituloPt:"1"};
		getJson("php/htmlObj/getCaseBus.php", jsonData);
	}
	moveCont(that);
}
function getBusMN(that)
{
	if(jsonBusMN==undefined)
	{
		$("#network").find(".busModuleShow").append(makeGal());
		jsonReq="busMN";
		jsonData = {data : "1", img : "1", tipo:"1", catg:"1", tituloPt:"1"};
		getJson("php/htmlObj/getCaseBus.php", jsonData);
	}
	moveCont(that);
}
function getBusBA(that)
{
	if(jsonBusBA==undefined)
	{
		$("#activation").find(".busModuleShow").append(makeGal());
		jsonReq="busBA";
		jsonData = {data : "1", img : "1", tipo:"1", catg:"2", tituloPt:"1"};
		getJson("php/htmlObj/getCaseBus.php", jsonData);
	}
	moveCont(that);
}
function getBusMM(that)
{
	if(jsonBusMM==undefined)
	{
		$("#mobile").find(".busModuleShow").append(makeGal());
		jsonReq="busMM";
		jsonData = {data : "1", img : "1", tipo:"1", catg:"3", tituloPt:"1"};
		getJson("php/htmlObj/getCaseBus.php", jsonData);
	}
	moveCont(that);
}
