﻿// JavaScript Document


// inicioar slideshow



       ContentFlowGlobal.setAddOnConf('slideshow', {startOnLoad: true});



//         drop down menu           

$(function() {
		$('#nav').droppy();
	});


//    includes ajax    

var rootdomain="http://"+window.location.hostname

function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously 
page_request.send(null)
writecontent(page_request)
}

function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.write(page_request.responseText)
}

//        pesquisa intervalo de preço                

function setPrice(cbo){

var str = cbo.value.split(';');
document.getElementById('LPR').value=str[0];
document.getElementById('MPR').value=str[1];
//document.getElementById('Preco').value=0;
}


//        esconde e mostra div           


function show(nome) {
	
	document.getElementById(nome).style.display='block';
	}
	
function hidde(nome) {
	
	document.getElementById(nome).style.display='none';
	}
	
	
function showform(sNome, sId, sMens) 
	{
		document.getElementById('cty').value= sId;
		document.getElementById(sNome).style.display='block' ;
		document.getElementById('mensagem').innerHTML = sMens;
	}
// rollover imoveis

function over(nome) {
	
	document.getElementById(nome).style.color="#ffffff";
	document.getElementById(nome).style.backgroundColor="#a9cf38";
	}
	
function out(nome) {
	
	document.getElementById(nome).style.color="#a9cf38";
	document.getElementById(nome).style.backgroundColor="#000000";
	}

	
// caracteristicas 
	
	var featArr = new Array();
var oOld = null;
function show_feat(nID)
{
	if( nID!= null )
	{
		if(oOld)
			oOld.style.color = '';
		document.getElementById('featCont').innerHTML = featArr[nID];
		document.getElementById(nID).style.color = "#078cc7";
		oOld = document.getElementById(nID);
	}
	else
	{
		if( featArr.length > 0 )
			document.getElementById('featCont').innerHTML = featArr.slice(0,1);
			
	}
}
	
	   
function autoVideo(videoFile, larg, altu, bIsTransparent, plugin, autoStart)
{
	 document.write('<object id="objFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" id="imoplayer" width="'+larg+'" height="'+altu+'">');
	 document.write('<param name="src" value="'+plugin+'?autostart='+(autoStart?'true':'false')+'&file='+videoFile+'">'); 
	 document.write('<param name="quality" value="high">');
	 if(bIsTransparent)
	   document.write('<param name="wmode" value="transparent">'); 
	 document.write('<param name="menu" value="false">'); 
	 document.write('<embed id="imoplayer" src="'+plugin+'?autostart='+(autoStart?'true':'false')+'&file='+videoFile+'" '+(bIsTransparent?'wmode="transparent"':'')+' menu="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+larg+'" height="'+altu+'"></embed>');
	 document.write('</object>');
}

//mostrar automaticamente formulario nos ligamos 


function timedMsg()
{
var t=setTimeout("show('nosligamos')",80000)
}


function getTyp()
	{
		var typ = '';
		var tipMin = document.getElementById('pesquisarap').tipMin.value;
		var tipMax = document.getElementById('pesquisarap').tipMax.value;
		
		var sRef = document.getElementById('pesquisarap').ref.value;
		
		if(document.getElementById('pesquisarap').ref.value != "")
		{
		document.getElementById('pesquisarap').ref.value = "*"+sRef+"*";
		}
		
		
		if (tipMin && tipMax)
		{
			if (tipMin == tipMax)
			{
				typ = tipMin;	
			}
			else
			{
				typ = tipMin;
				for ( i=parseInt(tipMin)+1; i<=tipMax; i++ )
				{
					typ += ","+i;
				}
			}
		}
		else
		{
			if (tipMin)
				typ = tipMin;
			else if (tipMax)
				typ = 1;
				for ( i=2; i<=tipMax; i++ )
				{
					typ += ","+i;
				}
		}
		
		document.getElementById('typ').value = typ;
		
		return true;
	}
	
// mostrar caracteristicas


function showcar()
{
	document.getElementById('caracteristicas').style.display = "block";
	document.getElementById('seta1').style.display = "none";
	document.getElementById('seta2').style.display = "block";
		
}
function hidecar()
{
	document.getElementById('caracteristicas').style.display = "none";
	document.getElementById('seta1').style.display = "block";
	document.getElementById('seta2').style.display = "none";
		
}

// animacao botao clique aqui nos ligamos

function clique1() {
			document.getElementById('cliqueaqui1').style.display = "none";
			document.getElementById('cliqueaqui2').style.display = "block";
	}
	
function clique2() {
			document.getElementById('cliqueaqui1').style.display = "block";
			document.getElementById('cliqueaqui2').style.display = "none";
	}
	
/*  recize  divposition */

$(window).load(function() {

/*alert($(document).width());*/

 $(window).resize(function() {
		resizediv();
		});
	$(window).ready(function() {
		resizediv()
		});
		
	function resizediv(){
		 var windowHeigh = $(window).height();
		 var docHeigh = $(document).height();
		 var docWidth = $(document).width();
		  var windowWidth = $(window).width();
		 if (windowHeigh < 565){
			 $('.divposition').css("position", "absolute");
			$('.divposition').css("height", docHeigh);
			}
		
		if (windowWidth < 960){
			$('.divposition').css("width", docWidth);
			
		}
		
	}
})
