function cor_erro(var_erro,msg){
	var_erro.style.borderColor = '#CC0000';
	//var_erro.style.backgroundColor = '#F5CCCC';
	var_erro.focus();
	if(msg != ''){
		window.alert(''+msg+'');
	}
}
function cor_erro_ok(var_erro){
	var_erro.style.borderColor = '#CCCCCC';
	//var_erro.style.backgroundColor = '#FFFFFF';
}
function verifica_fale_conosco(form){
	texto = form;
	if(form.nome.value == '') {
		cor_erro(form.nome,'O campo NOME é obrigatorio!');
		return false;
	} else {
		cor_erro_ok(form.nome);
	}
	if(form.email.value == '') {
		cor_erro(form.email,'O campo E-MAIL é obrigatorio!');
		return false;
	} else {
		cor_erro_ok(form.email);
	}
	if(form.assunto.value == '') {
		cor_erro(form.assunto,'O campo ASSUNTO é obrigatorio!');
		return false;
	} else {
		cor_erro_ok(form.assunto);
	}
	if(form.mensagem.value == '') {
		cor_erro(form.mensagem,'O campo MENSAGEM é obrigatorio!');
		return false;
	} else {
		cor_erro_ok(form.mensagem);
	}
	if(form.img_seguranca.value == '') {
		cor_erro(form.img_seguranca,'O campo IMAGEM DE SEGURANÇA é obrigatorio!');
		return false;
	} else {
		cor_erro_ok(form.img_seguranca);
	}
	if(form.email.value != '') {
		var invalid;
		invalid = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
		// verifica se o email é válido
		if (invalid.test(form.email.value) == false) {
			cor_erro(form.email,'Endereço de E-mail inválido!');
			return false;
		}
	} else {
		cor_erro_ok(form.usuario);
	}
	document.getElementById('bt_envia_fale_conosco').style.display = 'none';
	//document.getElementById('bt_limpa_fale_conosco').style.display = 'none';
	document.getElementById('carregando_login_fale_conosco').style.display = 'block';
}
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
	if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function pg_busca(pesquisa,pagina){
	document.getElementById('q').value = pesquisa;
	document.getElementById('pagina').value = pagina;
	document.frm_pesquisa.submit();
}


function tp (min, seg, k) {
	if (k > 0) {	
		if (min < 60 & seg < 60) {
			if (min > 1) {	
				seg = seg * 1
				seg = seg + min * 60
				seg = seg * k
				seg = seg / 60
				min = min * 1
				min = seg
				seg = min % 1
				min = min - min % 1
				seg = seg * 0.6 * 100
				seg = seg - seg % 1
				hora = min / 60
				hora = hora - hora % 1
				min = min - hora * 60
				if (min < 10) { min = "0" + min}
				if (seg < 10) { seg = "0" + seg}
				document.pace.time.value = hora + "h" + min + "min" + seg + "seg"
			} else {
				document.pace.time.value = "Vai de carro ?" 
			} 
		} else { 
			document.pace.time.value = "Min e seg entre (0-59)"
		}
	} else { 
		document.pace.time.value = "Entre com a distância"	
	}								
}

function ritmo(hora,min,seg,k) {
	if (seg < 60 & min < 60)  { 	
		seg = seg * 1		
		seg = seg + min * 60 + hora * 60 * 60
		ritseg = seg / k / 60
		pacemin = ritseg - ritseg % 1
		paceseg = ritseg % 1 * 0.6 * 100 
		paceseg = paceseg - paceseg % 1
		if (paceseg <10) { paceseg = "0" + paceseg}
		if (pacemin <10) { pacemin = "0" + pacemin}
		if (pacemin  > 1 ) { 
			document.pace.rit.value = pacemin + ":" + paceseg + " min/km" 
		} else {
			if ( ritseg > 0) {
				document.pace.rit.value = "Vai de carro ? "
			} else { 
				document.pace.rit.value = "Dados?"  
			}	
		}
	} else { 
		document.pace.rit.value = "Min e seg entre (0-59)"
	} 
}
function cVirgulaPonto(field){
	field.value = field.value.replace( ",", "." );
	field.value = field.value.replace(/[^0-9.]/g,'');
}
