function vai(pg,args){
	if(pg=='') pg=page;
	if(!args) args="?";
	else args+="&";
	//alert(pg+args+"_nc="+(Math.random()));
	document.location.href=pg+args+"_nc="+(Math.random());
}

function chkBchc(){
	var objT=_gel("ibtit");
	if(objT) if(objT.value==""||!objT.value) return false;
	objT=_gel("ibtxt");
	if(objx.value>"") return true; 
	return false;
}


//lista cat
function gestLst(obj){
	var id=obj.id.split("_");
	id=id[1];
	var objDiv=_gel("div_"+id);
	if(objDiv.style.height=="auto"){
		objDiv.style.height="0px";
		obj.className="lstC";
	}else{
		objDiv.style.height="auto";
		obj.className="lstO";
	}
}



///Oscura
function opOsc(func){
	if(_gel("divOscura")) return;
	var objOscura=_cel("div");
	objOscura.id="divOscura";
	objOscura.className="dOsc";
	addEvent(objOscura,'click',func,false);
	var h=(document.documentElement.clientHeight>document.body.clientHeight)?document.documentElement.clientHeight:document.body.clientHeight;
	objOscura.style.height=h+"px";
	document.body.appendChild(objOscura);
	if(!_isIE){
		stAlph(objOscura,0);
		new objFade(objOscura,100,100);
	}	
}
function clOsc(){
	if(_gel("divOscura")) document.body.removeChild(_gel("divOscura"));
}

//foto//
preloadImages={
	iNumImg:0,
	iNumLdd:0,
	onComplete:"",
	onLoaded:function(){},
	currImgLdd:"",
	arImg:[],
	arImgInc:[],
	queue_images:function(arImg){
  		this.iNumLdd=0;
  		this.arImg=[];
  		this.iNumImg=arImg.length;
  		this.arImgInc=arImg;
  		this.process_queue();
	},
	process_queue:function(){
		this.load_image(this.arImgInc.shift());
 	},
	load_image:function(image){
		var this_ref=this;
		var preload_image=new Image;
  		preload_image.onload=function(){
   			this_ref.currImgLdd=preload_image;
   			this_ref.arImg.push(preload_image);
			this_ref.iNumLdd+=1;
			(this_ref.onLoaded)();
   			if(this_ref.iNumImg==this_ref.iNumLdd) (this_ref.onComplete)(); 
			else this_ref.process_queue();
		}
		preload_image.src=image;
	}
}
preloadImages.onLoaded=function(){}
var ftSel=0;
var arFoto=new Array();
function sFoto(szNome,szDescr){ this.szNome=szNome; this.szDescr=szDescr; }

function viewImg(szImg){
	opOsc(function(){clOsc();if(_gel("imgLoad")) document.body.removeChild(_gel("imgLoad"));if(_gel("imgEnl")) document.body.removeChild(_gel("imgEnl"));});
	var objLoad=document.createElement("img");
	objLoad.id="imgLoad";
	objLoad.className="imgLoad";
	objLoad.src="imgdef/loader.gif";
	document.body.appendChild(objLoad);
	cntrObj(objLoad,32,32);
	var iKey=arGetKey(arFoto,"szNome",szImg);
	ftSel=iKey;
	preloadImages.onComplete=function(){
		imgLoaded(preloadImages.currImgLdd.src,preloadImages.currImgLdd.width,preloadImages.currImgLdd.height);
		_gel("ftDescr").innerHTML=_gel("imgBig").title=_gel("imgBig").alt=arFoto[iKey].szDescr;
		
		if(arFoto[iKey].szDescr.indexOf("<br")>-1) _gel("ftDescr").style.textAlign="left";
		
		document.body.removeChild(_gel("imgLoad"));
	}
	preloadImages.queue_images(new Array(szImg));
}
function imgLoaded(szImg,iW,iH){
	var objDiv=document.createElement("div");
	objDiv.id="imgEnl";
	objDiv.className="imgEnl";
	addEvent(objDiv,'click',function(){clOsc();if(_gel("imgLoad")) document.body.removeChild(_gel("imgLoad"));if(_gel("imgEnl")) document.body.removeChild(_gel("imgEnl"));},false);
	var szL="<img id=\"ftLeft\" style=\"z-index:1002;opacity:100;width:16px;\" src=\"imgdef/ftLeft.png\" onmouseover=\"imgRollOver(this)\" onmouseout=\"imgRollOver(this)\" onclick=\"ftChg(event,-1,arFoto)\">";
	var szB="<img src=\""+szImg+"\" id=\"imgBig\" alt=\"\" width=\""+iW+"\" height=\""+iH+"\" />";
	var szR="<img id=\"ftRight\" style=\"z-index:1003;opacity:100;width:16px;\" src=\"imgdef/ftRight.png\" onmouseover=\"imgRollOver(this)\" onmouseout=\"imgRollOver(this)\" onclick=\"ftChg(event,1,arFoto)\"><div id=\"ftDescr\" style=\"z-index:1004;width:"+iW+"px;margin-left:36px;\"></div>";
	var sz=(arFoto.length>1)?szL+szB+szR:szB;
	objDiv.innerHTML=sz;
	document.body.appendChild(objDiv);
	cntrObj(objDiv,iW+92,iH+20);
	new objFade(_gel("imgBig"),300,100);
}

