<!--
function AbrirPopup(url,titulo,parametros) {
	window.open(url,titulo,parametros);
}
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}
function getStyle(el,styleProp) {
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}
function aumentarFonte() {
	var increment = 1;
	var el = "Body";
	var styleProp = "font-size";
	if (navigator.appName == "Microsoft Internet Explorer" && styleProp == "font-size") {
		styleProp = "fontSize";
	}
	var result = getStyle(el,styleProp);
	var sizeOfBaseFont = result.substring(0,result.length-2);
	sizeOfBaseFont = (parseInt(sizeOfBaseFont) + parseInt(increment));
	document.getElementById(el).style.fontSize = sizeOfBaseFont+"px";
}
function diminuirFonte() {
	var increment = 1;
	var el = "Body";
	var styleProp = "font-size";
	if (navigator.appName == "Microsoft Internet Explorer" && styleProp == "font-size") {
		styleProp = "fontSize";
	}
	var result = getStyle(el,styleProp);
	var sizeOfBaseFont = result.substring(0,result.length-2);
	sizeOfBaseFont = (parseInt(sizeOfBaseFont) - parseInt(increment));
	document.getElementById(el).style.fontSize = sizeOfBaseFont+"px";
}
function tamanhoPadrao() {
	var el = "Body";
	document.getElementById(el).style.fontSize = "10px";
}
function CapaVerGaleria() {
	document.getElementById("idCategoria").value = 0;
	document.getElementById("acaoNavGalerias").value = "exibir";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
}
function CategoriaVerGaleria() {
	document.getElementById("idCategoria").value = 0;
	document.getElementById("acaoNavGalerias").value = "exibir_galeria";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
}
function ExibicaoVerGaleria() {
	document.getElementById("idCategoria").value = 0;
	document.getElementById("acaoNavGalerias").value = "exibir_galeria";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
}
function CapaVerCategoria() {
	if (document.getElementById("idCategoria").value != "0") {
		document.getElementById("acaoNavGalerias").value = "exibir_categoria";
		document.getElementById("FormularioDeNavegacaoGalerias").submit();
	} else {
		window.alert("Por favor selecione uma categoria.");
	}
}
function CategoriaVerCategoria() {
	if (document.getElementById("idCategoria").value != "0") {
	document.getElementById("acaoNavGalerias").value = "exibir";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
	} else {
		window.alert("Por favor selecione uma categoria.");
	}
}

function ExibicaoVerCategoria() {
	if (document.getElementById("idCategoria").value != "0") {
	document.getElementById("acaoNavGalerias").value = "exibir_categoria";
	document.getElementById("FormularioDeNavegacaoGalerias").submit();
	} else {
		window.alert("Por favor selecione uma categoria.");
	}
}
function ComentarFoto() {
	var emailValido = document.getElementById("Email").value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	if (emailValido) {
		var alerta = 0;
		if (document.getElementById("Nome").value=="") { alerta=1 } else {''}
		if (document.getElementById("Comentario").value=="") { alerta=1 } else {''}
		if (alerta==1) {
			window.alert("Por favor preencha todos os campos.");
		} else {
			document.getElementById("FormularioDeComentarioFoto").submit();
		}
	} else {
		window.alert("Por favor forneça um endereço de e-mail válido.");
	}
}
function VerResultadoEnquete(idWebSite) {
	window.open('/oktiva.net/'+idWebSite+'/pagOrigem/pagEnquete/acao/mostrarResultado/iframe/','','location=no,scrollbars=no,menubar=no,resizable=no,status=no,toolbar=no,width=240,height=280','');
}
function Votar() {
	window.open('','pagResultadoEnquete','location=no,scrollbars=no,menubar=no,resizable=no,status=no,toolbar=no,width=240,height=280','');
	document.getElementById("FormularioEnquete").submit();
}

function pedido(acao) {
	if (acao == "exibir") {
		document.getElementById("pagOrigemFormularioDePedido").value = "pag_ver_pedido";
	} else {
		document.getElementById("pagOrigemFormularioDePedido").value = "pag_ver_foto_galeria";
	}
	document.getElementById("acaoFormularioDePedido").value = acao;
	document.getElementById("FormularioDePedido").submit();
}

