//crio o objeto xmlHttpRequest


var xmlHttp;

function Cria_XmlHttpObject(){
	
	var xmlHttp=null;
	//cria o objeto XMLHttpRequest pra firefox, mozila, opera, etc
	try{
		xmlHttp=new XMLHttpRequest();
	}
	
		//cria o objeto XMLHttpRequest pra internet explorer, 6,0 + e posteriormente para internet explorer
	catch (e){
		try{
		xmlHttp= new ActiveXObject("Msxml2.XMLHTTP");
		}
		
		catch (e){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}	
	}

return xmlHttp;
}














//FUNCAO QUE MUDA ALBUM DO PORTFÓLIO
function AlbumPortfolio(ParTypePortfolio){
	
	alert(ParTypePortfolio)//DEBUG
	
	
	xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var ArquivoPHP="Requires/frame_cont_album_jobs.php";
			ArquivoPHP=ArquivoPHP+"?type_port="+ParTypePortfolio;
			
			xmlHttp.open("GET", ArquivoPHP,true);
			xmlHttp.send(null);
			xmlHttp.onreadystatechange=function(){
													if(xmlHttp.readyState==4)
													{
														
														
																										
													
														document.getElementById("cont_album_jobs").innerHTML=xmlHttp.responseText;
														
														
														
											
													}
													
													else{
														
													
											

	
	
														document.getElementById("cont_album_jobs").innerHTML='<div id="carregador_resposta">'+
																												'<div>Por favor, aguarde...</div>'+
																												'<img src="../imagens/loading.gif" alt="Carregador" />'+
																											'</div>';
															
														}
													
												}
	
	
	}
	
	


function FormSubmit(SqlType,DB,TableDB,CamposTB,EmailSup){
	
	//alert(DB);
	//alert(SqlType);
	//alert(TableDB);
	//alert(CamposTB);
	
	var Elementos=document.getElementById("form_"+TableDB).elements;
	
	var ValuesFields="";
	
	var Count=0;
	var Separator="";
	for(var i=0; i<Elementos.length-1; i++)
	{
		
		//alert( Elementos[i].value);//DEBUG
		
		if(Count > 0)
		{
			Separator="','";
		}
	
		
	
		ValuesFields+=(Separator+Elementos[i].value);
		  
		Count++;  
		
	}
	
	//alert(CamposTB);
	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina="requires/"+SqlType+".php";
			Pagina=Pagina+"?bd="+DB+"&table_bd="+TableDB+"&campos_tb="+CamposTB+"&values_fields="+ValuesFields+"&email_sup"+EmailSup;
			
			
			
		
		xmlHttp.open("GET", Pagina,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													
													window.scrollTo(0,0);										
													
																							
													
														alert(xmlHttp.responseText);

														window.location.reload();

														
													
													
													
										
													
													
													
										
												}
												
												else{
													
			
													
													

													//document.getElementById("resposta_ajax").innerHTML='<div id="carregador_resposta">'+
			//'<div>Por favor, aguarde...</div>'+
			//'<img src="imagens/loading.gif" alt="Carregador" />'+
		//'</div>';
														
													}
												
											}


}



function SendPhotos()
{
	//USO parent PQ ESTOU USANDO UM iframe ESCONDIDO
	parent.document.getElementById("cont_loading_upload").style.visibility="visible";
	document.getElementById("form_fotos").submit();//submete o formulário
	
	
}




function PreviewPhoto(Domain,Album,ParCodPhoto)
{
	//alert(ParPhoto);
	parent.document.getElementById("cont_preview_photo").src="http://"+Domain+"/content/albuns/"+Album+"/"+ParCodPhoto+".php";

	
	
}





function SetGroupPhoto(___levelDir,ParOrdemGroup,ParCodAlbum)
{

	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=___levelDir+"requires/set_group_thumbs.php";
			Pagina=Pagina+"?c="+ParOrdemGroup+"&a="+ParCodAlbum;
			
			
			
		
		xmlHttp.open("GET", Pagina,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													//fazer ferramenta para arrumar código ai já mudo de uma vez e salvo.										
													//alert(document.getElementById("cont_mini").innerHTML=xmlHttp.responseText);
													document.getElementById("cont_mini").innerHTML=xmlHttp.responseText;									
												}
												
												else{
													
			
													
													

													document.getElementById("cont_mini").innerHTML='<div id="response_loading">'+
																										'<img src="'+___levelDir+'requires/classes/images/loading_album.gif" /> <span>Carregando novas fotos...</span>'+
																											
																										'</div>';
														
													}
												
											}


}




					
						

//#################################################################################################

