// JavaScript Document

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_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_findObj(n, d) { 
  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_showhidelayers() { 
  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_preloadImages() { 
  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 validadadosbuscageral(form) {
	if (form.txtBusca.value == "") {
		alert("Digite o que deseja procurar.");
		return false;
	}
}

function validaDados1(form) {

	if (form.cboLocal.value == 0) {
		alert("Selecione algum Local.");
		return false;
	}
}

function validaDados2(form) {
	if ((form.txtLocal.value == "") || (form.txtLocal.value == "Digite aqui")) {
		alert("Digite o que deseja procurar.");
		return false;
	}

}

function mm_swapimage() { 
  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_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function validaDados(form) {

	if ((form.txtEmail.value == "") || (form.txtEmail.value == "digite seu e-mail")) {
		alert("Campo E-mail em branco.");
		return false;
	}
	if (form.cboEstrelas.value == 0) {
		alert("Campo Classificação em branco.");
		return false;
	}
	if (form.txtComentario.value == "") {
		alert("Campo Comentar em branco.");
		return false;
	}
	if (form.cboAno.value == "") {
	if (form.cboMes.value == "") {
	if (form.cboDia.value != "") {
		alert("Para selecionar um Dia, é necessário selecionar um Mês.");
	return false;
	}
	}				
	else {
		alert("Para selecionar um Mês, é necessário selecionar um Ano.");
		return false;
	}
	}	
	
	if ((form.cboLocal.value == "") && (form.cboEvento.value == "") && (form.cboAno.value == "")) {
		alert("Selecione algum campo para pesquisa.");
		return false;
	}
	
	if (form1.cboLocal.value == 0){
	
	if (form1.cboAtracao.value == 0){
	alert("É necessário escolher um Local ou uma Atração.");
	return false;
	}
	}
	if ((form.txtEmail.value == "") || (form.txtEmail.value == "digite seu e-mail")) {
		alert("Campo E-mail em branco.");
		return false;
	}
	if (form.cboEstrelas.value == 0) {
		alert("Campo Classificação em branco.");
		return false;
	}
	if (form.txtComentario.value == "") {
		alert("Campo Comentar em branco.");
		return false;
	}	
}

function mm_openbrwindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function validadadosbuscageral(form) {
	if (form.txtBusca.value == "") {
		alert("Digite o que deseja procurar.");
		return false;
	}
}

function validadadosenvia(form) {
	var var_selecionou;
	var int_selecionado;
	var_selecionou = false;
	for (var i = 0; i < form.optRespEnquete.length; i++){
		if (form.optRespEnquete[i].checked){
			var_selecionou = true;
			int_selecionado = i;
		}
	}
	
	if (var_selecionou == false) {
		alert("Você deve escolher alguma das respostas do Enquete.");
	}else{
		mm_openbrwindow('http://www.taemtodas.com.br/Resp_Enquete.asp?cod_resp_enquete=' + form.optRespEnquete[int_selecionado].value,'Enquete','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=250,height=' + (100 + (form.optRespEnquete.length * 40)));
	}
	return false;
	
}

function EnviaForm(form){
	if(form.cboSecao.value != 0){
		form.submit();
}
}

/* Programação include*/

function ap_getObj(name) {
	    if (document.getElementById){ 
			return document.getElementById(name).style; 
	    }else if (document.all){
			return document.all[name].style; 
		}else if (document.layers){
			return document.layers[name]; 
		}
	}
    function carregaComboSubCategoria(){
		if(document.formHoje.cboCategoria.value != '0'){
			var x = ap_getObj('LayerAguarde'); x.visibility = 'visible';
			var x = ap_getObj('LayerHoje'); x.visibility = 'hidden';
			document.formHoje.submit();
		}else{
			y = document.formHoje.cboSubCategoria.options.length
			for (i=0; i < y; i++){
 			  document.formHoje.cboSubCategoria.remove(1);
			}
		}
    }
    function submitComboSubCategoria(){
		if(document.formHoje.cboSubCategoria.value != '0'){
			var x = ap_getObj('LayerAguarde'); x.visibility = 'visible';
			var x = ap_getObj('LayerHoje'); x.visibility = 'hidden';
			document.formHoje.action = "pesq_hoje.asp"; 
			document.formHoje.target = "_parent";
			document.formHoje.submit();
		}
    }
	
	
function saveCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))
		var expires = "; expires="+date.toGMTString()
	}
	else expires = ""
	document.cookie = name+"="+value+expires+"; path=/"
}
function readCookie(name) {
	var nameEQ = name + "="
	var ca = document.cookie.split(';')
	for(var i=0;i<ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length)
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
	}
	return null
}
function deleteCookie(name) {
	saveCookie(name,"",-1)
}

function goback() {
    history.go(-1);
}





var tam = 11;

function mudaFonte( tipo )
{
  if( tipo == 'mais' )
  {
    if( tam < 17 ) tam += 2 ;    			 
  }
  else
  {
    if( tam > 9 ) tam -= 2 ;
  }
  if( document.getElementById( 'mudaFonte' ) )
    mudaFonteRecursiva( tipo , document.getElementById( 'mudaFonte' ) ) ;

  if( document.getElementById( 'mudaFoto' ) )
    mudaFonteRecursiva( tipo , document.getElementById( 'mudaFoto' ) ) ;  
}

function mudaFonteRecursiva( tipo , domElement )
{		
  for( var i = 0 ; i < domElement.childNodes.length ; i++ )
  {
    mudaFonteRecursiva( tipo , domElement.childNodes.item( i )  ) ;
  }
  if( domElement.style )
    domElement.style.fontSize = tam+'px';
}

function toggleBox(szDivID, iState, iState2, iState3, iState4) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
	   document.layers[szDivID].height = iState2 ? "110px" : "0";
	   document.layers[szDivID].font = iState3 ? "13px" : "0";	   
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
		obj.style.height = iState2 ? "110px" : "0";
		obj.style.font = iState3 ? "13px" : "0";		
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
		document.all[szDivID].style.height = iState2 ? "110px" : "0";
		document.all[szDivID].style.font = iState3 ? "13px" : "0";		
    }
}

function toggleBox2(szDivID, iState, iState2) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
	   document.layers[szDivID].height = iState2 ? "800px" : "0";	  	   
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
		obj.style.height = iState2 ? "800px" : "0";				
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
		document.all[szDivID].style.height = iState2 ? "800px" : "0";				
    }
}

function OpenWindow(URL) {
    width = screen.width-10;
    height = screen.height-58;
    window.open(URL,'','width='+width+',height='+height+'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0, left=0, top=0');
}


