function mudarClasse (id, tipo) {
	if (tipo == "on") {
		document.getElementById(id).className = "menuLinkOn";	
	}
	if (tipo == "out") {
		document.getElementById(id).className = "menuLink";	
	}
}

function flash_w3c(arqflash,ident,largura,altura) {
    if (window.navigator.appName == "Microsoft Internet Explorer") {
        document.write('<object id="'+ident+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+largura+'" height="'+altura+'">');
        document.write('<param name="allowScriptAccess" value="sameDomain">');
        document.write('<param name="movie" value="'+arqflash+'">');
        document.write('<param name="quality" value="high">');
        document.write('<param name="salign" value="t">');
        document.write('</object>');

    }else{
        document.write('<embed src="'+arqflash+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'"></embed>');
    }
}

function validarCadastro() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.getElementById("nome").value == "") {
	 passou = false; alerta += "- Nome preenchido incorretamente.\n";
  }
  if (document.getElementById("empresa").value == "") {
	 passou = false; alerta += "- Empresa preenchido incorretamente.\n";
  }
  if (document.getElementById("site").value == "") {
	 passou = false; alerta += "- Site preenchido incorretamente.\n";
  }
  if (document.cadastro.emailCadastro.value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.cadastro.emailCadastro.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  if (document.getElementById("telefoneCadastro").value == "") {
	 passou = false; alerta += "- Telefone preenchido incorretamente.\n";
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

function validarNews() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.newsletter.news.value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.newsletter.news.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

function validarVendas() {
  var passou = true;
  var alerta = "O sistema encontrou os seguintes erros no preenchimento do formulário:\n\n";

  // validações dos campos gerais
  if (document.getElementById("necessidade").value == "") {
	 passou = false; alerta += "- Necessidade preenchido incorretamente.\n";
  }
  if (document.getElementById("nomeVendas").value == "") {
	 passou = false; alerta += "- Nome preenchido incorretamente.\n";
  }
  if (document.getElementById("telefone").value == "") {
	 passou = false; alerta += "- Telefone preenchido incorretamente.\n";
  }
  if (document.vendas.email.value == "") {
     passou = false; alerta += "- E-mail preenchido incorretamente.\n";
  }else{
      if (!validarEmail(document.vendas.email.value)) {
           passou = false; alerta += "- E-mail preenchido incorretamente.\n";
      }
  }
  
  if (passou == true) { return true; }
  else { alert(alerta); return false; }
}

function validarEmail(email)
{
	var s = email;
	var filter=/^[A-Za-z][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if (s.length == 0 ) return true;
	if (filter.test(s))
	return true;
	else
	return false;
}

/*function abrir1() {  
window.open ("disjuntores-contatores-tensao-voltagem-rompedores-compactadores-disjuntores4-mms-32h.php", "Janela", "status=no, width=625,  height=495, top=0") ;
} 
function abrir2() {  
window.open ("disjuntores-contatores-tensao-voltagem-rompedores-compactadores-disjuntores4-mms-63h.php", "Janela", "status=no, width=625,  height=360, top=60") ;
} */
function abrir4() {  
window.open ("disjuntores-contatores-tensao-voltagem-rompedores-compactadores-disjuntores4.php", "Janela", "status=no, width=648,  height=900, top=0, scrollbars=yes") ;
} 