function SendTwittes(ParId, ParPassword)
{
	//alert(ParId);
	//alert(ParPassword);
	

	var MsgPt=document.getElementById("mensagem_textarea").value;
	var MsgEn=document.getElementById("mensagem_en_textarea").value;
	var MsgEs=document.getElementById("mensagem_es_textarea").value;	
	
	
	document.getElementById("cont_loading_twittes").style.visibility='visible';

	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina="requires/send_twittes.php";
			Pagina=Pagina+"?i="+ParId+"&p="+ParPassword+"&mpt="+MsgPt+"&men="+MsgEn+"&mes="+MsgEs;
			
			//alert(Pagina);
			
		
		xmlHttp.open("GET", Pagina,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													
													//fazer ferramenta para arrumar código ai já mudo de uma vez e salvo.										
													//alert(document.getElementById("cont_mini").innerHTML=xmlHttp.responseText);
													document.getElementById("cont_loading_twittes").innerHTML=xmlHttp.responseText;									
													setTimeout('Clean(\"cont_loading_twittes\")', 2500);
												}
												
												else{
													
			
													
													

													document.getElementById("cont_loading_twittes").innerHTML="<img src='requires/classes/images/loading.gif'/>"+
																									  "<p>Enviando Foto...</p>";

														
													}
												
											}


}







function FormSubmit(SqlType,DB,TableDB,CamposTB,EmailSup){
	
	//alert(DB);
	//alert(SqlType);
	//alert(TableDB);
	//alert(CamposTB);
	
	var Elementos=document.getElementById("form_"+TableDB).elements;
	
	var ValuesFields="";
	
	var Count=0;
	var Separator="";
	for(var i=0; i<Elementos.length-1; i++)
	{
		
		//alert( Elementos[i].value);//DEBUG
		
		if(Count > 0)
		{
			Separator="','";
		}
	
		
	
		ValuesFields+=(Separator+Elementos[i].value);
		  
		Count++;  
		
	}
	
	//alert(CamposTB);
	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina="requires/"+SqlType+".php";
			Pagina=Pagina+"?bd="+DB+"&table_bd="+TableDB+"&campos_tb="+CamposTB+"&values_fields="+ValuesFields+"&email_sup"+EmailSup;
			
			
			
		
		xmlHttp.open("GET", Pagina,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													
													window.scrollTo(0,0);										
													
																							
													
														alert(xmlHttp.responseText);

														window.location.reload();

														
													
													
													
										
													
													
													
										
												}
												
												else{
													
			
													
													

													//document.getElementById("resposta_ajax").innerHTML='<div id="carregador_resposta">'+
			//'<div>Por favor, aguarde...</div>'+
			//'<img src="imagens/loading.gif" alt="Carregador" />'+
		//'</div>';
														
													}
												
											}


}












function SendMail(ParFormEmail){

	document.getElementById(ParFormEmail).submit();

}








function moreImage(ParNameAlbum)
{
	
	

	
	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
	
	
	document.getElementById('cont_form_'+ParNameAlbum).style.display="block";
	
		
	
}


function closeFormAlbum(ParNameAlbum)
{
	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "none";
	
	
	document.getElementById('cont_form_'+ParNameAlbum).style.display="none";
		
		
		
}




function saveTextPhoto(___parDir,___urlPage)
{
	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Alterando descri&ccedil;&atilde;o da foto...</div>'+
																											
																											'</div>';


    if (document.getElementById("cont_preview_photo").contentDocument ) { // DOM
        
		var codPhoto=document.getElementById("cont_preview_photo").contentDocument.getElementById('cod_foto').value;
		var textPhoto=document.getElementById("cont_preview_photo").contentDocument.getElementById('e_c').value;
		//alert(codPhoto);
		//alert(textPhoto);
		
		
		
		
    } else if ( document.getElementById("cont_preview_photo").contentWindow ) { // IE win
        
		var codPhoto=document.getElementById("cont_preview_photo").contentWindow.document.getElementById('cod_foto').value;
		var textPhoto=document.getElementById("cont_preview_photo").contentWindow.document.getElementById('e_c').value;
		
		//alert(codPhoto);	
		//alert(textPhoto);	
    }



						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=___parDir+"requires/edit_text_photo.php";
			Pagina=Pagina+"?cod_photo="+codPhoto+"&text_photo="+textPhoto;
			
			
			
		
		xmlHttp.open("GET", Pagina,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													textPhoto=xmlHttp.responseText;
													
													
													
													
														
													document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Descri&ccedil;&atilde;o da foto alterada.</div>'+
																											
																											'</div>';

													
													setTimeout('closeDiv("loading_ajax")', 5000);
													setTimeout('closeDiv("transparent")', 5000);
													
													window.location.href="http://"+___urlPage;

												}
												
												else{
													


													


													
														
													}
												
											}




	
}











