//funcao para salto de menu----------------------------------------------------------------------------
function jump(targ,selObj,restore){ 
	var par = selObj.options[selObj.selectedIndex].value;
	if(par!=0){
		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		if (restore) selObj.selectedIndex=0;
	}
}

//funcao verifica tensao--------------------------------------------------------------------------------
function Valida(form){
var ok = false;
var form = document.forms[0].tam;
for (i = 0; i < form.length; i++)    {
    if (form[i].checked) {
        ok = true;
    }
}
if (!ok) {
    alert ("É obrigatório selecionar uma TENSÃO OU TAMANHO !");
    return false;
    }
}

//atencao-----------------------------------------------------------------------------------------------
function atencao(par){
 	el = document.getElementById(par);
	el.style.display='block';
}

//função abre popup-------------------------------------------------------------------------------------
function popup(par,w,h){
	window.open(par+'.php','_blank','width='+w+'px height='+h+'px');	
}

//função abre outra aba---------------------------------------------------------------------------------
function redirect(par,par2){
	window.open('?src='+par2+'/'+par);	
}

//função redireciona-------------------------------------------------------------------------------------
function enviaFor(par){
 window.location.href=par;	
}

//função limpar------------------------------------------------------------------------------------------
function limpar(par){
 	el = document.getElementById(par);
	el.value=" ";
}

//função limpar FORM-------------------------------------------------------------------------------------
function limpaForm(par){
	var el = document.getElementById(par);
	el.reset();
}

//IMPRIMIR////////////////////////////////////////////////////////////////////
function DoPrinting(){
	if (!window.print){
	alert("Use o Firefox ou Internet Explorer \n nas versões 4.0 ou superior!")
	return
	}
	window.print()
}

//Aparece e some div de acordo com a escolha-------------------------------------------------------------
function escolha(pick,tipo) {
	if (pick == "") {
		Justshow(tipo);
	}
	else if(pick == ""){
		JustshowHide(tipo);
	}
}

//Aparece e some div-------------------------------------------------------------------------------------
function showHide(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none') {
		el.style.display = 'none';
		if(obj=="newsletter"){
			document.getElementById('fume').style.display='none';
		}
	}
	else {
		el.style.display = 'block';
		if(obj=="newsletter"){
			document.getElementById('fume').style.display='block';
		}
	}
}

//Aparece e some div na posicao do mouse------------------------------------------------------------------
function showHidePos(obj,e,pos) {
	var el = document.getElementById(obj);
	if(pos=="lateral"){ var distY = 400;}
	else{var distY = 200;}
		if ( el.style.display != 'none') {
			el.style.display = 'none';
		}
		else {
			el.style.display = 'block';
			el.style.top = e.clientY +'px';
			el.style.left = (e.clientX - distY) +'px';
			//document.getElementById('fume').style.display='block';
			//mostraDados(obj);
		}
}

//so aparece div---------------------------------------------------------------------------------------------
function Justshow(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'block' ) {
		el.style.display = 'block';
	}
	else {
		el.style.display = 'block';
	}
}

//so some div---------------------------------------------------------------------------------------------
function JustshowHide(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'block' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'none';
	}
}

//Coloca com negrito e sem negrito------------------------------------------------------------------------
function mouseOverOut(obj){//Made a effect of hiperlink, changing its style to bold and normal
	var el = document.getElementById(obj);
		 el.style.color='#FFCC00';
		 
}
//VERIFICA SE É NUMERICO----------------------------------------------------------------------------------
function ifnumber(id,par){
	var el = document.getElementById(id);
	if(isNaN(el.value)){
		el.value="";		
		el.focus();
		alert("Somente valores numéricos em " + par);
		return false;	
	}
		
return true;	
}

//LIBERA CAMPOS-------------------------------------------------------------------------------------------
function Vazio(id){
	if(document.getElementById(id).value.lenght!=""){
		document.getElementById(id).value="";		
		document.getElementById(id).focus();
		return false;	
	}
		
return true;	
}

