function formatar(src, mask) {
	var i = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(i)

	if (texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}

function doDate(pStr, id)
{

 var reDate5 = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;

	if (reDate5.test(pStr)) {
		
	} else if (pStr != null && pStr != "") {
		alert("Data não válida!\n"+pStr);
		window.document.getElementById(id).value = "";
	} 
}

function marca(id){
	window.document.getElementById('cinza').className='cinza';
	window.document.getElementById('amarelo').className='amarelo';
	window.document.getElementById('azul').className='azul';
	window.document.getElementById('verde').className='verde';
	window.document.getElementById('rosa').className='rosa';
	window.document.getElementById(id).className=id+'Ativo';
}
function formFocus(id){
	if((document.getElementById(id).className) == "formInput2"){
		document.getElementById(id).className="formInput";
	}else{
		document.getElementById(id).className="formInput2";
	}
}
function formMultFocus(id){
	if((document.getElementById(id).className) == "formMulInput2"){
		document.getElementById(id).className="formMulInput";
	}else{
		document.getElementById(id).className="formMulInput2";
	}
}
function get_flash(arquivo, largura, altura, bgcolor, id, qualidade, alinhamento,transparente,pgphp) {
	obj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'" id="'+id+'" align="'+alinhamento+'">';
	obj+= '<param name="allowScriptAccess" value="sameDomain" />';
	obj+= '<param name="movie" value="'+arquivo+'" />';
	obj+= '<param name="quality" value="'+qualidade+'" />';
	if(transparente == true) {
		obj+= '<param name="wmode" value="transparent" />';
	}
	obj+= '<param name="bgcolor" value="'+bgcolor+'" />';
	obj+= '<param name="FlashVars" value="pg='+pgphp+'" />';
	obj+= '<embed src="'+arquivo+'" '+((transparente==true)?'wmode="transparent"':'')+'" quality="'+qualidade+'" bgcolor="'+bgcolor+'" FlashVars="pg='+pgphp+'" width="'+largura+'" height="'+altura+'" name="'+id+'" align="'+alinhamento+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	obj+= '</object>';
	document.write(obj);
}

function abre(id) {
	if(window.document.getElementById(id).style.display == 'none') { 
		window.document.getElementById(id).style.display = '';
		window.document.getElementById("img_"+id).src = '/checkup/imagens/seta_up.gif';
	} else { 
		window.document.getElementById(id).style.display = 'none'; 
		window.document.getElementById("img_"+id).src = '/checkup/imagens/seta_down.gif';
	}
}

function escondeAbasArgalit(){
	document.getElementById('qualidade').style.display = 'none';
	document.getElementById('diferenciais').style.display = 'none';
	//document.getElementById('ficha').style.display = 'none';
	document.getElementById('responsabilidade').style.display = 'none';
}

function mostraAbas(id){
	window.document.getElementById('qualidade').style.display = 'none';
	document.getElementById('qualidade_li').className = '';
	document.getElementById('diferenciais').style.display = 'none';
	document.getElementById('diferenciais_li').className = '';
	//document.getElementById('ficha').style.display = 'none';
	//document.getElementById('ficha_li').className = '';
	document.getElementById('responsabilidade').style.display = 'none';
	document.getElementById('responsabilidade_li').className = '';
	document.getElementById('apresentacao').style.display = 'none';
	document.getElementById('apresentacao_li').className = '';
	document.getElementById(id).style.display = '';
	document.getElementById(id+'_li').className = 'ativo';
}

function validaNews(){
	var msg = "";
	if((window.document.formNews.ds_nome.value == 'Nome completo') || (window.document.formNews.ds_nome.value == '')){
		msg = " - Seu nome!\n";
	}
	if((window.document.formNews.ds_email.value == 'E-mail') || (window.document.formNews.ds_email.value == '')){
		msg = msg + " - Seu email!\n";
	}
	
	if(msg == ""){
		return true;
	}else{
		alert("Preencha os campos corretamente.");
		return false;
	}
}


function validaBusca(){
	var msg = "";
	if((window.document.formBusca.ds_busca.value == 'Palavra chave') || (window.document.formBusca.ds_busca.value == '')){
		msg = " - Seu nome!\n";
	}

	if(msg == ""){
		return true;
	}else{
		alert("Digite uma palavra chave.");
		return false;
	}
}


function ordena(pag, tipo, mod){
	document.location.href = "../produtos/?pg="+pag+"&mod="+mod+"&tipo="+tipo;
	marcaClasseProdutos(tipo);
}


function marcaClasseProdutos(tipo){
	document.getElementById("todos_li").className = "";
	document.getElementById("tintas_li").className = "";
	document.getElementById("solventes_li").className = "";
	document.getElementById("massa_li").className = "";
	document.getElementById("argamassa_li").className = "";
	document.getElementById(tipo+"_li").className = "ativo";
}

// Função Link da paginação (fiveedit linha:)
function Page(cd_sesit, p, tipo, pag, mod){
	document.location.href = "?cd_sesit="+cd_sesit+"&p="+p+"&tipo="+tipo+"&pg="+pag+"&mod="+mod;
}

// Função Link de matérias (fiveedit linha:)
function Url(url, cd_matia, cd_site){
	document.location.href = url+"?cd_matia="+cd_matia+"&cd_site="+cd_site;
}

function url(url){
	document.location.href = url;
}


function escondeAbasGuiaProd(){
	document.getElementById('cromoterapia').style.display = 'none';
	document.getElementById('cores_cor').style.display = 'none';
	document.getElementById('fengshui').style.display = 'none';
	document.getElementById('galeria').style.display = 'none';
	document.getElementById('duvidas').style.display = 'none';
}

function mostraAbasGuiaProd(id){
	document.getElementById('dicas').style.display = 'none';
	document.getElementById('dicas_li').className = '';
	document.getElementById('cromoterapia').style.display = 'none';
	document.getElementById('cromoterapia_li').className = '';
	document.getElementById('cores_cor').style.display = 'none';
	document.getElementById('cores_cor_li').className = '';
	document.getElementById('fengshui').style.display = 'none';
	document.getElementById('fengshui_li').className = '';
	document.getElementById('galeria').style.display = 'none';
	document.getElementById('galeria_li').className = '';
	document.getElementById('duvidas').style.display = 'none';
	document.getElementById('duvidas_li').className = '';
	document.getElementById(id).style.display = '';
	document.getElementById(id+'_li').className = 'ativo';
}


function mostraAbasCanalLojista(id){
	document.getElementById('campanhas').style.display = 'none';
	document.getElementById('campanhas_li').className = '';
	document.getElementById('logomarcas').style.display = 'none';
	document.getElementById('logomarcas_li').className = '';
	document.getElementById('clube').style.display = 'none';
	document.getElementById('clube_li').className = '';
	document.getElementById(id).style.display = '';
	document.getElementById(id+'_li').className = 'ativo';
}

function mostraAbasSaladeImprensa(id){
	document.getElementById('jornal').style.display = 'none';
	document.getElementById('jornal_li').className = '';
	document.getElementById('arquivos').style.display = 'none';
	document.getElementById('arquivos_li').className = '';
	document.getElementById(id).style.display = '';
	document.getElementById(id+'_li').className = 'ativo';
}

function dicasAbas(id){
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display = '';
		document.getElementById(id+"_li").className = 'ativo';
	}else{
		document.getElementById(id).style.display = 'none';
		document.getElementById(id+"_li").className = '';
	}
}

