
// FOI SUBSTTITUIDO O $ PARA $foo PARA SOLUCIONAR O PROBLEMA DO CONFLITO ENTRE OS SCRIPTS.

var $foo = jQuery.noConflict();

<!--
/******************************************************************************
 Produzido por Gustavo Valle
 Conteúdo protegido pela lei Nº 9.610/98 de Direitos Autorais.
 É expressamente proibida a cópia ou reprodução sem autorização.
/******************************************************************************/
/********************* FUNÇÕES GERAIS DO ADMINISTRADOR DO SISTEMA *************/
/******************************************************************************/
//Escreve o flash na div desejada para que nao precise clicar nele antes de usa-lo
//float
function ocultaMostraDiv(div){
	var objDiv = document.getElementById(div);
    if(objDiv.style.display=="none"){
        objDiv.style.display = "";
    }else{
        objDiv.style.display = "none";
    }
}

function criaElementoA(){
	
	$foo("body").prepend("<a id=\"id_logado\" href=\"logado.php\" onclick=\"return parent.hs.htmlExpand(this, {objectType:'iframe', wrapperClassName: 'draggable-header no-footer', width:352, height:300})\" style='display:none;'>.</a>");

}


function montaFlash(destino, flavez, width, height, trans, scale){

	var myFlash =
	'<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="'+width+'" height="'+height+'" id="'+flavez+'" align="middle" id="flashObject1">'+
	'<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="movie" value="swf/'+flavez+'.swf" />'
	;
	if (trans == "yes"){
		myFlash += '<param name="wmode" value="transparent" />';
	}
	if (scale == "yes"){
		myFlash += '<param name="scale" value="noscale" />';
	}
	myFlash +=
	'<param name="quality" value="high" />'+
	'<param name="bgcolor" value="#ffffff" />'+
	'<embed src="swf/'+flavez+'.swf" wmode="transparent" id="flashObject2" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="empresas" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
	'</object>'
	;
	document.getElementById(destino).innerHTML = myFlash;
}



function expandBanner(){
	if($foo("#ban_float_dentro").css("height")=="400px"){
		$foo("#ban_float_dentro").css("height", "94px");
		
	}else{
		$foo("#ban_float_dentro").css("height", "400px");
	}
}

// BUSCA DO GOOGLE
/******************************************************************************/

function verificaBusca(form){
	if(form.tipo.value == "google"){
		window.open("http://www.google.com/search?q="+form.busca.value,"google");
		return false;
	}
	return true
}



// LINK NO DIV
/******************************************************************************/
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
/******************************************************************************/
// MUDA IMAGEM NO MOUSE OVER
/******************************************************************************/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j] = new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/******************************************************************************/
// AUMENTE E DIMINUI TAMANHO DAS FONTES
/******************************************************************************/
var tam=10;
				function mudaFonte(tipo){
				if (tipo=="mais"){		
					tam+=5;
				}else{
					tam-=5;
				} 
				document.getElementById('tx').style.fontSize=tam+'px' ;
					
				}
/******************************************************************************/
// RESTRINGE OS CAMPOS A NUMÉRICO
/******************************************************************************/
function Numerico(Campo) {
	var	strValor = Campo.value;
	var intTam = strValor.length;
	var intLoop = 0;
	var strCaracter;
	for (; intLoop < intTam; intLoop++){
		strCaracter = strValor.substring(intLoop, intLoop + 1);
		if (strCaracter == 0 || strCaracter == 1 || strCaracter == 2 || strCaracter == 3 || strCaracter == 4 || strCaracter == 5 || strCaracter == 6 || strCaracter == 7 || strCaracter == 8 || strCaracter == 9 || strCaracter == ',' || strCaracter == '(' || strCaracter == ')' || strCaracter == '-' || strCaracter == ':' || strCaracter == '/' || strCaracter == '.') {
		}
		else{
			Campo.value = strValor.substring(0, intLoop );
		}
	}
}
/******************************************************************************/
// RESTRINGE SOMENTE PARA NÚMEROS
/******************************************************************************/
function Numeros(Campo) {
	var	strValor = Campo.value;
	var intTam = strValor.length;
	var intLoop = 0;
	var strCaracter;
	for (; intLoop < intTam; intLoop++){
		strCaracter = strValor.substring(intLoop, intLoop + 1);
		if (strCaracter == 0 || strCaracter == 1 || strCaracter == 2 || strCaracter == 3 || strCaracter == 4 || strCaracter == 5 || strCaracter == 6 || strCaracter == 7 || strCaracter == 8 || strCaracter == 9) {
		}
		else{
			Campo.value = strValor.substring(0, intLoop );
		}
	}
}
/******************************************************************************/
//Formata número tipo moeda usando o evento onKeyDown 

function MascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode); // Valor para o código da Chave
    if (strCheck.indexOf(key) == -1) return false; // Chave inválida
    len = objTextBox.value.length;
    for(i = 0; i < len; i++)
        if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) objTextBox.value = '';
    if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2) objTextBox.value = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        objTextBox.value = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        objTextBox.value += aux2.charAt(i);
        objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return false;
}
/******************************************************************************/
//COLOCA BARRAS NA DATA
/******************************************************************************/
function DataVer (formato,objeto)
{
	Campo = eval (objeto);
	// DATA
	if (formato=='data')
	{
		separador = '/'; 
		conjunto1 = 2;
		conjunto2 = 5;
		if (Campo.value.length == conjunto1)
		{
			Campo.value = Campo.value + separador;
		}
		if (Campo.value.length == conjunto2)
		{
			Campo.value = Campo.value + separador;
		}
	}
}
/******************************************************************************/
// VERIFICA QUANTIDADE DE DIAS EM FEVEREIRO
/******************************************************************************/
function DiasInFevereiro (pnAno) {
    return (  ((pnAno % 4 == 0) && ( (!(pnAno % 100 == 0)) || (pnAno % 400 == 0) ) ) ? 29 : 28 );
}

// VALIDA DATA
function ValidaData(field) {
	if (field.value == "") {
		return true;
	}
	var hoje = new Date();
	var anoAtual = hoje.getFullYear();
	var barras = field.value.split("/");
	if (barras.length == 3) {
		var dia = barras[0];
		var mes = barras[1];
		var ano = barras[2];
		var resultado = (!isNaN(dia) && (dia > 0) && (dia < 32)) && (!isNaN(mes) && (mes > 0) && (mes < 13)) && (!isNaN(ano) && (ano.length == 4));
		if (!resultado) {
			alert("Formato de data inválido. Ex.: (dd/mm/aaaa)");
			field.focus();
			field.select();
			return false;
		}
		if (ano.length != 4) {
			alert("O ano deve ter 4 digitos.");
			field.focus();
			field.select();
			return false;
		}
		//if (ano < anoAtual) {
			//alert("O ano não pode ser menor que o ano atual.");
			//field.focus();
			//field.select();
			//return false;
		//}
		dias = new Array(13);
		dias[1] = 31;
		dias[2] = DiasInFevereiro(ano);   // deve ser verificado o caso de anos bissextos
		dias[3] = 31;
		dias[4] = 30;
		dias[5] = 31;
		dias[6] = 30;
		dias[7] = 31;
		dias[8] = 31;
		dias[9] = 30;
		dias[10] = 31;
		dias[11] = 30;
		dias[12] = 31;
		if (dia > dias[mes]) {
			alert("Dia inválido.");
			field.focus();
			field.select();
			return false;
		}
	} else {
		alert("Formato de data inválido. Ex.: (dd/mm/aaaa)");
		field.focus();
		field.select();
		return false;
	}
}
/******************************************************************************/
// VALIDA HORA MINUTO
/******************************************************************************/
function ValidaHora(field) {
	if (field.value == "") {
		return true;
	}
	if (field.value.length != 5) {
		alert("Formato de hora inválido. Ex.: (hh:mm)");
		field.focus();
		field.select();
		return false;
	}
	var barras = field.value.split(":");
	if (barras.length == 2) {
		var hora = barras[0];
		var minuto = barras[1];
		var resultado = (!isNaN(hora) && (hora >= 0) && (hora < 24)) && (!isNaN(minuto) && (minuto >= 0) && (minuto < 60));
		if (!resultado) {
			alert("Formato de hora inválido. Ex.: (hh:mm)");
			field.focus();
			field.select();
			return false;
		}
	}
	else {
		alert("Formato da hora inválido. Ex.: (hh:mm)");
		field.focus();
		field.select();
		return false;
	}
}
/******************************************************************************/
//COLOCA PONTO E TRACO NO CEP
/******************************************************************************/
function CEPVer (formato,objeto)
{
	Campo = eval (objeto);
	// CEP
	if (formato=='cep')
	{
		separador1 = '.';
		separador2 = '-';
		conjunto1 = 2;
		conjunto2 = 6;
		if (Campo.value.length == conjunto1)
		{
			Campo.value = Campo.value + separador1;
		}
		if (Campo.value.length == conjunto2)
		{
			Campo.value = Campo.value + separador2;
		}
	}
}
/******************************************************************************/
// Valida o CEP
/******************************************************************************/
function ValidaCEP(field) {
	var lcValor = new String(field.value); 
	if (lcValor.length == 0) {
		return true;
	}
	// Último Caracter Digitado
	var lcCaracter_Digitado = lcValor.substring(lcValor.length - 1, 10);
	
	// Verifica se o usuário entrou com um caracter válido
	if ( !(lcCaracter_Digitado.charCodeAt() >=48 && lcCaracter_Digitado.charCodeAt() <= 57) ) {
		field.value = lcValor.substring(0, lcValor.length - 1);
		alert("Caracter inválido!");
		field.focus();
	}
	if (lcValor.length < 5) {
		if (lcCaracter_Digitado == "/") {
			// Remove caracter
			field.value = lcValor.substring(0, lcValor.length - 1);
			field.value = "";
			field.focus();
		}
	}
	if (lcValor.length == 5) {
		// Adiciona caracter
		field.value = poObjeto.value + "-";
		field.focus();
	}
	if (lcValor.length > 9) {
		if (lcCaracter_Digitado == "/") {
			// Remove caracter
			field.value = lcValor.substring(0, lcValor.length - 1);
			field.value = "";
			field.focus();
		}
	}
	return true;
}
/******************************************************************************/
//COLOCA BARRAS NO CPF
/******************************************************************************/
function CPFVer (formato,objeto)
{
	Campo = eval (objeto);
	// CPF
	if (formato=='cpf')
	{
		separador = '.';
		separador1 = '-';
		conjunto1 = 3;
		conjunto2 = 7;
		conjunto3 = 11;
		if (Campo.value.length == conjunto1)
		{
			Campo.value = Campo.value + separador;
		}
		if (Campo.value.length == conjunto2)
		{
			Campo.value = Campo.value + separador;
		}
		if (Campo.value.length == conjunto3)
		{
			Campo.value = Campo.value + separador1;
		}
	}
}
/******************************************************************************/
//VALIDA CPF
/******************************************************************************/
function validaCPF(campo) {
    cpf = campo.value;
    numeros = "0123456789"
    cpfx = "";
      for (x = 0; x <= 14; x++)
      {
      if (numeros.indexOf(cpf.charAt(x)) >= 0)
      cpfx = cpfx + cpf.charAt(x);
      }
  valor = true;
  erro = new String;
  //if (cpf.length < 11) erro += "CPF incompleto. ";
  //campo.value = "";
  var nonNumbers = /\D/;
  if (nonNumbers.test(cpfx)) erro += "A verificacao de CPF suporta apenas Números!";
  if (cpf == "000.000.000-00" || cpf == "111.111.111-11" || cpf == "222.222.222-22" || cpf == "333.333.333-33" || cpf == "444.444.444-44" || cpf == "555.555.555-55" || cpf == "666.666.666-66" || cpf == "777.777.777-77" || cpf == "888.888.888-88" || cpf == "999.999.999-99"){
      erro += "Número de CPF invalido!"
      //campo.value = "";
  }
  var a = [];
  var b = new Number;
  var c = 11;
  for (i=0; i<11; i++){
    a[i] = cpfx.charAt(i);
    if (i < 9) b += (a[i] *  --c);
  }
  if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
  b = 0;
  c = 11;
  for (y=0; y<10; y++) b += (a[y] *  c--);
  if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
  if ((cpfx.charAt(9) != a[9]) || (cpfx.charAt(10) != a[10])){
    erro +="Número de CPF invalido!";
    //campo.value = "";
  }
  if (erro.length > 0){
    alert(erro);
    campo.focus();
    return false;
  }
  return true;
  }