function ftChg(e,iDir,ar){
	noPropag(e);
	var thi=this;
	var ft="";
	switch(iDir){
		case 1:
			if(ftSel<ar.length-1) ftSel++; else ftSel=0;
			break;
		case -1:
			if(ftSel>0) ftSel--; else ftSel=ar.length-1;
			break;
	}
	var obj=_gel("imgBig");
	this.imgChgShw=function(obj,ar){
		var objImg=_gel("imgLoad");
		if(!objImg) return;
		stAlph(obj,0);
		if(_gel("imgEnl")){
			stAlph(_gel("imgEnl"),100);
			_gel("ftDescr").style.width=preloadImages.currImgLdd.width+"px";
		}
		objImg.parentNode.removeChild(objImg);
		obj.src=preloadImages.currImgLdd.src;
		obj.style.width=preloadImages.currImgLdd.width+"px";
		obj.style.height=preloadImages.currImgLdd.height+"px";
		_gel("ftDescr").innerHTML=obj.title=obj.alt=ar[ftSel].szDescr;
		
		if(ar[ftSel].szDescr.indexOf("<br")>-1) _gel("ftDescr").style.textAlign="left";
		
		new objFade(obj,150,100);
	}
	this.imgChgHd=function(){
		var iW=iH=0;
		var objEnl=_gel("imgEnl");
		if(objEnl) stAlph(objEnl,0);
		else{
			var objBig=_gel("imgBig");
			iW=parseInt(objBig.offsetLeft+objBig.offsetWidth/2);
			iH=parseInt(objBig.offsetTop+objBig.offsetHeight/2);
			stAlph(objBig);
		}
		var objLoad=document.createElement("img");
		objLoad.id="imgLoad";
		objLoad.className="imgLoad";
		objLoad.src="imgdef/loader.gif";
		document.body.appendChild(objLoad);
		if(objEnl) cntrObj(objLoad,32,32);
		else{
			objLoad.style.left=iW+"px";
			objLoad.style.top=iH+"px";
		}
	}
	this.imgChgHd();
	preloadImages.onComplete=function(){
		thi.cntrObj(obj.parentNode,preloadImages.currImgLdd.width+92,preloadImages.currImgLdd.height+20);
		imgChgShw(obj,ar);
	}
	preloadImages.queue_images(new Array(ar[ftSel].szNome));
}

var bFlC=0;
function intRidim(hF){
	gestResize(_gel("Hd"),null,hF,intRdmCls);
}
function intRdmCls(){
	setCookie("intRdm",szUrl,24000);
	bFlC=1;
	//crHd();
}
function crHd(bRvw){
	var b=false;
	if(HdFlash>""){
		if(bFlC==1){
			b=false;
			var obj=_cel("div");
			obj.id="HdRvw";
			_gel("HdCell").parentNode.insertBefore(obj,_gel("HdCell"));
			obj.innerHTML="<a href=\"javascript:crHd(1)\">play Intro</a>";
		}else b=true;
	}else b=false;
	if(bRvw) b=true;
	var objF=_gel("HdFlash");
	if(!objF) objF=_cel("div");
	objF.id="HdFlash";
	var objHd=_gel("Hd");
	objHd.appendChild(objF);
	if(b){
		_gel("HdImg").innerHTML="";
		var ar=ppArr(HdFlash);
		objHd.style.height=ar[1]+"px";
		_gel("HdFlash").innerHTML='<object width="'+ar[0]+'" height="'+ar[1]+'"><param name="movie" value="'+szPth+ar[2]+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+szPth+ar[2]+'?a='+ar[4]+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'+ar[0]+'" height="'+ar[1]+'"></embed></object>';
	}else{
		if(HdImg>""){ 
			if(objHd.offsetHeight<szHdH) objHd.style.height=szHdH+"px";
			_gel("HdImg").innerHTML="<img id=\"HdImg\" src=\""+HdImg+"\" alt=\""+HdTxt+"\" />";
			
		}
		
	}
}