function dicasAbasProd(id){
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id+"_corpo").style.display = '';
		document.getElementById(id+"_li").className = 'ativo';
	}else{
		document.getElementById(id+"_corpo").style.display = 'none';
		document.getElementById(id+"_li").className = '';
	}
}

function Dicas(id){
	if(document.getElementById(id).style.display == ""){
		document.getElementById(id).style.display = "none";
		document.getElementById(id+"_tit").className = "barBtn";
	}else{
		document.getElementById(id).style.display = "";
		document.getElementById(id+"_tit").className = "barBtnAtivo";
	}
}

    
function ativaAbaCores(){
	document.getElementById('dicas').style.display = "none";
	document.getElementById('dicas_li').className = "";
	document.getElementById('cores_cor').style.display = "";
	document.getElementById('cores_cor_li').className = "ativo";
}  

    
function mudaAbaFaleConosco(id){
		window.document.getElementById("formContato").style.display = "none";
		window.document.getElementById("formContato_li").className = "";
		window.document.getElementById("formTrabalhe").style.display = "none";
		window.document.getElementById("formTrabalhe_li").className = "";
		window.document.getElementById(id).style.display = "";
		window.document.getElementById(id+"_li").className = "ativo";
} 

    
function abasClasses(id){
	if(document.getElementById(id).style.display == ''){
		document.getElementById(id+"_t").className = 'barBtn';
		document.getElementById(id).style.display = 'none';
	}else{	
		document.getElementById(id+"_t").className = 'barBtnAtivo';
		document.getElementById(id).style.display = '';
	}
} 

