/*    VALIDAï¿½ï¿½O DE E-MAIL   */
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve conter um e-mail válido.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' é necessário.\n'; }
    } if (errors) alert('Os seguintes erros ocorreram:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
function checkEmail(strEmail)
{
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(strEmail.value))
    {
      return (true)
    }
  return (false)
}

function validaFormulario(objForm)
{
  if ("" == objForm.strNome.value)
  {
    alert("Por favor, informe seu nome.");
    objForm.strNome.focus();
    return false;
  }

  if (!checkEmail(objForm.strEmail))
  {
    alert("Por favor, informe um endereço de e-mail válido.");
    objForm.strEmail.focus();
    return false;
  }

  if ("" == objForm.strMensagem.value)
  {
    alert("Por favor, preencha o campo 'Mensagem'.");
    objForm.strMensagem.focus();
    return false;
  }

  return true;
}

  function abreVideo(video)

  {
    var width = screen.width;
    var height = screen.height;

    var x = (width / 2) - (450 / 2);
    var y = (height / 2) - (430 / 2);

    window.open("popup_video.php?video="+video,"Vídeo e TV",'width=450,height=430,left = '+x+',top='+y+',scrollbars=no,resizable=no,menubar=no');
  }
	
	function fechaPopup(){
	popup = document.getElementById("popupResult");
	popup.style.display="none";
	}
	
function fechaTodos(){
	for(i=0;i<total;i++){
		sessao = sessoes[i];
		var submenu = document.getElementById("submenu_"+sessao);
		if(submenu.style.visibility!= "hidden")
		submenu.style.visibility = "hidden";
		}
	}
$daberta = Array(false, false, false, false, false, false, false, false,false);

function abreDica(qual){
	if(!$daberta[qual]){//fechada
		for(i=0;i<=8;i++){
			$daberta[i] = false;
			 var element0 = document.getElementById("d"+i);
				element0.style.display = 'none';
				var topoElement0 = document.getElementById("t"+i);
				//topoElement0.style.background='#F8F8F8';
				topoElement0.style.background='#fff';
				alert(element0);
			}
			$daberta[qual] = true;
		 var element = document.getElementById("d"+qual);
		 var sinal = "sinal_"+qual;
		 var topoElement = document.getElementById("t"+qual);

			element.style.display = 'block';
			topoElement.style.background='#EEEEEE';
		 
	}else{///aberta
		$daberta[qual] = false;
			var element = document.getElementById("d"+qual);
			 var sinal = "sinal_"+qual;
			 var topoElement = document.getElementById("t"+qual);

			 element.style.display = 'none';
			 topoElement.style.background='#fff';
		}
}
function abreDica2(){
	var element0 = document.getElementById("d0");
	if(element0.style.display == 'none'){
		element0.style.display = 'block';
		 
	}else{///aberta
			 element0.style.display = 'none';
		}
}


  function abrePopup(strUrl, strJanela, intLargura, intAltura)
  {
    var width = screen.width;
    var height = screen.height;

    var x = (width / 2) - (intLargura / 2);
    var y = (height / 2) - (intAltura / 2);

    window.open(strUrl,strJanela,'width='+intLargura+ ',height='+intAltura+ ',left = '+x+',top='+y+',scrollbars=no,resizable=no,menubar=no');
  }