/******************************************************************************/
// VALIDA EMAILS
/******************************************************************************/
function ValidaEmail(field) {
	var mail='';
	if (field.value == '') { return false; }
	else { mail = field; }
	
	if (mail.value == "") {
		alert("Informe seu e-mail.");
		mail.focus();
		mail.select();
		return false;
	}
	else {
		prim = mail.value.indexOf("@")
		if (prim < 2) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf(".") < 1) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf(" ") != -1) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("zipmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("hotmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf(".@") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("@.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf(".com.br.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("/") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("[") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("]") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("(") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf(")") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
		if (mail.value.indexOf("..") > 0) {
			alert("O e-mail informado parece não estar correto.");
			mail.focus();
			mail.select();
			return false;
		}
	}
	return true;
}
/******************************************************************************/
//VALIDA A IMAGEM
/******************************************************************************/
function Submit_Imagem(){

var nomeForm = document.Registro_Imagem;

var txt_imagem=nomeForm.txt_imagem.value;
if (txt_imagem==""){
alert("Insira uma imagem.")
nomeForm.txt_imagem.focus()
return false
	}

extArray = new Array(".jpg");
var file=nomeForm.txt_imagem.value;
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1)
file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) { allowSubmit = true; break; }
}
if (allowSubmit) nomeForm.submit();
else
alert("Por favor, só serão aceitos arquivos nas terminações:  " 
+ (extArray.join("  ")) + "\nEscolha uma nova "
+ "imagem e envie novamente.");
return false