function escondeAbas(){
	document.getElementById('produtos_relacionados').style.display = 'none';
	document.getElementById('duvidas_frequentes').style.display = 'none';
	document.getElementById('dicas').style.display = 'none';
	document.getElementById('rendimentos').style.display = 'none';
} 



function Voltar(){
	document.getElementById('matiaProximo_img').src = '/imagens/btn_prod_pro_off.gif';
	document.getElementById('matiaProximo').href = 'javascript:;';
	
}

function Ir(){
	document.getElementById('matiaProximo_img').src = '/imagens/btn_prod_pro.gif';
	document.getElementById('matiaAnterior').href = 'javascript:prodAnt();';
}

function Ir_ant(){
	document.getElementById('matiaAnterior_img').src = '/imagens/btn_prod_ant_off.gif';
	document.getElementById('matiaAnterior').href = 'javascript:;';
	//alert('ok');
}

function Voltar_ant(){
	document.getElementById('matiaAnterior_img').src = '/imagens/btn_prod_ant.gif';
	//document.getElementById('matiaProximo').href = 'javascript:prodProx();';
	
	//alert('ok');
}

function enviarFotos(){
	if(document.getElementById('enviarFotos').style.display == ""){
		document.getElementById('enviarFotos').style.display = "none";
	}else{
		document.getElementById('enviarFotos').style.display = "";
	}
}

function checaEnivoFotos(){

	var msg = "";
	if(window.document.formEnviaFotos.con_nome.value == ''){
		msg = " - Seu nome!\n";
	}
	if(window.document.formEnviaFotos.con_bairro.value == ''){
		msg = msg + " - Seu bairro!\n";
	}
	if(window.document.formEnviaFotos.con_cidade.value == ''){
		msg = msg + " - Sua Cidade!\n";
	}
	if(window.document.formEnviaFotos.con_estado.value == ''){
		msg = msg + " - Seu Estado!\n";
	}
	if(window.document.formEnviaFotos.arquivo.value == ''){
		msg = msg + " - Sua Foto!\n";
	}
	if(window.document.formEnviaFotos.con_produto.value == ''){
		msg = msg + " - O nome do produto utilizado!\n";
	}
	if(window.document.formEnviaFotos.con_historia.value == ''){
		msg = msg + " - Conte sua história!\n";
	}	
	
	if(msg == ""){
		return true;
	}else{
		alert("Preencha os campos corretamente.\n\n"+msg);
		return false;
	}	
}



function checaFaleConosco(){

	var msg = "";
	if(window.document.formContato.con_nome.value == ''){
		msg = " - Seu nome!\n";
	}
	/*if(window.document.formContato.con_empresa.value == ''){
		msg = msg + " - Sua empresa!\n";
	}*/
	if(window.document.formContato.con_telefone.value == ''){
		msg = msg + " - Seu telefone!\n";
	}
	if(window.document.formContato.con_email.value == ''){
		msg = msg + " - Seu e-mail!\n";
	}
	if(window.document.formContato.con_setor.value == 0){
		msg = msg + " - Escolha para qual setor deseja enviar a mensagem!\n";
	}
	if(window.document.formContato.con_mensagem.value == ''){
		msg = msg + " - Escreva sua mensagem!\n";
	}	
	
	if(msg == ""){
		return true;
	}else{
		alert("Preencha os campos corretamente.\n\n"+msg);
		return false;
	}	
}



