function ajaxcar(local,programa,params) {
	if (params == null) {params = {nada: 0};}
//	$('loading').show();
	new Ajax.Updater(local, programa,
					 {
						 method: 'get',
						 encoding: 'ISO-8859-1',
						 parameters: params,
						 onComplete: function(transport) {
//							  $('loading').hide();
							  },
						  onFailure : function (transport) {
							  alert ('Ocorreu um erro inesperado!\nFavor, efetue login novamente.');							 
							  }
					 });
	//$('titulo_campanhas').update('Resultado da busca');
}

function voltar(elem){
		document.location.href = elem;
	}


function ValidCamp(identificador, Char, TxtMsg)
	{
		
			if(identificador.value.length < Char)
			{
				alert(TxtMsg);
				identificador.focus();
				return false
			}else{
				return true
			}
	}


function ValidCamp2(campo1, campo2, char1, char2, txt1, txt2)
{
 	if(campo1.value.length < char1)
	{
	 	alert(txt1);
		campo1.focus();
		return false
	}

 	else if(campo2.value.length < char2)
	{
	 	alert(txt2);
		campo2.focus();
		return false
	}
	else
	{   return true		}


}

function ValidaFaleConosco(formaulario)
{
	if(RegExp(/[0-9]/, formaulario.NmFaleConosco.assert))
	{
			alert("Erro");
			return false;
	}
	return false;
}


function MostrarTrailer(flv)
{
	$("CarregaTrailer").style.display = "block";
	$("CarregaTrailer").innerHTML = 
	"<div style=\"text-align:right;margin-bottom:15px; margin-right:10px; ;margin-top:15px;\"><span style=\"cursor:pointer;\" onClick=\"FecharTrailer()\">Fechar</div>"+
	"<div>"+
	"<div style=\"width:35px; float:left;\" >&nbsp;</div>"+
	"<div style=\"width:330px; float:left;\" >"+
	"<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"320\" height=\"320\" align=\"center\">"+
	"<param name=\"allowScriptAccess\" value=\"sameDomain\" />"+
	"<param name=\"movie\" value=\"trailer.swf?CarregarFlv="+flv+"\" />"+
	"<param name=\"quality\" value=\"high\" />"+
	"<param name=\"bgcolor\" value=\"#333333\" />"+
	"<embed src=\"trailer.swf?CarregarFlv="+flv+"\" quality=\"high\" bgcolor=\"#333333\" width=\"330\" height=\"320\" align=\"center\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"+
"	</object>"+
	"</div>"+
	
"</div>"

;
}


function FecharTrailer()
{
	$("CarregaTrailer").style.display = "none";
	$("CarregaTrailer").innerHTML = "";
}


function AbrirDivFac(campo)
{
	NVarAlvo = document.getElementById(campo);
	NVarAlvo.style.display = "block";
}

function FecharDivFac(campo)
{
	NVarAlvo = document.getElementById(campo);
	NVarAlvo.style.display = "none";
}

function AutoDivDisplay(id)
{
	NVarAlvo = document.getElementById(id);
	
	if(NVarAlvo.style.display == "none")
	{
		NVarAlvo.style.display = "block";
	}else{
		NVarAlvo.style.display = "none";
	}
	
}

function AutoDivDisplayCEP(id)
{
	NVarAlvo = (id);
	if(NVarAlvo == "Alvo0")
	{
		Alvo0.style.display = "block";
		Alvo1.style.display = "none";		
	}
	else if(NVarAlvo == "Alvo1")
	{
		Alvo1.style.display = "block";
		Alvo0.style.display = "none";		
	}
}




function ajaxcarRelatorio (local,programa,params) {
	if (params == null) {params = {nada: 0};}
//	$('loading').show();
	new Ajax.Updater(local, programa,
					 {
						 method: 'post',
						 encoding: 'ISO-8859-1',
						 parameters: params,
						 onComplete: function(transport) {
//							  $('loading').hide();
							  },
						  onFailure : function (transport) {
							  alert ('Ocorreu um erro inesperado!\nFavor, efetue login novamente.');							 
							  }
					 });
	//$('titulo_campanhas').update('Resultado da busca');
}

function ValidaVariavel(variavel)
{
	if(variavel == "")
	{
		return "";
	}else{
		return variavel;
	}
}


function BuscaAjaxLocadoras(NmForm)
{
	
	NmForm2 = new Array;
	for(i=0;i < NmForm.length-1;i++)
	{
		NmForm2[NmForm[i].name] = NmForm[i].value;
	}
		
	ajaxcarRelatorio("ajaxRelatorioCatalogo", "ajax_catalogo.php", NmForm2);
	return false;
}

var backupbody = "";
var StModoVisual = 0;

function ApplyAlpha(div)
{
	if(StModoVisual == 0)
	{
		StModoVisual = 1;
		ModifyPage(div);
		$("BotaoAcaoView").value = "Retornar";
	}else{
		StModoVisual = 0;
		backupPage();
		$("BotaoAcaoView").value = "Imprimir";
	}
}

function ModifyPage(div)
{
		this.conteudo = div.innerHTML;
		backupbody = document.body.innerHTML;
		document.body.innerHTML = this.conteudo;
}

function backupPage()
{
	document.body.innerHTML = backupbody;
}

function CarregaGoogleMpas(NovoSrc)
{
	
	document.getElementById("DivMenuGoogleMaps").style.display = "block";
	
	document.getElementById("IframeMenuGoogleMaps").src = NovoSrc;
	
	document.getElementById("IframeMenuGoogleMaps").style.Width = 425;
	document.getElementById("IframeMenuGoogleMaps").style.Height = 350;
	
}

function FecharGoogleMapa()
{
		document.getElementById("DivMenuGoogleMaps").style.display = "none";
		document.getElementById("IframeMenuGoogleMaps").src = "";
}







/*

function AlterarStatusCep(E_Id, E_Status, E_este)
{
	$("loading").style.display = "block";
	ajaxcar('BoxAjaxLoad', '_car_alterar_cep.php', {id: E_Id, status: E_Status});

	if(E_Status == 0)
	{
		document.getElementById(E_este).src = "_imgs/ATIVADO.jpg";
	}else{
		document.getElementById(E_este).src = "_imgs/DESATIVAR.jpg";
	}
	$("loading").style.display = "none";
}
*/
