<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
	str = targ+".location='"+selObj.options[selObj.selectedIndex].value+"'";
	eval(str);
		if (restore) selObj.selectedIndex=0;
}

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_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_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];}
}

function tabela() {
//var winl = (screen.width - w) / 2;
//var wint = (screen.height - h) / 2;
var tamanho = screen.height;
return tamanho
}

function selec(url) {
document.location.href=url
}

function movepic(img_name,img_src) {
document[img_name].src=img_src;
}

//---------------------------------------------------------------------------------------------------------------------

// JavaScript para tv //
var index = 1;
var menu_time = 6000;
var anterior = 3;
var timer = setTimeout('trocaMsg()',menu_time); 

function trocaMsg() {
	index = index%3 +1; channel(index); tempo();
}          

function tempo() {
	clearTimeout(timer);	timer = setTimeout("trocaMsg()",menu_time);
}  

function channel(id) {
	index = id;
	document.getElementById("tvn" + anterior).className= "transp";
	document.getElementById("tvn" + id).className = "opac";
	document.getElementById('tvshow').innerHTML = document.getElementById('tv' + id).innerHTML;
	anterior = id;
}

function tvch(id, out) {
	if (out == 1)	{
		clearTimeout(timer);
		channel(id);
		} else {
		tempo();
	}
}
//channel(1);

// JavaScript para tv-papeis //
var index_p = 1;
var menu_time_p = 2800;
var anterior_p = 3;
var timer_p = setTimeout('trocaMsg_p()',menu_time_p);

function trocaMsg_p() {
	index_p = index_p%3 +1; channel_p(index_p); tempo_p();
}

function tempo_p() {
	clearTimeout(timer_p);
	timer_p = setTimeout("trocaMsg_p()",menu_time_p);
}

function channel_p(idx) {
	index_p = idx;
	document.getElementById("tvp" + anterior_p).className= "transp";
	document.getElementById("tvp" + idx).className = "opac";
	document.getElementById('paptv').innerHTML=document.getElementById('ptv' + idx).innerHTML;
	anterior_p = idx;
}

function tvch_p(idx, out) {
	if (out == 1)	{
		clearTimeout(timer_p);	channel_p(idx);
		} else {
		tempo_p();
	}
}
// channel_p(1);

// Função p/ n Aparecer erro de JS no navegador do Tiozinho
function semerro(){
return true;}
window.onerror=semerro;

function link(arg){
	document.location = arg;
}

//------------------------------------------- Minha Lista -------------------------------------------------

//function Selecao( nome, valor, expira, excluir, path, domain, secure )
function Selecao(nome, valor, expira, excluir)
{
var data = new Date();
var val = valor;
var msg = "";
var msg1;
data.setTime(data.getTime());

//alert(document.cookie);

if (document.cookie.match(eval("/" + escape(nome) + "=/"))) {
	var o_cookie = document.cookie;
	var o_cookie = unescape(o_cookie);
	var vl = o_cookie.split(nome+"=")

	var vl = vl[1].replace(/ASPSESSIONID\w.*/gi,"");
	var vl = vl.replace(/saveit\w.*/gi,"");

	if(excluir == "e"){
	
	valor = vl.replace(valor," ");
	valor = valor.replace("; ","");
	valor = valor.replace(" ;","");
	valor = valor.replace(/[:-@].$/,"");
	valor = valor.replace(/[ ]/gi,"");

	msg1 = "excluído";
//	alert(valor);
	
	}else{
	
	if(vl != ""){
	valor = vl.replace("; ","") + ";" + valor;
	}else{
	valor = vl.replace(" ","") + valor;
	valor = valor.replace("; ","");
	}
	
	msg1 = "adicionado";
	msg = "                          OK!\nO imóvel foi " + msg1 + " com sucesso!";
//	alert(valor);
	}


	if (vl.indexOf(val) == -1){
		msg = "                          OK!\nO imóvel foi " + msg1 + " com sucesso!";
	}else{
		msg = "            JÁ CADASTRADO!\nO imóvel já se encontra cadastrado!";
	}

}

/*
set time, it's in milliseconds
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expira ){
expira = expira * 1000 * 60 * 60 * 24;
}

var expira_data = new Date( data.getTime() + (expira) );

if (excluir == "e" || msg == "" || msg.indexOf("OK!") != -1){
document.cookie = nome + "=" + escape( valor ) +
( ( expira ) ? ";expires=" + expira_data.toGMTString() : "" ) 
/*+
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
*/

if(expira < 0){
msg = "Todos os imóveis foram excluídos da Minha Seleção.";
}else if(excluir == "e"){
msg = "                     OK!\nO imóvel foi " + msg1 + " com sucesso!";
}else{
msg = "                       OK!\nO imóvel foi adicionado com sucesso!";
}


var total = valor.split(";");
document.getElementById("minha_selecao").innerHTML = total.length;
//document.getElementById(nome).href = "selecao_granja_viana.asp"
document.getElementById(nome).disabled = false;
}



if(msg1 == "excluído"){
		document.location = "selecao_imoveis.asp"
}

alert(msg);

}
//---------------------------------------------------------------------------------------------------------------------


//-->