function checaTrabalhe(){

	var msg = "";
	if(window.document.formTrabalhe.tra_nome.value == ''){
		msg = " - Seu nome!\n";
	}
	if(window.document.formTrabalhe.tra_email.value == ''){
		msg = msg + " - Seu e-mail!\n";
	}
	if(window.document.formTrabalhe.tra_telefone.value == ''){
		msg = msg + " - Seu telefone!\n";
	}
	if(window.document.formTrabalhe.tra_celular.value == ''){
		msg = msg + " - Seu celular!\n";
	}
	if(window.document.formTrabalhe.tra_endereco.value == ''){
		msg = msg + " - Seu endereço!\n";
	}
	if(window.document.formTrabalhe.tra_cidade.value == ''){
		msg = msg + " - Sua cidade!\n";
	}
	if(window.document.formTrabalhe.tra_bairro.value == ''){
		msg = msg + " - Seu bairro!\n";
	}	
	if(window.document.formTrabalhe.tra_estado.value == 0){
		msg = msg + " - Seu estado!\n";
	}
	if(window.document.formTrabalhe.tra_nascimento.value == ''){
		msg = msg + " - Sua data de nascimento!\n";
	}
	if(window.document.formTrabalhe.tra_idade.value == ''){
		msg = msg + " - Sua idade!\n";
	}
	if(window.document.formTrabalhe.tra_sexo.value == 0){
		msg = msg + " - Seu sexo!\n";
	}
	if(window.document.formTrabalhe.tra_naturalidade.value == ''){
		msg = msg + " - Sua naturalidade!\n";
	}
	if(window.document.formTrabalhe.tra_estadocivil.value == 0){
		msg = msg + " - Seu estado civil!\n";
	}
	/*if(window.document.formTrabalhe.tra_cnh.value == 'Sim'){
		if(window.document.formTrabalhe.tra_cnh.value == 'Sim'){
			msg = msg + " - Conte sua história!\n";
		}
	}*/
	if(window.document.formTrabalhe.tra_curso.value == ''){
		msg = msg + " - Nome do curso!\n";
	}
	if(window.document.formTrabalhe.tra_instituicao.value == ''){
		msg = msg + " - Nome da instituição!\n";
	}
	if(window.document.formTrabalhe.tra_turno.value == ''){
		msg = msg + " - Turno do curso!\n";
	}
	if(window.document.formTrabalhe.tra_conclusao.value == ''){
		msg = msg + " - Data da conclusão do curso!\n";
	}
	/*if(window.document.formTrabalhe.tra_extra.value == ''){
		msg = msg + " - Atividades extra curriculares!\n";
	}*/
	/*if(window.document.formTrabalhe.tra_outros.value == ''){
		msg = msg + " - Conte sua história!\n";
	}*/
	if(window.document.formTrabalhe.tra_empresa.value == ''){
		msg = msg + " - Nome da empresa de sua última experiência profissional!\n";
	}
	if(window.document.formTrabalhe.tra_segmento.value == ''){
		msg = msg + " - Segmento da empresa de sua última experiência profissional!\n";
	}
	if(window.document.formTrabalhe.tra_cargo.value == ''){
		msg = msg + " - Seu cargo na empresa de sua última experiência profissional!\n";
	}
	if(window.document.formTrabalhe.tra_atividades.value == ''){
		msg = msg + " - Atividades na empresa de sua última experiência profissional!\n";
	}
	if(window.document.formTrabalhe.tra_inicial.value == ''){
		msg = msg + " - Data de ínicio de sua última experiência profissional!\n";
	}
	if(window.document.formTrabalhe.tra_grupo.value == 0){
		msg = msg + " - Já trabalhou no grupo Argalit?\n";
	}
	if(window.document.formTrabalhe.tra_parentes.value == 0){
		msg = msg + " - Tem parentes na Argalit?\n";
	}
	/*if(window.document.formTrabalhe.tra_final.value == ''){
		msg = msg + " - Data final de sua última experiência profissional!\n";
	}*/
	/*if(window.document.formTrabalhe.tra_observacoes.value == ''){
		msg = msg + " - Conte sua história!\n";
	}*/	
	
	
	if(msg == ""){
		return true;
	}else{
		alert("Preencha os campos corretamente.\n\n"+msg);
		return false;
	}	
}

function LiberaCampo(valor){
	if(valor == "Sim"){
		document.getElementById('tiposCarteria').style.display = '';
	}else{
		document.getElementById('tiposCarteria').style.display = 'none';
	}
}

function Popup(Url, Titulo, Width, Height){
    window.open(Url, Titulo, 'width='+Width+', height='+Height+', scrollbars=no, status=no, resizable, top='+((screen.availHeight/2)-(Height/2))+', left='+((screen.availWidth/2)-(Width/2)))
}