function alterar_pedido(acao,idItem) {
	if (acao == 'remover_item') {
		document.getElementById("idItemFormularioDePedido").value = idItem;
	}
	document.getElementById("acaoFormularioDePedido").value = acao;
	if (document.getElementById("acaoFormularioDePedido").value == 'enviar_pedido') {
		$alerta = 0;
		if (document.getElementById("Nome").value=="") { $alerta = 1; }
		if (document.getElementById("Email").value=="") { $alerta = 1; }
		if (document.getElementById("Telefone").value=="") { $alerta = 1; }
		if ($alerta == 1) {
			window.alert("Os campos \"Nome\", \"Email\" e \"Telefone\" devem ser preenchidos.");
		} else {
			document.getElementById("FormularioDePedido").submit(); 
		}
	} else {
		document.getElementById("FormularioDePedido").submit(); 
	}
}

var ajax;
function ajaxInit () {
	var xmlhttp ;
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (ee) {
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	}
	return xmlhttp ;
}
function carregar_imagem () {
        //Instancia o objeto xmlhttp
        ajax = ajaxInit();
        if (ajax) {
                window.document.getElementById("ContainerCaptcha").innerHTML = "Carregando a imagem de verifica&#231;&#227;o...";
                var url = "http://"+location.hostname+"/sispub/cgi-bin/retornar_imagem_captcha.fcgi?rand="+Math.random()*1000;
                ajax.open("GET", url, true);
                ajax.onreadystatechange = exibir_imagem;
                ajax.send(null);
        } else {
                alert("N&#227;o foi possivel criar o objeto xmlhttp")
        }
}

function exibir_imagem () {
        if (ajax.readyState == 4) {
                if (ajax.status == 200) {
                        var xmldocument = ajax.responseXML;
                        if (xmldocument) {
                                var src_captcha = xmldocument.getElementsByTagName('src_captcha')[0].firstChild.data;
                                var md5sum = xmldocument.getElementsByTagName('md5sum')[0].firstChild.data;
                                if (src_captcha) {
                                        //Alterando o campo hidden "md5sum"
                                        window.document.getElementById("md5sum").value = md5sum;
                                        var html = "<img src=\"http://"+location.hostname+"/"+src_captcha+"\" alt=\"Imagem de verifica&#231;&#227;o\" id=\"ImagemCaptcha\" /><input id=\"CaptchaCode\" name=\"captcha_code\" value=\"XXXX\" onfocus=\"clearDefault(this)\" type=\"text\" />";
                                        window.document.getElementById("ContainerCaptcha").innerHTML = html;
                                } else {
                                         window.document.getElementById("ContainerCaptcha").innerHTML = "Não foi possível carregar a imagem de verifica&#231;&#227;o";
                                }
                        }
                } else {
                         window.document.getElementById("ContainerCaptcha").innerHTML = "Não foi possível carregar a imagem de verifica&#231;&#227;o";
                }
        }
}

var matricula = "";
var nome = "";
var email = "";
var mes = "";
var campo = "";
var ordem = "";

// função que le todos os campos de um form e envia!
function EnviarForm(){	
	// Captura o form
	f = document.getElementById("FormBuscaCorretores");
	matricula = f.matricula.value;
	nome = f.nome.value;
	try { 
		mes = f.mes.value;
	} catch (e) {}
// 	email = f.email.value;
	buscar_corretores();
}


function buscar_corretores (pagina) {
	//Instancia o objeto xmlhttp
        ajax = ajaxInit();
        if (ajax) {
                window.document.getElementById("ContainerCorretores").innerHTML = "Carregando...";
		if (!pagina) {
			pagina=1;
		}
		// inicializa nova URL
		var url="http://"+location.hostname+"/sincom/cgi-bin/ajax.cgi";
                url = url+"?acao=buscar&matricula="+matricula+"&nome="+nome+"&email="+email+"&mes="+mes+"&pagina="+pagina+"&"+Math.random()*1000;
		
		if (campo) {
			url += "&campo="+campo;
		}
		if (ordem) {
			url += "&ordem="+ordem;
		}
                ajax.open("GET", url, true);
                ajax.onreadystatechange = exibir_corretores;
                ajax.send(null);
        } else {
                alert("N&#227;o foi possivel criar o objeto xmlhttp")
        }
}


function ordenar (campo1, ordem1) {
	campo = campo1;
	ordem = ordem1;
	buscar_corretores();
}

function exibir_corretores () {
        if (ajax.readyState == 4) {
                if (ajax.status == 200) {
                        window.document.getElementById("ContainerCorretores").innerHTML = ajax.responseText;
                } else {
                        window.document.getElementById("ContainerCorretores").innerHTML = "Não foi possível realizar a busca por corretores";
                }
        }
}

function exibir_corretor (id) {
	window.open("http://"+location.hostname+"/sincom/cgi-bin/exibir_corretor.cgi?idCorretor="+id,"janela1","width=400,height=300,scrollbars=NO, menubar=NO,location=NO"); 
}
//-->