function saveTextsPages(___parNivelDir,___templatePage)
{

	
	 //alert(___templatePage);//DEBUG	
	
	

	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Atualizando conte&uacute;do da P&aacute;gina...</div>'+
																											
																											'</div>';



	

    if (___templatePage == "simple_text" || ___templatePage == "contact" || ___templatePage == "view_medias" ) { // DOM
        
		var tituloTexto=document.getElementById("e_c_title").innerHTML;
		
		var text=tinyMCE.get("content_page_admin").getContent();
		
		//var text=document.getElementById("content_page").innerHTML;
		
		//alert(document.cont_texto.content_page.value);
		
		//alert(tituloTexto);//DEBUG
		
		//alert(text);//DEBUG
		
		//alert(tinyMCE.get("content_page").getContent());//DEBUG
		
		var Dados="content="+escape(tituloTexto)+"($)"+escape(text);
		
		var dir=___parNivelDir;
		
    } 
	
	
	if(___templatePage == "view_news_articles")
	{
	
		//alert(___templatePage);	
	
	
		//RESOLVI EDITAR AS SUBCATEGORIAS SEPARADAMENTE PARA DAR MAIOR FLEXIBILIDADE AO USUÁRIO
		//var subCatTexto=document.getElementById("e_c_subcat").innerHTML;
		
		var subcat=document.getElementById("e_c_subcat").value;
		
		var tituloTexto=document.getElementById("e_c_title").innerHTML;
		
		var introTexto=document.getElementById("e_c_intro").innerHTML;
		
		
		var text=tinyMCE.get("content_page_admin").getContent();
		
		var keyWords=document.getElementById("e_c_keywords").innerHTML;
		
		
		var Dados="content="+escape(subcat)+"($)"+escape(tituloTexto)+"($)"+escape(introTexto)+"($)"+escape(text)+"($)"+escape(keyWords);
				
	
		//alert(Dados);//DEBUG
		
		var dir=___parNivelDir;
	}
	

	if(___templatePage == "view_medias")
	{
	
		//alert(___templatePage);	
	
	
		//RESOLVI EDITAR AS SUBCATEGORIAS SEPARADAMENTE PARA DAR MAIOR FLEXIBILIDADE AO USUÁRIO
		//var subCatTexto=document.getElementById("e_c_subcat").innerHTML;
		
		var subcat=document.getElementById("e_c_subcat").value;
		
		var tituloTexto=document.getElementById("e_c_title").innerHTML;
		
		var introTexto=document.getElementById("e_c_intro").innerHTML;
		
		
		var text=tinyMCE.get("content_page_admin").getContent();
		
		var keyWords=document.getElementById("e_c_keywords").innerHTML;
		
		
		var Dados="content="+escape(subcat)+"($)"+escape(tituloTexto)+"($)"+escape(introTexto)+"($)"+escape(text)+"($)"+escape(keyWords);
				
	
		//alert(Dados);//DEBUG
		
		var dir=___parNivelDir;
	}
	


	if(___templatePage == "view_albuns")
	{
	
		//alert(___templatePage);	
	
	
		//RESOLVI EDITAR AS SUBCATEGORIAS SEPARADAMENTE PARA DAR MAIOR FLEXIBILIDADE AO USUÁRIO
		//var subCatTexto=document.getElementById("e_c_subcat").innerHTML;
		
		var tituloTexto=document.getElementById("e_c_title").innerHTML;
		
		var introTexto=document.getElementById("e_c_intro").innerHTML;
		
		var keyWords=document.getElementById("e_c_keywords").innerHTML;
		
		
		var Dados="content="+escape(tituloTexto)+"($)"+escape(introTexto)+"($)"+escape(keyWords);
				
	
		//alert(Dados);//DEBUG
		
		var dir=___parNivelDir;
	}
	
	if(___templatePage == "all_medias" || ___templatePage == "all_albuns" || ___templatePage == "all_news_articles")
	{
	
		//alert(___templatePage);	
	
	
		//RESOLVI EDITAR AS SUBCATEGORIAS SEPARADAMENTE PARA DAR MAIOR FLEXIBILIDADE AO USUÁRIO
		//var subCatTexto=document.getElementById("e_c_subcat").innerHTML;
		
		
		var tituloTexto=document.getElementById("e_c_title").innerHTML;
		
		
		var Dados="content="+escape(tituloTexto);
				
	
		//alert(Dados);//DEBUG
		
		var dir=___parNivelDir;
	}


						
						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=dir+"requires/edit_text_pages.php";
		
		
		//alert(Pagina);//DEBUG
		
			
		
		
							
		xmlHttp.open("POST", Pagina,true);
		
		
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", Dados.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		
		xmlHttp.send(Dados);
		
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													
													newUrl=xmlHttp.responseText;
													//alert(newUrl);
													
													
													
														
													document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Conte&uacute;do atualizado com sucesso!</div>'+
																											
																											'</div>';

													
													setTimeout('closeDiv("loading_ajax")', 5000);
													setTimeout('closeDiv("transparent")', 5000);
													
													
													
													window.location.href=newUrl;
													

												}
												
												else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1){
													


														//xmlHttp.readyState==1,2,3
															
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Atualizando URL da P&aacute;gina...</div>'+
																											
																											'</div>';

														
													
														
													}
												
											}




	
}













