// JavaScript Document
var i;
var a;

var gecko;	//tipo de browser para fazer o parsing do xml

var bgRatio;

//offset e novos x/y para a colocação das class.. float sucks
var objs = document.createElement('div');//para verificar as medidas dos objs (width, padding...)
var ox;//offest X
var oy;//offset Y
var nx;//novo Pos x
var ny;//novo Pos Y
var nm;//nova margem


//offset para o movimento do conteudo(Main)
var offX;	
var offY;

var lang;//linguagem actual da página
var xmlpt=null;//xmlPt
var xmlsp=null;//xmlSP
var xmlen=null;//xmlEn

/*
a mudança de lingua nos objectos tem de ser por fases para mudar todos os objectos de uma vez,
assim como acontece com o xml, esta variavel é para saber em qual a fase que se segue.
*/
var langObjPhase;

var jsonData;//data enviada para por json para o php

var jsonReq;//equivale ao pedido que foi feito para guardar na variavel respectiva
var jsonPar;
var jsonCli;
var jsonNews;
var jsonCase0;
var jsonCase1;
var jsonCase2;
var jsonCase3;
var jsonCase4;
var jsonCase5;
var jsonCase6;
var jsonCase7;
var jsonBusNM;
var jsonBusMN;
var jsonBusBA;
var jsonBusMM;
var jsonGal;

var bgAnim=false;

$(document).ready(init);
$(window).resize(function() { resize(); });

function init()
{
	gecko=(navigator.product == 'Gecko' || navigator.appName=="Opera")?0:1;//0<=>crome raposa.....1<=>IE

	var margin=$("#mask").width()-$(".cont").width();
	margin*=0.5;
	offX=$(".cont").width()+margin;
	offY=$(".cont").height()+10;
	
	for(i=0;i<$(".cont").length;i++)
	{
		$(".cont:eq("+i+")").css("left", offX*i+margin);
		$(".cont:eq("+i+")").css("top", "0");
	}
	
	lang="pt";
 	getXML();
	
	//parece rebuscado...
		
	$("body").append(objs);
	$(objs).css("display", "none");

	$("#bg img").load(function(){  resize(); setTimeout(function() { resize(); },200);});
	//$("#bg img").load(function(){ setTimeout(function() {bgAnim=true; initCanvas(); resize();},300);});
}

function getXML()
{
	$.ajax({
			type : 'POST',
			url: "xml/life_"+lang+".xml",
			dataType: "xml",
			success: function(xml) { 
			switch(lang)
			{
				case "pt":
					xmlpt=xml;
				break;
				case "sp":
					xmlsp=xml;
				break;
				case "en":
					xmlen=xml;
				break;
			}
			getLang(xml);
		}
	});
}

