window.onload = function() {
	  var links = document.links;
	  for (var i = 0, s = links.length; i < s; i++) {
		if (links[i].rel == 'external') {
		  links[i].target = '_blank';
		}
	  }
	}
	
function trim(str){return str.replace(/^\s+|\s+$/g,"");}

function chkContato(){
	var aux = document.getElementById("formPedido")
	aux.target = "_self";
	
	if (trim(aux.nome.value) == ""){
		alert("Por Favor Coloque Seu Nome.");
		aux.nome.focus();
		aux.nome.select();
		return;
	}
	if (aux.mail.value == ""){
		alert("Por Favor Coloque Seu E-mail.");
		aux.mail.focus();
		return;
	}
	if (!(verifica_email(aux.mail))){
		aux.mail.focus();
		return;
	}

	if (((aux.telefone_num.value.length < 6) || (aux.telefone_ddd.value.length < 2)) && ((aux.celular_num.value.length < 7) || (aux.celular_ddd.value.length < 2))){
		alert("É necessário preencher pelo menos um telefone corretamente.");
		aux.telefone_ddd.focus();
		return;
	}
	aux.submit();
}
function verifica_email(campo) {
		var Email = campo.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (campo.value == ''){
		} else{
		if (Email){
		   correto = true;
		   return true;
		} else {
		   alert(unescape('Favor entrar com um endere%E7o de e-mail v%E1lido!'));
		   return false;
		   }
		}
	}

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 if(document.getElementById) { // FireFox
	nTecla = evtKeyPress.which;
		} 
	else {
		nTecla = evtKeyPress.which;
		if (nTecla == 8) {
			return true;
		}
}

    sValue = objeto.value;

    // Limpa todos os caracteres de formatao que
    // ja 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 nmeros...
        return ((nTecla > 47) && (nTecla < 58)); } 
      else { // qualquer caracter...
        return true;
      } 
    }
    else {
      return true;
    }
	alert(objeto.maxlength);
  }
  
	function validateKey (bloqCtrl)   
    {
        if (bloqCtrl.keyCode == '17')  
         {  
            alert(unescape("Fun%E7%E3o Desabilitada Nesse Campo! "));
             return false  
         }  
         return true  
    }
	
	function verificaPaginaAtiva(){
		var aux = document.location.href;
		inicio = aux.lastIndexOf("/") +1;
		fim = aux.lastIndexOf(".php");
		if (fim >=0){
			teste = aux.lastIndexOf("lavadoras-ultrassonicas.php");
			if (teste >=0){
				aux = "por-que-utilizar-lavadoras-ultrassonicas";
			}else{
				aux = aux.substring(inicio,fim);
			}
		}else{
			aux = "index";
		}
		aux = "Menu_"+ aux.toLowerCase();
		obj = document.getElementById(aux);
		obj.className="menu_Selecionado";
	}
