// JavaScript Document

//JAVASCRIPT



var ie4=document.all;

var dom=document.getElementById;

var ie;

ie=veBrowser();



function veBrowser()

{

app=navigator.appName;

if (app.indexOf('Netscape') != -1) {

	return false;

}

 if (app.indexOf('Microsoft') != -1)

 	{

		return true;

	}		

}



function MM_reloadPage(init) {  //reloads the window if Nav4 resized

  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_showHideLayers() { //v6.0

  var i,p,v,obj,args=MM_showHideLayers.arguments;

  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];

    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }

    obj.visibility=v; }

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function MM_goToURL() { //v3.0

  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;

  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");

}



function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}





var indice;

indice=0;

var imagens=new Array();



var	fadeTarget;

var rel5;

function fadeIn2(opacity) {

		if (opacity <= 100) {

			document.all("ct2").style.filter = "alpha(opacity="+opacity+")";

			opacity += 10;

			rel5=window.setTimeout("fadeIn2("+opacity+")", 30);

		}

		else			

	 		{

			 	clearTimeout(rel5);

				coloca_imagem1();

	

		 	}



}



function fadeIn3(opacity) {

		if (opacity <= 100) {

			document.all("ct").style.filter = "alpha(opacity="+opacity+")";

			opacity += 10;

			rel5=window.setTimeout("fadeIn3("+opacity+")", 30);

		}

		else			

	 		{

			 	clearTimeout(rel5);

				coloca_imagem2();

	

		 	}



}

var rel8;

function fadeOut1(opacity) {

	

		if (opacity >= 0) {

			

			document.all("ct").style.filter = "alpha(opacity="+opacity+")";

			opacity -= 10;

			rel8=window.setTimeout("fadeOut1("+opacity+")", 30);

		}

		else

	 {

 	  	

	  //document.all("ct").innerHTML="";

	  clearTimeout(rel8);

	  

	  fadeIn2(0)//coloca_source();

	 }

	

}



function fadeOut2(opacity) {

	

		if (opacity >= 0) {

			

			document.all("ct2").style.filter = "alpha(opacity="+opacity+")";

			opacity -= 10;

			rel8=window.setTimeout("fadeOut2("+opacity+")", 30);

		}

		else

	 {

 	  	

	  //document.all("ct").innerHTML="";

	  clearTimeout(rel8);

	  

	  fadeIn3(0)//coloca_source();

	 }

	

}

visivel=1;

indice=1;

function coloca_imagem1()

{

	if((indice+1)==imagens.length)

		{

			indice=0;

		}

	else

		{

			indice=indice+1;

		}

	document.all("photo").src=imagens[indice];

	visivel=2;	

	setTimeout("animacao()",10000);		

}

function coloca_imagem2()

{

	if((indice+1)==imagens.length)

		{

			indice=0;

		}

	else

		{

			indice=indice+1;

		}

	document.all("photo2").src=imagens[indice];

	visivel=1;

	setTimeout("animacao()",10000);			

}

function animacao()

{

	if(visivel==1)

	{

		if(document.all("photo2").complete)

			{

		 		//alert("força");

				loader.style.visibility="hidden";

				document.all("ct2").style.filter = "alpha(opacity=0)";

				esconde1();

				

			}

		else

			{

			 loader.style.visibility="visible";

			 setTimeout("empata1()",200);

			}	

	}

	else

	{

		if(document.all("photo").complete)

			{

		 		//alert("forçaII");

				loader.style.visibility="hidden";

				document.all("ct").style.filter = "alpha(opacity=0)";

				esconde2();

				

			}

		else

			{

			 loader.style.visibility="visible";

     	 	setTimeout("empata2()",200);

			}	

	}

}

function empata1()

{

	if(document.all("photo2").complete==false)

	 {

	 	loader.style.visibility="visible";

		setTimeout("empata1()",200);

	 }

	else

	 {

	 	 setTimeout("animacao()",200);

	} 

}



function empata2()

{

	if(document.all("photo").complete==false)

	 {

	 	loader.style.visibility="visible";

		setTimeout("empata2()",200);

	 }

	else

	 {

	 	 setTimeout("animacao()",200);

	} 

}



function esconde1()

{

   fadeOut1(100);



}



function esconde2()

{

   fadeOut2(100);



}

//setTimeout("Startimagenshow()",2000);







function first()

{

	if(document.all("photo").complete)

	 {

	 	

		setTimeout("fadeIn4(0)",200);	

	 }	

	 else

	 	{

			empata3();

		}

}



var rel20;

function fadeIn4(opacity) {

document.all("ct").style.visibility="visible";

document.all("ct2").style.visibility="hidden";

		if (opacity <= 100) {

			document.all("ct").style.filter = "alpha(opacity="+opacity+")";

			opacity += 10;

			rel20=window.setTimeout("fadeIn4("+opacity+")", 50);

		}

		else			

	 		{

			 	clearTimeout(rel20);

				document.all("ct2").style.visibility="visible";

				setTimeout("animacao()",10000);

		 	}



}

function empata3()

{

	//alert(document.all("photo").src + document.all("photo").complete);

	if(document.all("photo").complete==false)

	 {

	 	loader.style.visibility="visible";

		setTimeout("empata3()",200);

	 }

	else

	 {	

	 	loader.style.visibility="hidden";

	 	 setTimeout("first()",200);

	} 

}

function esc()

{

document.all("ct").style.filter = "alpha(opacity=0)";

}

if ((ie4||dom) && ie)

{

	setTimeout("first()",50);

}	

//setTimeout("animacao()",10000);