function getJson( pathUrl, jsonD)
{
	
	$.ajax({
		type : 'POST',
		url: pathUrl,
		dataType: 'json',
		data: jsonD,
		success: function(data)
		{
			nx=0;
			ny=0;
			
			switch (jsonReq)
			{
				case "par":			
					jsonPar=data;
					
					nrRow=3;
					objs.setAttribute('class', "Par");
					fillVerContObj($("#parceiros"), jsonPar, ".Par");
				break;
				case "cli":
					jsonCli=data;
					
					nrRow=6;
					objs.setAttribute('class', "IT");
					fillVerContObj($("#clientes"), jsonCli, ".IT");
					
					for (i=0;i<$("#clientes").find(".contGal .IT").length;i++)
					{
						$($("#clientes").find(".contGal .IT")[i]).prop("onclick", null);
						$($("#clientes").find(".contGal .IT")[i]).attr("onclick", "getLinkThat(this)");
					}
					

				break;
				case "new":
					jsonNews=data;
				
					nrRow=2;
					objs.setAttribute('class', "News");
					fillVerContObj($("#noticias"), jsonNews, ".News");
				break;
				case "case0":	
					jsonCase0=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSholo"), jsonCase0, ".News");
				break;
				case "case1":	
					jsonCase1=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSmobile"), jsonCase1, ".News");
				break;
				case "case2":	
					jsonCase2=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSprint"), jsonCase2, ".News");
				break;
				case "case3":	
					jsonCase3=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSproj"), jsonCase3, ".News");
				break;
				case "case4":	
					jsonCase4=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSaug"), jsonCase4, ".News");
				break;
				case "case5":	
					jsonCase5=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSevents"), jsonCase5, ".News");
				break;
				case "case6":	
					jsonCase6=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSsecreen"), jsonCase6, ".News");
				break;
				case "case7":	
					jsonCase7=data;
					nrRow=2;
					
					objs.setAttribute('class', "News");
					fillVerContObj($("#CSsurface"), jsonCase7, ".News");
				break;
				case "busNM":		
					jsonBusNM=data;
					nrRow=3;
					objs.setAttribute('class', "ITbu");
					fillVerContObj($("#new"), jsonBusNM, ".ITbu");
				break;
				case "busMN":		
					jsonBusMN=data;
					nrRow=3;
					objs.setAttribute('class', "ITbu");
					fillVerContObj($("#network"), jsonBusMN, ".ITbu");
				break;
				case "busBA":		
					jsonBusBA=data;
					
					nrRow=3;
					objs.setAttribute('class', "ITbu");
					fillVerContObj($("#activation"), jsonBusBA, ".ITbu");
				break;
				case "busMM":		
					jsonBusMM=data;
					
					nrRow=3;
					objs.setAttribute('class', "ITbu");
					fillVerContObj($("#mobile"), jsonBusMM, ".ITbu");
				break;
				case "parLang":
					for(i=0;i<jsonPar.length;i++)
					{
						switch(lang)
						{
							case "pt":
								jsonPar[i]["textoPt"]=data[i]["textoPt"];
							break;
							case "en":
								jsonPar[i]["textoEn"]=data[i]["textoEn"];						
							break;
							case "sp":
								jsonPar[i]["textoSp"]=data[i]["textoSp"];
							break;
						}
					}
					switchParLang(jsonPar);
					langObjPhase++;
					getLangObj();
				break;
				case "newsLang":
					for(i=0;i<jsonNews.length;i++)
					{
						switch(lang)
						{
							case "pt":
								jsonNews[i]["tituloPt"]=data[i]["tituloPt"];
								jsonNews[i]["excertoPt"]=data[i]["excertoPt"];
							break;
							case "en":
								jsonNews[i]["tituloEn"]=data[i]["tituloEn"];
								jsonNews[i]["excertoEn"]=data[i]["excertoEn"];						
							break;
							case "sp":
								jsonNews[i]["tituloSp"]=data[i]["tituloSp"];
								jsonNews[i]["excertoSp"]=data[i]["excertoSp"];
							break;
						}
					}
					switchNLang(jsonNews);
					langObjPhase++;
					getLangObj();
				break;
				case "case0Lang":
					getCaseLang(jsonCase0, data);
				break;
				case "case1Lang":
					getCaseLang(jsonCase0, data);
				break;
				case "case0Lang":
					getCaseLang(jsonCase1, data);
				break;
				case "case2Lang":
					getCaseLang(jsonCase2, data);
				break;
				case "case3Lang":
					getCaseLang(jsonCase3, data);
				break;
				case "case4Lang":
					getCaseLang(jsonCase4, data);
				break;
				case "case5Lang":
					getCaseLang(jsonCase5, data);
				break;
				case "case6Lang":
					getCaseLang(jsonCase6, data);
				break;
				case "case7Lang":
					getCaseLang(jsonCase7, data);
				break;
				case "artLang":
					switch($("#"+data[0]["data"]).parents("section").attr("id"))
					{
						case "noticias":
							switch(lang)
							{
								case "pt":
									jsonNews[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonNews[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+artId).find("h1").html(jsonNews[artJsonIndex]["tituloPt"]);
									$("#aritcle"+artId).find(".textArt").html(jsonNews[artJsonIndex]["textoPt"]);
								break;
								case "sp":
									jsonNews[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonNews[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+artId).find("h1").html(jsonNews[artJsonIndex]["tituloSp"]);
									$("#aritcle"+artId).find(".textArt").html(jsonNews[artJsonIndex]["textoSp"]);
								break;
								case "en":
									jsonNews[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonNews[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+artId).find("h1").html(jsonNews[artJsonIndex]["tituloEn"]);
									$("#aritcle"+artId).find(".textArt").html(jsonNews[artJsonIndex]["textoEn"]);
								break;
							}	
						break;
						case "parceiros":
							switch(lang)
							{
								case "pt":
									jsonPar[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+artId).find(".textArt").html(jsonPar[artJsonIndex]["textoPt"]);
								break;
								case "sp":
									jsonPar[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+artId).find(".textArt").html(jsonPar[artJsonIndex]["textoSp"]);
								break;
								case "en":
									jsonPar[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+artId).find(".textArt").html(jsonPar[artJsonIndex]["textoEn"]);
								break;
							}
						break;
						case "new":
							switch(lang)
							{
								case "pt":
									jsonBusNM[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusNM[artJsonIndex]["textoPt"]);
								break;
								case "sp":
									jsonBusNM[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusNM[artJsonIndex]["textoSp"]);
								break;
								case "en":
									jsonBusNM[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusNM[artJsonIndex]["textoEn"]);
								break;
							}	
						break;
						case "network":
							switch(lang)
							{
								case "pt":
									jsonBusMN[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusMN[artJsonIndex]["textoPt"]);
								break;
								case "sp":
									jsonBusMN[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusMN[artJsonIndex]["textoSp"]);
								break;
								case "en":
									jsonBusMN[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusMN[artJsonIndex]["textoEn"]);
								break;
							}	
						break;
						case "activation":
							switch(lang)
							{
								case "pt":
									jsonBusBA[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusBA[artJsonIndex]["textoPt"]);
								break;
								case "sp":
									jsonBusBA[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusBA[artJsonIndex]["textoSp"]);
								break;
								case "en":
									jsonBusBA[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusBA[artJsonIndex]["textoEn"]);
								break;
							}	
						break;
						case "mobile":
							switch(lang)
							{
								case "pt":
									jsonBusMM[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusMM[artJsonIndex]["textoPt"]);
								break;
								case "sp":
									jsonBusMM[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusMM[artJsonIndex]["textoSp"]);
								break;
								case "en":
									jsonBusMM[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+artId).find(".textArt").html(jsonBusMM[artJsonIndex]["textoEn"]);
								break;
							}
						break;
						case "CSholo":
							switch(lang)
							{
								case "pt":
									jsonCase0[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase0[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase0[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase0[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase0[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase0[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase0[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase0[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase0[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase0[artJsonIndex]);
						break;
						case "CSmobile":
							switch(lang)
							{
								case "pt":
									jsonCase1[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase1[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase1[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase1[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase1[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase1[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase1[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase1[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase1[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase1[artJsonIndex]);
						break;
						case "CSprint":
							switch(lang)
							{
								case "pt":
									jsonCase2[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase2[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase2[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase2[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase2[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase2[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase2[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase2[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase2[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase2[artJsonIndex]);
						break;
						case "CSproj":
							switch(lang)
							{
								case "pt":
									jsonCase3[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase3[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase3[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase3[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase3[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase3[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase3[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase3[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase3[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase3[artJsonIndex]);
						break;
						case "CSaug":
							switch(lang)
							{
								case "pt":
									jsonCase4[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase4[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase4[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase4[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase4[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase4[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase4[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase4[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase4[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase4[artJsonIndex]);
						break;
						case "CSevents":
							switch(lang)
							{
								case "pt":
									jsonCase5[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase5[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase5[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase5[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase5[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase5[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase5[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase5[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase5[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase5[artJsonIndex]);
						break;
						case "CSsecreen":
							switch(lang)
							{
								case "pt":
									jsonCase6[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase6[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase6[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase6[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase6[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase6[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase6[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase6[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase6[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase6[artJsonIndex]);
						break;
						case "CSsurface":
							switch(lang)
							{
								case "pt":
									jsonCase7[artJsonIndex]["tituloPt"]=data[0]["tituloPt"];
									jsonCase7[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase7[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase7[artJsonIndex]["tituloSp"]=data[0]["tituloSp"];
									jsonCase7[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase7[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase7[artJsonIndex]["tituloEn"]=data[0]["tituloEn"];
									jsonCase7[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase7[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase7[artJsonIndex]);
						break;
					}
				break;
				case "art":
					switch($("#"+data[0]["data"]).parents("section").attr("id"))
					{
						case "noticias":
							if(data[0]["link"]!="")
							{
								jsonNews[artJsonIndex]["link"]=data[0]["link"];
								$("#aritcle"+data[0]["data"]).find(".contNav").attr("href", data[0]["link"]);
								$("#aritcle"+data[0]["data"]).find(".contNav").css("display", "block");
							}
							switch(lang)
							{
								case "pt":
									jsonNews[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoPt"]);
								break;
								case "sp":
									jsonNews[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoSp"]);
								break;
								case "en":
									jsonNews[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoEn"]);
								break;
							}	
						break;
						case "parceiros":
							if(data[0]["link"]!="")
							{
								jsonPar[artJsonIndex]["link"]=data[0]["link"];
								$("#aritcle"+data[0]["data"]).find(".contNav").attr("href", data[0]["link"]);
								$("#aritcle"+data[0]["data"]).find(".contNav").css("display", "block");
							}
						break;
						case "new":
							switch(lang)
							{
								case "pt":
									jsonBusNM[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoPt"]);
								break;
								case "sp":
									jsonBusNM[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoSp"]);
								break;
								case "en":
									jsonBusNM[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoEn"]);
								break;
							}	
						break;
						case "network":
							switch(lang)
							{
								case "pt":
									jsonBusMN[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoPt"]);
								break;
								case "sp":
									jsonBusMN[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoSp"]);
								break;
								case "en":
									jsonBusMN[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoEn"]);
								break;
							}	
						break;
						case "activation":
							switch(lang)
							{
								case "pt":
									jsonBusBA[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoPt"]);
								break;
								case "sp":
									jsonBusBA[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoSp"]);
								break;
								case "en":
									jsonBusBA[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoEn"]);
								break;
							}	
						break;
						case "mobile":
							switch(lang)
							{
								case "pt":
									jsonBusMM[artJsonIndex]["textoPt"]=data[0]["textoPt"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoPt"]);
								break;
								case "sp":
									jsonBusMM[artJsonIndex]["textoSp"]=data[0]["textoSp"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoSp"]);
								break;
								case "en":
									jsonBusMM[artJsonIndex]["textoEn"]=data[0]["textoEn"];
									$("#aritcle"+data[0]["data"]).find(".textArt").html(data[0]["textoEn"]);
								break;
							}	
						break;
						case "CSholo":
							if(data[0]["link"]!="")
							{
								jsonCase0[artJsonIndex]["link"]=data[0]["link"];
							}
							
							if(data[0]["cliente"]!="")
							{
								jsonCase0[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase0[artJsonIndex]["data"]).find(".cliente").html(jsonCase0[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase0[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							
							if(data[0]["contratante"]!="")
							{
								jsonCase0[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase0[artJsonIndex]["data"]).find(".contratante").html(jsonCase0[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase0[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}

							if(data[0]["projecto"]!="")
							{
								jsonCase0[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase0[artJsonIndex]["data"]).find(".projecto").html(jsonCase0[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase0[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}

							switch(lang)
							{
								case "pt":
									jsonCase0[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase0[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase0[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase0[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase0[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase0[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase0[artJsonIndex]);
						break;
						case "CSmobile":
							
							if(data[0]["link"]!="")
							{
								jsonCase1[artJsonIndex]["link"]=data[0]["link"];
							}
							if(data[0]["cliente"]!="")
							{
								jsonCase1[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase1[artJsonIndex]["data"]).find(".cliente").html(jsonCase1[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase1[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							if(data[0]["contratante"]!="")
							{
								jsonCase1[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase1[artJsonIndex]["data"]).find(".contratante").html(jsonCase1[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase1[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}
							if(data[0]["projecto"]!="")
							{
								jsonCase1[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase1[artJsonIndex]["data"]).find(".projecto").html(jsonCase1[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase1[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}
							
							switch(lang)
							{
								case "pt":
									jsonCase1[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase1[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase1[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase1[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase1[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase1[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase1[artJsonIndex]);
						break;
						case "CSprint":
							
							if(data[0]["link"]!="")
							{
								jsonCase2[artJsonIndex]["link"]=data[0]["link"];
							}
							if(data[0]["cliente"]!="")
							{
								jsonCase2[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase2[artJsonIndex]["data"]).find(".cliente").html(jsonCase2[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase2[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							if(data[0]["contratante"]!="")
							{
								jsonCase2[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase2[artJsonIndex]["data"]).find(".contratante").html(jsonCase2[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase2[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}
							if(data[0]["projecto"]!="")
							{
								jsonCase2[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase2[artJsonIndex]["data"]).find(".projecto").html(jsonCase2[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase2[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}
							
							switch(lang)
							{
								case "pt":
									jsonCase2[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase2[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase2[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase2[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase2[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase2[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase2[artJsonIndex]);
						break;
						case "CSproj":
							
							if(data[0]["link"]!="")
							{
								jsonCase3[artJsonIndex]["link"]=data[0]["link"];
							}
							if(data[0]["cliente"]!="")
							{
								jsonCase3[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase3[artJsonIndex]["data"]).find(".cliente").html(jsonCase3[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase3[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							if(data[0]["contratante"]!="")
							{
								jsonCase3[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase3[artJsonIndex]["data"]).find(".contratante").html(jsonCase3[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase3[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}
							if(data[0]["projecto"]!="")
							{
								jsonCase3[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase3[artJsonIndex]["data"]).find(".projecto").html(jsonCase3[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase3[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}

							switch(lang)
							{
								case "pt":
									jsonCase3[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase3[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase3[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase3[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase3[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase3[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase3[artJsonIndex]);
						break;
						case "CSaug":
							
							if(data[0]["link"]!="")
							{
								jsonCase4[artJsonIndex]["link"]=data[0]["link"];
							}
							if(data[0]["cliente"]!="")
							{
								jsonCase4[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase4[artJsonIndex]["data"]).find(".cliente").html(jsonCase4[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase4[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							if(data[0]["contratante"]!="")
							{
								jsonCase4[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase4[artJsonIndex]["data"]).find(".contratante").html(jsonCase4[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase4[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}
							if(data[0]["projecto"]!="")
							{
								jsonCase4[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase4[artJsonIndex]["data"]).find(".projecto").html(jsonCase4[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase4[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}

							switch(lang)
							{
								case "pt":
									jsonCase4[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase4[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase4[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase4[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase4[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase4[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase4[artJsonIndex]);
						break;
						case "CSevents":
							
							if(data[0]["link"]!="")
							{
								jsonCase5[artJsonIndex]["link"]=data[0]["link"];
							}
							if(data[0]["cliente"]!="")
							{
								jsonCase5[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase5[artJsonIndex]["data"]).find(".cliente").html(jsonCase5[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase5[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							if(data[0]["contratante"]!="")
							{
								jsonCase5[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase5[artJsonIndex]["data"]).find(".contratante").html(jsonCase5[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase5[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}
							if(data[0]["projecto"]!="")
							{
								jsonCase5[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase5[artJsonIndex]["data"]).find(".projecto").html(jsonCase5[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase5[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}

							switch(lang)
							{
								case "pt":
									jsonCase5[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase5[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase5[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase5[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase5[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase5[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase5[artJsonIndex]);
						break;
						case "CSsecreen":
							
							if(data[0]["link"]!="")
							{
								jsonCase6[artJsonIndex]["link"]=data[0]["link"];
							}
							if(data[0]["cliente"]!="")
							{
								jsonCase6[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase6[artJsonIndex]["data"]).find(".cliente").html(jsonCase6[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase6[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							if(data[0]["contratante"]!="")
							{
								jsonCase6[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase6[artJsonIndex]["data"]).find(".contratante").html(jsonCase6[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase6[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}
							if(data[0]["projecto"]!="")
							{
								jsonCase6[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase6[artJsonIndex]["data"]).find(".projecto").html(jsonCase6[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase6[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}

							switch(lang)
							{
								case "pt":
									jsonCase6[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase6[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase6[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase6[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase6[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase6[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase6[artJsonIndex]);
						break;
						case "CSsurface":
								
							if(data[0]["link"]!="")
							{
								jsonCase7[artJsonIndex]["link"]=data[0]["link"];
							}
							if(data[0]["cliente"]!="")
							{
								jsonCase7[artJsonIndex]["cliente"]=data[0]["cliente"];
								$("#aritcle"+jsonCase7[artJsonIndex]["data"]).find(".cliente").html(jsonCase7[artJsonIndex]["cliente"]);
								$("#aritcle"+jsonCase7[artJsonIndex]["data"]).find(".contCli").css("display", "block");
							}
							if(data[0]["contratante"]!="")
							{
								jsonCase7[artJsonIndex]["contratante"]=data[0]["contratante"];
								$("#aritcle"+jsonCase7[artJsonIndex]["data"]).find(".contratante").html(jsonCase7[artJsonIndex]["contratante"]);
								$("#aritcle"+jsonCase7[artJsonIndex]["data"]).find(".contContra").css("display", "block");
							}
							if(data[0]["projecto"]!="")
							{
								jsonCase7[artJsonIndex]["projecto"]=data[0]["projecto"];
								$("#aritcle"+jsonCase7[artJsonIndex]["data"]).find(".projecto").html(jsonCase7[artJsonIndex]["projecto"]);
								$("#aritcle"+jsonCase7[artJsonIndex]["data"]).find(".contProj").css("display", "block");
							}

							switch(lang)
							{
								case "pt":
									jsonCase7[artJsonIndex]["brifPt"]=data[0]["brifPt"];
									jsonCase7[artJsonIndex]["solPt"]=data[0]["solPt"];
								break;
								case "sp":
									jsonCase7[artJsonIndex]["brifSp"]=data[0]["brifSp"];
									jsonCase7[artJsonIndex]["solSp"]=data[0]["solSp"];
								break;
								case "en":
									jsonCase7[artJsonIndex]["brifEn"]=data[0]["brifEn"];
									jsonCase7[artJsonIndex]["solEn"]=data[0]["solEn"];
								break;
							}
							fillArtCaseTxt(jsonCase7[artJsonIndex]);
						break;
					}
					
					jsonReq="gal";

					jsonData = {tags : artId, nome : "1"};
					switch(lang)
					{
						case "pt":
							jsonData.legendaPt="1";
						break;
						case "sp":
							jsonData.legendaSp="1";
						break;
						case "en":
							jsonData.legendaEn="1";
						break;
					}
					getJson("php/htmlObj/getImagens.php", jsonData);
				break;
				case "gal":

					jsonGal=new Array();
					objs.setAttribute('class', "ArtThumb");

					for(i=0;i<data.length;i++)
					{	
						jsonGal[i]=new Array();
						jsonGal[i]["nome"]=data[i]["nome"];
						
						switch(lang)
						{
							case "pt":
								jsonGal[i]["legendaPt"]=data[i]["legendaPt"];
							break;
							case "sp":
								jsonGal[i]["legendaSp"]=data[i]["legendaSp"];
							break;
							case "en":
								jsonGal[i]["legendaEn"]=data[i]["legendaEn"];
							break;
						}				
						$("#aritcle"+artId).find(".contBarH").append(makeArtThumb(data[i]));

						nx= $(".ArtThumb").width() * i + parseInt($(".ArtThumb").css("margin-right"))*i;
						$($("#aritcle"+artId).find(".contBarH").children(".ArtThumb")[i]).css("left",nx );
					}
					if(jsonGal.length>0)
					{
						artDisplayImg($($("#aritcle"+artId).find(".contBarH .ArtThumb")[0]));
					}
					
					nx+=$(".ArtThumb").width() + parseInt($(".ArtThumb").css("padding-top"))*2;
					$("#aritcle"+artId).find(".contBarH").css("width",nx);
					checkBarButsH($("#aritcle"+artId).find(".BarH"), $(".ArtThumb"));	
				break;
			}
		}
	});
}
function fillArtCaseTxt(jsonTree)
{
	if(jsonTree["link"]!=undefined)
	{
		$("#aritcle"+jsonTree["data"]).find(".contNav").attr("href", jsonTree["link"]);
		$("#aritcle"+jsonTree["data"]).find(".contNav").css("display", "block");
	}
	switch(lang)
	{
		case "pt":
			$("#aritcle"+jsonTree["data"]).find(" .titProj").html("Projecto - ");
			$("#aritcle"+jsonTree["data"]).find(" .titCli").html("Cliente - ");
			$("#aritcle"+jsonTree["data"]).find(" .titContra").html("Contratante - ");
			
			$("#aritcle"+jsonTree["data"]).find(" .h1").html(jsonTree["tituloPt"]);
			$("#aritcle"+jsonTree["data"]).find(" .titSol").html("Solução");
			$("#aritcle"+jsonTree["data"]).find(" .brif").html(jsonTree["brifPt"]);
			$("#aritcle"+jsonTree["data"]).find(" .sol").html(jsonTree["solPt"]);
		break;
		case "sp":

			$("#aritcle"+jsonTree["data"]).find(" .titProj").html("Proyecto - ");
			$("#aritcle"+jsonTree["data"]).find(" .titCli").html("Cliente - ");
			$("#aritcle"+jsonTree["data"]).find(" .titContra").html("Contratista - ");

			$("#aritcle"+jsonTree["data"]).find(" .h1").html(jsonTree["tituloSp"]);
			$("#aritcle"+jsonTree["data"]).find(" .titSol").html("Solución");
			$("#aritcle"+jsonTree["data"]).find(" .brif").html(jsonTree["brifSp"]);
			$("#aritcle"+jsonTree["data"]).find(" .sol").html(jsonTree["solSp"]);
		break;
		case "en":
		$("#aritcle"+jsonTree["data"]).find(" .titProj").html("Project - ");
			$("#aritcle"+jsonTree["data"]).find(" .titCli").html("Client - ");
			$("#aritcle"+jsonTree["data"]).find(" .titContra").html("Contractor - ");
			
			$("#aritcle"+jsonTree["data"]).find(" .h1").html(jsonTree["tituloEn"]);
			$("#aritcle"+jsonTree["data"]).find(" .titSol").html("Solution");
			$("#aritcle"+jsonTree["data"]).find(" .brif").html(jsonTree["brifEn"]);
			$("#aritcle"+jsonTree["data"]).find(" .sol").html(jsonTree["solEn"]);
		break;
	}
}

function getCaseLang(jsonTree, data)
{
	for(i=0;i<jsonTree.length;i++)
	{
		switch(lang)
		{
			case "pt":
				jsonTree[i]["solPt"]=data[i]["solPt"];
				jsonTree[i]["brifPt"]=data[i]["brifPt"];
				jsonTree[i]["tituloPt"]=data[i]["tituloPt"];
			break;
			case "en":
				jsonTree[i]["solEn"]=data[i]["solEn"];
				jsonTree[i]["brifEn"]=data[i]["brifEn"];
				jsonTree[i]["tituloEn"]=data[i]["tituloEn"];						
			break;
			case "sp":
				jsonTree[i]["solSp"]=data[i]["solSp"];
				jsonTree[i]["brifSp"]=data[i]["brifSp"];
				jsonTree[i]["tituloSp"]=data[i]["tituloSp"];
			break;
		}
	}
	switchCaseLang(jsonTree);	
	
	langObjPhase++;
	getLangObj();
}
function subMenu()
{
	$("#leave").css("display", "block");
	$("#foot").animate( {"height": 150}, 500);
}
function closeSub()
{
	$("#leave").css("display", "none");
	$("#foot").stop();
	$("#foot").animate( {"height": 30}, 500);
}

function spacer(x, y)
{
	var space = document.createElement('div');
	space.setAttribute('class', "spacer");
	$(space).css("left", x );
	$(space).css("top", y );
	return space;
}

function objBgOver(that)
{
	$(that).find(".objBg").stop();
	$(that).find(".objBg").css("opacity", "0.2");
}
function objBgOut(that)
{
	$(that).find(".objBg").stop();
	$(that).find(".objBg").animate({"opacity": "0"}, 500);
}
function getLinkThat(that)
{
	switch($("#"+$(that).attr("id")).parents("section").attr("id"))
	{
		case "clientes":
			openLink(jsonCli[findIndex(jsonCli, that.id)]["link"]);
		break;
	}
}
function openLink(url) {
	window.open(url,'_blank');
}


function fillVerContObj(sel, jsonTree, objClass)
{
	nm=$(sel).find(".contGal").width()/nrRow;
	
	nm-=$(objs).width();
	nm+=nm/(nrRow-1);
	nm-=parseInt($(objs).css("padding-top"))*2/(nrRow-1);

	for(i=0;i<jsonTree.length;i++)
	{	
		switch(objClass)
		{
			case ".IT":
				$(sel).find(".contGal").append(makeObjIT(jsonTree[i]));
			break;
			case ".ITbu":
				$(sel).find(".contGal").append(makeObjITbu(jsonTree[i]));
			break;
			case ".News":
				if(jsonReq=="new")
				{
					$(sel).find(".contGal").append(makeNews(jsonTree[i]));
				}
				else
				{
					$(sel).find(".contGal").append(makeCase(jsonTree[i]));
				}
				
			break;
			case ".Par":
				$(sel).find(".contGal").append(makePar(jsonTree[i]));
			break;
		}
		

		ox= Math.floor(i % nrRow );
		oy= Math.floor(i / nrRow);

		nx= $(objClass).width() * ox + nm*ox;
		ny= $(objClass).height()* oy +  parseInt($(objClass).css("margin-bottom"))*oy;

		$($(sel).find(".contGal").children(objClass)[i]).css("top", ny );
		$($(sel).find(".contGal").children(objClass)[i]).css("left",nx );
		
		if(i % nrRow==0 && i!=0)
		{
			$(sel).find(".contGal").append(spacer(0, ny-parseInt($(objClass).css("margin-bottom"))*0.5));
		}
	}
	ny=(i/nrRow>oy)?ny+$(objClass).height():ny-parseInt($(objClass).css("margin-bottom"));
	ny+=parseInt($(objClass).css("padding-top"))*2;
	
	$(sel).find(".contGal").css("height",ny);
	checkGalButs($(sel).find(".Gal"), $(objClass));
}

function checkTxtL(txt, maxL)
{
	var nText = txt;
	if(txt.length> parseInt(maxL))
	{
		nText= txt.slice(0, maxL)+"...";
	}
	return nText;
}

function resize()
{
	winRatio=$(window).width()/($(window).height()-80);	

	$("#bg").css("height", $(window).height()- 80);
	bgRatio=$("#bg img").width()/$("#bg img").height();

	if(bgRatio<=winRatio)
	{
		$("#bg img").css("width","100%");
		$("#bg img").css("height","auto");
	}
	else
	{
		$("#bg img").css("width","auto");
		$("#bg img").css("height","100%");
	}
	//canvasResize();
}