//RECARREGAPAGINA-----------------------------------------------------------------------------------------
function realoaded(id){
    window.location.href = id;	
}

//VERIFICA SE REALMENTE QUER EFETUAR ALGUM PROCEDIMENTO----------------------------------------------------
function real(){
  var r=confirm("DESEJA REALMENTE DELETAR");
  if (r!=true){
	//document.write("entrando....");
    //window.location.href="";	
	 document.getElementById("cancelar").style.visibility = "visible";  
    }
	 else{

	} 
}

//FUNÇÃO VALIDA E-MAIL-------------------------------------------------------------------------------------
function validaMail(id){
	var el=document.getElementById(id);			
      p1 = el.value.indexOf("@");
		p2 = el.value.indexOf(".");
		if(!(p1 >= 1 && p2 >= 3)){
			el.focus();
			alert("O CAMPO E-MAIL DEVE CONTER UM ENDEREÇO VÁLIDO!");
			return false;
	   }
return true;
}

//COMPARA CAPTCHA-----------------------------------------------------------------------------------------
function CAPTCHA(){
	if(document.forms[1].captcha.value!=document.forms[1].confCaptcha.value){
		alert("ERRO DE ESCRITA NO CÓDIGO !!!");
		document.forms[1].captcha.value="";
		forms[1].confCaptcha.focus();		
		return false;
	}
return true;
}

//COMPARA SENHA--------------------------------------------------------------------------------------------
function comparaSenha(id,id2){
	var el=document.getElementById(id);
	var el2=document.getElementById(id2);
	if(el2.value.length<=5){
		alert("VALOR DE DÍGITOS INSUFICIENTE PARA SENHA !!!\nFAVOR, CRIAR SENHA COM MÍNIMO DE 6 DÍGITOS.");
		el2.value="";
		el.focus();
		return false;
	}
	if(el.value!=el2.value){
		alert("ERRO NA COMPARAÇÃO DE SENHA !!!");
		el.value="";
		el2.value="";
		el.focus();
		return false;
	}
return true;
}

//----------------------------------------------------------------------------------------------------------
// FUNÇÃO PARA FAZER UM RELOAD NA PÁGINA SEM RECARREGAR O SERVIÇO NOVAMENTE
function rld() {
window.location.href=window.location.href;
}

//----------------------------------------------------------------------------------------------------------
// FUNÇÃO QUE DESABILITA CAMPO TEXT
function desable(id) { 
	var el = document.getElementById(id);
	if(el.style.visibility != 'hidden'){
		el.style.visibility = 'hidden';
	}
	else{
		el.style.visibility = 'visible';
	}
}

//-----------------------------------------------------------------------------------------------------------
// FUNÇÃO PARA FAZER UM FADE IN OU FADE OUT (USADA NA FUNÇÃO SHOWPOPUP)
// fadeOut('ID', 1) --> 1 é o tempo
// fadeIn('ID', 1)
function fadeOut(id, time) {
	target = document.getElementById(id);
	alpha = 100;
	timer = time;//(time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha <= 0)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha -= 2;
			}, timer);
}

// FUNÇÃO FADE IN
function fadeIn(id, time) {
	target = document.getElementById(id);
	alpha = 0;
	timer = (time*1000)/50;//time;
	var i = setInterval(
			function() {
				if (alpha >= 100)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha += 2;
			}, timer);
}

// ESTA FUNÇÃO DEFINE A TRANSPARÊNCIA (USADA NAS FUNÇÕES FADEOUT E FADEIN)
function setAlpha(target, alpha) {
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/15;
}

//-----------------------------------------------------------------------------------------------------------
// FUNÇÃO DESENVOLVIDA remover todos os filhos do nodo fornecido
function limpa(elemento){
		if(elemento != null && elemento.hasChildNodes()){
			for(var i=0; i<elemento.childNodes.length; i++){
				elemento.removeChild(elemento.firstChild);
			}
		}
}

