function OpenWin(url,title,options) {
	window.open(url,title,options);
}
function validarPesquisa(frm) {
	if (frm.txtPesquisa.value == "") {
		alert("Por favor, informe o texto a ser pesquisado.");
		frm.txtPesquisa.focus();
		return(false);
	}
	return(true);
}
function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
function restauraTroca() { 
	var i,x,a=document.origem; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function carregaImagens() { 
	var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=carregaImagens.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
function buscaObjeto(n, d) { 
	var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=buscaObjeto(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function trocaImagens() { 
	var i,j=0,x,a=trocaImagens.arguments; document.origem=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=buscaObjeto(a[i]))!=null){document.origem[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


count = 0;
count2 = 80;
pontinho= '|';
function precarrega() {
	imgVar = new Image();
	imgVar.src = imagemVar;
	loadCheck();
}
function loadCheck() {
	if(pontinho.length == 20) {
		pontinho = '|';
	}
	pontinho = pontinho + '|';
	if (imgVar.complete || navigator.appName == "Netscape") {
		terminacount();
		if (imgVar.width >= screen.availWidth || imgVar.height >= screen.availHeight) {
			scrollVar="yes";
		} else{
			scrollVar="no";
		}
		configura="width=500,height=500,resizable=no,top=50,scrollbars="+scrollVar+",left=150"
		pop=window.open('/show_img.htm','',configura);
		count=0;
		if (navigator.appName == "Netscape"){
			setTimeout("pop.location.reload();", 3000);
			setTimeout("pop.location.reload();", 200);
		}
	} else {
		if (count < 80) {
			count = count + 1;
			setTimeout('loadCheck()',200);
			window.status = 'Carregando Imagem... '+count+'% '+pontinho;
		} else { 
			setTimeout('loadCheck()',200);
			window.status = 'Carregando Imagem... '+count2+'% '+pontinho;
		}
	}
}
function terminacount() {
	if (count2 < 100) {
		count2 = count2 + 5;
		window.status = '';
		//window.status = 'Imagem Carreganda '+count2+'%';
		setTimeout('terminacount()',10);
	} else {
		window.status = '';
		//window.status = 'Imagem Carregada 100%';
	}
}
function ValidaFormNewsletter(theForm) {
	if (theForm.nome.value == "") {
		alert("Preencha o campo Nome.");
		theForm.nome.focus();
		return (false);
	}
	 if (theForm.email.value == "")
	 {
	   alert("Preencha o campo E-mail.");
	   theForm.email.focus();
	   return (false);
	 }
	 else {
			if (theForm.email.value.indexOf('@', 0) == -1) {	
			  	alert("Preencha o campo E-mail corretamente.");
			  	theForm.email.focus();
			  	return(false);
			}
			if (theForm.email.value.indexOf('.', 0) == -1) {
			    alert("Preencha o campo E-mail corretamente.");
			  	theForm.email.focus();
			  	return(false);
			}
	 }
	 if (theForm.estado.value == "")
	 {
	   alert("Selecione o Estado.");
	   theForm.estado.focus();
	   return (false);
	 }
	 if (theForm.pais.value == "")
	 {
	   alert("Selecione o País.");
	   theForm.pais.focus();
	   return (false);
	 }
	if (theForm.ano.value == "") {
		alert("Preencha o campo Ano de Nascimento.");
		theForm.ano.focus();
		return (false);
	}
	if (theForm.ano.value < 1900 || theForm.ano.value > 2000) {
		alert("Preencha o campo Ano de Nascimento corretamente.");
		theForm.ano.focus();
		return (false);
	}
	return (true);
}
