/* Google Analytics - Inicio */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-28166167-1']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();  
/* Google Analytics - Fim */

/* Loader - Inicio */
function showLoader(){
	$('#loading').fadeIn(300);
}

function hideLoader() {
	hideLoader(500);
}

function hideLoader(time) {
	$('#loading').fadeOut(time);
}
/* Loader - Fim */

/* Index - Inicio */
function highlight_estado(region, show) {
        var highlightItem = document.getElementById("areaMap");

        if (!show) {
                highlightItem.style.backgroundImage = "url(images/mapa/estados/estado_" + region + ".png)";
        } else {
                highlightItem.style.backgroundImage = "url(images/mapa/transparent.gif)";
        }

        return true;
}
/* Index - Fim */

/* Formulario de Contato - Inicio */
function validaFormularioContato(formId) {
	var msgRetorno = "";
	var retorno = true;

	var nome = document.getElementById("nome").value;
	var site = document.getElementById("site").value;
	var email = document.getElementById("email").value;
	var assunto = document.getElementById("assunto").value;
	var mensagem = document.getElementById("mensagem").value;

	if (retorno && (nome == null || nome == "")) {	    
		retorno	= false;
		msgRetorno = "&Eacute; necess&aacute;rio o preenchimento do <b>NOME</b>!"
	}

	//if (retorno && (site == null || site == "")) {
	//	retorno	= false;
	//	msgRetorno = "&Eacute; necess&aacute;rio o preenchimento do <b>SITE</b>!"
	//}

	if (retorno && (email == null || email == "")) {
		retorno	= false;
		msgRetorno = "&Eacute; necess&aacute;rio o preenchimento do <b>E-MAIL</b>!"
	}

	if (retorno && !validaMail(email)) {
		retorno	= false;
		msgRetorno = "O <b>E-MAIL</b> preenchido &eacute; <b>INV&Aacute;LIDO</b>!"
	}

	if (retorno && (assunto == null || assunto == "")) {
		retorno	= false;
		msgRetorno = "&Eacute; necess&aacute;rio o preenchimento da <b>ASSUNTO</b>!"
	}

	if (retorno && (mensagem == null || mensagem == "")) {
		retorno	= false;
		msgRetorno = "&Eacute; necess&aacute;rio o preenchimento da <b>MENSAGEM</b>!"
	}

	if (!retorno && (msgRetorno != null && msgRetorno != "")) {
		document.getElementById("divError").style.display="block"
		document.getElementById("mensagemErro").innerHTML = msgRetorno;
		document.getElementById("form_content").style.display="none";
		return false;
	} else {
		document.getElementById("form").submit();
		document.getElementById("form_content").style.display="none";
		return true;
	}	
}

function reexibirFormularioContato() {
    document.getElementById("divError").style.display="none"
	document.getElementById("mensagemErro").innerHTML = "";
	document.getElementById("form_content").style.display="block";
}

function validaMail(mail) {
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);

	if (typeof(mail) == "string") {
		if (er.test(mail)){
			return true;
		}
	} else if (typeof(mail) == "object") {
		if (er.test(mail.value)) { 
			return true; 
		}
	} else {
		return false;
	}
}
/* Formulario de Contato - Fim */








function show_estado(show, estado) {
//        if (show) {
//            document.getElementById("estadoNome").style.display = "block";
//            document.getElementById("estadoNome").className = "show_estado_nome";
//			document.getElementById("estadoNome").innerHTML = estado;
//        } else {
//            document.getElementById("estadoNome").style.display = "none";
//        }
//
        return false;
}

/*
function openDivCidades(divId) {
	//alert(divId);

	var flowValue = document.getElementById(divId).style.overflowY;

	if (flowValue == "visible") {
		document.getElementById(divId).style.overflowY = "hidden";
	} else {
		document.getElementById(divId).style.overflowY = "scroll";
	}

	//http://stackoverflow.com/questions/7272282/overflow-y-not-working-in-javascript
	//http://www.w3schools.com/cssref/pr_pos_overflow.asp
}

function showLinkDecoration(element) {
	element.style.textDecoration ='underline';
}

function hideLinkDecoration(element) {
	element.style.textDecoration ='none';
}
*/
