
function loadDATA(url,div){
	Ext.Ajax.request({
		url: url,
		method: 'POST',
		success: function(dt,opt){
			var retorno = dt.responseText;
			document.getElementById(div).innerHTML = retorno;
			}
	});	

	if('local.php'==url){
		setTimeout(function(){
			loadLOCALTXT(1);
	       }, 1000);
	}
}

function abreWIN(url,w,h){
	window.open(url,'','width:'+w+',height:'+h+',scrollbars=1,resizable=1');
}

function openNEWWIN(tit,w,h,pg,cod){
	var pag = pg+'?cod='+cod;
	var compl = 'scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,width='+w+',height='+h;
	window.open(pag,'',compl);
}

function abreWINIMG(url,w,h){
	var pasta = document.orcamento_carimbados.pasta.value;
	var nurl = url+'?pasta='+pasta;
	var compl = 'scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,width='+w+',height='+h;
	window.open(nurl,'',compl);
}

function loadDATATXT(txt,div){
	document.getElementById(div).innerHTML = txt;
}

function loadDATATXTBG(txt,div,bg){	
	document.getElementById('video_emp').style.visibility = 'hidden';
	document.getElementById(div).style.background = bg;
	document.getElementById(div).innerHTML = txt;
}

function loadLOCAL(uf){
	document.getElementById('uf_local').value = uf;

	var tipo = document.getElementById('tp_local').value;
	var txt_tipo = "DISTRIBUIDORES";
	var color = "color_blue_local";	

	if(2 == tipo){
		txt_tipo = "REPRESENTANTES";
		color = "color_yellow_local";	
	}

	loadDATA('get_local.php?uf='+uf+"&tp="+tipo,'txt_right_local');
	loadDATATXT('<span class="'+color+'"><b>'+txt_tipo+' - '+getTXTUFJS(uf)+'</b></span>','txt_tit_right_local');
}

function loadLOCALTXT(tipo){

	document.getElementById('tp_local').value = tipo;

	var uf = document.getElementById('uf_local').value;
	var txt_tipo = "DISTRIBUIDORES";
	var color = "color_blue_local";	
	
	if(2 == tipo){
		txt_tipo = "REPRESENTANTES";
		color = "color_yellow_local";	
	}

	loadDATA('get_local.php?uf='+uf+"&tp="+tipo,'txt_right_local');
	loadDATATXT('<span class="'+color+'"><b>'+txt_tipo+' - '+getTXTUFJS(uf)+'</b></span>','txt_tit_right_local');
}

function getTXTUFJS(uf){

	var str = "";

	switch(uf){
		case 'AM':
			str =  "Estado do Amazonas";
			break; 
		case 'CE':
			str =  "Estado do Ceará";
			break; 
		case 'BA':
			str =  "Estado da Bahia";
			break; 
		case 'AP':
			str =  "Estado do Amapá";
			break; 
		case 'AC':
			str =  "Estado do Acre";
			break; 
		case 'AL':
			str =  "Estado do Alagoas";
			break; 
		case 'DF':
			str =  "Estado do Distrito Federal";
			break; 
		case 'ES':
			str =  "Estado do Espírito Santo";
			break; 
		case 'GO':
			str =  "Estado de Goias";
			break; 
		case 'MA':
			str =  "Estado do Maranhão";
			break; 
		case 'MT':
			str =  "Estado do Mato Grosso";
			break; 
		case 'MS':
			str =  "Estado do Mato Grosso do Sul";
			break; 
		case 'MG':
			str =  "Estado de Minas Gerais";
			break; 
		case 'PA':
			str =  "Estado do Pará";
			break; 
		case 'PB':
			str =  "Estado da Paraiba";
			break; 
		case 'PR':
			str =  "Estado do Paraná";
			break; 
		case 'PE':
			str =  "Estado de Pernambuco";
			break; 
		case 'PI':
			str =  "Estado do Piaui";
			break; 
		case 'RJ':
			str =  "Estado do Rio de Janeiro";
			break; 
		case 'RN':
			str =  "Estado do Rio Grande do Norte";
			break; 
		case 'RS':
			str =  "Estado do Rio Grande do Sul";
			break; 
		case 'RR':
			str =  "Estado de Roraima";
			break; 
		case 'RO':
			str =  "Estado de Rondônia";
			break; 
		case 'SC':
			str =  "Estado de Santa Catarina";
			break; 
		case 'SP':
			str =  "Estado de São Paulo";
			break; 
		case 'TO':
			str =  "Estado do Tocantins";
			break; 
		case 'SE':
			str =  "Estado de Sergipe";
			break; 
	}
	return (str);
}	

