function contato_campos()
{
	if ( document.contato.nome.value == '' )
	{
		alert( 'Por favor, informe seu nome.' );
		document.contato.nome.focus();
		return false;
	}
	else if ( document.contato.email.value == '' )
	{
		alert( 'Por favor, informe seu email.' );
		document.contato.email.focus();
		return false;
	}
	else if ( document.contato.mensagem.value == '' )
	{
		alert( 'Por favor, informe uma mensagem.' );
		document.contato.mensagem.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function conhecer_campos()
{
	if ( document.conhecer.nome.value == '' )
	{
		alert( 'Por favor, informe seu nome.' );
		document.conhecer.nome.focus();
		return false;
	}
	else if ( document.conhecer.email.value == '' )
	{
		alert( 'Por favor, informe seu email.' );
		document.conhecer.email.focus();
		return false;
	}
	else if ( document.conhecer.telefone.value == '' )
	{
		alert( 'Por favor, informe seu telefone.' );
		document.conhecer.telefone.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function cep_only (foo) 
{
	foo.value = foo.value.replace(/\D/g,'');
	if (foo.value.length > 3)
	{
		foo.value = foo.value.substring(0, foo.value.length - 3) +'-'+ foo.value.substring(foo.value.length - 3);
	}
}

function duvida(url)
{
                function createXMLHttpRequest()
                {
                        try{ return new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){}
                        try{ return new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){}
                        try{ return new XMLHttpRequest(); }catch(e){}
                        alert("XMLHttpRequest not supported");
                        return null;
                }
                var xhReq = createXMLHttpRequest();
                xhReq.open("post",url,true);
                xhReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                xhReq.onreadystatechange = function do_readyStateChange(to) {
                        if (xhReq.readyState == 4)
                        {
                                document.getElementById("duvidas_texto").innerHTML = xhReq.responseText;
                        }
                        else
                        {
                                document.getElementById("duvidas_texto").innerHTML = '<p style="text-align: center; padding-top: 50px;"><img src="/img/loader.gif"><br /><br />Carregando...</p>';
                        }
                }
                xhReq.send("&a=1");
}

	function txtBoxFormat(strField, 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 = document.getElementById(strField).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( " ", "" );
	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++;
	}
	
	document.getElementById(strField).value = sCod;
	if (nTecla != 8 || nTecla != 9) { // backspace
	if (sMask.charAt(i-1) == "9") { // apenas números...
		return ((nTecla > 47) && (nTecla < 58));
	} else { // qualquer caracter...
		return true;
	}
	} else {
	return true;
	}
	}
	
	//Fim da Função Máscaras Gerais
	
	/***
	* AUTO TAB - ao prencher o campo, automaticamente manda o foco para o próximo!
	***/
	var isNN = (navigator.appName.indexOf("Netscape")!=-1);
	function autoTab(input,len, e) {
	var keyCode = (isNN) ? e.which : e.keyCode;
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	
	function containsElement(arr, ele) {
	var found = false, index = 0;
	while(!found && index < arr.length)
	if(arr[index] == ele)
		found = true;
	else
		index++;
		return found;
	}
	
	function getIndex(input) {
	var index = -1, i = 0, found = false;
	while (i < input.form.length && index == -1)
		if (input.form[i] == input)index = i;
		else i++;
		return index;
	}
	return true;
	}
	//Fim da Função AutoTab