function Redirecionar(endereco){
   var local="";
   var i=0;
	for(i=0;i<window.location.href.split('/').length-1;i++){
	  local+=window.location.href.split('/')[i];
	  local+="/"
	}
	local+=endereco;  	
	window.location=local;	
}

/**
         FUNÇÕES PARA VALIDAÇÃO DE DADOS

 */

function is_email(sender)
        {
         var email= sender.value;
         if(email=="")
            return true;
          er = /^[a-zA-Z0-9][a-zA-Z0-9\._-]+@([a-zA-Z0-9\._-]+\.)[a-zA-Z-0-9]{2}/;
          
          if(er.exec(email))
                {
                  return true;
                } else {
                  alert("E-mail invalido.")
                  sender.value="";
                  sender.focus();
                  return false;
                }
        }
        
function is_data(data)
        {
          if(data.length == 10)
                {
                  er = /(0[0-9]|[12][0-9]|3[01])[-\.\/](0[0-9]|1[012])[-\.\/][0-9]{4}/; 
          
                  if(er.exec(data))
                        {
                          return true;
                        } else {
                          return false;
                        }
                
                } else {
                  return false;
                }               
        }

function is_hora(hora)
        {
          er = /(0[0-9]|1[0-9]|2[0123]):[0-5][0-9]/;
          
          if(er.exec(hora))
                {
                  return true;
                } else {
                  return false;
                }
        }

//MÁSCARA DE VALORES

function txtBoxFormat(objeto, sMask, evtKeyPress) {
    var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;


if(document.all) { // Internet Explorer
    nTecla = evtKeyPress.keyCode;
} else if(document.layers) { // Nestcape
    nTecla = evtKeyPress.which;
} else {
    nTecla = evtKeyPress.which;
    if (nTecla == 8) {
        return true;
    }
}

    sValue = objeto.value;

    // Limpa todos os caracteres de formatação que
    // já estiverem no campo.
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( "-", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( ".", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( "/", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( ":", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( "(", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( ")", "" );
    sValue = sValue.toString().replace( " ", "" );
    sValue = sValue.toString().replace( " ", "" );
    fldLen = sValue.length;
    mskLen = sMask.length;

    i = 0;
    nCount = 0;
    sCod = "";
    mskLen = fldLen;

    while (i <= mskLen) {
      bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
      bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

      if (bolMask) {
        sCod += sMask.charAt(i);
        mskLen++; }
      else {
        sCod += sValue.charAt(nCount);
        nCount++;
      }

      i++;
    }

    objeto.value = sCod;

    if (nTecla != 8) { // backspace
      if (sMask.charAt(i-1) == "9") { // apenas números...
        return ((nTecla > 47) && (nTecla < 58)); } 
      else { // qualquer caracter...
        return true;
      } 
    }
    else {
      return true;
    }
  }


  //MENU
  //
  //
  //
    function HabilitarMenuDicas(){
    	    	   $("#DicasDiv")[0].style["display"]="block";    	    	
    	    	   DesabilitarMenuOferecemos();
    }
   function DesabilitarMenuDicas(){
    	    	   $("#DicasDiv")[0].style["display"]="none";     	    	
    }
        function HabilitarMenuOferecemos(){
    	    	   $("#OferecemosDiv")[0].style["display"]="block";     	    	
    	    	   DesabilitarMenuDicas();
    }
   function DesabilitarMenuOferecemos(){
    	    	   $("#OferecemosDiv")[0].style["display"]="none";    	    	
    }
    function DesabilitarMenus(){
        	    DesabilitarMenuDicas();
  	  	      DesabilitarMenuOferecemos();
    }


//submenu

function MouseOverSubMenu(sender){
             sender.style["cursor"]="pointer";
             sender.style["fontWeight"]="bold";
}
  function MouseOutSubMenu(sender){
                 sender.style["fontWeight"]="";
}

// Validar Envio Email

function ValidarEnvioEmail(){
var mensagem =	$("#mensagem")[0].value;
   if(!ValidarEnvioNews())
      return false;
   if(mensagem==""){
      //$.popup.show("", "O Campo Mensagem \xe9 obrigat\xf3rio.");
      alert('Mensagem \xe9 Obrigat\xf3rio.');
      $("mensagem")[0].focus();
      return false;
   }
   return true;

}
function ValidarEnvioNews(){
var nome =	$("#nome")[0].value;
var email =	$("#email")[0].value;
   if(nome==""){
    //$.popup.show("", "O Campo Nome \xe9 obrigat\xf3rio.");
      alert('Nome \xe9 Obrigat\xf3rio.');
      $("#nome")[0].focus();
      return false;
   }
   if(email==""){
      // $.popup.show("", "O Campo Email \xe9 obrigat\xf3rio.");
      alert("E-Mail \xe9 Obrigat\xf3rio.");
      $("#email")[0].focus();
      return false;
   }
   return true;
}

function ValidarScroll(){
   var resolucao = obterResolucao();
	window.document.body.style["overflowX"]="hidden";	
   if(resolucao=="800x600"){
      if(!BrowserIE()){
      	 $('#TotalDiv')[0].style.marginLeft="-165px";
      	 $('.DicasDiv')[0].style["left"]="277px";
      	 $('.OferecemosDiv')[0].style["left"]="440px";
      }   	
   	else {
   		$('#TotalDiv')[0].style.marginLeft="-165px"
   	   $('.DicasDiv')[0].style["left"]="275px";
   	   $('.OferecemosDiv')[0].style["left"]="440px";
   	}
   }
   if(resolucao=="1024x768"){

 	       $('#Tudo')[0].style.paddingLeft="50px";
           $('#Menu1')[0].style.left="80px";
 	
   }
   else{

   if(!BrowserIE()){
   $('#Tudo')[0].style.paddingLeft="12.5%";
           $('#Menu1')[0].style.left="14.5%";      	
      }   	
   	else {
   	 $('#Tudo')[0].style.paddingLeft="0%";
           $('#Menu1')[0].style.left="18.5%";
   	}
       
   }

}

function obterResolucao(){
      var resX = screen.width;	
      var resY = screen.height;
	   return (resX+'x'+resY);
}

function BrowserIE(){
	var browserName = navigator.appName;
if ( browserName == "Netscape" ) {
   return false
} else if ( browserName == "Microsoft Internet Explorer" ) {
  return true;
}	
}

function FocusCaixa(sender){
sender.style["background"]="WhiteSmoke";
}
 function BlurCaixa(sender){
sender.style["background"]="";
}