function changeIMG(div,img){
	document.getElementById(div).innerHTML = '<img src="img/'+img+'">';
}

function changeVIDEO(div){
	document.getElementById(div).style.visibility = 'visible';
	document.getElementById(div).innerHTML = '<object width="398" height="300"><param name="movie" value="http://www.youtube.com/v/y2d5zq4CaSY&hl=pt-br&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/y2d5zq4CaSY&hl=pt-br&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="398" height="300"></embed></object>';
}

function openWIN(link,div){
	window.open(link,'BLOG', 'menubar=no, toolbar=no,status=no');
}

function submitCONTATO(){

	var assunto = document.form_contato.assunto.options[document.form_contato.assunto.selectedIndex].value;
	var nome 	= document.form_contato.nome.value;
	var email 	= document.form_contato.email.value;
	var ddd 	= document.form_contato.ddd.value;
	var tel 	= document.form_contato.tel.value;
	var obs 	= document.form_contato.obs.value;
	var balerta	= 0;

	if(nome==null || nome==" " || nome.length<3){
		document.form_contato.nome.style.border = "1px solid #FF0000";
		balerta = 1;
	}else{
		document.form_contato.nome.style.border = "1px solid #97a7ae";
	}

	if(!checkEMAIL(email)){
		document.form_contato.email.style.border = "1px solid #FF0000";
		balerta = 1;
	}else{
		document.form_contato.email.style.border = "1px solid #97a7ae";
	}

	if( (ddd==null || ddd==" " || ddd.length<2) || (tel==null || tel==" " || tel.length<8)){
		document.form_contato.ddd.style.border = "1px solid #FF0000";
		document.form_contato.tel.style.border = "1px solid #FF0000";
		balerta = 1;
	}else{
		document.form_contato.ddd.style.border = "1px solid #97a7ae";
		document.form_contato.tel.style.border = "1px solid #97a7ae";
	}

	if(1==balerta){
		document.getElementById('alerta_contato').style.visibility = "visible";
		document.getElementById('alerta_contato').innerHTML = '<B>ATENÇÃO!!!<br><br>Os campos com borda vermelha são obrigatórios.<BR><BR></B><a href="#"><img src="img/tit_fechar_janela.gif" onClick="hideDIV(\'alerta_contato\')"></a> ';
	}else{
		document.getElementById('alerta_contato').innerHTML = '<img src="img/carregando_01.gif">';			
	}

	if(0==balerta){
		document.getElementById('alerta_contato').style.visibility = "visible";
		Ext.Ajax.request({
			url: 'envio_email_contato.php?assunto='+assunto+'&nome='+nome+'&&email='+email+'&&ddd='+ddd+'&&tel='+tel+'&&obs='+obs,
			method: 'POST',
			success: function(dt,opt){
				var retorno = dt.responseText;
					document.getElementById('alerta_contato').innerHTML = retorno+'<a href="#"><img src="img/tit_fechar_janela.gif" onClick="hideDIV(\'alerta_contato\')"></a>';
				},
			failure:function(dt,opt){
					document.getElementById('alerta_contato').innerHTML = '<b>Prezado Cliente,<br><br>Infelizmente não foi possível enviar o seu formulário neste momento.<br><br>Por gentileza, utilize o nosso telefone de contato <span class="t_18">(11) 4714-7900.</span><br><br><br>Obrigado.<br>SAC<br><br></b><a href="#"><img src="img/tit_fechar_janela.gif" onClick="hideDIV(\'alerta_contato\')"></a> ';
				}
		});	
	}

}

	function showResult(txt,div,time){
		document.getElementById(div).innerHTML = txt;
	    setTimeout(function(){
			document.getElementById(div).style.visibility = 'hidden';
	        }, time);
	}

	function checkCOR(id,valor){
		var campo = 'c'+id;	
		document.getElementById(campo).options.length = 0;
		switch(valor){
			case '9.0':
				document.getElementById(campo).options[0] = new Option('AMARELO','AMARELO');
				document.getElementById(campo).options[1] = new Option('AMARELO GEMA','AMARELO GEMA');
				document.getElementById(campo).options[2] = new Option('AZUL','AZUL');
				document.getElementById(campo).options[3] = new Option('AZUL CELESTE','AZUL CELESTE');
				document.getElementById(campo).options[4] = new Option('AZUL CLARO','AZUL CLARO');
				document.getElementById(campo).options[5] = new Option('BRANCO','BRANCO');
				document.getElementById(campo).options[6] = new Option('LARANJA','LARANJA');
				document.getElementById(campo).options[7] = new Option('LILAS','LILAS');
				document.getElementById(campo).options[8] = new Option('MARROM','MARROM');
				document.getElementById(campo).options[9] = new Option('MENTA','MENTA');
				document.getElementById(campo).options[10] = new Option('PÊSSEGO','PÊSSEGO');
				document.getElementById(campo).options[11] = new Option('PINK','PINK');
				document.getElementById(campo).options[12] = new Option('PRETO','PRETO');
				document.getElementById(campo).options[13] = new Option('ROSA','ROSA');
				document.getElementById(campo).options[14] = new Option('ROSA TERNURA','ROSA TERNURA');
				document.getElementById(campo).options[15] = new Option('SALMÃO','SALMÃO');
				document.getElementById(campo).options[16] = new Option('VERDE','VERDE');
				document.getElementById(campo).options[17] = new Option('VERDE BANDEIRA','VERDE BANDEIRA');
				document.getElementById(campo).options[18] = new Option('VERDE CÍTRUS','VERDE CÍTRUS');
				document.getElementById(campo).options[19] = new Option('VERDE LIMÃO','VERDE LIMÃO');
				document.getElementById(campo).options[20] = new Option('VERDE ÁGUA','VERDE ÁGUA');
				document.getElementById(campo).options[21] = new Option('VERMELHO','VERMELHO');
				document.getElementById(campo).options[22] = new Option('VERMELHO PAIXÃO','VERMELHO PAIXÃO');
				document.getElementById(campo).options[23] = new Option('VIOLETA','VIOLETA');
				document.getElementById(campo).options[24] = new Option('OURO','OURO');
				document.getElementById(campo).options[25] = new Option('PRATA','PRATA');
				break;
			case '8.0':
				document.getElementById(campo).options[0] = new Option('AMARELO','AMARELO');
				document.getElementById(campo).options[1] = new Option('AMARELO GEMA','AMARELO GEMA');
				document.getElementById(campo).options[2] = new Option('AZUL','AZUL');
				document.getElementById(campo).options[3] = new Option('AZUL CELESTE','AZUL CELESTE');
				document.getElementById(campo).options[4] = new Option('AZUL CLARO','AZUL CLARO');
				document.getElementById(campo).options[5] = new Option('BRANCO','BRANCO');
				document.getElementById(campo).options[6] = new Option('LARANJA','LARANJA');
				document.getElementById(campo).options[7] = new Option('LILAS','LILAS');
				document.getElementById(campo).options[8] = new Option('MARROM','MARROM');
				document.getElementById(campo).options[9] = new Option('PINK','PINK');
				document.getElementById(campo).options[10] = new Option('PRETO','PRETO');
				document.getElementById(campo).options[11] = new Option('ROSA','ROSA');
				document.getElementById(campo).options[12] = new Option('VERDE','VERDE');
				document.getElementById(campo).options[13] = new Option('VERDE BANDEIRA','VERDE BANDEIRA');
				document.getElementById(campo).options[14] = new Option('VERDE CÍTRUS','VERDE CÍTRUS');
				document.getElementById(campo).options[15] = new Option('VERDE LIMÃO','VERDE LIMÃO');
				document.getElementById(campo).options[16] = new Option('VERDE ÁGUA','VERDE ÁGUA');
				document.getElementById(campo).options[17] = new Option('VERMELHO','VERMELHO');
				document.getElementById(campo).options[18] = new Option('VERMELHO PAIXÃO','VERMELHO PAIXÃO');
				document.getElementById(campo).options[19] = new Option('VIOLETA','VIOLETA');
				document.getElementById(campo).options[20] = new Option('OURO','OURO');
				document.getElementById(campo).options[21] = new Option('PRATA','PRATA');
				break;
			case '11.0':
				document.getElementById(campo).options[0] = new Option('AMARELO','AMARELO');
				document.getElementById(campo).options[1] = new Option('AZUL','AZUL');
				document.getElementById(campo).options[2] = new Option('AZUL CELESTE','AZUL CELESTE');
				document.getElementById(campo).options[3] = new Option('AZUL CLARO','AZUL CLARO');
				document.getElementById(campo).options[4] = new Option('BRANCO','BRANCO');
				document.getElementById(campo).options[5] = new Option('LARANJA','LARANJA');
				document.getElementById(campo).options[6] = new Option('LILAS','LILAS');
				document.getElementById(campo).options[7] = new Option('PINK','PINK');
				document.getElementById(campo).options[8] = new Option('PRETO','PRETO');
				document.getElementById(campo).options[9] = new Option('ROSA','ROSA');
				document.getElementById(campo).options[10] = new Option('VERDE','VERDE');
				document.getElementById(campo).options[11] = new Option('VERDE BANDEIRA','VERDE BANDEIRA');
				document.getElementById(campo).options[12] = new Option('VERDE CÍTRUS','VERDE CÍTRUS');
				document.getElementById(campo).options[13] = new Option('VERDE LIMÃO','VERDE LIMÃO');
				document.getElementById(campo).options[14] = new Option('VERMELHO','VERMELHO');
				document.getElementById(campo).options[15] = new Option('VIOLETA','VIOLETA');
				break;
			case 'COR11':
				document.getElementById(campo).options[0] = new Option('BRANCO','BRANCO');
				document.getElementById(campo).options[1] = new Option('ROSA','ROSA');
				document.getElementById(campo).options[2] = new Option('VERMELHO','VERMELHO');
				break;
		}
	}

	function hideDIV(div){
		document.getElementById(div).style.visibility = 'hidden';
	}

	function montaDIVDADOSFORM(){
		var div_dados_bal = "";
		var top_div_1 = 447;
		var top_div_2 = 495;
		var top_div_3 = 615;
		var top_div_4 = 650;
		var t_alerta = 0;
		var campo = "";

		var checkField = 0;
		
		for(i=1;i<=5;i++){
			campo = "dados_bal_0"+i;	
			if(""!=document.getElementById(campo).value){
				if(""!=div_dados_bal){
					div_dados_bal += "<br/>";
				}
				div_dados_bal += '<img src="img/ico_excluir.gif" onClick="javascript:delDADOSFORM(\''+campo+'\')" class="cursor_hand">'+document.getElementById(campo).value;				
				top_div_1 += 36;
				top_div_2 += 36;
				top_div_3 += 36;
				top_div_4 += 36;	
				var t_alerta = 1;
				checkField++;
			}
		}
		
		if(0==checkField){
			top_div_1 = 447;
			top_div_2 = 495;
			top_div_3 = 615;
			top_div_4 = 650;	
		}else{
			top_div_1 += 22;
			top_div_2 += 22;
			top_div_3 += 22;
			top_div_4 += 22;	
		}
/*

		if(""!= document.orcamento_carimbados.dados_bal_01.value){ 
			if(""!=div_dados_bal){
				div_dados_bal += "<br/>";
			}
			div_dados_bal += '<img src="img/ico_excluir.gif" onClick="javascript:delDADOSFORM(\'dados_bal_01\')" class="cursor_hand">'+document.orcamento_carimbados.dados_bal_01.value;
			top_div_1 = 505;
			top_div_2 = 553;
			top_div_3 = 668;
			top_div_4 = 722;
			
			var t_alerta = 1;
		}
		if (""!= document.orcamento_carimbados.dados_bal_02.value){
			if(""!=div_dados_bal){
				div_dados_bal += "<br/>";
			}
			div_dados_bal += '<img src="img/ico_excluir.gif" onClick="javascript:delDADOSFORM(\'dados_bal_02\')" class="cursor_hand">'+document.orcamento_carimbados.dados_bal_02.value;
			top_div_1 = 541;
			top_div_2 = 589;
			top_div_3 = 704;
			top_div_4 = 758;
			
			var t_alerta = 1;
		} 
		if (""!= document.orcamento_carimbados.dados_bal_03.value){
			if(""!=div_dados_bal){
				div_dados_bal += "<br/>";
			}
			div_dados_bal += '<img src="img/ico_excluir.gif" onClick="javascript:delDADOSFORM(\'dados_bal_03\')" class="cursor_hand">'+document.orcamento_carimbados.dados_bal_03.value;
			top_div_1 = 577;
			top_div_2 = 625;
			top_div_3 = 740;
			top_div_4 = 776;
			var t_alerta = 1;
		} 
		if (""!= document.orcamento_carimbados.dados_bal_04.value){
			if(""!=div_dados_bal){
				div_dados_bal += "<br/>";
			}
			div_dados_bal += '<img src="img/ico_excluir.gif" onClick="javascript:delDADOSFORM(\'dados_bal_04\')" class="cursor_hand">'+document.orcamento_carimbados.dados_bal_04.value;
			top_div_1 = 613;
			top_div_2 = 661;
			top_div_3 = 697;
			top_div_4 = 733;
			var t_alerta = 1;
		} 
		if (""!= document.orcamento_carimbados.dados_bal_05.value){
			if(""!=div_dados_bal){
				div_dados_bal += "<br/>";
			}
			div_dados_bal += '<img src="img/ico_excluir.gif" onClick="javascript:delDADOSFORM(\'dados_bal_05\')" class="cursor_hand">'+document.orcamento_carimbados.dados_bal_05.value;
			top_div_1 = 649;
			top_div_2 = 697;
			top_div_3 = 733;
			top_div_4 = 769;
			var t_alerta = 1;
		}
*/
		if(1==t_alerta){
			document.getElementById('form_carimbos_extra').style.visibility = "visible";
			document.getElementById('form_carimbos_extra').innerHTML = div_dados_bal;
		}else{
			document.getElementById('form_carimbos_extra').style.visibility = "hidden";
		}
		document.getElementById('form_carimbos_03').style.top =  top_div_1;
		document.getElementById('form_carimbos_04').style.top =  top_div_2;
		document.getElementById('form_carimbos_05').style.top =  top_div_3;
		document.getElementById('carimbos_fotos').style.top =  top_div_4;
	}

	function delDADOSFORM(field){
		document.getElementById(field).value = "";
		montaDIVDADOSFORM();
	}



	function getDADOSFORM(){
		var tam_bal_1 	= document.orcamento_carimbados.tam_bal_1.options[document.orcamento_carimbados.tam_bal_1.selectedIndex].value;
		var ctam_bal_1 	= document.orcamento_carimbados.ctam_bal_1.options[document.orcamento_carimbados.ctam_bal_1.selectedIndex].value;
		var qtd_bal_1 	= 0;
		if(0<document.orcamento_carimbados.qtd_bal_1.value){
			qtd_bal_1 = document.orcamento_carimbados.qtd_bal_1.value;				
		}
		var qtd_lados_1 	= document.orcamento_carimbados.qtd_lados_1.options[document.orcamento_carimbados.qtd_lados_1.selectedIndex].value;
		var pos_bal_1	= 'AR';
		if(document.orcamento_carimbados.pos_bal_1[1].checked){
			pos_bal_1 = 'GÁS';				
		}
		var cor_carimbo_1 = "";
		if(document.orcamento_carimbados.cor_carimbo_1.checked){
			var cor_carimbo_1 = document.orcamento_carimbados.cor_carimbo_1.value;
		}
		var cor_carimbo_2 = "";
		if(document.orcamento_carimbados.cor_carimbo_2.checked){
			var cor_carimbo_2 = document.orcamento_carimbados.cor_carimbo_2.value;
		}
		var cor_carimbo_3 = "";
		if(document.orcamento_carimbados.cor_carimbo_3.checked){
			var cor_carimbo_3 = document.orcamento_carimbados.cor_carimbo_3.value;
		}
		var cor_carimbo_4 = "";
		if(document.orcamento_carimbados.cor_carimbo_4.checked){
			var cor_carimbo_4 = document.orcamento_carimbados.cor_carimbo_4.value;
		}
		var cor_carimbo_5 = "";
		if(document.orcamento_carimbados.cor_carimbo_5.checked){
			var cor_carimbo_5 = document.orcamento_carimbados.cor_carimbo_5.value;
		}
		var cor_carimbo_6 = "";
		if(document.orcamento_carimbados.cor_carimbo_6.checked){
			var cor_carimbo_6 = document.orcamento_carimbados.cor_carimbo_6.value;
		}
		var cor_carimbo_7 = "";
		if(document.orcamento_carimbados.cor_carimbo_7.checked){
			var cor_carimbo_7 = document.orcamento_carimbados.cor_carimbo_7.value;
		}
		var cor_carimbo_8 = "";
		var cor_carimbo_9 = "";
		if(document.orcamento_carimbados.cor_carimbo_8.checked){
			var cor_carimbo_8 = document.orcamento_carimbados.cor_carimbo_8.value;
			var cor_carimbo_9 = document.orcamento_carimbados.cor_carimbo_9.value.toUpperCase();
		}

		if('COR11'==tam_bal_1){
			tam_bal_1 = 'CORAÇÃO 11.0';	
		}
		
		var dados_bal = qtd_bal_1+' BALÕES '+tam_bal_1+' '+ctam_bal_1+' / IMPRESSÃO EM '+qtd_lados_1+' LADO(S) - '+pos_bal_1+'<br/>CARIMBO(S): ';
		var dados_cor = "";
		if(""!=cor_carimbo_1){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_1;
		}
		
		if(""!=cor_carimbo_2){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_2;
		}
		if(""!=cor_carimbo_3){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_3;
		}
		if(""!=cor_carimbo_4){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_4;
		}
		if(""!=cor_carimbo_5){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_5;
		}
		if(""!=cor_carimbo_6){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_6;
		}
		if(""!=cor_carimbo_7){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_7;
		}
		if(""!=cor_carimbo_8 && ""!=cor_carimbo_9){
			if(""!=dados_cor){
				dados_cor += ", ";
			}
			dados_cor += cor_carimbo_9;
		}
				

		if(""!=dados_cor){
			dados_bal+= dados_cor;
		}
		
		if(""== document.orcamento_carimbados.dados_bal_01.value){ 
			document.orcamento_carimbados.dados_bal_01.value = dados_bal;
		} else if (""== document.orcamento_carimbados.dados_bal_02.value){
			document.orcamento_carimbados.dados_bal_02.value = dados_bal;		
		} else if (""== document.orcamento_carimbados.dados_bal_03.value){
			document.orcamento_carimbados.dados_bal_03.value = dados_bal;		
		} else if (""== document.orcamento_carimbados.dados_bal_04.value){
			document.orcamento_carimbados.dados_bal_04.value = dados_bal;		
		} else if (""== document.orcamento_carimbados.dados_bal_05.value){
			document.orcamento_carimbados.dados_bal_05.value = dados_bal;		
		}
		montaDIVDADOSFORM();
	}

	function submitCARIMBOS(){
		var nome 		= document.orcamento_carimbados.nome.value.toUpperCase();
		var contato 	= document.orcamento_carimbados.contato.value.toUpperCase();
		var email 		= document.orcamento_carimbados.email.value.toUpperCase();
		var ddd 		= document.orcamento_carimbados.ddd.value;
		var tel 		= document.orcamento_carimbados.tel.value;
		var end 		= document.orcamento_carimbados.end.value.toUpperCase();
		var cidade 		= document.orcamento_carimbados.cidade.value.toUpperCase();
		var cep1 		= document.orcamento_carimbados.cep1.value;
		var cep2 		= document.orcamento_carimbados.cep2.value;
		var uf 			= document.orcamento_carimbados.uf.options[document.orcamento_carimbados.uf.selectedIndex].value;
		var obs 		= document.orcamento_carimbados.obs.value;
		

/*
		var tam_bal_1 	= document.orcamento_carimbados.tam_bal_1.options[document.orcamento_carimbados.tam_bal_1.selectedIndex].value;
		var tam_bal_2 	= document.orcamento_carimbados.tam_bal_2.options[document.orcamento_carimbados.tam_bal_2.selectedIndex].value;
		var tam_bal_3 	= document.orcamento_carimbados.tam_bal_3.options[document.orcamento_carimbados.tam_bal_3.selectedIndex].value;
		var tam_bal_4 	= document.orcamento_carimbados.tam_bal_4.options[document.orcamento_carimbados.tam_bal_4.selectedIndex].value;
		var ctam_bal_1 	= document.orcamento_carimbados.ctam_bal_1.options[document.orcamento_carimbados.ctam_bal_1.selectedIndex].value;
		var ctam_bal_2 	= document.orcamento_carimbados.ctam_bal_2.options[document.orcamento_carimbados.ctam_bal_2.selectedIndex].value;
		var ctam_bal_3 	= document.orcamento_carimbados.ctam_bal_3.options[document.orcamento_carimbados.ctam_bal_3.selectedIndex].value;
		var ctam_bal_4 	= document.orcamento_carimbados.ctam_bal_4.options[document.orcamento_carimbados.ctam_bal_4.selectedIndex].value;
		var qtd_bal_1 	= 0;
		if(0<document.orcamento_carimbados.qtd_bal_1.value){
			qtd_bal_1 = document.orcamento_carimbados.qtd_bal_1.value;				
		}
		var qtd_bal_2 	= 0;
		if(0<document.orcamento_carimbados.qtd_bal_2.value){
			qtd_bal_2 = document.orcamento_carimbados.qtd_bal_2.value;				
		}
		var qtd_bal_3 	= 0;
		if(0<document.orcamento_carimbados.qtd_bal_3.value){
			qtd_bal_3 = document.orcamento_carimbados.qtd_bal_3.value;				
		}
		var qtd_bal_4 	= 0;
		if(0<document.orcamento_carimbados.qtd_bal_4.value){
			qtd_bal_4 = document.orcamento_carimbados.qtd_bal_4.value;				
		}
		var qtd_lados_1 	= document.orcamento_carimbados.qtd_lados_1.options[document.orcamento_carimbados.qtd_lados_1.selectedIndex].value;
		var qtd_lados_2 	= document.orcamento_carimbados.qtd_lados_2.options[document.orcamento_carimbados.qtd_lados_2.selectedIndex].value;
		var qtd_lados_3 	= document.orcamento_carimbados.qtd_lados_3.options[document.orcamento_carimbados.qtd_lados_3.selectedIndex].value;
		var qtd_lados_4 	= document.orcamento_carimbados.qtd_lados_4.options[document.orcamento_carimbados.qtd_lados_4.selectedIndex].value;
		var pos_bal_1	= 'AR';
		if(document.orcamento_carimbados.pos_bal_1[1].checked){
			pos_bal_1 = 'GÁS';				
		}
		var pos_bal_2	= 'AR';
		if(document.orcamento_carimbados.pos_bal_2[1].checked){
			pos_bal_2 = 'GÁS';				
		}
		var pos_bal_3	= 'AR';
		if(document.orcamento_carimbados.pos_bal_3[1].checked){
			pos_bal_3 = 'GÁS';				
		}
		var pos_bal_4	= 'AR';
		if(document.orcamento_carimbados.pos_bal_4[1].checked){
			pos_bal_4 = 'GÁS';				
		}
		var cor_carimbo_1	= document.orcamento_carimbados.cor_carimbo_1.options[document.orcamento_carimbados.cor_carimbo_1.selectedIndex].value;
		var cor_carimbo_2	= document.orcamento_carimbados.cor_carimbo_2.options[document.orcamento_carimbados.cor_carimbo_2.selectedIndex].value;
		var cor_carimbo_3	= document.orcamento_carimbados.cor_carimbo_3.options[document.orcamento_carimbados.cor_carimbo_3.selectedIndex].value;
		var cor_carimbo_4	= document.orcamento_carimbados.cor_carimbo_4.options[document.orcamento_carimbados.cor_carimbo_4.selectedIndex].value;
*/

		var dados_bal_01 		= document.orcamento_carimbados.dados_bal_01.value;
		var dados_bal_02 		= document.orcamento_carimbados.dados_bal_02.value;
		var dados_bal_03 		= document.orcamento_carimbados.dados_bal_03.value;
		var dados_bal_04 		= document.orcamento_carimbados.dados_bal_04.value;
		var dados_bal_05 		= document.orcamento_carimbados.dados_bal_05.value;
		var pasta 				= document.orcamento_carimbados.pasta.value;


		var balerta = 0;

		if(nome==null || nome==" " || nome.length<3){
			document.orcamento_carimbados.nome.style.border = "1px solid #FF0000";
			balerta = 1;
		}else{
			document.orcamento_carimbados.nome.style.border = "1px solid #97a7ae";
		}
		if(!checkEMAIL(email)){
			document.orcamento_carimbados.email.style.border = "1px solid #FF0000";
			balerta = 1;
		}else{
			document.orcamento_carimbados.email.style.border = "1px solid #97a7ae";
		}
		if( (ddd==null || ddd==" " || ddd.length<2) || (tel==null || tel==" " || tel.length<8)){
			document.orcamento_carimbados.ddd.style.border = "1px solid #FF0000";
			document.orcamento_carimbados.tel.style.border = "1px solid #FF0000";
			balerta = 1;
		}else{
			document.orcamento_carimbados.ddd.style.border = "1px solid #97a7ae";
			document.orcamento_carimbados.tel.style.border = "1px solid #97a7ae";
		}
		if(1==balerta){
			document.getElementById('alerta_carimbos').style.visibility = "visible";
			document.getElementById('alerta_carimbos').innerHTML = '<B>ATENÇÃO!!!<br><br>Os campos com borda vermelha são obrigatórios.<BR><BR></B><a href="#"><img src="img/tit_fechar_janela.gif" onClick="hideDIV(\'alerta_carimbos\')"></a> ';
		}else{


			if(""==dados_bal_01 && ""==dados_bal_02 && ""==dados_bal_03 && ""==dados_bal_04 && ""==dados_bal_05){
				document.getElementById('alerta_carimbos').style.visibility = "visible";
				document.getElementById('alerta_carimbos').innerHTML = '<B>ATENÇÃO!!!<br><br>Atenção! Clique no botão LARANJA para incluir os dados do balão no formulário<BR><BR></B><a href="#"><img src="img/tit_fechar_janela.gif" onClick="hideDIV(\'alerta_carimbos\')"></a> ';
				balerta = 1;
			}else{
				document.getElementById('alerta_carimbos').innerHTML = '<img src="img/carregando_01.gif">';			
			}
		}

		if(0==balerta){
			document.getElementById('alerta_carimbos').style.visibility = "visible";
			Ext.Ajax.request({
/*
	url: 'envio_orc_carimbados.php?nome='+nome+'&contato='+contato+'&email='+email+'&ddd='+ddd+'&tel='+tel+'&end='+end+'&cep1='+cep1+'&cep2='+cep2+'&cidade='+cidade+'&uf='+uf+'&tam_bal_1='+tam_bal_1+'&tam_bal_2='+tam_bal_2+'&tam_bal_3='+tam_bal_3+'&tam_bal_4='+tam_bal_4+'&ctam_bal_1='+ctam_bal_1+'&ctam_bal_2='+ctam_bal_2+'&ctam_bal_3='+ctam_bal_3+'&ctam_bal_4='+ctam_bal_4+'&qtd_bal_1='+qtd_bal_1+'&qtd_bal_2='+qtd_bal_2+'&qtd_bal_3='+qtd_bal_3+'&qtd_bal_4='+qtd_bal_4+'&qtd_lados_1='+qtd_lados_1+'&qtd_lados_2='+qtd_lados_2+'&qtd_lados_3='+qtd_lados_3+'&qtd_lados_4='+qtd_lados_4+'&pos_bal_1='+pos_bal_1+'&pos_bal_2='+pos_bal_2+'&pos_bal_3='+pos_bal_3+'&pos_bal_4='+pos_bal_4+'&cor_carimbo_1='+cor_carimbo_1+'&cor_carimbo_2='+cor_carimbo_2+'&cor_carimbo_3='+cor_carimbo_3+'&cor_carimbo_4='+cor_carimbo_4+'&obs='+obs,

*/
				url: 'envio_orc_carimbados.php?nome='+nome+'&contato='+contato+'&email='+email+'&ddd='+ddd+'&tel='+tel+'&end='+end+'&cep1='+cep1+'&cep2='+cep2+'&cidade='+cidade+'&uf='+uf+'&obs='+obs+'&dados_bal_01='+dados_bal_01+'&dados_bal_02='+dados_bal_02+'&dados_bal_03='+dados_bal_03+'&dados_bal_04='+dados_bal_04+'&dados_bal_05='+dados_bal_05+'&pasta='+pasta,
				method: 'POST',
				success: function(dt,opt){
					var retorno = dt.responseText;
					document.getElementById('alerta_carimbos').innerHTML = retorno+'<a href="#"><img src="img/tit_fechar_janela.gif" onClick="hideDIV(\'alerta_carimbos\')"></a>';
					},
				failure:function(dt,opt){
					document.getElementById('alerta_carimbos').innerHTML = '<b>Prezado Cliente,<br><br>Infelizmente não foi possível enviar o seu orçamento neste momento.<br><br>Por gentileza, utilize o nosso telefone de contato <span class="t_18">(11) 4714-7900.</span><br><br><br>Obrigado.<br>Depto. Comercial<br><br></b><a href="#"><img src="img/tit_fechar_janela.gif" onClick="hideDIV(\'alerta_carimbos\')"></a>';
					}
			});	
		}
	}

/* ********************************  ********************************** */
/* ********************************  ********************************** */
/* ********************************  ********************************** */
/* ********************************  ********************************** */
/* ********************************  MASCARA FORMS ******************** */
/* ********************************  ********************************** */

	function txtBoxFormat(objForm, strField, sMask, e) {
		var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
		if(!e) e = window.e; 
		nTecla = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
		sValue = objForm[strField].value;
		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++;
		}

		objForm[strField].value = sCod;

if (nTecla != 8) { // backspace

if (sMask.charAt(i-1) == "9") { // apenas números...

return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9

else { // qualquer caracter...

return true;

}

} else {

return true;

}

}



/* ********************************  ********************************** */
/* ********************************  ********************************** */
/* ********************************  ********************************** */
/* ********************************  ********************************** */
/* ********************************  DECODE URLS ********************** */
/* ********************************  ********************************** */
/*
|------------------------------------------------
| 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;
}

/*
|------------------------------------------------
| VALIDA EMAILS 
|------------------------------------------------
|
*/







function checkEMAIL(emailad){



    var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;



    var check=/@[\w\-]+\./;



    var checkend=/\.[a-zA-Z]{2,3}$/;



    if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){



        return false;



    }



    else {



        return true;



    }



}	