function PegaURL(id, campo){

gE(campo).value = id;

}

function exibeFash(swf, width, height, wmode, cache){



noCache = cache || cache == undefined ? "" : "?" + new Date();



wmode = wmode || wmode == undefined ? "opaque" : "transparent";

monta_swf = "";

monta_swf += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\""+ width +"\" height=\""+ height +"\" title=\"\">";



monta_swf += "<param name=\"movie\" value=\""+ swf + noCache +"\" />";



monta_swf += "<param name=\"quality\" value=\"high\" />";



monta_swf += "<param name=\"menu\" value=\"0\" />";



monta_swf += "<param name=\"allowScriptAccess\" value=\"always\"/>";



monta_swf += "<param name=\"wmode\" value=\"transparent\" />";



monta_swf += "<embed src=\""+ swf + noCache +"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+ width +"\" height=\""+ height +"\"></embed>";



monta_swf += "</object>";


document.write(monta_swf);



}

function PopUp(URL) {

  var width = 656;

  var height = 480;

  var left = 50;

  var top = 10

  window.open(URL, 'PopUp', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}

function MSN(URL) {



  var width = 406;



  var height = 286;



  var left = 50;



  var top = 10



  window.open(URL, 'MSN', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}


function Enviar(URL) {



  var width = 480; 



  var height = 250;



  var left = 50;



  var top = 10



  window.open(URL, 'Enviar', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}


function comentar(URL) {



  var width = 550; 



  var height = 350;



  var left = 50;



  var top = 10



  window.open(URL, 'comentar', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}



function comentarios(URL) {



  var width = 550; 



  var height = 500;



  var left = 50;



  var top = 10



  window.open(URL, 'comentarios', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}

function Comprar(url) {



  window.open(url,'comprar','width=535, height=230, top=12, left=15, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}







function cores(url) {



  window.open(url,'cores','width=225, height=169, top=10, left=10, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}



function AbreFotoAgenda(url) {



  window.open(url,'fotoagenda','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150');



}


function AbreAudio(URL) {



  var width = 300;



  var height = 195;



  var left = 50;



  var top = 10



  window.open(URL, 'audio', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}



function confirmaExclusao(aURL) {



	if(confirm('Você tem certeza que deseja excluir?')) {



	location.href = aURL;



	}



}


function confirmaPedido(aURL) {



	if(confirm('Você tem certeza que deseja confirmar este pedido?')) {



	location.href = aURL;



	}



}

function mudaPedido(aURL) {



	if(confirm('Você tem certeza que deseja mudar este pedido p/ orçamento?')) {



	location.href = aURL;



	}



}



function AbreListaProdutos(URL) {



  var width = 675;



  var height = 450;



  var left = 50;



  var top = 10



  window.open(URL, 'AbreListaProdutos', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');



}


function AtualizaValores(aURL) {



	if(confirm('Você tem certeza que deseja atualizar os valores deste orçamento?')) {



	location.href = aURL;



	}



}


function confirmaEntrega(aURL) {



	if(confirm('Você tem certeza que deseja confirmar a entrega deste pedido?')) {



	location.href = aURL;



	}



}


function mudaEntrega(aURL) {



	if(confirm('Você tem certeza que deseja mudar este pedido p/ nao entregue?')) {



	location.href = aURL;



	}



}

// FUNCAO SELEIONA TODOS REGISTROS PRA EXCLUIR



cont321 = 0;



function SelectAll() { 



	for (var i=0; i<document.FORMLISTA.elements.length; i++){



	var x = document.FORMLISTA.elements[i];



    	if (x.id == 'check_sel') { 



	   		if (cont321 == 0){



	       	x.checked = true;



		   	} else {



        	x.checked = false;



			}



		} 



	}







	if (cont321 == 0){    



	var elem = document.getElementById("sel_todos");



	elem.value = "Desmarcar todos";



	cont321 = 1;



	} else {



	var elem = document.getElementById("sel_todos");



	elem.value = "Selecionar todos";



	cont321 = 0;



	}	  



}


// FUNCAO SELEIONA TODOS REGISTROS PRA EXCLUIR



function checkdeletetion(){



   if (!confirm("Você realmente deseja deletar este registro.") == false )



   FORMLISTA.submit();



}



function confirmaBloqueio(aURL) {



	if(confirm('Você tem certeza disso?')) {



	location.href = aURL;



	}



}



// FORMATAR CAMPO COM MASCARA



function FormatarCampo(src, mask){



var i = src.value.length;



var saida = mask.substring(0,1);



var texto = mask.substring(i)



	if (texto.substring(0,1) != saida){



	src.value += texto.substring(0,1);



  	}



}


// FUNCAO DE IMPRIMIR



function Imprimir(URL) {



  var width = 820;



  var height = 500;



  var left = 50;



  var top = 10



  window.open(URL, 'imprimir', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=yes, resizable=no, fullscreen=no');



}

// FUNCAO DE EFEITO NAS FOTOS



function makevisible(cur,which){



	if (which==0){



	cur.filters.alpha.opacity=85;



	} else {



	cur.filters.alpha.opacity=100;



	}



}


function ValidaEmail(email) {



	return email.search(/(\w[\w[\w\.\+]+)@(.+)\.(\w+)$/)==0; 



}







function gE(ID) {



	return document.getElementById(ID);



}

function gEs(tag) {



	return document.getElementsByTagName(tag);



}



// PESQUISA QUAL É O BROWSER



function Pesquisa(){



var Dados = null;



	try {



	// Firefox, Opera 8.0+, Safari



	Dados = new XMLHttpRequest();



	} catch (e) {



	//Internet Explorer



		try {



		Dados = new ActiveXObject("Msxml2.XMLHTTP");



		} catch (e) {



		Dados = new ActiveXObject("Microsoft.XMLHTTP");



		}



	}



return Dados;



}


// FUNCAO MOSTRA DADOS



var Dados



function MostrarDados(arquivo, id, campo) {



Dados = Pesquisa();







var url = arquivo+id;







Dados.open("GET", url, true)



Dados.onreadystatechange = function(){



	if (Dados.readyState==1) { // Cria o efeito de loading



	loading(true, campo);



	}



	if (Dados.readyState==4 || Dados.readyState=="complete") {// Remove o efeito de loading



	//loading(false, campo);



	gE(campo).innerHTML = Dados.responseText;



	}



}



Dados.send(null)



}


// FUNCAO MOSTRA ID



function MostraID(id, campo){



gE(campo).value = id;



}




// CRIA EFEITO LOADING



function loading(act, campo) {



	if(act == true){



	var loading = "<div align='center' style='background-color:#FFFFFF;'><img src='http://kolpingpiaui.com.br/images/loading.gif'></div>"; 



	gE(campo).innerHTML = loading;



	}



	if(act == false){



	//FechaDIV('Carregando');



	var bgBody = gE(campo);



	bgBody.parentNode.removeChild(bgBody);



	}



}











// FUNCAO FECHA DIV



function FechaDIV(campo){



//gE(campo).style.visibility = 'hidden';



gE(campo).style.display = 'none';



}







// FUNCAO AUMENTA E DIMINUI FONTE DAS NOTICIAS



function aumentar(campo){



fontSize += 3;



gE(campo).style.fontSize = fontSize + "px";



}



  



function diminuir(campo){



fontSize -= 3;



gE(campo).style.fontSize = fontSize + "px";



}







// FUNCAO QUE EXIBE MENSAGEM NA BARRA DE STATUS



function ExibeMensagem(){ 



window.status = mensagem_status;



timerID= setTimeout("ExibeMensagem()", 0);



}





function AbreJanelaGaleria(URL) {

  var width = 650;

  var height = 490;

  var left = 50;

  var top = 10

  window.open(URL, 'ema3', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}







function abrePopUp(url, larg, alt) {

  window.open(url,'popupImageWindow','width='+larg+', height='+alt+', top=100, left=100, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no')

}





function detalhaAgenda(url) {

  window.open(url,'popupImageWindow','width=485, height=360, top=100, left=100, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no')

}





function popupMural(url, larg, alt, scroll) {

  window.open(url,'popupImageWindow','width='+larg+', height='+alt+', top=100, left=100, scrollbars='+scroll+', status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no')

}



function abreFlayer(url) {

  window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')

}





function flash(url,w,h){

document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+w+'" height="'+h+'">');

document.write('<param name="movie" value="'+url+'">');

document.write('<param name="quality" value="high">');

document.write('<param name="wmode" value="transparent">');

document.write('<param name="menu" value="false">');

document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>');

document.write('</object>');

}





function validaDivulgue() {

                d = document.cadastro;

                if (d.nome.value == ""){

                        alert("Campo -Nome- deve ser preenchido.");

                        d.nome.focus();

                        return false;

                }



				if (d.email.value == ""){

                        alert("Campo -Nome- deve ser preenchido.");

                        d.email.focus();

                        return false;

                }



                parte1 = d.email.value.indexOf("@");

                parte2 = d.email.value.indexOf(".");

                parte3 = d.email.value.length;

                if (!(parte1 >= 3 && parte2 >= 6 && parte3 >= 9)) {

                        alert("vixi... que e-mail eh esse? coloca um verdadeiro aeeeee");

                        d.email.focus();

                        return false;

                }



                if (d.cidade.value == ""){

                        alert("Campo -Cidade- deve ser preenchido.");

                        d.cidade.focus();

                        return false;

                }



                if (d.mensagem.value == ""){

                        alert("Campo -Mensagem- deve ser preenchido.");

                        d.mensagem.focus();

                        return false;

                }



    return true;

}













// O AJAX DAS PAGINAS COMECA AQUI //



carregandoHTML = '<div id="Carregando">&nbsp;<img src=\'ajaxs/load.gif\'></div>';



try{

	xmlhttp = new XMLHttpRequest();

}catch(ee){

	try{

		 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

	 }catch(e){

		 try{

			 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

		 }catch(E){

			 xmlhttp = false;

		 }

	 }

 }















var ajax = {



	camposForm : function(idForm) {

		var aForm = document.getElementById(idForm);

		var elementosFormulario = aForm.elements;

		var qtdElementos = elementosFormulario.length;

		var queryString = "";

		var elemento;



		this.ConcatenaElemento = function(nome,valor) {

			if (queryString.length>0) {

				queryString += "&";

			}

			queryString += encodeURIComponent(nome) + "=" + encodeURIComponent(valor);

		};



		for (var i=0; i<qtdElementos; i++) {

			elemento = elementosFormulario[i];

			if (!elemento.disabled) {

				switch(elemento.type) {

					case 'text': case 'password': case 'hidden': case 'textarea':

							this.ConcatenaElemento(elemento.name,elemento.value);

					break;

					case 'select-one':

							if (elemento.selectedIndex>=0) {

						this.ConcatenaElemento(elemento.name,elemento.options[elemento.selectedIndex].value);

							}

							break;

					case 'select-multiple':

							for (var j=0; j<elemento.options.length; j++) {

						if (elemento.options[j].selected) {

							this.ConcatenaElemento(elemento.name,elemento.options[j].value);

						}

							}

							break;

					case 'checkbox': case 'radio':

							if (elemento.checked) {

						this.ConcatenaElemento(elemento.name,elemento.value);

							}

							break;

				}

			}

		}

//		aForm.reset();

		return queryString;

	},



	

	

	

	

	

	

abreLink : function(div,url){



		 local = document.getElementById(div);



		 xmlhttp.open('GET', url, true);

		 xmlhttp.onreadystatechange = function(){

			 if(xmlhttp.readyState == 1) {

				 local.innerHTML = carregandoHTML;

			 }

			 if(xmlhttp.readyState == 4) {

				 if(xmlhttp.status == 200){

					 local.innerHTML = xmlhttp.responseText;

					 

				 }

			 }

		 }

		 xmlhttp.send(null);

	 },









abreLinkCss : function(div,url){



 var lnk = document.createElement('link');

    lnk.setAttribute('type', "text/css" );

    lnk.setAttribute('rel', "stylesheet" );

    lnk.setAttribute('href', url );

    document.getElementsByTagName("head").item(0).appendChild(lnk);





		 local = document.getElementById(div);



		 xmlhttp.open('GET', url, true);

		 xmlhttp.onreadystatechange = function(){

			 if(xmlhttp.readyState == 1) {

				 local.innerHTML = carregandoHTML;

			 }

			 if(xmlhttp.readyState == 4) {

				 if(xmlhttp.status == 200){

					 local.innerHTML = xmlhttp.responseText;

					 

				 }

			 }

		 }

		 xmlhttp.send(null);

	 },











abrepg : function(div,url){



		 local = document.getElementById(div);



		 xmlhttp.open('GET', url, true);

		 xmlhttp.onreadystatechange = function(){

			 if(xmlhttp.readyState == 1) {

				 local.innerHTML = carregandoHTML;

			 }

			 if(xmlhttp.readyState == 4) {

				 if(xmlhttp.status == 200){

					 local.innerHTML = xmlhttp.responseText;

					 

				 }

			 }

		 }

		 xmlhttp.send(null);

	 },











	

	

	enviaEmail : function(idform){

		 param = ajax.camposForm(idform);



		 xmlhttp.open('POST', 'modulos/central_contatos/posta_contato.php', true);

		 xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

		 xmlhttp.onreadystatechange = ajax.repostasAcao;

		 xmlhttp.send(param);

		 document.getElementById(idform).reset();

	},

	 

	 

	 

	 

	 

	 

	vdContato : function(idform){

		 d = document.getElementById(idform);

		 if (d.nome.value == ""){

			 alert("O campo - Nome - deve ser preenchido!");

			 d.nome_.focus();

		 	return false;

		 }

		 if (d.assunto.value == ""){

			 alert("O campo - Assunto - deve ser preenchido!");

			 d.assunto.focus();

			 return false;

		 }

		 if (d.emailxc.value == ""){

			 alert("O campo - Seu E-mail - deve ser preenchido!");

			 d.emailxc.focus();

			 return false;

		 }

		 if (d.mensagem.value == ""){

			 alert("O campo - Mensagem - deve ser preenchido!");

			 d.mensagem.focus();

			 return false;

		 }

	

		 ajax.enviaEmail(idform);

	 	 return true;

	 },



	 

	 

	 

	 

	 

	 

	 repostasAcao : function(){



		 mensagens = document.getElementById('Mensagem');

		 mensagens.style.background = '#FFFFFF';

		 

		 if(xmlhttp.readyState == 1)

		 mensagens.innerHTML = carregandoHTML;



		 if(xmlhttp.readyState == 4) {

			 if(xmlhttp.status == 200) {

				 mensagens.innerHTML = xmlhttp.responseText;

			 }

		 }

	 },



	 

	 

	 

	 

	 

	 

	 



        

		

		

		

		

		

		

		exibeBanner : function(){



		 var cache = new Date().getTime(); 



		 local = document.getElementById('banner_topo');

		 local2 = document.getElementById('msg_banner');



                 xmlhttp.open('GET', 'mostra_banner.php?c='+cache, true);

		 xmlhttp.onreadystatechange = function(){

			 //if(xmlhttp.readyState == 1) {

			//	 local2.innerHTML = '';

			 //}

			 if(xmlhttp.readyState == 4) {

				 if(xmlhttp.status == 200){

					 local.innerHTML = xmlhttp.responseText;

				 }

			 }

		 }

		 xmlhttp.send(null);

        },



        runexibeBanner : function() {

                ajax.exibeBanner();

                time = setTimeout("ajax.runexibeBanner()",15000);

        }



}
