//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;
	}
}

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

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

//função abre outra janela-------------------------------------------------------------------------
function newWindow(par){
	window.open(par);	
}

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

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

//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-------------------------------------------------------------------------------
function showHide(obj) {
	var el = document.getElementById(obj);
		if ( el.style.display != 'none') {
			el.style.display = 'none';
		}
		else {
			el.style.display = 'block';
		}
}

//Some div-----------------------------------------------------------------------------------------
function disableDiv(obj) {
	var el = document.getElementById(obj);
	el.style.display = 'none';
}

//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{

	} 
}

//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;
}

//-----------------------------------------------------------------------------------------------
// 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;
	
	}
}

//-----------------------------------------------------------------------------------------------------------
// 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) {//setAlpha(id, 5)
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/15;
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO ENVIA CURRICULO
function enviaCurriculo(){
		ajaxCurriculo=IniciaAjax();
		if(ajaxCurriculo){
				ajaxCurriculo.onreadystatechange = function(){
					 try{
						  if (ajaxCurriculo.readyState == 1) {            
							document.getElementById("loading2").style.display = "block";         
						  } 
						  if(ajaxCurriculo.readyState == 4){
								 document.getElementById("loading2").style.display = "none"; 
								 if(ajaxCurriculo.status == 200){
								 		//alert(ajaxCurriculo.responseText);
										trataenviaCurriculo();
								 }
								 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); 
					 }
				}
    
				//Pega os radios como elementos pelo nome
				var radios = document.getElementsByName("redessociais");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < radios.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (radios[i].checked) {
					  var redessociais = radios[i].value; 
					 }
				}
				var checksql = document.getElementsByName("sql");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checksql.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checksql[i].checked) {
					  var sql = checksql[i].value; 
					 }
				}
				var checkcss = document.getElementsByName("css");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkcss.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkcss[i].checked) {
					  var css = checkcss[i].value; 
					 }
				}
				var checkhtml = document.getElementsByName("html");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkhtml.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkhtml[i].checked) {
					  var html = checkhtml[i].value; 
					 }
				}
				var checkphp = document.getElementsByName("php");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkphp.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkphp[i].checked) {
					  var php = checkphp[i].value; 
					 }
				}
				var checkscript = document.getElementsByName("javascript");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkscript.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkscript[i].checked) {
					  var javascript = checkscript[i].value; 
					 }
				}
				var checkjquery = document.getElementsByName("jquery");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkjquery.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkjquery[i].checked) {
					  var jquery = checkjquery[i].value; 
					 }
				}
				var checkdream = document.getElementsByName("dreamweaver");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkdream.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkdream[i].checked) {
					  var dreamweaver = checkdream[i].value; 
					 }
				}
				var checkfire = document.getElementsByName("fireworks");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkfire.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkfire[i].checked) {
					  var fireworks = checkfire[i].value; 
					 }
				}
				var checkphoto = document.getElementsByName("photoshop");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkphoto.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkphoto[i].checked) {
					  var photoshop = checkphoto[i].value; 
					 }
				}
				var checkmyadmin = document.getElementsByName("phpmyadmin");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkmyadmin.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkmyadmin[i].checked) {
					  var phpmyadmin = checkmyadmin[i].value; 
					 }
				}
				var checkfirebird = document.getElementsByName("firebird");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkfirebird.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkfirebird[i].checked) {
					  var firebird = checkfirebird[i].value; 
					 }
				}
				var checkusa = document.getElementsByName("usabilidade");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkusa.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkusa[i].checked) {
					  var usabilidade = checkusa[i].value; 
					 }
				}
				var checktipo = document.getElementsByName("tipografia");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checktipo.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checktipo[i].checked) {
					  var tipografia = checktipo[i].value; 
					 }
				}
				var checkaces = document.getElementsByName("acessibilidade");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkaces.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkaces[i].checked) {
					  var acessibilidade = checkaces[i].value; 
					 }
				}
				var checkcores = document.getElementsByName("cores");				
				// Faz um laço para saber qual está checado
				for(i = 0; i < checkcores.length; i++) {
					 // Verifica qual radio foi selecionado
					 if (checkcores[i].checked) {
					  var cores = checkcores[i].value; 
					 }
				}
				//traz dados do form
				var nome = document.getElementById("nome").value;
				var email = document.getElementById("email").value;
				var telfixo = document.getElementById("telfixo").value;
				var celular = document.getElementById("celular").value;
				var endereco = document.getElementById("endereco").value;
				var bairro = document.getElementById("bairro").value;
				var sexo = document.getElementById("sexo").value;
				var datanasc = document.getElementById("datanasc").value;
				var formacao = document.getElementById("formacao").value;
				//var sql = document.getElementById("sql").value;
				//var css = document.getElementById("css").value;
				//var html = document.getElementById("html").value;
				//var php = document.getElementById("php").value;
				//var javascript = document.getElementById("javascript").value;
				//var jquery = document.getElementById("jquery").value;
				//var dreamweaver = document.getElementById("dreamweaver").value;
				//var fireworks = document.getElementById("fireworks").value;
				//var photoshop = document.getElementById("photoshop").value;
				//var phpmyadmin = document.getElementById("phpmyadmin").value;
				//var firebird = document.getElementById("firebird").value;
				//var usabilidade = document.getElementById("usabilidade").value;
				//var tipografia = document.getElementById("tipografia").value;
				//var acessibilidade = document.getElementById("acessibilidade").value;
				//var cores = document.getElementById("cores").value;
				var completa = document.getElementById("COMPLETA").value;
				
				//monta a query string
				dados = "nome="+nome+"&email="+email+"&telfixo="+telfixo+"&celular="+celular+"&endereco="+endereco+"&bairro="+bairro+"&sexo="+sexo+"&datanasc="+datanasc+"&formacao="+formacao+"&sql="+sql+"&css="+css+"&html="+html+"&php="+php+"&javascript="+javascript+"&jquery="+jquery+"&dreamweaver="+dreamweaver+"&fireworks="+fireworks+"&photoshop="+photoshop+"&redessociais="+redessociais+"&phpmyadmin="+phpmyadmin+"&firebird="+firebird+"&usabilidade="+usabilidade+"&tipografia="+tipografia+"&acessibilidade="+acessibilidade+"&cores="+cores+"&completa="+completa;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxCurriculo.open('POST','ScriptsPHP/AjaxCurriculo.php',true);
				ajaxCurriculo.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxCurriculo.send(dados);
		}
}
function trataenviaCurriculo(){
	var info =ajaxCurriculo.responseText;
	if(info==1){alerta="ERRO!!!\nCAMPO NOME VAZIO."; document.getElementById("nome").style.background="#F2F2F2";}
	if(info==2){alerta="ERRO!!!\nCARACTERES INCORRETOS EM NOME."; document.getElementById("email").value=" "; }
	if(info==3){alerta="ERRO!!!\nE-MAIL INCORRETO !!!";  document.getElementById("email").style.background="#F2F2F2"; }
	if(info==4){alerta="ERRO!!!\nCARACTERES INCORRETOS EM E-MAIL"; document.getElementById("email").value=" ";}
	if(info==5){alerta="ERRO!!!\nE-MAIL INCORRETO !!!"; document.getElementById("email").value=" ";}
	if(info==6){alerta="ERRO!!!\nTELEFONE FIXO INCORRETO !!!"; document.getElementById("telfixo").value=" ";}
	if(info==7){alerta="ERRO!!!\nCELULAR INCORRETO !!!"; document.getElementById("celular").value=" ";}
	if(info==8){alerta="ERRO!!!\nDATA DE NASCIMENTO INCORRETO !!!"; document.getElementById("datanasc").value=" ";}
	if(info==9){alerta="PREENCHIMENTO INCORRETO NO CAMPO ENDEREÇO !!!"; document.getElementById('endereco').style.background="#F2F2F2";}
	if(info==10){alerta="PREENCHIMENTO INCORRETO NO CAMPO BAIRRO !!!"; document.getElementById('bairro').style.background="#F2F2F2";}
	if(info==11){alerta="CAMPO SEXO É NECESSÁRIO !!!"; }
	if(info==12){alerta="PREENCHIMENTO INCORRETO NO CAMPO FORMAÇAO !!!";}
	if(info==13){alerta="ERRO DE ENVIO !!!";}
	if(info==14){alerta="ERRO DE ENVIO !!!\nSERVIDOR OCUPADO TEMPORARIAMENTE\nTENTE MAIS TARDE !!!."; document.Formcurriculo.reset();}
	if(info==15){alerta="ENVIO REALIZADO COM SUCESSO !!!\nA VIEW UP AGRADECE POR SEU CADASTRO."; document.Formcurriculo.reset();}
 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("loading").style.display = "block";         
						  } 
						  if(ajaxContato.readyState == 4){
								 document.getElementById("loading").style.display = "none"; 
								 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("nomecont").value;
				var email = document.getElementById("emailcont").value;
				var tel = document.getElementById("telcont").value;
				var cidade = document.getElementById("cidadecont").value;
				var uf = document.getElementById("estadocont").value;
				var mensagem = document.getElementById("mencont").value;
				var completa = document.getElementById("COMPLETAcont").value;
				//monta a query string
				dados = "nome="+nome+"&email="+email+"&tel="+tel+"&cidade="+cidade+"&estado="+uf+"&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="ERRO!!!\nCAMPO NOME VAZIO."; document.getElementById("nomecont").style.background="#CCC";}
	if(info==2){alerta="NOME PREENCHIDO INCORRETAMENTE."; document.getElementById("emailcont").style.background="#CCC"; }
	if(info==3){alerta="ERRO!!!\nE-MAIL VAZIO !!!"; document.getElementById("emailcont").style.background="#CCC";}
	if(info==4){alerta="E-MAIL PREENCHIDO INCORRETAMENTE"; document.getElementById("emailcont").style.background="#CCC";}
	if(info==5){alerta="ERRO!!!E-MAIL INCORRETO !!!."; document.getElementById("emailcont").style.background="#CCC";}
	if(info==6){alerta="TELEFONE PREENCHIDO INCORRETAMENTE !!!"; document.getElementById("telcont").style.background="#CCC"; }
	if(info==7){alerta="FAVOR NAO INSERIR MARCAÇAO HTML NO CORPO DA MENSAGEM !!!."; document.getElementById("mencont").style.background="#CCC";}
	if(info==8){alerta="ENVIO INCORRETO !!!";}
	if(info==9){alerta="ERRO DE ENVIO\nSERVIDOR OCUPADO TEMPORARIAMENTE !!!."; document.formContato.reset();}
	if(info==10){alerta="ENVIO REALIZADO COM SUCESSO !!!."; document.formContato.reset();}
 alert(alerta);
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO ENVIA NEWS
function news(){
		ajaxnews=IniciaAjax();
		if(ajaxnews){
				ajaxnews.onreadystatechange = function(){
					 try{
						  if (ajaxnews.readyState == 1) {            
							//document.getElementById("divLoading").style.display = "block";        
						  } 
						  if(ajaxnews.readyState == 4){
								 //document.getElementById("divLoading").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!"); 
					 }
				}
				//captura dados
				var nome = document.getElementById("nomeNews").value;
				var email = document.getElementById("emailNews").value;
				//por default 1 = geral
				var area = 1;
				//monta a query string
				dados = "nome="+nome+"&email="+email+"&area="+area;
				//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="ERRO! NOME É CAMPO OBRIGATÓRIO "; document.getElementById("nomeNews").value="";}
	if(info==2){alerta="ERRO!!!\nE-MAIL INVÁLIDO !!!"; document.getElementById("emailNews").value="";}
	if(info==3){alerta="ERRO! E-MAIL É CAMPO OBRIGATÓRIO."; document.getElementById("emailNews").value="";}
	if(info==4){alerta="ERRO DE ENVIO.\nSERVIDOR OCUPADO TEMPORARIAMENTE."; document.formNews.reset();}
	if(info==5){alerta="CADASTRO REALIZADO COM SUCESSO !!!."; document.formNews.reset();}
	if(info==6){alerta="E-MAIL JÁ CADASTRADO!!!."; document.formNews.reset();}
 alert(alerta);
}

//---------------------------------------------------------------------------------------------
//-- inicializa o objeto criado e envia dados(se existirem) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO MOSTRA DADOS
function mostraDados(pag,cod){
		ajaxShow=IniciaAjax();
		if(ajaxShow){
				ajaxShow.onreadystatechange = function(){
					 try{
						  if (ajaxShow.readyState == 1) {            
							document.getElementById("divLoading").style.display = "block";        
						  } 
						  if(ajaxShow.readyState == 4){
								 document.getElementById("divLoading").style.display = "none";    
								if(ajaxShow.status == 200){
									//alert(ajaxShow.responseText);	
									if(pag=="produtos"){
										document.getElementById(pag).innerHTML= ajaxShow.responseText;
										document.getElementById("btnprod").style.display = "block"; 
									}
									else if(pag=="Local"){
										document.getElementById(pag).innerHTML= ajaxShow.responseText;
										document.getElementById("Local").style.display = "block"; 										
									}
									else{
										 document.getElementById(pag).innerHTML= ajaxShow.responseText;
										 document.getElementById("btnprod").style.display = "none";
									}
								}
								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="+cod;
				//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) -----------------------------------
//---------------------------------------------------------------------------------------------
//FUNCAO MOSTRA DADOS
function mostraProdutos(cod,pag){
		ajaxShow=IniciaAjax();
		if(ajaxShow){
				ajaxShow.onreadystatechange = function(){
					 try{
						  if (ajaxShow.readyState == 1) {            
							document.getElementById("divLoading").style.display = "block";        
						  } 
						  if(ajaxShow.readyState == 4){
								 document.getElementById("divLoading").style.display = "none";    
								if(ajaxShow.status == 200){
									//alert(ajaxShow.responseText);	
									document.getElementById("produtos").innerHTML= ajaxShow.responseText;
									document.getElementById("btnprod").style.display = "block"; 
								}
								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 = "cod="+cod+"&pag="+pag;
				//alert(dados);
				//faz requizicao e envio pelo metodo post ou get
				ajaxShow.open('POST','ScriptsPHP/AjaxMostraConcatenacao.php',true);
				ajaxShow.setRequestHeader('Content-type','application/x-www-form-urlencoded');
				ajaxShow.send(dados);
		}
}

//-----------------------------------------------------------------------------------------------
//FUNCAO TROCA TITULO
function trocaTitle(arg){	
	switch(arg){
		case "main":
		var saida = "CASÃO MÓVEIS - PÁGINA PRINCIPAL";
		break;
		case "contato":
		var saida = "CASÃO MÓVEIS - CONTATO";
		break;
		case "empresa":
		var saida = "CASÃO MÓVEIS - EMPRESA";
		break;
		case "produtos":
		var saida = "CASÃO MÓVEIS - PRODUTOS";
		break;
	}
	document.title = saida;
}