nomeForm.submit();
}
/******************************************************************************/
//VALIDA O ARQUIVO
/******************************************************************************/
function Submit_Arquivo(){

var nomeForm = document.Registro_Arquivo;

var txt_arquivo=nomeForm.txt_arquivo.value;
if (txt_arquivo==""){
alert("Insira um arquivo.")
nomeForm.txt_arquivo.focus()
return false
	}

extArray = new Array(".xls",".pdf");
var file=nomeForm.txt_arquivo.value;
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1)
file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) { allowSubmit = true; break; }
}
if (allowSubmit) nomeForm.submit();
else
alert("Por favor, só serão aceitos arquivos nas terminações:  " 
+ (extArray.join("  ")) + "\nEscolha um novo "
+ "arquivo e envie novamente.");
return false

nomeForm.submit();
}
/******************************************************************************/
// USUÁRIO E SENHA NO LOGIN
/******************************************************************************/
function Submit_Login(){

var nomeForm = document.Reg_Login;

var txt_email=nomeForm.txt_email.value;
if (txt_email==""){
alert("Digite seu E-mail.")
nomeForm.txt_email.focus()
return false
	}
/*TROCA ASPAS SIMPLES E DUPLAS POR CODIGO HTML*/
var HTMLEncode = txt_email;
HTMLEncode = HTMLEncode.replace(/["]+/g,'&quot;');
HTMLEncode = HTMLEncode.replace(/[']+/g,'&quot;');
HTMLEncode = HTMLEncode.replace(/[<]+/g,'&lt;');
HTMLEncode = HTMLEncode.replace(/[>]+/g,'&gt;');
/*********************************************/
nomeForm.txt_email.value = HTMLEncode

var txt_senha=nomeForm.txt_senha.value;
if (txt_senha==""){
alert("Digite sua Senha.")
nomeForm.txt_senha.focus()
return false
	}
/*TROCA ASPAS SIMPLES E DUPLAS POR CODIGO HTML*/
var HTMLEncode1 = txt_senha;
HTMLEncode1 = HTMLEncode1.replace(/["]+/g,'&quot;');
HTMLEncode1 = HTMLEncode1.replace(/[']+/g,'&quot;');
HTMLEncode1 = HTMLEncode1.replace(/[<]+/g,'&lt;');
HTMLEncode1 = HTMLEncode1.replace(/[>]+/g,'&gt;');
/*********************************************/
nomeForm.txt_senha.value = HTMLEncode1

}
/******************************************************************************/
// VALIDA BUSCA
/******************************************************************************/
function Submit_Buscador(){

var nomeForm = document.Registro_Buscador;

var txt_busca=nomeForm.txt_busca.value;
if (txt_busca==""){
alert("Digite uma palavra para a busca.")
nomeForm.txt_busca.focus()
return false
	}

nomeForm.submit();
}
//******************************************************************************/
//VALIDA ENVIO DE CONTATO
/******************************************************************************/
function Submit_Contato(){

var nomeForm = document.Registro_Contato;

var txt_nome=nomeForm.txt_nome.value;
if (txt_nome==""){
alert("Digite o seu nome.")
nomeForm.txt_nome.focus()
return false
	}

var txt_email=nomeForm.txt_email.value;
if (txt_email==""){
alert("Didite o seu e-mail.")
nomeForm.txt_email.focus()
return false
	}
	
var txt_telefone=nomeForm.txt_telefone.value;
if (txt_telefone==""){
alert("Didite o seu telefone.")
nomeForm.txt_telefone.focus()
return false
	}


	marcado = -1
	for (i=0; i<nomeForm.txt_assunto.length; i++) {
		if (nomeForm.txt_assunto[i].checked) {
			marcado = i
			resposta = nomeForm.txt_assunto[i].value
		}
	}
	
	if (marcado == -1) {
		alert("Selecione o assunto.");
		nomeForm.txt_assunto[0].focus();
		return false;
	}


var txt_texto=nomeForm.txt_texto.value;
if (txt_texto==""){
alert("Didite o texto.")
nomeForm.txt_texto.focus()
return false
	}

nomeForm.submit();
}
/******************************************************************************/
// -->	
 /******************************************************************************/
// POPUP
/******************************************************************************/
function Popup(mypage, popup, w, h, scroll, _title) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, popup, winprops)
	if (parseInt(navigator.appVersion) >= 4)
	{
		win.window.focus();
	}
	if(!(_title == undefined))setTimeout(mudaTitle, 500);
	function mudaTitle()
	{
		
		if(win.document.title == "" || win.document.title == null)
		{
			setTimeout(mudaTitle, 500);
		}
		else
		{
			win.document.title = _title;
		}
	}
	
}


function Popup2(mypage, popup, w, h, scroll) {
	var winl = (screen.width - 990) / 2;
	var wint = (screen.height - 500) / 2;
	winprops = 'height='+500+',width='+990+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, popup, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
function jrs_Valida(campo, prox, total)
{
	if(campo.value.length>total-1)document.getElementById(prox).focus();
}
function topAll()
{
	var url = window.parent.location.href;
	if(url.indexOf("#") == -1)window.parent.location.href = url+"#";
	else window.parent.location.href = url
}

function abreRegistro() {
	parent.principal.window.location = "registro.php";
	parent.hs.close();
}

function abreInscricao() {
	parent.principal.window.location = "contato.php";
	parent.hs.close();
}

function Email(mailField){
  strMail = mailField.value;
  var re = new RegExp;
  re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  var arr = re.exec(strMail);
  if (arr == null)
    return(false);
  else
    return(true);
}

function Inscricao(){

  	var nomeForm = document.Registro_Inscricao;
	
	var nome=nomeForm.nome.value;
	var endereco=nomeForm.endereco.value;
	var pais=nomeForm.pais.value;
	var cidade=nomeForm.cidade.value;
	var uf=nomeForm.uf.value;
	var cep1=nomeForm.cep1.value;
	var cep2=nomeForm.cep2.value;
	var cpf=nomeForm.cpf.value;
	var crm=nomeForm.crm.value;
	var especialidade=nomeForm.especialidade.value;
	var hospital_referencia=nomeForm.hospital_referencia.value;
	var celu_ddd=nomeForm.celu_ddd.value;
	var celu_num=nomeForm.celu_num.value;
	var resid_ddd=nomeForm.resid_ddd.value;
	var resid_num=nomeForm.resid_num.value;
	var email=nomeForm.email.value;
	var acompanhante=nomeForm.acompanhante.value;

	if (nome==""){
		alert("Digite o nome.");
		nomeForm.nome.focus();
		return false;
	}
	if (endereco==""){
		alert("Digite o Endereco.");
		nomeForm.endereco.focus();
		return false;
	}
	if (pais==""){
		alert("Digite o Pais.");
		nomeForm.pais.focus();
		return false;
	}
	if (cidade==""){
		alert("Digite a Cidade.");
		nomeForm.cidade.focus();
		return false;
	}
	if (uf==""){
		alert("Digite o UF.");
		nomeForm.uf.focus();
		return false;
	}
	if (cep1==""){
		alert("Digite o CEP.");
		nomeForm.cep1.focus();
		return false;
	}
	if (cep2==""){
		alert("Digite o CEP.");
		nomeForm.cep2.focus();
		return false;
	}
	if (cpf==""){
		alert("Digite o CPF.");
		nomeForm.cpf.focus();
		return false;
	}
	if (crm==""){
		alert("Digite o CRM.");
		nomeForm.crm.focus();
		return false;
	}
	if (especialidade==""){
		alert("Informe a Especialidade.");
		nomeForm.especialidade.focus();
		return false;
	}
	if (hospital_referencia==""){
		alert("Digite o Hospital Referencia.");
		nomeForm.hospital_referencia.focus();
		return false;
	}
	if (celu_ddd==""){
		alert("Digite o DDD do Celular.");
		nomeForm.celu_ddd.focus();
		return false;
	}
	if (celu_num==""){
		alert("Digite o Numero do Celular.");
		nomeForm.celu_num.focus();
		return false;
	}
	if (resid_ddd==""){
		alert("Digite o DDD Residencial.");
		nomeForm.celu_ddd.focus();
		return false;
	}
	if (resid_num==""){
		alert("Digite o Numero Residencial.");
		nomeForm.resid_num.focus();
		return false;
	}
	if (email==""){
		alert("Digite seu E-mail.");
		nomeForm.email.focus();
		return false;
	} else if (!Email(nomeForm.email)) {
		alert("Formato incorreto de e-mail.");
		nomeForm.email.focus();
		return false;
	}
	if (acompanhante==""){
		alert("Digite o Acompanhante.");
		nomeForm.acompanhante.focus();
		return false;
	}
	return true; 
	topAll();
}

function Valida_Registro(){
	
	var nomeForm = document.Form_Registro;
	
	var nome			= nomeForm.nome.value;
	var dia				= nomeForm.dia.value;
	var mes				= nomeForm.mes.value;
	var ano				= nomeForm.ano.value;
	var pais			= nomeForm.pais.value;
	var cidade			= nomeForm.cidade.value;
	var uf				= nomeForm.uf.value;
	var endereco		= nomeForm.endereco.value;
	var num_endereco	= nomeForm.num_endereco.value;
	var complemento		= nomeForm.complemento.value;
	var bairro			= nomeForm.bairro.value;
	var cep1			= nomeForm.cep1.value;
	var cep2			= nomeForm.cep2.value;
	var celu_ddd		= nomeForm.celu_ddd.value;
	var celu_num		= nomeForm.celu_num.value;
	var resid_ddd		= nomeForm.resid_ddd.value;
	var resid_num		= nomeForm.resid_num.value;
	var email			= nomeForm.email.value;
	var instituicao		= nomeForm.instituicao.value;
	var hospital_referencia = nomeForm.hospital_referencia.value;
	var cidade_instituicao = nomeForm.cidade_instituicao.value;
	var uf_instituicao	= nomeForm.uf_instituicao.value;
	var login			= nomeForm.login.value;
	var login_confirma	= nomeForm.login_confirma.value;
	var senha			= nomeForm.senha.value;
	var senha_confirma	= nomeForm.senha_confirma.value;

	if (nome==""){
		alert("Digite o nome.");
		nomeForm.nome.focus();
		return false;
	}
	if (dia==""){
		alert("Digite o Dia Nascimento.");
		nomeForm.dia.focus();
		return false;
	}
	if ((dia < 1) || (dia > 31)) {
		alert("Digite dia entre 1 e 31.");
		nomeForm.dia.focus();
		return false;		
	}
	if (mes==""){
		alert("Digite o Mes de Nascimento.");
		nomeForm.mes.focus();
		return false;
	}
	if ((mes < 1) || (mes > 12)) {
		alert("Digite mes entre 1 e 12.");
		nomeForm.mes.focus();
		return false;		
	}
	if (ano==""){
		alert("Digite o Ano de Nascimento.");
		nomeForm.ano.focus();
		return false;
	}
	if (pais==""){
		alert("Digite o Pais.");
		nomeForm.pais.focus();
		return false;
	}
	if (cidade==""){
		alert("Digite a Cidade.");
		nomeForm.cidade.focus();
		return false;
	}
	if (uf==""){
		alert("Digite o Estado.");
		nomeForm.uf.focus();
		return false;
	}
	if (endereco==""){
		alert("Digite o Endereco.");
		nomeForm.endereco.focus();
		return false;
	}
	if (num_endereco==""){
		alert("Digite o Numero do Endereco.");
		nomeForm.num_endereco.focus();
		return false;
	}
	if (complemento==""){
		alert("Digite o Complemento.");
		nomeForm.complemento.focus();
		return false;
	}
	if (bairro==""){
		alert("Digite o Bairro.");
		nomeForm.bairro.focus();
		return false;
	}
	if (cep1==""){
		alert("Digite o CEP.");
		nomeForm.cep1.focus();
		return false;
	}
	if (cep2==""){
		alert("Digite o CEP.");
		nomeForm.cep2.focus();
		return false;
	}
	if (celu_ddd==""){
		alert("Digite o DDD do Celular.");
		nomeForm.celu_ddd.focus();
		return false;
	}
	if (celu_num==""){
		alert("Digite o Numero do Celular.");
		nomeForm.celu_num.focus();
		return false;
	}
	if (resid_ddd==""){
		alert("Digite o DDD Residencial.");
		nomeForm.resid_ddd.focus();
		return false;
	}
	if (resid_num==""){
		alert("Digite o Numero Residencial.");
		nomeForm.resid_num.focus();
		return false;
	}
	if (email==""){
		alert("Digite seu E-mail.");
		nomeForm.email.focus();
		return false;
	} else if (!Email(nomeForm.email)) {
		alert("Formato incorreto de e-mail.");
		nomeForm.email.focus();
		return false;
	}	
	if (instituicao==""){
		alert("Digite a Instituicao.");
		nomeForm.instituicao.focus();
		return false;
	}
	if (hospital_referencia==""){
		alert("Digite o Hospital Referencia.");
		nomeForm.hospital_referencia.focus();
		return false;
	}
	if (cidade_instituicao==""){
		alert("Informe a cidade da Instituicao.");
		nomeForm.cidade_instituicao.focus();
		return false;
	}
	if (uf_instituicao==""){
		alert("Informe a estado da Instituicao.");
		nomeForm.uf_instituicao.focus();
		return false;
	}
	if (login==""){
		alert("Digite o Login.");
		nomeForm.login.focus();
		return false;
	}
	if (login_confirma==""){
		alert("Confirme o Login.");
		nomeForm.login_confirma.focus();
		return false;
	}
	if (senha==""){
		alert("Digite a Senha.");
		nomeForm.senha.focus();
		return false;
	}
	if (senha_confirma==""){
		alert("Confirme a Senha.");
		nomeForm.senha_confirma.focus();
		return false;
	}
	return true;	
}



function Valida_Dados_Cadastrais(){
	
	var nomeForm = document.Form_Dados_Cadastrais;
	
	var nome			= nomeForm.nome.value;
	var dia				= nomeForm.dia.value;
	var mes				= nomeForm.mes.value;
	var ano				= nomeForm.ano.value;
	var pais			= nomeForm.pais.value;
	var cidade			= nomeForm.cidade.value;
	var uf				= nomeForm.uf.value;
	var endereco		= nomeForm.endereco.value;
	var num_endereco	= nomeForm.num_endereco.value;
	var complemento		= nomeForm.complemento.value;
	var bairro			= nomeForm.bairro.value;
	var cep1			= nomeForm.cep1.value;
	var cep2			= nomeForm.cep2.value;
	var celu_ddd		= nomeForm.celu_ddd.value;
	var celu_num		= nomeForm.celu_num.value;
	var resid_ddd		= nomeForm.resid_ddd.value;
	var resid_num		= nomeForm.resid_num.value;
	var email			= nomeForm.email.value;
	var instituicao		= nomeForm.instituicao.value;
	var hospital_referencia = nomeForm.hospital_referencia.value;
	var cidade_instituicao = nomeForm.cidade_instituicao.value;
	var uf_instituicao	= nomeForm.uf_instituicao.value;
	var login			= nomeForm.login.value;
	var login_confirma	= nomeForm.login_confirma.value;
	var senha			= nomeForm.senha.value;
	var senha_confirma	= nomeForm.senha_confirma.value;

	if (nome==""){
		alert("Digite o nome.");
		nomeForm.nome.focus();
		return false;
	}
	if (dia==""){
		alert("Digite o Dia Nascimento.");
		nomeForm.dia.focus();
		return false;
	}
	if ((dia < 1) || (dia > 31)) {
		alert("Digite dia entre 1 e 31.");
		nomeForm.dia.focus();
		return false;		
	}
	if (mes==""){
		alert("Digite o Mes de Nascimento.");
		nomeForm.mes.focus();
		return false;
	}
	if ((mes < 1) || (mes > 12)) {
		alert("Digite mes entre 1 e 12.");
		nomeForm.mes.focus();
		return false;		
	}
	if (ano==""){
		alert("Digite o Ano de Nascimento.");
		nomeForm.ano.focus();
		return false;
	}
	if (pais==""){
		alert("Digite o Pais.");
		nomeForm.pais.focus();
		return false;
	}
	if (cidade==""){
		alert("Digite a Cidade.");
		nomeForm.cidade.focus();
		return false;
	}
	if (uf==""){
		alert("Digite o Estado.");
		nomeForm.uf.focus();
		return false;
	}
	if (endereco==""){
		alert("Digite o Endereco.");
		nomeForm.endereco.focus();
		return false;
	}
	if (num_endereco==""){
		alert("Digite o Numero do Endereco.");
		nomeForm.num_endereco.focus();
		return false;
	}
	if (complemento==""){
		alert("Digite o Complemento.");
		nomeForm.complemento.focus();
		return false;
	}
	if (bairro==""){
		alert("Digite o Bairro.");
		nomeForm.bairro.focus();
		return false;
	}
	if (cep1==""){
		alert("Digite o CEP.");
		nomeForm.cep1.focus();
		return false;
	}
	if (cep2==""){
		alert("Digite o CEP.");
		nomeForm.cep2.focus();
		return false;
	}
	if (celu_ddd==""){
		alert("Digite o DDD do Celular.");
		nomeForm.celu_ddd.focus();
		return false;
	}
	if (celu_num==""){
		alert("Digite o Numero do Celular.");
		nomeForm.celu_num.focus();
		return false;
	}
	if (resid_ddd==""){
		alert("Digite o DDD Residencial.");
		nomeForm.resid_ddd.focus();
		return false;
	}
	if (resid_num==""){
		alert("Digite o Numero Residencial.");
		nomeForm.resid_num.focus();
		return false;
	}
	if (email==""){
		alert("Digite seu E-mail.");
		nomeForm.email.focus();
		return false;
	} else if (!Email(nomeForm.email)) {
		alert("Formato incorreto de e-mail.");
		nomeForm.email.focus();
		return false;
	}	
	if (instituicao==""){
		alert("Digite a Instituicao.");
		nomeForm.instituicao.focus();
		return false;
	}
	if (hospital_referencia==""){
		alert("Digite o Hospital Referencia.");
		nomeForm.hospital_referencia.focus();
		return false;
	}
	if (cidade_instituicao==""){
		alert("Informe a cidade da Instituicao.");
		nomeForm.cidade_instituicao.focus();
		return false;
	}
	if (uf_instituicao==""){
		alert("Informe a estado da Instituicao.");
		nomeForm.uf_instituicao.focus();
		return false;
	}
	if (login==""){
		alert("Digite o Login.");
		nomeForm.login.focus();
		return false;
	}
	return true;	
}



//******************************************************************************/
//CONTROLE CENTRAL DE DOWNLOAD
/******************************************************************************/


var destWidth;
var qtdImovel;

function centDownloads(){
	qtdImovel = $foo(".downloads_container div.geral > div").length;
	destWidth = qtdImovel*108;
	$foo(".downloads_container div.geral").css("width",destWidth);
	
	if(qtdImovel<=4){
		$foo("img.avancar").attr("src", "img/btn_seta_dir_disabled.jpg");
		$foo(".btn_dir a").attr("onclick","");
		$foo("img.voltar").attr("src", "img/btn_seta_esq_disabled.jpg");
		$foo(".btn_esq a").attr("onclick","");
	}else{
		$foo("img.avancar").attr("src", "img/btn_seta_dir_enabled.jpg");
		$foo(".btn_dir a").attr("href","javascript:avancar();");
		$foo("img.voltar").attr("src", "img/btn_seta_esq_disabled.jpg");
		$foo(".btn_esq a").attr("href","javascript:;");
	}
	
}

/*

// ESTE MOVE DE 4 EM 4 QUADRO---------------------
function avancar(){
	var margin = $foo(".downloads_container div.geral").css("marginLeft").replace("px","");
	var pontoRef = (destWidth-432)*(-1);
	var sobra = destWidth%4;
	
	$foo(".btn_dir a").attr("href","javascript:;");
	
	//alert("w: "+destWidth+"  ref: "+pontoRef);
	if((margin-432)<pontoRef){
		//move = (4-sobra)*108;
		move = -(margin-432-pontoRef);
		moveDownloads(-move, margin);
	}else{
		moveDownloads(-432, margin);
	}
}

function voltar(){
	var margin = $foo(".downloads_container div.geral").css("marginLeft").replace("px","");
	var sobra = destWidth%4;
	
	$foo(".btn_esq a").attr("href","javascript:;");
	if(margin > -432){
		//move = (4-sobra)*108;
		move = -margin;
		$foo(".btn_dir a").attr("href","javascript:;");
		moveDownloads(move, margin);
	}else{
		moveDownloads(432, margin);
	}
	
}

//-----------------------------------------------

*/


// ESTE MOVE DE 1 EM 1 QUADRO---------------------

function voltar(){
	var margin = $foo(".downloads_container div.geral").css("marginLeft").replace("px","");
	moveDownloads(108, margin);
}

function avancar(){
	var margin = $foo(".downloads_container div.geral").css("marginLeft").replace("px","");
	moveDownloads(-108, margin);
}

//-----------------------------------------------

function moveDownloads(num, margin){
	
	$foo(".btn_esq a").attr("href","javascript:;");
	$foo(".btn_dir a").attr("href","javascript:;");
	var movimenta = parseInt(margin)+num;
	//$foo(".downloads_container div.geral").html("merda");
	$foo(".downloads_container div.geral").animate({ 
        marginLeft: parseInt(movimenta)+"px"
	}, 250, "swing", verifica );
}

function verifica(){
	
	var margin = $foo(".downloads_container div.geral").css("marginLeft").replace("px","");
	var pontoRef = (destWidth-432)*(-1);
	
	if(margin==0 && destWidth>432){
		$foo("img.voltar").attr("src", "img/btn_seta_esq_disabled.jpg");
		$foo(".btn_dir a").attr("href","javascript:avancar();");
		$foo(".btn_esq a").attr("href","javascript:;");
	}else if(margin==pontoRef && destWidth>432){
		$foo("img.avancar").attr("src", "img/btn_seta_dir_disabled.jpg");
		$foo(".btn_esq a").attr("href","javascript:voltar();");
		$foo(".btn_dir a").attr("href","javascript:;");
	}else{
		$foo("img.avancar").attr("src", "img/btn_seta_dir_enabled.jpg");
		$foo(".btn_dir a").attr("href","javascript:avancar();");
		$foo("img.voltar").attr("src", "img/btn_seta_esq_enabled.jpg");
		$foo(".btn_esq a").attr("href","javascript:voltar();");
	}	
}