function delPages(___parNivelDir,___templatePage)
{

		
		
	//alert(___parNivelDir);
			
	var dir=___parNivelDir;
	/*

		
		var dir="";
		if(___parNivelDir>1)
		{
		
			
			for(var i=1;i<(___parNivelDir);i++)
			{
			
				dir=dir+"../";
			
			
			}
			
		
			
			
		
		}	
		
		else
		{
		
			dir="";
		
		
		
		}
*/

	//alert(___templatePage);	
	
	

	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Excluindo P&aacute;gina...</div>'+
																											
																											'</div>';



	

  

						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=dir+"requires/del_pages.php";
		
		
		
		
			
		
		
							
		xmlHttp.open("POST", Pagina,true);
		//xmlHttp.open("GET", Pagina,true);
		
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", Pagina.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		
		xmlHttp.send(Pagina);
		
		//GET
		//xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													
													//alert(xmlHttp.responseText);
													
													if(xmlHttp.responseText == '-1')
													{
													
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Esta p&aacute;gina possui p&aacute;ginas internas. Imposs&iacute;vel excluir!</div>'+
																											
																											'</div>';
																											
													setTimeout('closeDiv("loading_ajax")', 5000);
													setTimeout('closeDiv("transparent")', 5000);
													
													
													
													window.location.reload();											
													
													}
													else if(xmlHttp.responseText == '0')
													{
													
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Erro ao excluir!</div>'+
																											
																											'</div>';
													
													}
													
													else if(xmlHttp.responseText == '1')
													{
													
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>P&aacute;ginas principais n&atilde;o podem ser exclu&iacute;das!</div>'+
																											
																											'</div>';
													
													setTimeout('closeDiv("loading_ajax")', 5000);
													setTimeout('closeDiv("transparent")', 5000);
													
													}
													
													else
													{
													
													newUrl=xmlHttp.responseText;
													//alert(newUrl);	
													document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>P&aacute;gina exclu&iacute;da com sucesso!</div>'+
																											
																											'</div>';

													
													setTimeout('closeDiv("loading_ajax")', 5000);
													setTimeout('closeDiv("transparent")', 5000);
													
													
													
													window.location.href=newUrl;
													
													}

												}
												
												else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1){
													


														//xmlHttp.readyState==1,2,3
															
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Excluindo URL da P&aacute;gina...</div>'+
																											
																											'</div>';

														
													
														
													}
												
											}




	
}









function addPost(___parNivelDir,___pagePost, ___titlePagePost)
{

	
	//alert(___templatePage);	
	
	

	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Criando novo &Iacute;tem para '+___titlePagePost+' ...</div>'+
																											
																											'</div>';



	
						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=___parNivelDir+"requires/add_post.php";
		var Dados="content="+___pagePost;
		
		//alert(Pagina);
		//alert(Dados);	
			
		
		
							
		xmlHttp.open("POST", Pagina,true);
		//xmlHttp.open("GET", Pagina,true);
		
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", Dados.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		
		xmlHttp.send(Dados);
		
		//GET
		//xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													var response=xmlHttp.responseText;
													
													if(response == "-1")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Novo &iacute;tem j&aacute; criado! Atualize este &iacute;tem antes de criar um novo.</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}
													
													if(response != "-1")
													{
													
													
																			newUrl=response;
																			//alert(newUrl);
																			
																			
																			
																				
																			document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																																	'<div>&Iacute;tem criado com sucesso!</div>'+
																																	
																																	'</div>';
						
																			
																			setTimeout('closeDiv("loading_ajax")', 5000);
																			setTimeout('closeDiv("transparent")', 5000);
																			
																			
																			
																			window.location.href=newUrl;
																	}
														}
																		
														else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1)
														{
																			
						
						
																				//xmlHttp.readyState==1,2,3
																					
																				
																				document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																																	'<div>Criando novo &Iacute;tem para '+___titlePagePost+' ...</div>'+
																																	
																																	'</div>';
						
																				
																			
																				
														}
																		
													}




	
}














































function addAlbum(___parNivelDir,___pagePost, ___titlePagePost)
{

	
	//alert(___templatePage);	
	
	

	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Criando novo &Iacute;tem para '+___titlePagePost+' ...</div>'+
																											
																											'</div>';



	
						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=___parNivelDir+"requires/add_album.php";
		var Dados="content="+___pagePost;
		
		//alert(Pagina);
		//alert(Dados);	
			
		
		
							
		xmlHttp.open("POST", Pagina,true);
		//xmlHttp.open("GET", Pagina,true);
		
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", Dados.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		
		xmlHttp.send(Dados);
		
		//GET
		//xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													var response=xmlHttp.responseText;
													
													if(response == "-1")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Novo &iacute;tem j&aacute; criado! Atualize este &iacute;tem antes de criar um novo.</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}
													
													if(response != "-1")
													{
													
													
																			newUrl=response;
																			//alert(newUrl);
																			
																			
																			
																				
																			document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																																	'<div>&Iacute;tem criado com sucesso!</div>'+
																																	
																																	'</div>';
						
																			
																			setTimeout('closeDiv("loading_ajax")', 5000);
																			setTimeout('closeDiv("transparent")', 5000);
																			
																			
																			
																			window.location.href=newUrl;
																	}
														}
																		
														else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1)
														{
																			
						
						
																				//xmlHttp.readyState==1,2,3
																					
																				
																				document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																																	'<div>Criando novo &Iacute;tem para '+___titlePagePost+' ...</div>'+
																																	
																																	'</div>';
						
																				
																			
																				
														}
																		
													}




	
}









































