// AJAX Add to Favorites
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {
var obj = document.getElementById(divID);
XMLHttpRequestObject.open("GET", dataSource);
XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {
// Coloco el mensaje "Cargando..." en la capa
obj.innerHTML="Saving...";
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send(null);
}
}

function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
  if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
  o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}
/*************************************************************************
  This code is from Dynamic Web Coding at dyn-web.com
  Copyright 2003-5 by Sharon Paine 
  See Terms of Use at www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/
function doTooltip(e, ar) {
    if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
    var cntnt = wrapTipContent(ar);
    var tip = document.getElementById( Tooltip.tipID );
    Tooltip.show(e, cntnt);
}
function hideTip() {
    if ( typeof Tooltip == "undefined" || !Tooltip.ready ) return;
    Tooltip.hide();
}
function wrapTipContent(ar) {
    var cntnt = "";
    if ( ar[0] ) cntnt += '<a href="communities.php?id=' + ar[0] + '">';
	if ( ar[1] ) cntnt += '<div class="img"><img src="' + ar[1] + '" border="0"></div>';
    if ( ar[2] ) cntnt += '<div class="txt">' + ar[2] + '</div></a>';
    return cntnt;
}
// tooltip content here
var messages = new Array();
// array elements: image file name, optional text
messages[0] = ['1', 'images/buscador/boardwalk.jpg', '<div align="center"><span style="font-weight:bold; font-family: Arial; font-size: 12px; color: #30677c; text-decoration:none;">BOARDWALK<br />MIRAMAR</span><br /><span style="font-family: Arial; font-size: 10px; color: #30677c; text-decoration:none;">Two &amp; Three Bedrooms Townvillas</span></div>'];

messages[1] = ['3', 'images/buscador/ventanas.jpg', '<div align="center"><span style="font-weight:bold; font-family: Arial; font-size: 12px; color: #30677c; text-decoration:none;">VENTANAS DEL SOL<br />HOMESTEAD</span><br /><span style="font-family: Arial; font-size: 10px; color: #30677c; text-decoration:none;">Three to Six Bedrooms Estate Homes</span></div>'];

messages[2] = ['4', 'images/buscador/village.jpg', '<div align="center"><span style="font-weight:bold; font-family: Arial; font-size: 12px; color: #30677c; text-decoration:none;">THE VILLAGE<br />MIRAMAR</span><br /><span style="font-family: Arial; font-size: 10px; color: #30677c; text-decoration:none;">Three to Four Bedrooms Townvillas</span></div>'];

messages[3] = ['7', 'images/buscador/woodbridge.jpg', '<div align="center"><span style="font-weight:bold; font-family: Arial; font-size: 12px; color: #30677c; text-decoration:none;">WOODBRIDGE<br />DAVIE</span><br /><span style="font-family: Arial; font-size: 10px; color: #30677c; text-decoration:none;">4 to 8 Bedrooms Estates Homes</span></div>'];

messages[4] = ['5', 'images/buscador/waterside.jpg', '<div align="center"><span style="font-weight:bold; font-family: Arial; font-size: 12px; color: #30677c; text-decoration:none;">WATERSIDE<br />BOYNTON BEACH</span><br /><span style="font-family: Arial; font-size: 10px; color: #30677c; text-decoration:none;">Two to Four Bedrooms Townhomes</span></div>'];


messages[6] = ['2', 'images/buscador/copperoaks.jpg', '<div align="center"><span style="font-weight:bold; font-family: Arial; font-size: 12px; color: #30677c; text-decoration:none;">COPPER OAKS<br />NAPLES / ESTERO</span><br /><span style="font-family: Arial; font-size: 10px; color: #30677c; text-decoration:none;">Two &amp; Three Bedrooms Townvillas</span></div>'];

messages[7] = ['9', 'images/buscador/wickham.jpg', '<div align="center"><span style="font-weight:bold; font-family: Arial; font-size: 12px; color: #30677c; text-decoration:none;">WICKHAM PLACE<br />MELBOURNE</span><br /><span style="font-family: Arial; font-size: 10px; color: #30677c; text-decoration:none;">Three to Five bedroom estate homes</span></div>'];

// optional preloader 
var imageHandler = { 
    path:"images/", // path to images
    imgs:[], preload:function() { for(var i=0;arguments[i];i++) {
    var img=new Image(); img.src=this.path+arguments[i]; this.imgs[this.imgs.length]=img;}}
}
imageHandler.preload("balloon.gif");



/***************************************************************/
/**********           MODEL DESCRIPTION         ****************/
/***************************************************************/

function showHide(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'inline';
		}
		else {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
		}
	}
}

/***************************************************************/
/**********           VARIOUS FUNCTIONS         ****************/
/***************************************************************/

function openFloorPlan(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=780,height=500,left = 265,top = 150');");
}
function openPromoSlide(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=380,height=290,left = 450,top = 255');");
}
function openFGDetails(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=620,height=360,left = 330,top = 233');");
}
function openFMDetails(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=620,height=340,left = 330,top = 233');");
}
