var tmp_bg = 0;
function trocaBg(x, bg){
	if(this.tmp_bg > 0)
		clearTimeout(this.tmp_bg);
	
	var rs = '1280_1024';
	if(window.screen.width == 1024 && window.screen.height == 768)
		rs = '1024_768';
	if(window.screen.width == 1152 && window.screen.height == 864)
		rs = '1152_864';
	if(window.screen.width == 1280 && window.screen.height == 720)
		rs = '1280_720';
	if(window.screen.width == 1280 && window.screen.height == 768)
		rs = '1280_768';
	if(window.screen.width == 1280 && window.screen.height == 800)
		rs = '1280_800';
	if(window.screen.width == 1280 && window.screen.height == 960)
		rs = '1280_960';
	if(window.screen.width == 1280 && window.screen.height == 1024)
		rs = '1280_1024';
	if(window.screen.width == 1680 && window.screen.height == 1050)
		rs = '1680_1050';
	
	Hide(gbid("bg" + (bg == 1?2:1)));
	Show(gbid("bg" + bg));
	
	gbid("bg" + (bg == 1?2:1)).style.backgroundImage = "url(imgs/bg" + rs + "/" + x + ".jpg)";
	x++;
	if(x > 15)
		x = 1;
	bg++;
	if(bg > 2)
		bg = 1;
	this.tmp_bg = setTimeout("trocaBg(" + x + ", " + bg + ")", 9000);
}
function menuExec(act){
	gbid("col2").style.background = "url(imgs/bg_cont.png)";
	Hide(gbid("ifr1"));
	Hide(gbid("ifr2"));
	Hide(gbid("ifr3"));
	Show(gbid("closecol"));
	gbid("ifr1").width  = "700px";
	gbid("ifr1").height = "550px";
	gbid("ifr1").style.marginLeft = "20px";
	gbid("ifr1").src = "";
	gbid("ifr2").src = "";
	gbid("ifr3").src = "";
	
	if(act == "hide"){
		gbid("col2").style.background = "";
		Hide(gbid("closecol"));
	}
	else{
		if(act == "art"){
			gbid("ifr1").width  = "220px";
			gbid("ifr1").height = "550px";
			gbid("ifr1").style.marginLeft = "0px";
			gbid("ifr1").src = "if_artesanatos.php";
			Show(gbid("ifr1"));
			
			gbid("ifr2").width  = "480px";
			gbid("ifr2").height = "550px";
			gbid("ifr2").style.position = "absolute";
			gbid("ifr2").style.top = "10px";
			gbid("ifr2").style.right = "0px";
			gbid("ifr2").src = "if_artesanato.php";
			Show(gbid("ifr2"));
		}
		else if(act == "vid"){
			gbid("ifr1").width  = "250px";
			gbid("ifr1").height = "550px";
			gbid("ifr1").style.marginLeft = "0px";
			gbid("ifr1").src = "if_videos.php";
			Show(gbid("ifr1"));
			
			gbid("ifr2").width  = "440px";
			gbid("ifr2").height = "350px";
			gbid("ifr2").style.position = "absolute";
			gbid("ifr2").style.top = "10px";
			gbid("ifr2").style.right = "0px";
			gbid("ifr2").src = "if_video_player.php";
			Show(gbid("ifr2"));
			
			gbid("ifr3").width  = "440px";
			gbid("ifr3").height = "200px";
			gbid("ifr3").style.position = "absolute";
			gbid("ifr3").style.top = "360px";
			gbid("ifr3").style.right = "0px";
			gbid("ifr3").src = "if_video_comentarios.php";
			Show(gbid("ifr3"));
		}
		else if(act == "bio"){
			gbid("ifr1").src = "if_biografia.php";
			Show(gbid("ifr1"));
		}
		else if(act == "dow"){
			gbid("ifr1").src = "if_downloads.php";
			Show(gbid("ifr1"));
		}
		else if(act == "gal"){
			gbid("ifr1").width  = "190px";
			gbid("ifr1").height = "550px";
			gbid("ifr1").style.marginLeft = "0px";
			gbid("ifr1").src = "if_galerias.php";
			Show(gbid("ifr1"));
			
			gbid("ifr2").width  = "510px";
			gbid("ifr2").height = "400px";
			gbid("ifr2").style.position = "absolute";
			gbid("ifr2").style.top = "50px";
			gbid("ifr2").style.right = "0px";
			gbid("ifr2").src = "if_galeria_img.php";
			Show(gbid("ifr2"));
			
			gbid("ifr3").width  = "510px";
			gbid("ifr3").height = "160px";
			gbid("ifr3").style.position = "absolute";
			gbid("ifr3").style.top = "400px";
			gbid("ifr3").style.right = "0px";
			gbid("ifr3").src = "if_galeria_imgs.php";
			Show(gbid("ifr3"));
		}
		else if(act == "loj"){
			
		}
		else if(act == "jog"){
			gbid("ifr1").style.marginLeft = "0px";
			gbid("ifr1").src = "if_jogos.php";
			Show(gbid("ifr1"));
		}
		else if(act == "con"){
			gbid("ifr1").src = "if_contato.php";
			Show(gbid("ifr1"));
		}
	}
}
function actExec(act, id){
	if(act == "arte_slct"){
		gbid("ifr2").src = "if_artesanato.php?id=" + id;
	}
	else if(act == "video_slct"){
		gbid("ifr2").src = "if_video_player.php?id=" + id;
		gbid("ifr3").src = "if_video_comentarios.php?id=" + id;
	}
	else if(act == "gal_slct"){
		gbid("ifr2").src = "if_galeria_img.php?id=" + id;
		gbid("ifr3").src = "if_galeria_imgs.php?id=" + id;
	}
	else if(act == "gal_slct_full"){
		gbid("ifr2").src = "if_galeria_img.php?acao=" + id;
	}
}
var gal_atual = 1;
function galShow(x){
	
	if(x == 1)
		this.gal_atual++;
	else
		this.gal_atual--;
	
	if(this.gal_atual < 1)
		this.gal_atual = gbid("t_gal").value;
	if(this.gal_atual > gbid("t_gal").value)
		this.gal_atual = 1;
	
	for(y=1; y<=gbid("t_gal").value; y++)
		Hide(gbid("gal" + y));
	
	Show(gbid("gal" + this.gal_atual));
}
function contato_valida(){
	objform = document.getElementById("frm_contato");
	
	if(objform.departamento.value==''){
      alert('Selecione o departamento');
      objform.departamento.focus("");
   }
   else if(objform.assunto.value.length < 2){
      alert('Digite o assunto corretamente');
      objform.assunto.focus("");
   }
   else if(objform.nome.value.length < 4){
      alert('Digite seu nome corretamente');
      objform.nome.focus("");
   }
   else if(objform.email.value.length < 8){
      alert('Digite seu e-mail corretamente');
      objform.email.focus("");
   }
   else if(objform.email.value!='' && (objform.email.value.split("@").length <=1 || objform.email.value.split(".").length <=1)){
      alert('E-mail invalido');
      objform.email.focus("");
   }
   else if(objform.ddd.value.length < 2){
      alert('Digite seu ddd corretamente');
      objform.ddd.focus("");
   }
   else if(objform.fone.value.length < 8){
      alert('Digite seu telefone corretamente');
      objform.fone.focus("");
   }
   else if(objform.mensagem.value==''){
      alert('Digite o comentario corretamente');
      objform.mensagem.focus("");
   }
   else
      objform.submit();
}
function comentario_valida(){
	if(document.frm.mensagem.value.length < 10){
      alert('Digite o comentario corretamente');
      document.frm.mensagem.focus();
   }
   else
      document.frm.submit();
}