
	// ##############################################################
	// #                                                            # 
	// #   W2N.Imóvel - Sistema para Imobiliárias e Corretores      # 
	// #                                                            # 
	// ##############################################################
	// #                                                            # 
	// #   W2N - SOLUÇÕES WEB				   www.w2nimovel.com    # 
	// #                                                            # 
	// #   Programador:	Marcelo Santos                              # 
	// #   Site:		www.w2n.com.br                              # 
	// #   E-mail:		comercial@w2n.com.br                        # 
	// #   MSN:			agenciaw2n@hotmail.com                      # 
	// #   GMAIL:		agenciaw2n@gmail.com		                # 
	// #   SKYPE:		agenciaw2n                                  # 
	// #   Telefone:	SP (11) 4063-1884                           # 
	// #				   (11) 7164-5020 (cel)                     # 
	// #				PR (41) 4063-8344                           # 
	// #                                                            # 
	// #   Versão: 2.0                                              #
	// #   Data: 18/03/2007                                         #  
	// #                                                            # 
	// #   Este é um sistema desenvolvido e vendido pela W2N,       # 
	// #   caso você tenha comprado de outra pessoa,			    # 
	// #   você não terá acesso a suporte e nem das atualizações.   #	
	// #                                                            # 
	// #   Não tire o copyright do autor deste sistema              #	
	// #                                                            # 
	// ##############################################################


	var xmlhttp;

	function getAjax(Metodo, Endereco, Funcao, Parametros){

		xmlhttp = getObjAjax();

		if(xmlhttp != null || Endereco.length > 0){

			xmlhttp.onreadystatechange = Funcao;

			if(Metodo=="post" && !Parametros==false && Parametros!= ""){
				xmlhttp.open("POST", Endereco, true);
				xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
				xmlhttp.send(Parametros);
			}else{
				xmlhttp.open("GET", Endereco, true);
				xmlhttp.send(null);
			}

		}

	}


	function getObjAjax() {

		objXML = null;

		var arrXml = new Array(
			'Msxml2.XMLHTTP.5.0',
			'Msxml2.XMLHTTP.4.0',
			'Msxml2.XMLHTTP.3.0',
			'Msxml2.XMLHTTP',
			'Microsoft.XMLHTTP');

		try {
			objXML = new XMLHttpRequest();
		} catch (e) {
			for (var i = 0; i < arrXml.length; i++) {
				try {
					objXML = new ActiveXObject(arrXml[i]);
				} catch (ee) {
					objXML = null;
				}
			}
		}

		return objXML;

	}

	function listarCampos(frm){
	
		var listagem = "";
		var FormCampos = frm.elements;
		var qtdCampos = frm.elements.length;
		var campo;

		this.juntarCampo = function(nome,valor) { 
								if (listagem.length > 0) { 
									listagem += "&";
								}
								listagem += encodeURIComponent(nome) + "=" + encodeURIComponent(valor);
							}

		for (var i=0; i < qtdCampos; i++) {
			campo = FormCampos[i];
			if (!campo.disabled) {
				switch(campo.type) {
					case 'text': case 'password': case 'hidden': case 'textarea': 
						this.juntarCampo(campo.name, campo.value);
						break;
					case 'select-one':
						if (campo.selectedIndex >= 0) {
							this.juntarCampo(campo.name, campo.options[campo.selectedIndex].value);
						}
						break;
					case 'select-multiple':
						for (var j=0; j < campo.options.length; j++) {
							if (campo.options[j].selected) {
								this.juntarCampo(campo.name, campo.options[j].value);
							}
						}
						break;
					case 'checkbox': case 'radio':
						if (campo.checked) {
							this.juntarCampo(campo.name, campo.value);
						}
						break;
				}
			}
		}	

		return(listagem);

	}
	
	function ajaxTipoImovel(vFinalidade){

		var c_tipoimovel = document.getElementById("tipo_imovel_br");
		while( c_tipoimovel.options.length > 0 ) c_tipoimovel.options[0]=null;
		c_tipoimovel.options[0]=new Option("","")
		
		getAjax('get', 'ajax.asp?tipo=tipoimovel&finalidade='+vFinalidade, ajaxTipoImovel_fun);

	}

	function ajaxTipoImovel_fun(){

		if(xmlhttp.readyState==4){ 
			if(parseInt(xmlhttp.status)==200){ 
				var c_tipoimovel = document.getElementById("tipo_imovel_br");
				while( c_tipoimovel.options.length > 0 ) c_tipoimovel.options[0]=null;
				var jsTipo = eval((xmlhttp.responseText));
				for(var i=0;i<jsTipo.length;i++){
					jsTipo[i]=unescape(jsTipo[i])
					arrjsTipo=jsTipo[i].split( "|" );
					c_tipoimovel.options[c_tipoimovel.options.length]=new Option(arrjsTipo[1],arrjsTipo[0]);
				}
			}
		}

	}

	function ajaxTipoImovelPro(vFinalidade){

		var c_tipoimovel = document.getElementById("tipo_imovel_pro");
		while( c_tipoimovel.options.length > 0 ) c_tipoimovel.options[0]=null;
		c_tipoimovel.options[0]=new Option("","")
		
		getAjax('get', 'ajax.asp?tipo=tipoimovel&finalidade='+vFinalidade, ajaxTipoImovelPro_fun);

	}

	function ajaxTipoImovelPro_fun(){

		if(xmlhttp.readyState==4){ 
			if(parseInt(xmlhttp.status)==200){ 
				var c_tipoimovel = document.getElementById("tipo_imovel_pro");
				while( c_tipoimovel.options.length > 0 ) c_tipoimovel.options[0]=null;
				var jsTipo = eval((xmlhttp.responseText));
				for(var i=0;i<jsTipo.length;i++){
					jsTipo[i]=unescape(jsTipo[i])
					arrjsTipo=jsTipo[i].split( "|" );
					c_tipoimovel.options[c_tipoimovel.options.length]=new Option(arrjsTipo[1],arrjsTipo[0]);
				}
			}
		}

	}

	function ajaxCidade(vCidade){

		var c_bairro = document.getElementById("bairro");
		while( c_bairro.options.length > 0 ) c_bairro.options[0]=null;
		c_bairro.options[0]=new Option("","")
		
		getAjax('get', 'ajax.asp?tipo=bairro&cidade='+vCidade, ajaxCidade_fun);

	}

	function ajaxCidade_fun(){

		if(xmlhttp.readyState==4){ 
			if(parseInt(xmlhttp.status)==200){ 
				var c_bairro = document.getElementById("bairro");
				while( c_bairro.options.length > 0 ) c_bairro.options[0]=null;
				var jsBairro = eval((xmlhttp.responseText));
				for(var i=0;i<jsBairro.length;i++){
					jsBairro[i]=unescape(jsBairro[i])
					arrjsBairro=jsBairro[i].split( "|" );
					c_bairro.options[c_bairro.options.length]=new Option(arrjsBairro[1],arrjsBairro[0]);
				}
			}
		}

	}

	function flash(arquivo, largura, altura){

		document.writeln('<object type="application/x-shockwave-flash" data="' + arquivo + '" width="' + largura + '" height="' + altura + '">');
		document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
		document.writeln('<param name="movie" value="' + arquivo + '" />');
		document.writeln('<param name="menu" value="false" />');
		document.writeln('<param name="quality" value="high" />');
		document.writeln('<param name="wmode" value="transparent" />');
		document.writeln('<param name="bgcolor" value="#ffffff" />');
		document.writeln('</object>');

	}


	function AbreJanela(link, x, y, s) {

		var t = (screen.height - y) / 2;
		var e = (screen.width - x) / 2;

		window.open(link,'','width=' + x + ',height=' + y + ',scrollbars=' + s + ',toolbar=0,location=0,status=0,menubar=0,resizable=0,left=' + e + ',top=' + t + '');

	}




	function OnlyNumbers(objeto){

		texto = objeto.value;

		for ( i=0; i < texto.length; i++ ) {
			charAtual = texto.substring(i,1+i);
			if(isNaN(charAtual)){
				objeto.value = objeto.value.replace( charAtual , "" );
			}
		}

	}

	function $(campo){
		return document.getElementById(campo);
	}


	function makenum(nro){
		
		var valid    = "0123456789";
		var numerook = "";
		var temp;
		for(var i = 0; i < nro.length; i++)
		{
			temp = nro.substr(i, 1);
			if (valid.indexOf(temp) != -1)
				numerook = numerook + temp;
		}
		return(numerook);
	}
	
	function mascaraValor(objeto, e, tammax, decimais){
		
		var tecla  = (window.Event) ? e.which : e.keyCode;
		var tamObj = objeto.value.length;
	
		if ((tecla == 8) && (tamObj == tammax))
			tamObj = tamObj - 1;
	
		vr = makenum(objeto.value);
		tam = vr.length;
	
		if (((tecla == 8) || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105)) && (parseInt(tamObj) + 1 <= parseInt(tammax)))
		{
			if ((tam < tammax) && (tecla != 8))
				tam = vr.length + 1;
			if ((tecla == 8) && (tam > 1))
				tam = tam - 1;
	
			if (tam <= decimais)
				objeto.value = ("0," + vr);
			if ((tam == (decimais + 1)) && (tecla == 8))
				objeto.value = vr.substr(0, (tam - decimais)) + "," + vr.substr((tam - decimais), tam);
			if ((tam > (decimais + 1)) && (tam <= (decimais + 3)) && (vr.substr(0,1) == "0"))
				objeto.value = vr.substr(1, (tam - (decimais+1))) + "," + vr.substr(tam - (decimais), tam);
			if ((tam > (decimais + 1)) && (tam <= (decimais + 3)) && (vr.substr(0,1) != "0"))
				objeto.value = vr.substr(0, (tam - decimais)) + "," + vr.substr(tam - decimais, tam);
			if ((tam >= (decimais + 4)) && (tam <= (decimais + 6)))
				objeto.value = vr.substr(0, tam - (decimais + 3)) + "." + vr.substr(tam - (decimais + 3), 3) + "," + vr.substr(tam - decimais, tam);
			if ((tam >= (decimais + 7)) && (tam <= (decimais + 9)))
				objeto.value = vr.substr(0, tam - (decimais + 6)) + "." + vr.substr(tam - (decimais + 6), 3) + "." + vr.substr(tam - (decimais + 3), 3) + "," + vr.substr(tam - decimais, tam);
			if ((tam >= (decimais + 10)) && (tam <= (decimais + 12)))
				objeto.value = vr.substr(0, tam - (decimais + 9)) + "." + vr.substr(tam - (decimais + 9), 3) + "." + vr.substr(tam - (decimais + 6), 3) + "." + vr.substr(tam - (decimais + 3), 3) + "," + vr.substr(tam - decimais, tam);
			if ((tam >= (decimais + 13)) && (tam <= (decimais + 15)))
				objeto.value = vr.substr(0, tam - (decimais + 12)) + "." + vr.substr(tam - (decimais + 12), 3) + "." + vr.substr(tam - (decimais + 9), 3) + "." + vr.substr(tam - (decimais + 6), 3) + "." + vr.substr(tam - (decimais + 3), 3) + "," + vr.substr(tam - decimais, tam);
		}
		else if((tecla != 8) && (tecla != 9) && (tecla != 13) && (tecla != 18) && (tecla != 35) && (tecla != 36) && (tecla != 37) && (tecla != 39))
		{
			return false;
		}
	}




	function validarFormContato(frm){

		if(frm.Nome.value==''){
			alert('Informe o Nome');
			frm.Nome.focus();
			return false;
		}

		if(frm.Email.value=='' || frm.Email.value.match(/(\w+)@(.+)\.(\w+)$/)==null){
			alert('Informe o E-mail');
			frm.Email.focus();
			return false;
		}

		if(frm.Telefone.value==''){
			alert('Informe o Telefone');
			frm.Telefone.focus();
			return false;
		}

		if(frm.Mensagem.value==''){
			alert('Informe sua Mensagem');
			frm.Mensagem.focus();
			return false;
		}

	}

	function validarFormCadastro(frm){

		if(frm.Nome.value==''){
			alert('Informe o Nome');
			frm.Nome.focus();
			return false;
		}

		if(frm.Email.value=='' || frm.Email.value.match(/(\w+)@(.+)\.(\w+)$/)==null){
			alert('Informe o E-mail');
			frm.Email.focus();
			return false;
		}

		if(frm.Telefone.value==''){
			alert('Informe o Telefone');
			frm.Telefone.focus();
			return false;
		}

		if(frm.Cidade.value==''){
			alert('Informe a Cidade');
			frm.Cidade.focus();
			return false;
		}

		if(frm.DesejaContato.value==''){
			alert('Informe por onde Deseja Contato');
			frm.DesejaContato.focus();
			return false;
		}

		if(frm.MelhorHorario.value==''){
			alert('Informe o Melhor Horário');
			frm.MelhorHorario.focus();
			return false;
		}

		if(frm.TipoImovel.value==''){
			alert('Informe o Tipo de Imóvel');
			frm.TipoImovel.focus();
			return false;
		}

		if(frm.Transacao.value==''){
			alert('Informe a Transação');
			frm.Transacao.focus();
			return false;
		}

		if(frm.Mensagem.value==''){
			alert('Informe os Detalhes do Imóvel');
			frm.Mensagem.focus();
			return false;
		}

	}


	function validarFormEncomenda(frm){

		if(frm.Nome.value==''){
			alert('Informe o Nome');
			frm.Nome.focus();
			return false;
		}

		if(frm.Email.value=='' || frm.Email.value.match(/(\w+)@(.+)\.(\w+)$/)==null){
			alert('Informe o E-mail');
			frm.Email.focus();
			return false;
		}

		if(frm.Telefone.value==''){
			alert('Informe o Telefone');
			frm.Telefone.focus();
			return false;
		}

		if(frm.DesejaContato.value==''){
			alert('Informe por onde Deseja Contato');
			frm.DesejaContato.focus();
			return false;
		}

		if(frm.MelhorHorario.value==''){
			alert('Informe o Melhor Horário');
			frm.MelhorHorario.focus();
			return false;
		}

		if(frm.Transacao.value==''){
			alert('Informe a Transação');
			frm.Transacao.focus();
			return false;
		}

		if(frm.Finalidade.value==''){
			alert('Informe a Finalidade');
			frm.Finalidade.focus();
			return false;
		}

		if(frm.TipoImovel.value==''){
			alert('Informe o Tipo de Imóvel');
			frm.TipoImovel.focus();
			return false;
		}

		if(frm.cidade.value==''){
			alert('Informe a Cidade');
			frm.cidade.focus();
			return false;
		}

		if(frm.PrecoMaximo.value=='' || frm.PrecoMaximo.value=='0,00'){
			alert('Informe o Preço Máximo');
			frm.PrecoMaximo.focus();
			return false;
		}

		if(frm.Detalhes.value==''){
			alert('Informe os Detalhes do Imóvel');
			frm.Detalhes.focus();
			return false;
		}

	}


	function validarFormInformacoes(frm){

		if(frm.Nome.value==''){
			alert('Informe o Nome');
			frm.Nome.focus();
			return false;
		}

		if(frm.Email.value=='' || frm.Email.value.match(/(\w+)@(.+)\.(\w+)$/)==null){
			alert('Informe o E-mail');
			frm.Email.focus();
			return false;
		}

		if(frm.Telefone.value==''){
			alert('Informe o Telefone');
			frm.Telefone.focus();
			return false;
		}

		if(frm.DesejaContato.value==''){
			alert('Informe por onde Deseja Contato');
			frm.DesejaContato.focus();
			return false;
		}

		if(frm.MelhorHorario.value==''){
			alert('Informe o Melhor Horário');
			frm.MelhorHorario.focus();
			return false;
		}

		if(frm.Mensagem.value==''){
			alert('Informe sua Mensagem');
			frm.Mensagem.focus();
			return false;
		}

	}



	function validarFormIndique(frm){

		if(frm.Nome.value==''){
			alert('Informe o Seu Nome');
			frm.Nome.focus();
			return false;
		}

		if(frm.Email.value=='' || frm.Email.value.match(/(\w+)@(.+)\.(\w+)$/)==null){
			alert('Informe o Seu E-mail');
			frm.Email.focus();
			return false;
		}

		if(frm.NomeAmigo.value==''){
			alert('Informe o Nome do seu Amigo');
			frm.NomeAmigo.focus();
			return false;
		}

		if(frm.EmailAmigo.value=='' || frm.EmailAmigo.value.match(/(\w+)@(.+)\.(\w+)$/)==null){
			alert('Informe o E-mail do seu Amigo');
			frm.EmailAmigo.focus();
			return false;
		}

		if(frm.Mensagem.value==''){
			alert('Informe sua Mensagem');
			frm.Mensagem.focus();
			return false;
		}

	}


	function getFoto(titulo,descricao,foto){
		$("div_titulo_foto").innerHTML=titulo;
		$("div_foto").innerHTML='<img src="' + foto + '"><br><br>' + descricao;		
	}




	//FUNÇÔES RETIRADAS NO SITE elcio.com.br

	function mascara(o,f){
		v_obj=o;
		v_fun=f;
		setTimeout("execmascara()",1);
	}

	function execmascara(){
		v_obj.value=v_fun(v_obj.value);
	}

	function leech(v){
		v=v.replace(/o/gi,"0");
		v=v.replace(/i/gi,"1");
		v=v.replace(/z/gi,"2");
		v=v.replace(/e/gi,"3");
		v=v.replace(/a/gi,"4");
		v=v.replace(/s/gi,"5");
		v=v.replace(/t/gi,"7");
		return v
	}

	function numero(v){
		return v.replace(/\D/g,"");
	}

	function telefone(v){
		v=v.replace(/\D/g,"");
		v=v.replace(/^(\d\d)(\d)/g,"($1) $2");
		v=v.replace(/(\d{4})(\d)/,"$1-$2");
		return v
	}

	function cpf(v){
		v=v.replace(/\D/g,"");
		v=v.replace(/(\d{3})(\d)/,"$1.$2");
		v=v.replace(/(\d{3})(\d)/,"$1.$2");
		v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2");
		return v
	}

	function cep(v){
		v=v.replace(/D/g,"");
		v=v.replace(/^(\d{5})(\d)/,"$1-$2");
		return v
	}

	function cnpj(v){
		v=v.replace(/\D/g,"");
		v=v.replace(/^(\d{2})(\d)/,"$1.$2");
		v=v.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3");
		v=v.replace(/\.(\d{3})(\d)/,".$1/$2");
		v=v.replace(/(\d{4})(\d)/,"$1-$2");
		return v
	}
	
	
	/* Configuração Tooltip */
	
	var id = "tooltip_w2n";
	var background = "#FFFFCC";
	var border = "1px solid #999999";
	var display = "none";
	var font = "11px Trebuchet MS, Verdana, Arial, Sans-serif";
	var color = "#000000";
	var marginX = 10; //distancia do mouse em x
	var marginY = 0; //distancia do mouse em y
	var opacity = 95; // 0 a 100
	var padding = "2px 5px";
	var position = "absolute";
	var _x = -10;
	var _y = -10;

	function setPos(event) {
		if (document.all) {//IE
			_x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
			_y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
			_x += (window.event.clientX+marginX);
			_y += (window.event.clientY+marginY);
		} else {//Good Browsers
			_x = (event.pageX+marginX);
			_y = (event.pageY+marginY);
		}
	}

	function showTip(text, posX, posY) {
		var t = document.getElementById(id);
		t.innerHTML = text;
		t.style.left = posX+"px";
		t.style.top = posY+"px";
		t.style.display = "block";
	}
	//
	function hideTip() {
		var t = document.getElementById(id).style;
		t.display = "none";
	}
	//
	function tooltip() {
		var body = document.getElementsByTagName("body");
		body = body[0];
		body.innerHTML += "<div id='"+id+"'></div>";
		var t = document.getElementById(id).style;
		t.background = background;
		t.border = border;
		t.display = display;
		t.font = font;
		t.color = color;
		t.opacity = opacity/100;
		t.filter = "alpha(opacity="+opacity+")";
		t.padding = padding;
		t.position = position;
		var links = document.getElementsByTagName("a");
		document.onmousemove = function(event) { setPos(event); }
		for (i=0; i<links.length; i++) {
			var title = links[i].getAttribute("title");
			if (title) {
				links[i].setAttribute("tptitle", title);
				links[i].removeAttribute("title");
				links[i].onmouseover = function() { showTip(this.getAttribute("tptitle"), _x, _y); }
			}
			links[i].onmouseout = function() { hideTip(); }
		}
	}
	//
	window.onload = function() {
		tooltip();
	}

	// ##############################################################
	// #                                                            # 
	// #   W2N.Imóvel - Sistema para Imobiliárias e Corretores      # 
	// #                                                            # 
	// ##############################################################
	// #                                                            # 
	// #   W2N - SOLUÇÕES WEB				   www.w2nimovel.com    # 
	// #                                                            # 
	// #   Programador:	Marcelo Santos                              # 
	// #   Site:		www.w2n.com.br                              # 
	// #   E-mail:		comercial@w2n.com.br                        # 
	// #   MSN:			agenciaw2n@hotmail.com                      # 
	// #   GMAIL:		agenciaw2n@gmail.com		                # 
	// #   SKYPE:		agenciaw2n                                  # 
	// #   Telefone:	SP (11) 4063-1884                           # 
	// #				   (11) 7164-5020 (cel)                     # 
	// #				PR (41) 4063-8344                           # 
	// #                                                            # 
	// #   Versão: 2.0                                              #
	// #   Data: 18/03/2007                                         #  
	// #                                                            # 
	// #   Este é um sistema desenvolvido e vendido pela W2N,       # 
	// #   caso você tenha comprado de outra pessoa,			    # 
	// #   você não terá acesso a suporte e nem das atualizações.   #	
	// #                                                            # 
	// #   Não tire o copyright do autor deste sistema              #	
	// #                                                            # 
	// ##############################################################