//function addMedias(___pagePost, ___titlePagePost)
function addMedias(___parNivelDir,___pagePost, ___titlePagePost)
{

	
	//alert(___templatePage);	
	
	

	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Criando novo &Iacute;tem para '+___titlePagePost+' ...</div>'+
																											
																											'</div>';



	
						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=___parNivelDir+"requires/add_media.php";
		var Dados="content="+___pagePost;
		
		//alert(Pagina);
		alert(Dados);	
			
		
		
							
		xmlHttp.open("POST", Pagina,true);
		//xmlHttp.open("GET", Pagina,true);
		
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", Dados.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		
		xmlHttp.send(Dados);
		
		//GET
		//xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													var response=xmlHttp.responseText;
													if(response == "-1")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Novo &iacute;tem de M&iacute;dia j&aacute; criado! Atualize este &iacute;tem antes de criar um novo.</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}
													
													if(response != "-1")
													{
													
																newUrl=response;
																//alert(newUrl);
																
																
																
																	
																document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																														'<div>&Iacute;tem criado com sucesso!</div>'+
																														
																														'</div>';
			
																
																setTimeout('closeDiv("loading_ajax")', 5000);
																setTimeout('closeDiv("transparent")', 5000);
																
																
																
																window.location.href=newUrl;
													}
												}
												
												else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1){
													


														//xmlHttp.readyState==1,2,3
															
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Criando novo &Iacute;tem para '+___titlePagePost+' ...</div>'+
																											
																											'</div>';

														
													
														
													}
												
											}




	
}


























function setFormTypePage(___codTypePage)
{
	
	//alert(___codTypePage)
	
	//if TEMPLATE == contact
	if(___codTypePage == 1)
	{
		
		document.getElementById("line_email_template").style.visibility="visible";
		
	}


	//if TEMPLATE == all_news_articles
	if(___codTypePage == 4)
	{
		
		document.getElementById("line_email_template").style.visibility="visible";
		
	}


	//if TEMPLATE == all_medias
	if(___codTypePage == 8)
	{
		
		document.getElementById("line_email_template").style.visibility="visible";
		
	}


	//if TEMPLATE == simple_text_galery
	if(___codTypePage == 3)
	{
		
		document.getElementById("line_email_template").style.visibility="hidden";
		
	}

	//if TEMPLATE == simple_text
	if(___codTypePage == 2)
	{
		
		document.getElementById("line_email_template").style.visibility="hidden";
		
	}

	//if TEMPLATE == all_news_articles
	if(___codTypePage == 4)
	{
		
		document.getElementById("line_email_template").style.visibility="hidden";
		
	}

	//if TEMPLATE == all_medias
	if(___codTypePage == 8)
	{
		
		document.getElementById("line_email_template").style.visibility="hidden";
		
	}

	//if TEMPLATE == all_albuns
	if(___codTypePage == 11)
	{
		
		document.getElementById("line_email_template").style.visibility="hidden";
		
	}
	
	
	//if TEMPLATE == simple_text_protected
	if(___codTypePage == 12)
	{
		
		document.getElementById("line_email_template").style.visibility="hidden";
		
	}
	
	document.getElementById('cod_templates').value=___codTypePage;
}


function addPage(___parNivelDir,___parAllRegister)
{
	
	
	
	//NÍVEL DA PÁGINA MAE(level_child FIELD TABLE BD)
	//alert(___parNivelDir);



	var ___codTypePage=document.getElementById('cod_templates').value;
	
	//alert(___codTypePage);	
		
	if(___codTypePage == "")
	{
			
					alert("Escolha um tipo de Página!");
		
					return null;
			
					
		
		
	}

	
	
	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Criando P&aacute;gina...</div>'+
																											
																											'</div>';



	
						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
	
	var dir=___parNivelDir;
	/*
		var dir="";
		if(___parNivelDir>1)
		{
		
			
			for(var i=1;i<(___parNivelDir);i++)
			{
			
				dir=dir+"../";
			
			
			}
			
		
			
			
		
		}	
		
		else
		{
		
			dir="";
		
		
		
		}

		*/
		
		//VER TOTAL DE DIRETORIOS
		//alert(dir);//DEBUG
	
		var Pagina=dir+"requires/add_page.php";
	
	//IF TEMPLATE == contact	
	if(___codTypePage == 1  || ___codTypePage == 4 || ___codTypePage == 8)
	{
		
		var Dados="dados="+___codTypePage+"($)"+document.getElementById("email_template").value;
		
	}


	//IF TEMPLATE == all_news_articles	
	else if(___codTypePage == 4)
	{
		
		var Dados="dados="+___codTypePage+"($)"+document.getElementById("email_template").value;
		
	}


	//IF TEMPLATE == all_medias	
	else if(___codTypePage == 8)
	{
		
		var Dados="dados="+___codTypePage+"($)"+document.getElementById("email_template").value;
		
	}

	else
	{
		
		var Dados="dados="+___codTypePage;
	}
		//alert(Pagina);
		//alert(Dados);	
			
		
			
							
		xmlHttp.open("POST", Pagina,true);
		//xmlHttp.open("GET", Pagina,true);
		
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", Dados.length);
		xmlHttp.setRequestHeader("Connection", "close");
		
		
		xmlHttp.send(Dados);
		
		//GET
		//xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													
													response=xmlHttp.responseText;
													//alert(response);
													
													if(response == "-1")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>P&aacute;gina j&aacute; criada! Verifique o site!</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}



													if(response == "-2")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Escolha um tipo de P&aacute;gina!</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}




									
													if(response == "1")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>P&aacute;gina criada com sucesso!</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}


												}
												
												else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1){
													


														//xmlHttp.readyState==1,2,3
															
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Criando P&aacute;gina...</div>'+
																											
																											'</div>';

														
													
														
													}
												
											}




	
}