//-----------------------------------------------------------------------------------------------
// FORMATAR CAMPOS DE TELEFONE
function formatar(objeto, sMask, evtKeyPress) {
	
	//escolha o tipo de mascara na chamada do evento, exemplo:
	//function formatar(this, '(32)3333-3333', event)
	
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
	
	//funcao para formatar campo CPF, DATA, TEL, CEP, COD
	
	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 = objeto.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( ")", "" );
	
	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++;
	
	}
	
	objeto.value = sCod;
	
	if (nTecla != 8) { // backspace
	
	if (sMask.charAt(i-1) == "9") { // apenas n£meros...
	
	return ((nTecla > 47) && (nTecla < 58)); }
	
	else { // qualquer caracter...
	
	return true;
	
	}
	
	}
	
	else {
	
	return true;
	
	}
}

//--------------------------------------------------------------------------------------------
//FUNCAO MUDA STILES
function changeStyle(id){
	switch(id){
		//ORDEM ALFABÉTICA
		// A ----------------------------------------------------
		case "entrega":	
		document.getElementById("cssentrega").href="css/entrega.css";
		break;
	}
}

//--------------------------------------------------------------------------------------------
//FUNCAO LIBERA DADOS
//libera elementos marcados
function dadosmarcados(id){
	var frm = document.getElementById(id);
	var numElementos = frm.elements.length;
	for(var i=0; i<numElementos; i++){
		 if(frm.elements[i].type=='input'){
			frm.elements[i].style.border="#999999 1px solid";
		 }
	}
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO CADASTRAR USUARIO
function cadastraUser(){	 
ajaxCad=IniciaAjax();
	if(ajaxCad){
			ajaxCad.onreadystatechange = function(){
				 try{
					  if (ajaxCad.readyState == 1) {            
						document.getElementById("divLoading").style.display = "block";         
					  } 
						if(ajaxCad.readyState == 4){
							 document.getElementById("divLoading").style.display = "none"; 
							 if(ajaxCad.status == 200){
								//alert(ajaxCad.responseText);
								trataCadastro();
							 }
							 else{
									alert("Ocorreu um erro de comunicação.\nContactar www.viewup.com.br."); 
							 }
						}
				 }
				 catch (err){
					alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); 
				 }
			}
			var nome = document.getElementById("nome").value;
			var cpf = document.getElementById("cpf").value;
			var tel = document.getElementById("tel").value;
			var mail = document.getElementById("emailcad").value;
			var senha = document.getElementById("senhacad").value;
			var confsenha = document.getElementById("confsenhacad").value;
			//monta a query string
			dados = "nome="+nome+"&cpf="+cpf+"&tel="+tel+"&email="+mail+"&senha="+senha+"&confsenha="+confsenha;
			//alert(dados);
			//faz requizicao e envio pelo metodo post ou get
			ajaxCad.open('POST','ScriptsPHP/AjaxCadUser.php',true);
			ajaxCad.setRequestHeader('Content-type','application/x-www-form-urlencoded');
			ajaxCad.send(dados);
	}
}
function trataCadastro(){
	var info = ajaxCad.responseText;
	if(info==1){alerta="NOME É CAMPO OBRIGATÓRIO !!!";}
	if(info==2){alerta="CPF INVÁLIDO !!!";}
	if(info==3){alerta="ERRO NO E-MAIL !!!";}
	if(info==4){alerta="SENHA NÃO CONFERE !!!";}
	if(info==5){alerta="USUÁRIO JÁ CADASTRADO!!!"; 
					document.getElementById('cpf').value="";
					document.getElementById('emailcad').value="";
					document.getElementById('senhacad').value="";
					document.getElementById('confsenhacad').value="";
	}
	if(info==6){alerta="ERRO DE GRAVAÇÃO.";}
	if(info==7){alerta="CADASTRO REALIZADO COM SUCESSO!!!\nAGUARDE E-MAIL INFORMANDO DESBLOQUEIO REALIZADO PELA GERÊNCIA DA TABLAS !\n\nA TABLAS AGRADECE POR SEU CADASTRO."; 
					document.formcadastro.reset(); 
					/*location.href="?src=tablas/cadastrorep";*/
					}	
   if(info==8){alerta="VALOR MÍNIMO DE CARACTERES PARA SENHA SÃO DE 6 DÍGITOS.";}
   if(info==9){alerta="SOMENTE VALORES NUMÉRICOS EM TELEFONE.";}
	if(info==10){alerta="CPF É UM CAMPO OBRIGATÓRIO !!!";}
	if(info==11){alerta="E-MAIL É UM CAMPO OBRIGATÓRIO !!!";}
	if(info==12){alerta="SENHA É UM CAMPO OBRIGATÓRIO !!!";}
 alert(alerta);
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO ENVIA CONTATO
function enviaContato(){
		ajaxContato=IniciaAjax();
		if(ajaxContato){
				ajaxContato.onreadystatechange = function(){
					 try{
						  if (ajaxContato.readyState == 1) {            
							document.getElementById("divLoadingcont").style.visibility = "visible";         
						  } 
						  if(ajaxContato.readyState == 4){
								 document.getElementById("divLoadingcont").style.visibility = "hidden"; 
								 if(ajaxContato.status == 200){
									 //alert(ajaxContato.responseText);
									 trataenviaContato();
								 }
								 else{
										alert("Ocorreu um erro de comunicação.\nContactar www.viewup.com.br."); 
								 }
						  }
					 }
					 catch (err){
							alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); 
					 }
				}
				//traz dados do form
				var nome = document.getElementById("nome").value;
				var email = document.getElementById("email").value;
				var tel = document.getElementById("tel").value;
				var uf = document.getElementById("uf").value;
				var cidade= document.getElementById("cidade").value;
				/*var assunto= document.getElementById("assunto").value;*/
				var mensagem = document.getElementById("men").value;
				var completa = document.getElementById("completa").value;
				//monta a query string
				dados = "nome="+nome+"&email="+email+"&tel="+tel+"&uf="+uf+"&cidade="+cidade+"&mensagem="+mensagem+"&completa="+completa;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxContato.open('POST','ScriptsPHP/AjaxContato.php',true);
				ajaxContato.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxContato.send(dados);
		}
}
function trataenviaContato(){
	var info = ajaxContato.responseText;
	if(info==1){alerta="CAMPO NOME VAZIO."; document.getElementById("nome").style.border="solid 1px #0099CC";}
	if(info==2){alerta="E-MAIL É UM CAMPO OBRIGATÓRIO."; document.getElementById("email").style.border="solid 1px #0099CC";}
	if(info==3){alerta="E-MAIL INCORRETO!!!."; document.getElementById("email").style.border="solid 1px #0099CC";}
	if(info==4){alerta="SOMENTE VALORES NUMÉRICOS PARA TELEFONE.";document.getElementById("tel").style.border="solid 1px #0099CC";}
	if(info==5){alerta="ENVIO INCORRETO!"}
	if(info==6){alerta="DEIXE SUA MENSAGEM DE CONTATO !!!";}
	if(info==7){alerta="ERRO DE ENVIO.\nSERVIDOR OCUPADO TEMPORARIAMENTE!";document.formContato.reset();}
	if(info==8){alerta="ENVIO REALIZADO COM SUCESSO!";document.formContato.reset();}
	if(info==9){alerta="ESTADO É UM CAMPO OBRIGATÓRIO."; document.getElementById("uf").style.border="solid 1px #0099CC";}
	if(info==10){alerta="CIDADE É UM CAMPO OBRIGATÓRIO."; document.getElementById("cidade").style.border="solid 1px #0099CC";}
 alert(alerta);
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO ENVIA NEWS
function news(){
	//dados do form
		ajaxnews=IniciaAjax();
		if(ajaxnews){
				ajaxnews.onreadystatechange = function(){
					 try{
						  if (ajaxnews.readyState == 1) {            
							document.getElementById("divLoadingnews").style.display = "block";        
						  } 
						  if(ajaxnews.readyState == 4){
								 document.getElementById("divLoadingnews").style.display = "none";    
								 if(ajaxnews.status == 200){
									//alert(ajaxnews.responseText);
									trataNews();
								 }
								 else{
										alert("Ocorreu um erro de comunicação.\nContactar www.viewup.com.br."); 
								 }
						  }
					 }
					 catch (err){
							alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); 
					 }
				}
				var nome = document.getElementById("nomenews").value;
				var email = document.getElementById("emailnews").value;
				//monta a query string
				dados = "nome="+nome+"&email="+email+"&area="+1;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxnews.open('POST','ScriptsPHP/AjaxNews.php',true);
				ajaxnews.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxnews.send(dados);
		}
}
function trataNews(){
	var info = ajaxnews.responseText;
	if(info==1){alerta="NOME É CAMPO OBRIGATÓRIO "; document.getElementById("nomenews").value="";}
	if(info==2){alerta="E-MAIL INVÁLIDO !!!"; document.getElementById("emailnews").value="";}
	if(info==3){alerta="E-MAIL É CAMPO OBRIGATÓRIO."; document.getElementById("emailnews").value="";}
	if(info==4){alerta="ERRO DE ENVIO.\nSERVIDOR OCUPADO TEMPORARIAMENTE."; 
					document.getElementById("nomenews").value="";
					document.getElementById("emailnews").value="";
	}
	if(info==5){alerta="ENVIO REALIZADO COM SUCESSO !!!."; 
					document.getElementById("nomenews").value="";
					document.getElementById("emailnews").value="";
					
	}
	if(info==6){alerta="E-MAIL JÁ CADASTRADO!!!."; 
					document.getElementById("nomenews").value="";
					document.getElementById("emailnews").value="";
	}
   if(info==7){alerta="NOME É CAMPO OBRIGATÓRIO "; document.getElementById("nomenews").value="";}
 alert(alerta);
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO MOSTRA DADOS
function mostraDados(pag,par){
	 if(pag=="maps"){var loading = "divLoadingmapa";}
	 if(pag=="dadosDorep"){var loading = "divLoadingmapa2";}
		ajaxShow=IniciaAjax();
		if(ajaxShow){
				ajaxShow.onreadystatechange = function(){
					 try{
						  if (ajaxShow.readyState == 1) {            
							document.getElementById(loading).style.display = "block";  
						  } 
						  if(ajaxShow.readyState == 4){
								 document.getElementById(loading).style.display = "none";    
								if(ajaxShow.status == 200){
									//alert(ajaxShow.responseText);
										document.getElementById(pag).style.display = "block";
										document.getElementById(pag).innerHTML= ajaxShow.responseText;	
								}
								else{
									 alert("Ocorreu um erro de comunicação.\nContactar www.viewup.com.br."); 
								}
						  }
					 }
					 catch (err){
							alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); 
					 }
				}				
				//monta a query string
				dados = "pag="+pag+"&cod="+par;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxShow.open('POST','ScriptsPHP/AjaxMostraDados.php',true);
				ajaxShow.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxShow.send(dados);
		}
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO FINALIZA ORCAMENTO
function finaliza(){
		ajaxfinal=IniciaAjax();
		if(ajaxfinal){
				ajaxfinal.onreadystatechange = function(){
					 try{
						  if (ajaxfinal.readyState == 1) {            
							document.getElementById("divLoadingOrca").style.display = "block";        
						  } 
						  if(ajaxfinal.readyState == 4){
								 document.getElementById("divLoadingOrca").style.display = "none";    
								 if(ajaxfinal.status == 200){
									//alert(ajaxfinal.responseText);
									trataFinal();
								 }
								 else{
										alert("Ocorreu um erro de comunicação.\nContactar www.viewup.com.br."); 
								 }
						  }
					 }
					 catch (err){
							//alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"+err); 
					 }
				}
				//dados do form
				var nome = document.getElementById('nome').value;
				var endereco = document.getElementById('endereco').value;
				var numero = document.getElementById('numero').value;
				var complemento = document.getElementById('complemento').value;
				var bairro = document.getElementById('bairro').value;
				var cidade = document.getElementById('cidade').value;
				var uf = document.getElementById('uf').value;
				var cep = document.getElementById('cep').value;
				var telfixo = document.getElementById('telfixo').value;
				var telcel = document.getElementById('telcel').value;
				var email = document.getElementById('email').value;
				var enderecoent = document.getElementById('enderecoent').value;
				var obs = document.getElementById('obs').value;
				//monta a query string
				dados = "nome="+nome+"&endereco="+endereco+"&numero="+numero+"&complemento="+complemento+"&bairro="+bairro+"&cidade="+cidade+"&uf="+uf+"&cep="+cep+"&telfixo="+telfixo+"&telcel="+telcel+"&email="+email+"&enderecoent="+enderecoent+"&obs="+obs;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxfinal.open('POST','ScriptsPHP/AjaxFinalizaorca.php',true);
				ajaxfinal.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxfinal.send(dados);
		}
}
function trataFinal(){
	var info = ajaxfinal.responseText;
	if(info==1){alerta="ERRO!!!\nORÇAMENTO NÃO PODE SER ENVIADO.\nSERVIDOR OCUPADO TEMPORARIAMENTE.\nTENTE NOVAMENTE MAIS TARDE. ";}
	if(info==2){alerta="ORÇAMENTO ENVIADO COM SUCESSO!!!\nENTRAREMOS EM CONTATO O MAIS BREVE POSSÍVEL.\nA CHARME COLEGIAL AGRADECE A PREFERÊNCIA."; document.formFinalOrca.reset(); realoaded('?src=view/carrinho');}
	if(info==3){alerta="NOME É UM CAMPO NECESSÁRIO"; document.getElementById('nome').value=""; document.getElementById('nome').style.border="red 1px solid";}
	if(info==4){alerta="ENDEREÇO É UM CAMPO NECESSÁRIO"; document.getElementById('endereco').value=""; document.getElementById('endereco').style.border="red 1px solid";}
	if(info==5){alerta="NÚMERO É UM CAMPO NECESSÁRIO"; document.getElementById('numero').value=""; document.getElementById('numero').style.border="red 1px solid";} 
	if(info==6){alerta="BAIRRO É UM CAMPO NECESSÁRIO"; document.getElementById('bairro').value=""; document.getElementById('bairro').style.border="red 1px solid";} 
	if(info==7){alerta="CIDADE É UM CAMPO NECESSÁRIO"; document.getElementById('cidade').value=""; document.getElementById('cidade').style.border="red 1px solid";} 
	if(info==8){alerta="ESTADO É UM CAMPO NECESSÁRIO"; document.getElementById('estado').value=""; document.getElementById('uf').style.border="red 1px solid";} 
	if(info==9){alerta="TELEFONE FIXO É UM CAMPO NECESSÁRIO"; document.getElementById('telfixo').value=""; document.getElementById('telfixo').style.border="red 1px solid";} 
	if(info==10){alerta="E-MAIL FIXO É UM CAMPO NECESSÁRIO"; document.getElementById('email').value=""; document.getElementById('email').style.border="red 1px solid";} 
	if(info==11){alerta="NÚMERO É UM CAMPO NECESSÁRIO"; document.getElementById('numero').value=""; document.getElementById('numero').style.border="red 1px solid";}
	if(info==12){alerta="FAVOR DIGITE UM E-MAIL VÁLIDO"; document.getElementById('email').value=""; document.getElementById('email').style.border="red 1px solid";}
	if(info==13){alerta="ERRO DE PREENCHIMENTO EM ENDEREÇO DE ENTREGA"; document.getElementById('enderecoent').value=""; document.getElementById('enderecoent').style.border="red 1px solid";}
	if(info==14){alerta="ERRO DE PREENCHIMENTO EM OBS"; document.getElementById('obs').value=""; document.getElementById('obs').style.border="red 1px solid";}
	if(info==15){alerta="ERRO DE PREENCHIMENTO NO CEP"; document.getElementById('cep').value=""; document.getElementById('cep').style.border="red 1px solid";}
 alert(alerta);
}
//MOSTRA PROPAGANDA SLIDER
//-------------------------------------------------------------------------------------------------------------
function slideShow() {
	//Set the opacity of all images to 0
	$('#gallery a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#gallery a:first').css({opacity: 1.0});
	
	//Set the caption background to semi-transparent
	$('#gallery .caption').css({opacity: 0.7});

	//Resize the width of the caption according to the image width
	$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
	
	//Get the caption of the first image from REL attribute and display it
	$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	.animate({opacity: 0.8}, 400);
	
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',6000);
	
}
function gallery() {
	//if no IMGs have the show class, grab the first image
	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	//Set the opacity to 0 and height to 1px
	$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	//$('#gallery .caption').animate({opacity: 0.8},100 ).animate({height: '100px'},500 );
	
	//Display the content
	//$('#gallery .content').html(caption);
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO ESQUECEU A SENHA
function esqueceu(){
		ajaxQuant=IniciaAjax();
		if(ajaxQuant){
				ajaxQuant.onreadystatechange = function(){
					 try{
						  if (ajaxQuant.readyState == 1) {            
							document.getElementById("divLoadingPass").style.display = "block";  
						  } 
						  if(ajaxQuant.readyState == 4){
								 document.getElementById("divLoadingPass").style.display = "none";    
								if(ajaxQuant.status == 200){
									//alert(ajaxQuant.responseText);
									trataEsqueceu();
								}
						  }
					 }
					 catch (err){
							alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"+err); 
					 }
				}		
				var email = document.getElementById("emailPass").value;
				//monta a query string
				dados = "email="+email;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxQuant.open('POST','ScriptsPHP/AjaxVerEmail.php',true);
				ajaxQuant.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxQuant.send(dados);
		}
}
function trataEsqueceu(){
	var info = ajaxQuant.responseText;
	if(info==1){alerta="NÃO CONSTA ESTE E-MAIL EM NOSSO CADASTRO.";}
	if(info==2){alerta="ERRO DE ENVIO.\nSERVIDOR OCUPADO TEMPORARIAMENTE !!!."; }
	if(info==3){alerta="ACABAMOS DE ENVIAR SEUS DADOS DE ACESSO PARA SUA CAIXA DE E-MAIL.\nFAVOR VERIFICAR !"; 
					document.getElementById("emailPass").value="";}
	if(info==4){alerta="LIMITE DE TENTATIVAS POR USUÁRIO EXCEDIDA !"; }
 alert(alerta);
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO ALTERA QUANTIDADE
function quant(id,cod,qt){
		ajaxQuant=IniciaAjax();
		if(ajaxQuant){
				ajaxQuant.onreadystatechange = function(){
					 try{
						  if (ajaxQuant.readyState == 1) {            
							document.getElementById("divLoadingQuant").style.display = "block";  
						  } 
						  if(ajaxQuant.readyState == 4){
								 document.getElementById("divLoadingQuant").style.display = "none";    
								if(ajaxQuant.status == 200){
									//alert(ajaxQuant.responseText);
									document.getElementById(id).value= ajaxQuant.responseText;	
								}
								else{
									 alert("FAVOR NÃO APERTE ENTER.\nSOMENTE ALTERE O VALOR! "); 
									 document.getElementById(id).value= qt;
								}
						  }
					 }
					 catch (err){
							alert("Seu navegador não possui suporte ou recursos para javascript estão desabilitados!"); 
					 }
				}				
				//monta a query string
				dados = "id="+id+"&cod="+cod+"&qt="+qt;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxQuant.open('POST','ScriptsPHP/AjaxQuant.php',true);
				ajaxQuant.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxQuant.send(dados);
		}
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO TROCA IMAGEM DE LOCAL
function trocaImg(img){
	document.getElementById('produtoDetalhe').innerHTML='<a href="img/img_galery/produtos/redimensiona.php?imgDetalheProdBig='+img+'" rel="lightbox"><img src="img/img_galery/produtos/redimensiona.php?imgDetalheProdG='+img+'" /></a><p>+ ampliar</p>';
	
}
