function addFav(){
    var url      = getUrlVars();
    var title    = document.title;
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

function getUrlVars(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
 
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
		hash[1] = unescape(hash[1]);
		vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
 	//alert(vars);
	
    return vars;
}

function LeftStr(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function RightStr(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function pesquisaSelecionaCombo(sItem, input) {
	if (sItem.className == "pesquisaPaginasComboItemOn") {
		input.checked = false;
		sItem.className = "pesquisaPaginasComboItem";
	}else{
		input.checked = true;
		sItem.className = "pesquisaPaginasComboItemOn";
	}
}

	$(document).ready(function(){
		//Examples of how to assign the ColorBox event to elements
		$("a[rel='ShowImage1']").colorbox();
		$("a[rel='ShowImage2']").colorbox({transition:"fade"});
		$("a[rel='ShowSlide']").colorbox({slideshow:true});
		$(".FrameYouTube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
		$(".WebPage").colorbox({width:"80%", height:"80%", iframe:true});
		$(".CadastreSeuImovel").colorbox({width:"600", height:"90%", iframe:true});
		$(".EncontreSeuImovel").colorbox({width:"600", height:"80%", iframe:true});
		$(".ExtratoOnline").colorbox({width:"810", height:"90%", iframe:true});
		$(".BoletoOnline").colorbox({width:"780", height:"90%", iframe:true});
		
		$(".GoogleMaps").colorbox({width:"90%", height:"90%", iframe:true});
		
		$(".ImovelIndica").colorbox({width:"550", height:"365", iframe:true});
		$(".MaisInformacoes").colorbox({width:"565", height:"355", iframe:true});
		$(".TermoDeVisita").colorbox({width:"680", height:"90%", iframe:true});
		$(".ImovelProposta").colorbox({width:"590", height:"90%", iframe:true});
		$(".ImovelFicha").colorbox({width:"650", height:"80%", iframe:true});
		
		//Example of preserving a JavaScript event for inline calls.
		$("#click").click(function(){ 
			$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
			return false;
		});
	});

