//<!--
/****************** FROM js / keyes.js  ********************/
function containsDOM (container, containee) {
  var isParent = false;
  do {
    if ((isParent = container == containee))
      break;
    containee = containee.parentNode;
  }
  while (containee != null);
  return isParent;
}

function checkMouseLeave (element, evt) {
  if (element.contains && evt.toElement) {
    return !element.contains(evt.toElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}


//availOptions.style.display='block'
function showAvailMenu(cid,fromwhat){
 var d = document.getElementById(cid);
 if (typeof d != "undefined"){
  if (typeof d.style.display != "undefined") {
   //document.write(cid+' has style.display => '+d.style.display);

   if (typeof fromwhat != 'undefied') {
	//alert(cid +' has style.display '+d.style.display+' toggle from ' + fromwhat);
	if (fromwhat == 'in' || fromwhat == 'over') {
		d.style.display= "block";
	} else {
		var handledok = 0;
		if (fromwhat == 'enter') {
			d.style.display= "block";
			//alert(cid +' has style.display '+d.style.display+' toggle from ' + fromwhat);
			handledok = 1;
		}
		if (fromwhat == 'over') {
			//d.style.display= "none";
			alert(cid +' has style.display '+d.style.display+' toggle from ' + fromwhat);
			handledok = 1;
		}
		if (fromwhat == 'leave') {
			d.style.display= "none";
			//alert(cid +' has style.display '+d.style.display+' toggle from ' + fromwhat);
			handledok = 1;
		} 
		if (fromwhat == 'out') {
			d.style.display= "none";
			//alert(cid +' has style.display '+d.style.display+' toggle from ' + fromwhat);
			handledok = 1;
		}
		if (handledok <= 0) {			
		    alert(cid +' has style.display '+d.style.display+' toggle from ' + fromwhat);
		    d.style.display= (d.style.display !="block") ?  "block" : "none";
		} //else not out and not leave
	} // else
   } else {
    d.style.display= (d.style.display !="block") ?  "block" : "none";
   } // else not defined must be leaving

  } // if defined styles
  //alert(cid);
 }//if
 //if (typeof fromwhat != 'undefined') { alert(cid +' toggle from ' + fromwhat); }
}//function

function opennational(){
 var popurl="http://www.relohomesearch.com/default.asp?COID=4647";
 winpops=window.open(popurl,"","width=800,height=500,scrollbars=1,resizable=1,");
}
function openluxury(){
 var popurl="http://www.luxuryrealestate.com/global/keyes/search.html";
 winpops=window.open(popurl,"","width=700,height=500,scrollbars=1,resizable=1,");
}
function openloop(){
 var popurl="http://www.loopnet.com/Looplink/keyes/qryradio.aspx";
 winpops=window.open(popurl,"","width=700,height=500,scrollbars=1,resizable=1,");
}
function popup_payment() {
        POP = window.open('https://www.securemortgage.net/homepart.elliemae.net/wholesale/MortgageCalc/payment.asp?From=main','HomePartner','scrollbars=yes,width=600,height=600,left=0,top=0,toolbar=1,status=1,resizable=1', 'scrolling=1,resizable=1');
        POP.focus();
}
function popup_rentvsown() {
        POP = window.open('https://www.securemortgage.net/homepart.elliemae.net/wholesale/MortgageCalc/rent.asp?From=main','HomePartner','scrollbars=yes,width=600,height=600,left=0,top=0,toolbar=1,status=1,resizable=1', 'scrolling=1,resizable=1');
        POP.focus();
}
function popup_refinance() {
        POP = window.open('https://www.securemortgage.net/homepart.elliemae.net/wholesale/MortgageCalc/BreakEven.asp?From=main','HomePartner','scrollbars=yes,width=600,height=600,left=0,top=0,toolbar=1,status=1,resizable=1', 'scrolling=1,resizable=1');
        POP.focus();
}
function popup_debt() {
        POP = window.open('https://www.securemortgage.net/homepart.elliemae.net/wholesale/MortgageCalc/debt.asp?From=main','HomePartner','scrollbars=yes,width=600,height=600,left=0,top=0,toolbar=1,status=1,resizable=1', 'scrolling=1,resizable=1');
        POP.focus();
}
function open72(extra){
// var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=72&"+extra;
 //var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=72&"+extra;
 var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=72&"+extra;
 
 winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}
function open73(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=73&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=2f7c8014-37a9-4e4c-9de6-3c69d032c93c&sourceID=33&formID=73&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=73&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open93(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=93&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=10a2c64a-3d86-4efc-a8b2-be5ec0b37cba&sourceID=33&formID=93&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=93&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open94(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=94&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=98458e70-1aa7-4e87-bf06-e6ff4009078f&sourceID=33&formID=94&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=94&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open599(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=599&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=77360535-3a08-4c58-a0cb-937c5c4d277f&sourceID=33&formID=599&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=599&"+extra;

winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open600(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=600&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=77360535-3a08-4c58-a0cb-937c5c4d277f&sourceID=33&formID=600&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=600&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open601(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=601&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=77360535-3a08-4c58-a0cb-937c5c4d277f&sourceID=33&formID=601&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=601&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open638(extra){  
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=638&"+extra;   
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=77360535-3a08-4c58-a0cb-937c5c4d277f&sourceID=33&formID=638&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=638&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open639(extra){  
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=639&"+extra;  
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=77360535-3a08-4c58-a0cb-937c5c4d277f&sourceID=33&formID=639&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=639&"+extra;

winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open602(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=602&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=77360535-3a08-4c58-a0cb-937c5c4d277f&sourceID=33&formID=602&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=602&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open603(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=603&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=77360535-3a08-4c58-a0cb-937c5c4d277f&sourceID=33&formID=603&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=603&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open603out(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=603&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=6254bfe8-155c-4734-baea-ce5217ed10b9&sourceID=33&formID=603&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=603&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open603map(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=603&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=9c188482-db83-4eef-ac37-9d762d480640&sourceID=33&formID=603&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=603&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open604(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=604&"+extra;
//var popurl="http://www.clientcapture.com/keyes/default.aspx?s=2f7c8014-37a9-4e4c-9de6-3c69d032c93c&sourceID=33&formID=604&"+extra;
var popurl="http://my-keyes.com/katabat.aspx?sourceID=33&formID=604&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open605(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=605&"+extra;
var popurl="http://www.clientcapture.com/keyes/default.aspx?s=2f7c8014-37a9-4e4c-9de6-3c69d032c93c&sourceID=33&formID=605&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}function open606(extra){
//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33&formID=606&"+extra;
var popurl="http://www.clientcapture.com/keyes/default.aspx?s=2f7c8014-37a9-4e4c-9de6-3c69d032c93c&sourceID=33&formID=606&"+extra;
winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}

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];}
}



 
var browserType;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}

function toggleDIV(nameOf) {
  if (browserType == "gecko" )
     s = 'document.getElementById(\'' + nameOf + '\')';
  else if (browserType == "ie")
     s = 'document.all[\'' + nameOf + '\']';
  else
     s = 'document.layers[\'' + nameOf + '\']';

     document.poppedLayer = eval(s);

    if (document.poppedLayer.style.display == "none") {
       document.poppedLayer.style.display = "block";
    } else {
       document.poppedLayer.style.display = "none";
    }


}//toogle


function setPointer(theRow, theRowNum, 
		theAction, theDefaultColor, 
		thePointerColor, theMarkColor
)
{
    var theCells = null;
    var marked_row = new Array;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function

function displayPopup(url, width, height,options,left,top) {
 return openPopup(url, width, height,options,left,top);
}
function open_popup(url, width, height,options,left,top) {
 return openPopup(url, width, height,options,left,top);
}
// nobody in their right mind uses height then width,
// this is the way it should be 
function openPopup(url, width, height,options,left,top) {

	if (!left || left == "" || left < 0)
	{
		left = 0
	}
	if (!top || top == "" || top < 0)
	{
		top = 0
	}
	if (!width || width == "" || width == 0)
	{
		width = 400
	}
	if (!height || height == "" || height == 0)
	{
		height = 450
	}
	if (!options || options == "")
	{
		options = "toolbar=0,location=0,scrollbars=1,resizable=1"
	}
	options = options + ",width=" + width + ",height=" + height;
	options = options + ",left="  + left  + ",top="    + top;
	popupWindow = open(url, "Popupwindow", options);
	//return popupWindow
} 


 function ReFreshParent(url){
   if(popupWindow != null && popupWindow.closed) {
   	//alert('pop exists refreshing');
        location.href = url;

   } else { if (popupWindow != null) {

        	//alert('pop is not null but timer refresh reset');
                setTimeout("ReFreshParent('"+url+"')",200);
	} else {
        	//alert('pop is null therefore no refresh timer');

	}//else window is null
   }// else window is not closed
 }// function


//		ONMOUSEOVER="helppopup('Keyes Development','333333','FFFFFF')" 
//		ONMOUSEOUT="helpkill()"

//===========================================================

//<!--
var msie5x = false;
var msie6x = false;
var ns4x = false;
var ns6x = false;
var ns7x = false;
var ff0x = false;
var mz1x = false;

var plateformeWin = false;
var plateformeMac = false;
var Xoffset = 0; // modify these values to ...
var Yoffset = 12; // change the popup position.
var yyy = 0;

var navName = navigator.appName;
var navVersion = navigator.appVersion;
var navUserAgent = navigator.userAgent;

var msgVersionInvalide = "Unsupported browser version.";

//--------------------------------------------------------------------------------------
function setBrowserVersion () {
msie5x = false;
msie6x = false;
ns4x = false;
ns6x = false;
ns7x = false;
ff0x = false;
mz1x = false;

plateformeWin = false;
plateformeMac = false;

Xoffset= 15; // modify these values to ...
Yoffset= 10; // change the popup position.

navName = navigator.appName;
navVersion = navigator.appVersion;
navUserAgent = navigator.userAgent;

/*----- Microsoft Internet Explorer 5.x -----*/
if (navName.indexOf("Microsoft") >= 0 && navVersion.indexOf("MSIE 5.") >= 0) {
msie5x = true;
}
/*----- Microsoft Internet Explorer 6.x -----*/
if (navName.indexOf("Microsoft") >= 0 && navVersion.indexOf("MSIE 6.") >= 0) {
msie6x = true;
}
/*----- NetScape 4.x -----*/
if (navName.indexOf("Netscape") >= 0 && navVersion.indexOf("4.") == 0) {
ns4x = true;
}
/*----- NetScape 6.x -----*/
if (navUserAgent.indexOf("Netscape6/6.") >= 0) {
ns6x = true;
}
/*----- NetScape 7.x -----*/
if (navUserAgent.indexOf("Netscape/7.") >= 0) {
ns7x = true;
}
/*----- NetScape FireFox1.x -----*/
if (navUserAgent.indexOf("Firefox/0.") >= 0) {
ff0x = true;
}
/*----- Mozilla 1.x -----*/
if (navUserAgent.indexOf("Gecko/") >= 0) {
mz1x = true;
}

/*----- Windows -----*/
if (navVersion.indexOf ("Win") >=0) {
plateformeWin = true;

/*----- Macintosh -----*/
} else if (navVersion.indexOf ("Mac") >=0) {
plateformeWin = true;

/*----- Inconnu -----*/
} else {
alert (msgVersionInvalide + " : " + navVersion);

}

}

//--------------------------------------------------------------------------------------
function gethelpmouse(e){
 setBrowserVersion();
 var x;
 var y;
 if (typeof event != "undefined") {
  x=(ns4x||ns6x)?e.pageX:event.clientX+document.body.scrollLeft;
  y=(ns4x||ns6x)?e.pageY:event.clientY+document.body.scrollTop;
 // x=(ns4x||ns6x)?e.pageX:event.X+document.body.scrollLeft;
 // y=(ns4x||ns6x)?e.pageY:event.Y+document.body.scrollTop;
 } else {
  x=(ns4x||ns6x)?e.pageX:e.clientX+document.body.scrollLeft;
  y=(ns4x||ns6x)?e.pageY:e.clientY+document.body.scrollTop;
 }


 larg = document.getElementById("help").offsetWidth;
 haut = document.getElementById("help").offsetHeight;

 if (x + larg > getWindowWidth() - 210) x = getWindowWidth() - larg - 210;

 document.getElementById("help").style.left=x+Xoffset;
 document.getElementById("help").style.top=y+Yoffset;

}

// document.onmousemove=gethelpmouse;
//--------------------------------------------------------------------------------------
function helppopup(msg,bak,forc) {
 setBrowserVersion();
 if (typeof forc == "undefined") {
  forc = "#FFFFFF";
 }//black
 if (typeof bak == "undefined") {
  bak = "#000000";
 }//black
 
 document.onmousemove=gethelpmouse;
 var content="<TABLE  WIDTH=150 BORDER=1 BORDERCOLOR='#BBBBBB' "+
	"CELLPADDING=2 CELLSPACING=0 "+
	"BGCOLOR='"+bak+"'><TR><TD ALIGN=center>"+
	"<FONT COLOR='"+forc+"' SIZE=2>"+
	unescape(msg)+
	"</FONT></TD></TR></TABLE>";

 yyy = Yoffset;
 document.getElementById("help").innerHTML=content;
 document.getElementById("help").style.display='';
 document.getElementById("help").style.visibility = "visible";
 document.getElementById("help").style.left=-1000;
}


//--------------------------------------------------------------------------------------
function helpkill(){
 setBrowserVersion();
 yyy=-1000;
 //alert('altkill');
 if (ns4x) {
  document.help.visibility="hidden";
 } else if (ns6x||msie6x) { 
  document.getElementById("help").style.display="none";
  document.getElementById("help").style.visibility = "hidden";
 } else if (msie5x) {
  document.all.help.style.display="none";
  document.all("help").style.visibility = "hidden";
 } else if (typeof document.getElementById("help") != "undefined") {
  document.getElementById("help").style.display="none";
  document.getElementById("help").style.visibility = "hidden";
 }

}//func

//--------------------------------------------------------------------------------------
function getWindowWidth () {
 return screen.availWidth;
}

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

 var header_index = 1+Math.floor(Math.random()*4); 
 var s = "/controls/keyesmain/layoutimages/topleft_image_"
					+header_index
					+".jpg";
 var rotated = 0;
 function rotateHeader() {//function
  if (document.images) 
  {
	if (rotated <= 0 && typeof document["headerImage"] != undefined) 
	{
	
			//alert("Currently: "+typeof document['headerImage']);
			document["headerImage"].src = s;
			rotated =1;
	}//tyepof
  } // if document.images suported
  if (rotated <= 0 && typeof document.getElementByID("headerImage") != undefined) {
	  document.getElementById("headerImage").src = s;
	  rotated =1;
  } // getElement
 }//function



function VISILINK(LinkName) {
	var SITEID = 13689;
	if (typeof DID != "undefined") {
		SITEID = DID;
	}
	var random = Math.random();
	sniff = new Image(); 
	sniff.src= 'https:\/\/sniff.visistat.com\/index.php?DID='+SITEID+'&LinkName='+LinkName+'&r='+random;
}
/****************** FROM js / keyes.js  ********************/
//-->
//<!--
/****************** FROM SCRIPT / general.js  ********************/
function contractPhotos() {
var ptd = undefined;
 var sl = undefined; 
 var hl = undefined; 
 try { //
     //--Get the photo table ----------------------
     if (typeof document.getElementById('photoTableDiv') != 'undefined') {
       // alert('photoTableDiv found');
        ptd = document.getElementById('photoTableDiv')
     }
     if (typeof document.getElementById('ctl00_ContentPlaceHolder1_photoTableDiv') != 'undefined') {
            //alert('cph1.photoTableDiv found');
            ptd = document.getElementById('ctl00_ContentPlaceHolder1_photoTableDiv') 
     }     
     
     //--Get the show link ----------------------
     if (typeof document.getElementById('showLink') != "undefined"){
        sl = document.getElementById('showLink');
     } 
     if (typeof document.getElementById('ctl00_ContentPlaceHolder1_showLink') != "undefined") {
        sl = document.getElementById('ctl00_ContentPlaceHolder1_showLink');
     }
     //--Get the hide link ----------------------
     if (typeof document.getElementById('hideLink') != "undefined") {
        hl = document.getElementById('hideLink')
     }
     if (typeof document.getElementById('ctl00_ContentPlaceHolder1_hideLink') != "undefined") {
        hl = document.getElementById('ctl00_ContentPlaceHolder1_hideLink')
     }//else
     
 }//try
 catch (ex) {
    alert('exception finding object: '+ex);
 }//catch
 
 if (typeof ptd !='undefined') {
	ptd.style.display='none';
	if (typeof sl != "undefined") {
	    sl.style.display='none';
	}
 }//if
 if (typeof hl != 'undefined') {
	hl.style.display='block'; 
 }//if
}//func

function expandPhotos() {
 var ptd = undefined;
 var sl = undefined; 
 var hl = undefined; 
 try { //
     //--Get the photo table ----------------------
     if (typeof document.getElementById('photoTableDiv') != 'undefined') {
       // alert('photoTableDiv found');
        ptd = document.getElementById('photoTableDiv')
     }
     if (typeof document.getElementById('ctl00_ContentPlaceHolder1_photoTableDiv') != 'undefined') {
            //alert('cph1.photoTableDiv found');
            ptd = document.getElementById('ctl00_ContentPlaceHolder1_photoTableDiv') 
     }     
     
     //--Get the show link ----------------------
     if (typeof document.getElementById('showLink') != "undefined"){
        sl = document.getElementById('showLink');
     } 
     if (typeof document.getElementById('ctl00_ContentPlaceHolder1_showLink') != "undefined") {
        sl = document.getElementById('ctl00_ContentPlaceHolder1_showLink');
     }
     //--Get the hide link ----------------------
     if (typeof document.getElementById('hideLink') != "undefined") {
        hl = document.getElementById('hideLink')
     }
     if (typeof document.getElementById('ctl00_ContentPlaceHolder1_hideLink') != "undefined") {
        hl = document.getElementById('ctl00_ContentPlaceHolder1_hideLink')
     }//else
     
 }//try
 catch (ex) {
    alert('exception finding object: '+ex);
 }//catch
 
 try { //try
     if (typeof ptd !='undefined') {
        if (typeof ptd.style != "undefined"){
	        ptd.style.display='block'; 
	    } // if style
	    if (typeof sl != 'undefined') {
	        if (typeof sl.style != "undefined") {
	            sl.style.display='block'; 
	        } // if style
	    }//if sl
     }//if ptd
     if (typeof hl != 'undefined') {
	    hl.style.display='none';
     }//if hl
 
 }//try
 catch (ex) {
 alert('exception setting display: '+ex);
 }//catch
}//func

function propertyPhotoMain(thumb) {
 var mp;
  try { //try
 if (typeof document.images["ctl00_ContentPlaceHolder1_mainPhoto"] != "undefined") {
    mp = document.images["ctl00_ContentPlaceHolder1_mainPhoto"];
 }
 if (typeof document.images["mainPhoto"] != "undefined") {
    mp = document.images["mainPhoto"];
 }
 if (mp) {
	if (thumb != null) { 
		mp.src = thumb
		if (typeof mp != 'undefined') {
			mp.focus();
			scroll(0,200);
		}
		//alert("doing property photo for:"+thumb);
	}
 }//if 
  }//try
  catch (ex) {
    alert('Exception: '+ex);
  };//catch
}//func
function associatePhotoMain(thumb) {
 if (document.images["mainPhoto"]) {
	if (thumb != null) { 
		document.images["mainPhoto"].src = thumb
		//alert("doing associate photo for:"+thumb);
	}
 }//if
}
function officePhotoMain(thumb) {
 if (document.images["mainPhoto"]) {
	if (thumb != null) { 
		document.images["mainPhoto"].src = thumb
		//alert("doing office photo for:"+thumb);
	}
 }//if
}
/****************** FROM SCRIPT / general.js  ********************/
//-->
//<!--
/****************** FROM js / hider.js  ********************/
var enablepersist="on"; //Enable saving state of content structure? (on/off)
if (document.getElementById){
  document.write('<style type="text/css">');
  document.write('.switchcontent{display:none;}');
  document.write('</style>');
}
 
function getElementbyClass(classname){
 ccollect=new Array()
 var inc=0;
 var alltags=document.all? document.all : document.getElementsByTagName("*");
 for (i=0; i<alltags.length; i++){
   if (alltags[i].className==classname)
     ccollect[inc++]=alltags[i];
 }
}

function contractcontent(omit){
 var inc=0;
 if (typeof ccollect != "undefined"){
 while (ccollect[inc]){
  if (typeof ccollect[inc] != 'undefined') { 
    if (ccollect[inc].id!=omit)
        ccollect[inc].style.display="none";    
  } // if not undefined
  inc++;
 }//while
 }//if
}//func contract

function expandContent(cid){
 if (typeof cid != "undefined"){
  contractcontent(cid);
   if (typeof document.getElementById(cid) != "undefined") {
    document.getElementById(cid).style.display= (document.getElementById(cid).style.display!="block") ?  "block" : "none";
    selectedItem=cid+"|"+document.getElementById(cid).style.display;
  }//  document.getElementById(cid)
 }// cid != empty
}//func expand content

function revivecontent(){
	//alert('reviving!');
	try {
	 selectedItem=getselectedItem();
	 selectedComponents=selectedItem.split("|");
	 contractcontent(selectedComponents[0]);
 	 if (typeof selectedComponents[0] !="undefined") {
 	  if (typeof document.getElementById(selectedComponents[0]) != "undefined") { 
 	   if (typeof document.getElementById(selectedComponents[0]).style != "undefined") {
	    document.getElementById(selectedComponents[0]).style.display=selectedComponents[1];
	   }
	  }
	 }
	}//try
	catch (ex) { 
	    //alert(ex); 
	}
}

//get_cookie(
function get_cookie(Name) {
 var search = Name + "=";
 var returnvalue = "";
 if (document.cookie.length > 0) {
	offset = document.cookie.indexOf(search);
	if (offset != -1) {
		offset += search.length   
		end = document.cookie.indexOf(";", offset);
		if (end == -1) end = document.cookie.length;
		returnvalue=unescape(document.cookie.substring(offset, end));
	}//offset
 } // cookie lenght
 return returnvalue;
}

function getselectedItem(){
 if (get_cookie(window.location.pathname) != ""){
	selectedItem=get_cookie(window.location.pathname);
	return selectedItem;
 }
 else
 	return "";
}

function saveswitchstate(){  
 if (typeof selectedItem!="undefined")
 	document.cookie=window.location.pathname+"="+selectedItem;
}
 
function do_onload(){
 getElementbyClass("switchcontent");
 if (enablepersist=="on" && getselectedItem()!="")
	revivecontent();
}


if (window.addEventListener)  
	window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
	window.attachEvent("onload", do_onload);
else if (document.getElementById)
	window.onload=do_onload;

if (enablepersist=="on" && document.getElementById)
	window.onunload=saveswitchstate ;

/****************** FROM js / hider.js  ********************/
//-->
//<!--
/****************** FROM js / default.js  ********************/
// JScript File
//---------------------- page load loop
	var LoginiLoopCounter = 1;
	var LoginiMaxLoop = 5;
	var LoginiIntervalID;
	var LoginStrTarGet;
	var LoginstrWhat;

function WaitWhileLoadPage(url) {
 if (typeof url != "undefined") {
    if (url == "") {
        return;
    }
	LoginStrTarGet = url	
	window.setInterval("window.location.href = '" + LoginStrTarGet + "'",500);
	if (navigator.appName != "Netscape") {
	LoginiIntervalID = window.setInterval("LoginiLoopCounter=UpdateProgress(LoginiLoopCounter, LoginiMaxLoop)", 1000);
    }//if not net	
 }
}//func

function UpdateProgress(iCurrentLoopCounter, iMaximumLoops) {
	iCurrentLoopCounter += 1;
			
	if (iCurrentLoopCounter <= iMaximumLoops) {
	//	Progress.innerText += ".";
		return iCurrentLoopCounter;
		}
	else {
	//	Progress.innerText = "";
		return 1;
		}
	
	}

function EndPageLoad() {
		window.clearInterval(LoginiIntervalID);
		Progress.innerText = "Page Loaded -- Now Transferring";
	}


function toggleControlProgress(progressId, iframeId)
{
 try {
     objProgress = document.getElementById(progressId);
     objIframe = document.getElementById(iframeId);
     if ((objProgress) && (objIframe))
     {
           objProgress.style.display = (objProgress.style.display == "none" ? "block" : "none");
           objIframe.style.display = (objIframe.style.display == "none" ? "block" : "none");
     }
 }//try
 catch (ex) {
  alert(ex);
 };//catch
}

function toggleControlNonKeyes(progressId, iframeId)
{
 try {
     objProgress = document.getElementById(progressId);
     objIframe = document.getElementById(iframeId);
     if ((objProgress) && (objIframe))
     {
           objProgress.style.display = (objProgress.style.display == "none" ? "block" : "none");
           objIframe.style.display = (objIframe.style.display == "none" ? "block" : "none");
           if (objIframe.style.display == "block") {
            location.href = objIframe.src;
           }
           
     }
 }//try
 catch (ex) {
  alert(ex);
 };//catch
}//func

function toggleControlNonKeyes2(progressId, iframeId)
{
 try {
     objProgress = document.getElementById(progressId);
     objIframe = document.getElementById(iframeId);
     if ((objProgress) && (objIframe))
     {
           objProgress.style.display = (objProgress.style.display == "none" ? "block" : "none");
           objIframe.style.display = (objIframe.style.display == "none" ? "block" : "none");                      
     }
 }//try
 catch (ex) {
  alert(ex);
 };//catch
}//func
/****************** FROM js / default.js  ********************/
//-->

//<!--
/****************** FROM js / dw_rotator.js ******************/
/*
<!-- Original:  Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site:  http://members.xoom.com/cyanide_7 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
*/
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
 if (typeof e != 'undefined') {
    var keyCode = (isNN) ? e.which : e.keyCode; 
    var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
    if (typeof input != 'undefined') { 
        if(input.value.length >= len && !containsElement(filter,keyCode)) { // if2
            input.value = input.value.slice(0, len);
            input.form[(getIndex(input)+1) % input.form.length].focus();
        }//if 2
    }//
 }//if
} //func

function containsElement(arr, ele) {
    var found = false, index = 0;
    if (typeof arr != 'undefined') { 
     if (typeof arr.length != 'undefined') { 
        while(!found && index < arr.length) {
         if (typeof arr[index] != 'undefined') { 
            if(arr[index] == ele)
                found = true;
            else
                index++;
         }//if
        }//while
     }//if
    }//if
    return found;
}
function getIndex(input) {
    var index = -1, i = 0, found = false;
    if (typeof input != 'undefined') { // if 1
     if (typeof input.form != 'undefined') { // if 2
        while (i < input.form.length && index == -1) { //while
            if (input.form[i] == input) { index = i; } 
            else { i++; } 
            return index;
        }//while
     }//if2 .form
    }//if1
    return true;
}//func
//  End -->
/****************** FROM js / dw_rotator.js ******************/
//-->
//<!--
/****************** FROM search / properties / inserts.js ****/
function pop_map(mls,refid) {
 POP = window.open('http://keyes.mapmuse.com/re2/map_keyes_re2.asp?freshmap=1&singlepoint=1&sp_table=KEYES&sp_zoom=1&sp_id='
        +mls + '&ref_id=' + refid
        ,'Map','scrollbars=yes,menubars=no,status=yes,width=795,height=600,top=0,left=0', 'scrolling=1,resizable=1');    
 POP.focus();
}
function pop_map_guide(mls) {
 POP = window.open('http://keyes.mapmuse.com/re2/map_keyes_realtor_re2.asp?freshmap=1&singlepoint=1&sp_table=KEYES&sp_zoom=2&sp_id='
        +mls
        ,'Map','scrollbars=yes,menubars=no,status=yes,width=795,height=600,top=0,left=0', 'scrolling=1,resizable=1');    
 POP.focus();
}
function popup_mapproperty_yahoo(mls,refid,addr,city,state,zip,zp4,width,height) {
 if (width <= 0) {
	width = 795
 }
 if (height <= 0) {
	height = 600
 }
 var fullzip = zip
 if (zp4 != '') {
	fullzip = fullzip + zp4
 }
 POP = window.open('http://maps.yahoo.com/beta/index.php#maxp=search'
	+'&q1='+addr+',%20'+city+',%20'+state+',%20'+fullzip
        ,'Map','scrollbars=yes,menubars=no,status=yes,width='+width+',height='+height+',top=0,left=0', 'scrolling=1,resizable=1');    
 POP.focus();
}
function popup_mapproperty_google(mls,refid,addr,city,state,zip,zp4,width,height) {
 if (width <= 0) {
	width = 795
 }
 if (height <= 0) {
	height = 600
 }
 var fullzip = zip
 if (zp4 != '') {
	fullzip = fullzip + zp4
 }
 POP = window.open('http://www.google.com/maps?f=d&hl=en'
	+'&saddr='+addr+'%20'+city+',%20'+state+'%20'+fullzip
        ,'Map','scrollbars=yes,menubars=no,status=yes,width='+width+',height='+height+',top=0,left=0', 'scrolling=1,resizable=1');    
 POP.focus();
}

function popup_tour(url) {
 POP = window.open(url,'VirtualTour','scrollbars=yes,width=675,height=675,resizable=1', 'scrolling=1,resizable=1');
 POP.focus();
}
function openLead(extra){ 
	//var popurl="http://services.katabat.com/im/launchInquiryManager.asp?sourceID=33"
    var popurl="http://my-keyes.com/katabat.aspx?sourceID=33"+extra;	
	popurl = "/katabat.aspx?sourceID=33"

	if (extra != '') {
		popurl  = popurl +'&'+ extra;
	}
	winpops=window.open(popurl,"","width=800,height=560,scrollbars=1,resizable=1,");
}
function openhouse(mls) {
 POP = window.open('/search/properties/openhouse.aspx?mls='+mls,'OpenHouse',
	'scrollbars=yes,width=220,height=250', 'scrolling=1,resizable=1');
 POP.focus();
}
function popup_flyer(lno) {
 POP = window.open('/search/properties/flyer.aspx?ListingNo='+lno,'Flyer',
	'scrollbars=yes,width=220,height=250', 'scrolling=1,resizable=1');
 POP.focus();
}
function popup_prequal() {
        POP = window.open('/mortgage/prequal.aspx','HomePartner','scrollbars=yes,width=600,height=600,left=0,top=0,toolbar=1,status=1,resizable=1', 'scrolling=1,resizable=1');
         POP.focus();
}
function popup_school(addr,zip,city,state) {
	var url = 'http://www.homefair.com/homefair/servlet/ActionServlet?pid=38&cid=keyes'
	url = 'http://www.greatschools.net/cgi-bin/byaddr/fl?stateselect=FL&city='+city+'&zip='+zip+'&street='+addr
        POP = window.open(url,'GreatSchools','scrollbars=yes,width=600,height=600,left=0,top=0,toolbar=1,status=1,resizable=1', 'scrolling=1,resizable=1');
        POP.focus();
}
function popup_neighborhood(addr,zip) {
        POP = window.open('/search/properties/neighborhood.aspx?address='+addr+'&zip='+zip,'Neighborhood',
	'scrollbars=yes,width=585,height=400,left=0,top=0,toolbar=0,status=1,resizable=1','scrolling=1,resizable=1');
        POP.focus();
}


//---------------------- page load loop
var IEversion=0
var navtemp;


	var iLoopCounter = 1;
	var iMaxLoop = 5;
	var iIntervalId;
	var strTarget;
	var strWhat;

function getListingResults(url) {
    try {
        if (navigator.appVersion.indexOf("MSIE")!=-1){
         navtemp=navigator.appVersion.split("MSIE")
         IEversion=parseFloat(navtemp[1])
        }
    }
    catch (ex) { 
        alert(ex);
    }
    try {
     if (IEversion>=5.5) //NON IE browser will return 0
     {
        location.href = url;
        //return getListingResultsIE(url);
     } else {
	    strTarget = url
	    location.href = strTarget;
	    iIntervalId = window.setInterval("iLoopCounter=UpdateProgress(iLoopCounter, iMaxLoop)", 500);
	 }//else
	}//try
    catch (ex) { 
        alert(ex);
    }//catch
   
}//getresults

function UpdateProgress(iCurrentLoopCounter, iMaximumLoops) {
	iCurrentLoopCounter += 1;
			
	if (iCurrentLoopCounter <= iMaximumLoops) {
    	if (typeof Progress != "undefined") {
	    	Progress.innerText += ".";
		}
		return iCurrentLoopCounter;
		}
	else {
	    if (typeof Progress != "undefined") {
		    Progress.innerText = "";
		}
		return 1;
		}
	
	}

function EndPageLoad() {
		window.clearInterval(iIntervalId);
		Progress.innerText = "Page Loaded -- Not Transferring";
	}
	
//****** IE CANT DO ANYTHING RIGHT *********************//
// variable to hold reference to XMLHTTP object
var oHTTP;
function getListingResultsIE(url) {
 try {
  return loadTarget(url);
 }
 catch (ex) {
 alert(ex);
 }
}
function loadTarget(sURL) {
 // create instance of a new XMLHTTP object
 oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
 if (oHTTP != null) {
  // specify callback for loading completion
  oHTTP.onreadystatechange = gotTarget;
  // open HTTP connection and send async request
  oHTTP.open('GET', sURL, true);
  oHTTP.send();
 }
 else {//else create
  if (typeof document.getElementById('spnError') != "undefined") {
    document.all['spnError'].innerText = 'ERROR: Cannot create XMLHTTP object to load next page';
  } //getelement
  else {
    alert("Cannot create XML HTTP object to load results");
  }//else spn  
 }//else create
}//func loadTarget

function gotTarget() {
 // see if loading is complete
 if (oHTTP.readyState == 4) {
  // check if there was an error
  if (oHTTP.status == 200) {
   // dump next page content into this page
   document.write(oHTTP.responseText);   
  }
  else {
   //alert("Cannot load next page");
   if (typeof document.getElementById('spnError') != "undefined") {
    document.all['spnError'].innerText = 'ERROR: Cannot load next page';
   }//spn
  }//else get
 }//readstate 4
}//gotTarget
/****************** FROM search / properties / inserts.js ****/
//-->
