try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

function ge(x){
	return document.getElementById(x);
}
function showDv(x,arg){ return ge(x).style.display=arg; }

function hideDv(x){ return ge(x).style.display="none"; }

function abrirCategorias(){
	ge('categhome').style.display = 'block';
	//Effect.toggle('categhome','appear');
}

function contactar(){
	var nome = ge('anome');
	var email = ge('aemail');
	var assunto = ge('aassunto');
	var msg = ge('amsg');
	
	var em1 = email.value.indexOf('@');
	var em3 = email.value.length;
	
	if(nome.value == ""){
		ge('a1').style.display="block";
		ge('a1').innerHTML="Preencha com seu nome para prosseguir.";
		nome.focus();
	}
	else if(email.value == ""){
		ge('a2').style.display="block";
		ge('a2').innerHTML="Preencha com seu e-mail para prosseguir.";
		email.focus();
	}
	else if(!(em1 >= 3 && em3 >= 9)){
		ge('a2').style.display="block";
		ge('a2').innerHTML="Preencha com um e-mail válido para prosseguir.";
		email.focus();
	}
	else if(assunto.value == ""){
		ge('a3').style.display="block";
		ge('a3').innerHTML="Preencha com o assunto para prosseguir.";
		assunto.focus();
	}
	else if(msg.value == ""){
		ge('a4').style.display="block";
		ge('a4').innerHTML="Preencha com a mensagem para prosseguir.";
		msg.focus();
	} else {
		
		document.frmcontato.submit();
		
	}
	
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