function delImage(___levelDir)
{
	
	
	
	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Excluindo foto...</div>'+
																											
																											'</div>';


    if (document.getElementById("cont_preview_photo").contentDocument ) { // DOM
        
		var codPhoto=document.getElementById("cont_preview_photo").contentDocument.getElementById('cod_foto').value;
		//alert(codPhoto);

		
		
		
		
    } else if ( document.getElementById("cont_preview_photo").contentWindow ) { // IE win
        
		var codPhoto=document.getElementById("cont_preview_photo").contentWindow.document.getElementById('cod_foto').value;

		
		//alert(codPhoto);	

    }



						

	
	var xmlHttp=Cria_XmlHttpObject();
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var Pagina=___levelDir+"requires/del_photo.php";
			Pagina=Pagina+"?cod_photo="+codPhoto;
			
			
			
		
		xmlHttp.open("GET", Pagina,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function(){
												if(xmlHttp.readyState==4)
												{
													
													
														
													document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Foto exclu&iacute;da.</div>'+
																											
																											'</div>';

												
													setTimeout('closeDiv("loading_ajax")', 4000);
													setTimeout('closeDiv("transparent")', 4000);
													
													window.location.href=xmlHttp.responseText;
													
													
												}
												
												
												
												else{
													


													


													
														
													}
												
											}




	
	
}





































//########################################################################################



var ReturnAjax;
var VarReturn;
var DataAjax;
function SearchAjax(ParMethod, ParPHP, ParData, ParLoading, ParReturn)
{
		
		//alert(ParMethod);
		//alert(ParPHP);
		//alert(ParData);
		
	
	
		var xmlHttp=Cria_XmlHttpObject();
	

		if(xmlHttp == null)
		{
			alert('O seu Broswer nao suporta AJAX!');
			return;
		}
	
		var FilePHP=ParPHP;
		
		
		if(ParMethod =="POST")
		{
		
			var Dados;
			xmlHttp.open(ParMethod, FilePHP,true);
			Dados="c="+ParData;
			xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", Dados.length);
			xmlHttp.setRequestHeader("Connection", "close");
			xmlHttp.send(Dados);
			//alert(Dados);
			//alert(FilePHP);
		
		}
		else
		{
				
			xmlHttp.open(ParMethod, FilePHP,true);
			xmlHttp.send(null);
		
		}
	    
		
		
		xmlHttp.onreadystatechange=function(){
			
			
															if(xmlHttp.readyState==4)
															{
													
																if(ParLoading !== "" && ParReturn == "")
																{
														
																
																document.getElementById(ParLoading).innerHTML=xmlHttp.responseText;
																					
																}
																					
															
															
																if(ParReturn !== "")
																{
															
																	ReturnAjax=xmlHttp.responseText;
																
																					
																}

															else
															{
																
																if(ParLoading !== "" && ParReturn == "")
																{
														
																	document.getElementById(ParLoading).innerHTML="<div id='loading_ajax'>"+
																													"Carregando..."+
																													"</div>";
																													
																}																													
																
															
															}
														
														}
														
														
														

													}//fim de StatusAjax()
														
														
														
													DataAjax=ReturnAjax;
}









//PARA UPLOAD TINY EDITOR

function setAtualFolder(___ParFolder)
{

	alert(___ParFolder);

	SearchAjax("POST", "___setSessionFolder.php", ___ParFolder, "","y")



}











function GeraCodSeg(ParDirSeo,ParContImagem){
		
		document.getElementById(ParContImagem).innerHTML="";
		document.getElementById(ParContImagem).display="none";
		document.getElementById(ParContImagem).display="block";
		
		
		xmlHttp=Cria_XmlHttpObject();
	

		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var GeraImagem=ParDirSeo+"requires/imagem_seguranca/requires/gera_codigo_ajax.php";
				
				
		//alert(GeraImagem);
		
		xmlHttp.open("GET", GeraImagem,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function (){
		
													if(xmlHttp.readyState==4){
														//alert(xmlHttp.responseText);
														document.getElementById(ParContImagem).innerHTML=xmlHttp.responseText;
													
													}else{

														document.getElementById(ParContImagem).innerHTML="carregando imagem...";
													
														
													}
	
		
		
												}






}






//###################################################################################################################
function StatusCodSegurancaSeo(){
	if(xmlHttp.readyState==4){
		//alert(xmlHttp.responseText);
		document.getElementById("ImagemGerada").innerHTML="<img src='http://www.dourados.loocal.com.br/requires/imagem_seguranca/requires/"+xmlHttp.responseText+"'>";
	
	}else{

		document.getElementById("ImagemGerada").innerHTML="carregando imagem...";
	
		
	}
	
}






function GeraCodSegSeo(){
		
		xmlHttp=Cria_XmlHttpObject();
	

		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var GeraImagem="../../../../requires/imagem_seguranca/requires/gera_codigo_ajax.php";
				
		
		xmlHttp.open("GET", GeraImagem,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=StatusCodSegurancaSeo;






}




//###########################################################################################
function StatusApagaCod(){
	if(xmlHttp.readyState==4){
		
	}else{

		
	
		
	}
	
}




function ApagaImagemCod(){
	
	xmlHttp=Cria_XmlHttpObject();
	

		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var ApagaImagem="requires/imagem_seguranca/apaga_cod.php";
				
		
		xmlHttp.open("GET", ApagaImagem,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=StatusApagaCod;
}



function ApagaImagemCodSeo(){
	
	xmlHttp=Cria_XmlHttpObject();
	

		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var ApagaImagem="../../../../requires/imagem_seguranca/apaga_cod.php";
				
		
		xmlHttp.open("GET", ApagaImagem,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=StatusApagaCod;
}




//###########################################################################################

function StatusEnviaEmail(){
	if(xmlHttp.readyState==4){
		document.getElementById("BotaoEnviar").innerHTML="<span style='font-size:11px;color:#3a688a;'>"+xmlHttp.responseText+"</span>";
		setTimeout("FechaEnvAmigo()", 3000);
	
	
	}else{

		document.getElementById("BotaoEnviar").innerHTML="<span style='font-size:11px;color:#3a688a;'>Enviando E-mail...</span>";
	
		
	}
	
}






function EmailAmigo(){
		
		xmlHttp=Cria_XmlHttpObject();
		
		
		var NomeInternauta=document.getElementById("NomeInternauta").value;
		var NomeAmigo=document.getElementById("NomeAmigo").value;
		var EmailAmigo=document.getElementById("EmailAmigo").value;
		var Mensagem=document.getElementById("Mensagem").value;
		var CodSeg=document.getElementById("CodSeg").value;
		
		
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var EnviaEmail="requires/imagem_seguranca/requires/mail.php";
		EnviaEmail=EnviaEmail+"?NomeInternauta="+NomeInternauta+"&NomeAmigo="+NomeAmigo+"&EmailAmigo="+EmailAmigo+"&Mensagem="+Mensagem+"&CodSeg="+CodSeg;
		
		xmlHttp.open("GET", EnviaEmail,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=StatusEnviaEmail;
}







function EmailAmigoSeo(){
		
		xmlHttp=Cria_XmlHttpObject();
		
		
		var NomeInternauta=document.getElementById("NomeInternauta").value;
		var NomeAmigo=document.getElementById("NomeAmigo").value;
		var EmailAmigo=document.getElementById("EmailAmigo").value;
		var Mensagem=document.getElementById("Mensagem").value;
		var CodSeg=document.getElementById("CodSeg").value;
		
		
		if(xmlHttp == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var EnviaEmail="../../../../requires/imagem_seguranca/requires/mail.php";
		EnviaEmail=EnviaEmail+"?NomeInternauta="+NomeInternauta+"&NomeAmigo="+NomeAmigo+"&EmailAmigo="+EmailAmigo+"&Mensagem="+Mensagem+"&CodSeg="+CodSeg;
		
		xmlHttp.open("GET", EnviaEmail,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=StatusEnviaEmail;
}















//############################################################
function VerificaCodImagem(){
	var ObjetoAjax;
	ObjetoAjax=Cria_XmlHttpObject();
	
	var CodSeguranca;
		CodSeguranca=document.getElementById("CodSeg").value;
		
		if(ObjetoAjax == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var FilePHP="requires/imagem_seguranca/verifica_cod_imagem.php";
			FilePHP=FilePHP+"?Par1="+CodSeguranca;
		
		
		ObjetoAjax.open("GET", FilePHP,true);
		ObjetoAjax.send(null);
	    ObjetoAjax.onreadystatechange=function(){
										if(ObjetoAjax.readyState==4){
												
											var RespostaAjax;		
											RespostaAjax=ObjetoAjax.responseText;
											
											
											if(RespostaAjax=="Correto"){
												
												EmailAmigo();	
												
											}else{
												alert("O Código digitado não confere com a Imagem!");
												ApagaImagemCod();
												GeraCodSeg();
												
											}								
											
											
											
										}else{
											
											
												//document.getElementById(ParDivResponse).innerHTML="Processando...";
											
											
		
										}
				
			
									}//FIM if xmlHttp.readyState==4){...
		

		
	}





//############################################################
function VerificaCodImagemSeo(){
	var ObjetoAjax;
	ObjetoAjax=Cria_XmlHttpObject();
	
	var CodSeguranca;
		CodSeguranca=document.getElementById("CodSeg").value;
		
		if(ObjetoAjax == null){
			alert('O seu Broswer nao suporta AJAX!');
		return;
		}
	
		var FilePHP="../../../../requires/imagem_seguranca/verifica_cod_imagem.php";
			FilePHP=FilePHP+"?Par1="+CodSeguranca;
		
		
		ObjetoAjax.open("GET", FilePHP,true);
		ObjetoAjax.send(null);
	    ObjetoAjax.onreadystatechange=function(){
										if(ObjetoAjax.readyState==4){
												
											var RespostaAjax;		
											RespostaAjax=ObjetoAjax.responseText;
											
											
											if(RespostaAjax=="Correto"){
												
												EmailAmigoSeo();	
												
											}else{
												alert("O Código digitado não confere com a Imagem!");
												ApagaImagemCodSeo();
												GeraCodSegSeo();
												
											}								
											
											
											
										}else{
											
											
												//document.getElementById(ParDivResponse).innerHTML="Processando...";
											
											
		
										}
				
			
									}//FIM if xmlHttp.readyState==4){...
		

		
	}









//#############################################################################################################################################
function AutoComp(___ParTipoCampo, ParElement,ParElementCod,ParValor,ParTable, ParSqlWhere){
	
	document.getElementById("bt_create").disabled=false;

	if(ParValor.length==0){
		document.getElementById("sug").innerHTML="Digite o nome do(a) "+___ParTipoCampo;
		return;
	}

	var xmlHttp=Cria_XmlHttpObject();

	if(xmlHttp == null){
		alert('O seu Broswer nao suporta AJAX!');
		return;
	}

	var file="../requires/auto_complet.php";
	
	if(ParSqlWhere == "")
	{
	
		file=file+"?e="+ParElement+"&cod="+ParElementCod+"&c="+ParValor+"&t="+ParTable+"&w=";
		
	}
	else
	{
		
	
		
		file=file+"?e="+ParElement+"&cod="+ParElementCod+"&c="+ParValor+"&t="+ParTable+"&w="+ParSqlWhere;
		//alert(file);//DEBUG
	}


		xmlHttp.open("GET", file,true);
		xmlHttp.send(null);
		xmlHttp.onreadystatechange=function (){
		
		if(xmlHttp.readyState==4)
		{
									
										
											document.getElementById("sug").innerHTML=xmlHttp.responseText;
											document.getElementById("sug").style.display="block";
									
										}else{
											document.getElementById("sug").innerHTML="Buscando dados...";
											document.getElementById("sug").style.display="block";
									
									
											}
									
									}//FIM DA FUNCAO DE ANALISE DO ESTADO DE RESPOSTA AJAX


}//FIM DA FUNCAO cidadeAutoCompletar()



















//#############################################################################################################################################
function restrictPage(___parNivelDir,___parPage,___parPageMother){
	
	
	
	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Bloqueando P&aacute;gina...</div>'+
																											
																											'</div>';

	
	
		file=___parNivelDir+"requires/restricted_page.php";
		file=file+"?page="+___parPage+"&page_mother="+___parPageMother;
		//alert(file);
	
		var xmlHttp=Cria_XmlHttpObject();




		xmlHttp.open("GET", file,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function (){
			
			
												if(xmlHttp.readyState==4)
												{
													
													
													response=xmlHttp.responseText;
													//alert(response);
													
													if(response == "1")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>P&aacute;gina bloqueada com sucesso!</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}





									
													if(response == "0")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>A P&aacute;gina n&atilde;o pode ser bloqueada. Contate o suporte: suporte@wingoo.com.br.</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}


												}
												
												else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1)
												{
													


														//xmlHttp.readyState==1,2,3
															
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Bloqueando P&aacute;gina...</div>'+
																											
																											'</div>';

														
													
														
													}			
			
			
			
			
			
									
									}//FIM DA FUNCAO DE ANALISE DO ESTADO DE RESPOSTA AJAX


}//












//#############################################################################################################################################
function in_restrictPage(___parNivelDir,___parPage,___parPageMother){
	
	
	
	//MOSTRO A TELA DE FUNDO COM 100% DE LARGURA
	var div=document.getElementById('transparent');
	div.style.display = "block";
	div.style.height = window.screen.height+"px";
	div.style.width = "100%";
													
								document.getElementById("loading_ajax").style.display="block";
								
								document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Desbloqueando P&aacute;gina...</div>'+
																											
																											'</div>';

	
	
		file=___parNivelDir+"requires/in_restricted_page.php";
		file=file+"?page="+___parPage+"&page_mother="+___parPageMother;
		//alert(file);
	
		var xmlHttp=Cria_XmlHttpObject();




		xmlHttp.open("GET", file,true);
		xmlHttp.send(null);
	    xmlHttp.onreadystatechange=function (){
			
			
												if(xmlHttp.readyState==4)
												{
													
													
													response=xmlHttp.responseText;
													//alert(response);
													
													if(response == "1")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>P&aacute;gina desbloqueada com sucesso!</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}





									
													if(response == "0")
													{
													
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>A P&aacute;gina n&atilde;o pode ser desbloqueada. Contate o suporte: suporte@wingoo.com.br.</div>'+
																											
																											'</div>';

													
														setTimeout('closeDiv("loading_ajax")', 5000);
														setTimeout('closeDiv("transparent")', 5000);
														
														
														
														window.location.reload();
													
													}


												}
												
												else if(xmlHttp.readyState==3 || xmlHttp.readyState==2 || xmlHttp.readyState==1)
												{
													


														//xmlHttp.readyState==1,2,3
															
														
														document.getElementById("loading_ajax").innerHTML='<div id="response_loading">'+
																											'<div>Desbloqueando P&aacute;gina...</div>'+
																											
																											'</div>';

														
													
														
													}			
			
			
			
			
			
									
									}//FIM DA FUNCAO DE ANALISE DO ESTADO DE RESPOSTA AJAX


}//












