var g_strRedirectLegalDisclaimer = "You have selected a link to a website that is not owned or maintained by Coldwell Banker Real Estate Corporation. Different terms of use and privacy policies will apply.";
var g_sCountry = '';
var g_biPad = navigator.userAgent.match(/iPad/i) != null;
var g_strShareTitle = '';
function ClearDefault(pField, strDefault){
if( pField && pField.value == strDefault ){
pField.value = '';
pField.style.color = '#222';
}
}
function FallBackPopupShareThis( strUrl, iWidth, iHeight )
{
var url = "";
var image = "";
var loc = '';
url = encodeURIComponent(window.location.href);
if(url.indexOf('enhanced') > -1) {
var aItems = location.hash.split(',');
for(var i=0;i<aItems.length;i++) {
var aPairs = aItems[i].split('=');
if(aPairs[0] == 'loc') {
loc = aPairs[1];
if(aPairs[2]) {
loc = loc + "=" + aPairs[2];
}
}
}
if(loc.length > 0) url = loc;
}
$(".cbc-st-image").each(function(index) { if (index === 0 ) image = encodeURI(this.src); });
if(strUrl.indexOf('digg') > -1) {
iWidth += 400;
}
strUrl = strUrl + "&image=" + image + "&url=" + url;
wind=window.open(strUrl,'','width='+iWidth+',height='+iHeight+',resizable=yes,scrollbars=yes,status=yes');
if ( wind ) return false;
return true;
}
function FallBackPopup( strUrl, iWidth, iHeight )
{
wind=window.open(strUrl,'','width='+iWidth+',height='+iHeight+',resizable=yes,scrollbars=yes,status=yes');
if ( wind ) return false;
return true;
}
function EmptyIfEnter(pField)
{
if ( pField ) {
if ( pField.value )
if ( pField.value.length > 5 )
if ( pField.value.indexOf("Enter ") >= 0 || pField.value.indexOf("Entre ") >= 0 || pField.value.indexOf("Introduzca") >= 0 )
pField.value = '';
}
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if ( endstr == -1 )
endstr = document.cookie.length;
return(unescape(document.cookie.substring(offset, endstr)));
}
function FixCookieDate (date) {
var base = new Date(0);
var skew = base.getTime();
date.setTime (date.getTime() - skew);
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while ( i < clen ) {
var j = i + alen;
if ( document.cookie.substring(i, j) == arg ) return(getCookieVal (j));
i = document.cookie.indexOf(" ", i) + 1;
if ( i == 0 ) break;
}
return(null);
}
function SetCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function DeleteCookie (name,path,domain) {
if ( GetCookie(name) ) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
function UrlDecode(strEncodeString)
{
var lsRegExp = /\+/g;
return unescape(String(strEncodeString).replace(lsRegExp, " "));
}
QueryString.keys = new Array();
QueryString.values = new Array();
function QueryString(key) {
var value = null;
for (var i=0;i<QueryString.keys.length;i++) {
if (QueryString.keys[i]==key) {
value = QueryString.values[i];
break;
}
}
return value;
}
function QueryString_Parse() {
QueryString.keys = new Array();
QueryString.values = new Array();
var query = window.location.search.substring(1);
var pairs = query.split("&");
for (var i=0;i<pairs.length;i++) {
var pos = pairs[i].indexOf('=');
if (pos >= 0) {
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
QueryString.keys[QueryString.keys.length] = argname;
QueryString.values[QueryString.values.length] = value;
}
}
}
function SavedQueryString_Parse( strUrl ) {
QueryString.keys = new Array();
QueryString.values = new Array();
if ( strUrl == null ) return;
var query = '';
var qpos = strUrl.indexOf('?');
if( qpos > 0 ){
query = strUrl.substring(qpos+1);
} else {
query = strUrl;
}
var pairs = query.split("&"); for (var i=0;i<pairs.length;i++) {
var pos = pairs[i].indexOf('=');
if (pos >= 0) {
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
QueryString.keys[QueryString.keys.length] = argname;
QueryString.values[QueryString.values.length] = value;
}
}
}
function moneyFormat(input) {
var dollars = Math.floor(input);
var tmp = new String(input);
for ( var decimalAt = 0; decimalAt < tmp.length; decimalAt++ ) {
if ( tmp.charAt(decimalAt)=="." )
break;
}
var cents = "" + Math.round(input * 100);
cents = cents.substring(cents.length-2, cents.length)
dollars += ((tmp.charAt(decimalAt+2)=="9")&&(cents=="00"))? 1 : 0;
if ( cents == "0" )
cents = "00";
return(dollars + "." + cents);
}
function PhoneFormat(strPhone) {
var bFormatted = false;
strPhone = strPhone.toString();
if( strPhone.indexOf('(') > -1 ) bFormatted = true;
if( (strPhone.length > 9) && !bFormatted) {
strFormatted = '(';
strFormatted += strPhone.substring(0, 3);
strFormatted += ') ';
strFormatted += strPhone.substring(3, 6);
strFormatted += '-';
strFormatted += strPhone.substring(6, 10);
if( strPhone.length > 10 ) {
strFormatted += ' x';
strFormatted += strPhone.substring(10, strPhone.length);
}
return strFormatted;
}
return strPhone;
}
function FormatExternalUrlWithLink(strUrl) {
var strLink = '';
strUrl = strUrl.toString();
if( strUrl.length > 0 ) {
var strFqUrl;
var strDisplay;
var iProtocolAt = strUrl.indexOf('://');
if( iProtocolAt > 0 ) {
strFqUrl = strUrl;
strDisplay = strUrl.substring(iProtocolAt + 3);
} else {
strDisplay = strUrl;
strFqUrl = 'http://' + strUrl;
}
var iDirectoryAt = strDisplay.indexOf('/');
if( iDirectoryAt > 0 ) {
strDisplay = strDisplay.substring(0, iDirectoryAt);
}
strLink = '<a href="'+strFqUrl+'" target="_external">' + strDisplay + '</a>';
}
return strLink;
}
function FormatEmailWithLink(strEmail) {
var strLink = '';
strEmail = strEmail.toString();
if( strEmail.length > 0 ) {
var iProtocolAt = strEmail.indexOf('@');
if( iProtocolAt > 0 ) {
strLink = '<a href="mailto:'+strEmail+'">' + strEmail + '</a>';
}
}
return strLink;
}
function IfLinkNotInCbcNetworkForceConfirmation()
{
var strServerName;
if( document.getElementsByTagName ) {
var aTags = document.getElementsByTagName('a');
var iAnchorCount = aTags.length;
for (var i=0; i < iAnchorCount; i++) {
if (! aTags[i].getAttribute('donotaddlegaldisclaimer')) {
if (aTags[i].href) {
strServerName = getServerName(aTags[i].getAttribute('href'));
if (strServerName.length > 0) {
if (!isValidCbcServer(strServerName)) {
aTags[i].onclick = function () { return confirm(g_strRedirectLegalDisclaimer); };
}
}
}
}
}
}
}
function findPos(obj) {
var curleft = curtop = scrolltop = 0;
if(obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
scrolltop += obj.scrollTop;
} while (obj = obj.offsetParent);
}
return {left:curleft,top:curtop,"scroll":scrolltop};
}
function HasClass(pPop, strClass){
if (typeof pPop == 'string') {
pPop = document.getElementById(pPop);
}
if( pPop && pPop.className ) {
return pPop.className.match(new RegExp('(\\s|^)'+ strClass +'(\\s|$)'));
}
return false;
}
function AddClass(pPop, strClass){
if (typeof pPop == 'string') {
pPop = document.getElementById(pPop);
}
if( pPop ) {
if (!this.HasClass(pPop, strClass)) {
pPop.className += " "+ strClass;
return true;
}
}
return false;
}
function RemoveClass(pPop, strClass){
if (typeof pPop == 'string') {
pPop = document.getElementById(pPop);
}
if( pPop ) {
if (HasClass(pPop, strClass)) {
var reg = new RegExp('(\\s|^)'+ strClass +'(\\s|$)');
pPop.className=pPop.className.replace(reg,' ');
return true;
}
}
return false;
}
function ToggleClass(pPop, strClass){
if ( HasClass(pPop, strClass) ) {
RemoveClass(pPop, strClass);
} else {
AddClass(pPop, strClass);
}
}
function getServerName(strValue)
{
var strServerName;
var iParmLocation;
strServerName = strValue.toLowerCase();
iParmLocation = strServerName.indexOf("?");
if (iParmLocation >= 0) {
strServerName = strServerName.substring(0,iParmLocation);
}
if (strServerName.indexOf("http") == 0) {
iParmLocation = strServerName.indexOf("https://");
if (iParmLocation >= 0) {
strServerName = strServerName.substring((iParmLocation+8),strServerName.length);
}
iParmLocation = strServerName.indexOf("http://");
if (iParmLocation >= 0) {
strServerName = strServerName.substring((iParmLocation+7),strServerName.length);
}
iParmLocation = strServerName.indexOf("/");
if (iParmLocation >= 0) {
strServerName = strServerName.substring(0,iParmLocation);
}
} else {
strServerName = "";
}
return strServerName;
}
function isValidCbcServer(strServerName)
{
var CurrentServer = document.location.host.toLowerCase();
if( strServerName.indexOf(".coldwellbankercommercial.com") >= 0 ){
return true;
}
if( strServerName == "coldwellbankercommercial.com" ){
return true;
}
if( strServerName.indexOf(".realogy.com") >= 0 ){
return true;
}
if( strServerName.indexOf(".instantclientaccess.com") >= 0 ){
return true;
}
if( strServerName == "instantclientaccess.com" ){
return true;
}
if( strServerName == CurrentServer ){
return true;
}
return false;
}
function RestorePreviousFormFill( pForm, strCookieName )
{
if( !pForm || !strCookieName ){
return;
}
SavedQueryString_Parse( GetCookie(strCookieName) );
var iNumElements = pForm.elements.length;
for( var i=0; i < iNumElements; i++ ){
if(pForm.elements[i].type == 'select-one' ) {
var strLast = UrlDecode(QueryString( pForm.elements[i].name ));
if( strLast ) {
for( var j=0; j<pForm.elements[i].length; j++ ){
if( pForm.elements[i][j].value == strLast ){
pForm.elements[i][j].selected = true;
}
}
}
} else if(pForm.elements[i].type == 'text' ) {
var strLast = UrlDecode(QueryString( pForm.elements[i].name ));
if( strLast && strLast != 'null' ){
pForm.elements[i].value = strLast;
}
}
}
QueryString_Parse();
for( var i=0; i < iNumElements; i++ ){
if(pForm.elements[i].type == 'select-one' ) {
var strLast = UrlDecode(QueryString( pForm.elements[i].name ));
if( strLast && strLast.length > 0) {
for( var j=0; j<pForm.elements[i].length; j++ ){
if( pForm.elements[i][j].value == strLast ){
pForm.elements[i][j].selected = true;
}
}
}
} else if(pForm.elements[i].type == 'text' ) {
var strLast = UrlDecode(QueryString( pForm.elements[i].name ));
if( strLast && strLast != 'null' && strLast.length > 0 ){
pForm.elements[i].value = strLast;
}
}
}
}
function CbcImgQuickSwap( pPhotoToSwap, strSrcId, strNewPhoto, strCaption, strLargeFileUrl )
{
var bReturn = true;
if( !pPhotoToSwap ) return;
if ( pPhotoToSwap ) {
if ( pPhotoToSwap.src ) {
pPhotoToSwap.src = strNewPhoto;
bReturn = false;
}
var pLPE = document.getElementById( strSrcId );
if( pLPE ) {
if ( strLargeFileUrl ) {
pLPE.value = strLargeFileUrl;
}
}
}
if( document.getElementById ) {
var pCaption = document.getElementById('photocaption');
if( pCaption ) {
pCaption.innerHTML = strCaption;
}
}
return bReturn;
}
function ShowLargePhotoUrl( strUrl, strCaptionId )
{
var strCaption = '';
var pCaption = document.getElementById(strCaptionId);
if( pCaption ) {
strCaption = pCaption.innerHTML;
}
if( strUrl != '' ) {
var pWinPop = window.open('', 'largeImage', 'width=760,height=540,resizeable=yes');
if( pWinPop ) {
pWinPop.document.write('<html><head><title>Image</title>');
pWinPop.document.write('</head><body>');
pWinPop.document.write('<p align=center><img src="'+strUrl+'"></p><p align=center>');
pWinPop.document.write(strCaption + '</p><p align=center>');
pWinPop.document.write('<a href="Javascript:window.close()">Close Window</a></p>');
pWinPop.document.write(' </body></html>');
setTimeout( function(){ fitWinToPic(pWinPop); }, 1000 );
}
}
}
function fitWinToPic( pWinHandle )
{
if( pWinHandle ) {
if( document.images[0].complete ) {
var NS = (navigator.appName=="Netscape")?true:false;
var iWidth = (NS)?pWinHandle.innerWidth:pWinHandle.document.body.clientWidth;
var iHeight = (NS)?pWinHandle.innerHeight:pWinHandle.document.body.clientHeight;
var iThisWidth = (NS)?window.innerWidth:document.body.clientWidth;
var iThisHeight = (NS)?window.innerHeight:document.body.clientHeight;
if( iWidth > iThisWidth ) iWidth = iThisWidth + 20;
if( iHeight > iThisHeight ) iHeight = iThisHeight + 100;
if( pWinHandle.document.images[0].width > iThisWidth ) pWinHandle.document.images[0].width = iThisWidth - 30;
else if( pWinHandle.document.images[0].height > iThisHeight) pWinHandle.document.images[0].height = iThisHeight - 30;
iWidth = (pWinHandle.document.images[0].width - iWidth) + 20;
iHeight = (pWinHandle.document.images[0].height - iHeight) + 100;
if( (iWidth > 0) || (iHeight > 0) ) {
pWinHandle.resizeBy(iWidth, iHeight);
pWinHandle.focus();
}
} else if ( pWinHandle.document.images[0] ) {
setTimeout( function(){ fitWinToPic(pWinPop); }, 250 );
}
}
}
var g_iSearchTipPosLeft = 0;
var g_iSearchTipPosRight = 0;
var g_iSearchTipPosTop = 0;
var g_iSearchTipPosBottom = 0;
var g_bSearchTipCancelCloseRequest = false;
var g_bSearchTipTimeoutActive = false;
var g_bSearchTipVisible = false;
var g_bSearchTipCurrentId = "";
var g_strSaveListingAddMsg = "(Add to Saved Listings)";
var g_strSaveListingRemMsg = "(Remove from Saved Listings)";
var g_strCompareListingAddMsg = "";var g_strCompareListingRemMsg = "";var g_iTotalCompareProperties = 3;
function CbcSearchMapPushPinMouseOver( x, y, title, details )
{
ShowSearchTooltip(unescape(title));
}
function ShowSearchTooltip( strObjectIdWithData )
{
if ( g_bSearchTipVisible ) {
if ( g_bSearchTipCurrentId == strObjectIdWithData ) {
return;
}
else {
HideSearchToolTip();
}
}
g_bSearchTipVisible = true;
g_bSearchTipCancelCloseRequest = true;
g_bSearchTipTimeoutActive = true;
var intX = CyberGetMouseXPosition(event);
var intY = CyberGetMouseYPosition(event);
var pObject = document.getElementById( strObjectIdWithData );
var pSearchToolTip = document.getElementById( 'searchtooltip' );
if ( pSearchToolTip == null ) {
pSearchToolTip = document.createElement("div");
pSearchToolTip.id = 'searchtooltip';
pSearchToolTip.style.position= 'absolute';
pSearchToolTip.style.display = 'none';
pSearchToolTip.style.border = "1px solid windowframe";
pSearchToolTip.style.background = '#FFFFEA';
pSearchToolTip.style.zIndex = 99;
document.body.appendChild(pSearchToolTip);
} else {
if( pSearchToolTip.strLastObjectBinding ) {
cbcResUnHighlight(pSearchToolTip.strLastObjectBinding);
}
}
pSearchToolTip.strLastObjectBinding = strObjectIdWithData;
pSearchToolTip.innerHTML = '<table border=0><tr>' + pObject.innerHTML + '</tr></table>';
CyberCoreSetObjectPosition(pSearchToolTip, intX - 20, intY - 20);
pSearchToolTip.style.display = 'block';
cbcResHighlight( strObjectIdWithData );
setTimeout( BeginShowSearchTip, 400 );
}
function TrackSearchToolTip( event )
{
var pSearchToolTip = document.getElementById( 'searchtooltip' );
if ( pSearchToolTip != null ) {
var tempX = CyberGetMouseXPosition(event);
var tempY = CyberGetMouseYPosition(event);
if( tempX < g_iSearchTipPosLeft || tempX > g_iSearchTipPosRight ){
if( ! g_bSearchTipTimeoutActive ) {
g_bSearchTipCancelCloseRequest = false;
setTimeout( RequestHideSearchToolTip, 400 );
g_bSearchTipTimeoutActive = true;
}
return;
}
if( tempY < g_iSearchTipPosTop || tempY > g_iSearchTipPosBottom ){
if( ! g_bSearchTipTimeoutActive ) {
g_bSearchTipCancelCloseRequest = false;
setTimeout( RequestHideSearchToolTip, 400 );
g_bSearchTipTimeoutActive = true;
}
return;
}
g_bSearchTipCancelCloseRequest = true;
}
}
function RequestHideSearchToolTip()
{
var pSearchToolTip = document.getElementById( 'searchtooltip' );
if ( pSearchToolTip != null ) {
g_bSearchTipTimeoutActive = false;
if( ! g_bSearchTipCancelCloseRequest ) {
HideSearchToolTip();
}
}
}
function HideSearchToolTip()
{
var pSearchToolTip = document.getElementById( 'searchtooltip' );
if ( pSearchToolTip != null ) {
CyberCoreRemoveEvent("onmousemove", document, TrackSearchToolTip );
pSearchToolTip.style.display = 'none';
g_bSearchTipVisible = false;
g_bSearchTipCurrentId = "";
if( pSearchToolTip.strLastObjectBinding ) {
cbcResUnHighlight(pSearchToolTip.strLastObjectBinding);
}
}
}
function BeginShowSearchTip()
{
var pSearchToolTip = document.getElementById( 'searchtooltip' );
if ( pSearchToolTip != null ) {
g_iSearchTipPosLeft = CyberCoreFindPosX(pSearchToolTip);
g_iSearchTipPosRight = g_iSearchTipPosLeft + CyberCoreFindWidth(pSearchToolTip);
g_iSearchTipPosTop = CyberCoreFindPosY(pSearchToolTip) - 30;
g_iSearchTipPosBottom = g_iSearchTipPosTop + CyberCoreFindHeight(pSearchToolTip) + 30;
CyberCoreAttachEvent( 'onmousemove', document, TrackSearchToolTip );
setTimeout( RequestHideSearchToolTip, 400 );
}
}
function cbcResHighlight( objectId )
{
var pObject = document.getElementById( objectId );
if( pObject != null ) {
if( pObject.style ) {
pObject.style.backgroundColor = '#FFFFEA';
}
}
}
function cbcResUnHighlight( objectId )
{
var pObject = document.getElementById( objectId );
if( pObject != null ) {
if( pObject.style ) {
pObject.style.backgroundColor = '';
}
}
}
function AddSearchAllCheckbox( strId )
{
document.write(' <span class="bodyText"><input type=checkbox name="check_' + strId + '" id="check_' + strId + '" value="1" onClick="CyberCoreCheckmarkAll(\'' + strId + '\', this.checked);"> <label for="check_' + strId + '"><i> Search All</i></label></span>');
}
function ClearSearchAllCheckbox( strId )
{
var pCb = CyberCoreGetObject('check_' + strId);
if ( pCb ) {
pCb.checked = 0;
}
}
function ClearLastSearch()
{
SetCookie ('lastsearch','',null,'/',null,false);
}
function ToggleSearchFlyout( strId )
{
var pDiv = CyberCoreGetObject(strId);
var pNode = CyberCoreGetObject(strId + '_node');
if ( pDiv ) {
if ( pDiv.style.display == 'block' ) {
pDiv.style.display = 'none';
if ( pNode ) {
pNode.src = '/images/plus.gif';
}
}
else {
pDiv.style.display = 'block';
if ( pNode ) {
pNode.src = '/images/minus.gif';
}
}
}
}
function ToggleSaveListing( lProperty )
{
var bAlreadyInCart = false;
var iCartLocation = 0;
var bNotify = false;
var strPropString = GetCookie("ListingSave");
var iCurr;
var aPropertyArray;
var strNewString;
var bFirst = true;
var dtExpiration = (new Date((new Date()).getTime() + 30*150000));
if ( strPropString ) {
aPropertyArray = strPropString.split('|');
} else {
aPropertyArray = new Array;
}
strNewString = "";
for ( iCurr=0; iCurr < aPropertyArray.length; iCurr++ ) {
if ( lProperty == aPropertyArray[iCurr] ) {
bAlreadyInCart = true;
iCartLocation = iCurr;
} else {
if ( !bFirst ) {
strNewString += "|" + aPropertyArray[iCurr];
} else {
strNewString += aPropertyArray[iCurr];
bFirst = false;
}
}
}
if ( !bAlreadyInCart ) {
if( aPropertyArray.length > 17 ) {
alert("You may only save up to 18 properties at a time. Please remove one or more proeprties from your list before trying to add more.");
return;
} else {
if ( !bFirst )
strNewString += "|";
strNewString += lProperty;
}
}
SetCookie("ListingSave", strNewString, dtExpiration, "/", null, false);
if ( document.getElementById ) {
var pDiv = document.getElementById( 'pcd' + lProperty );
if ( pDiv && pDiv.length && pDiv.length > 1 ) {
for ( iCurr = 0; iCurr < pDiv.length; iCurr++ ) {
pSubDiv = pDiv[iCurr];
if ( pSubDiv ) {
if ( bAlreadyInCart ) {
pSubDiv.innerHTML = g_strSaveListingAddMsg;
} else {
pSubDiv.innerHTML = g_strSaveListingRemMsg;
}
bNotify = false;
}
}
} else {
if ( pDiv ) {
if ( bAlreadyInCart ) {
pDiv.innerHTML = g_strSaveListingAddMsg;
} else {
pDiv.innerHTML = g_strSaveListingRemMsg;
}
bNotify = false;
}
}
}
if ( bNotify ) {
if ( bAlreadyInCart ) {
alert("You have removed this property from your saved listings.");
} else {
alert("You have added this property to your saved listings.");
}
}
if( !bAlreadyInCart ){
strPropString = GetCookie("ListingSave");
if( strPropString == null || strPropString == '' )
alert("You must have cookies enabled in your browser to use this feature.");
}
}
function ShowListingSaveButton( lProperty )
{
var bAlreadyInCart = false;
var strPropString = GetCookie("ListingSave");
var aPropertyArray;
if ( strPropString ) {
aPropertyArray = strPropString.split('|');
} else {
aPropertyArray = new Array;
}
for ( iCurr=0; iCurr < aPropertyArray.length; iCurr++ ) {
if ( lProperty == aPropertyArray[iCurr] ) {
bAlreadyInCart = true;
}
}
if ( !bAlreadyInCart ) {
document.write(g_strSaveListingAddMsg);
} else {
document.write(g_strSaveListingRemMsg);
}
}
function GetCompareArrayFromString( strPropString )
{
var iNumProperties = 0;
var aPropArray = new Array;
var aTmpItemArray = new Array;
if ( strPropString ) {
aTmpItemArray = strPropString.split('|');
var iNumItems = aTmpItemArray.length;
for( var i=0; i < iNumItems; i++ ) {
if( aTmpItemArray[i] ) {
var aThisProp = aTmpItemArray[i].split('*');
if( aThisProp.length == 4 ) {
aPropArray[iNumProperties] = new Array;
aPropArray[iNumProperties]['lProperty'] = aThisProp[0];
aPropArray[iNumProperties]['strProperty'] = aThisProp[1];
aPropArray[iNumProperties]['strCityState'] = aThisProp[2];
aPropArray[iNumProperties]['strPrice'] = aThisProp[3];
iNumProperties++;
}
}
}
}
return aPropArray;
}
function GetCompareStringFromArray( aPropArray )
{
var strPropString = '';
var iNumItems = aPropArray.length;
for( var i=0; i < iNumItems; i++ ) {
strPropString += aPropArray[i]['lProperty'];
strPropString += "*";
strPropString += aPropArray[i]['strProperty'].replace(/\*/g, " ");
strPropString += "*";
strPropString += aPropArray[i]['strCityState'].replace(/\*/g, " ");
strPropString += "*";
strPropString += aPropArray[i]['strPrice'];
if( iNumItems > (i+1) ) {
strPropString += "|";
}
}
return strPropString;
}
function ShowListingCompareButton( lProperty )
{
var bAlreadyInCart = false;
var strPropString = GetCookie("PropCompare");
var aPropertyArray;
aPropertyArray = GetCompareArrayFromString( strPropString );
for ( iCurr=0; iCurr < aPropertyArray.length; iCurr++ ) {
if ( lProperty == aPropertyArray[iCurr]['lProperty'] ) {
bAlreadyInCart = true;
}
}
if ( !bAlreadyInCart ) {
document.write(g_strCompareListingAddMsg);
} else {
document.write(g_strCompareListingRemMsg);
}
}
function ShowSavedListingTab()
{
var strPropString = GetCookie("ListingSave");
if( strPropString ) {
if( strPropString.length > 1 ) {
document.write('<td style="border-bottom: 1px solid #305782;width:4px;">&nbsp;</td>');
document.write('<td style="border: 1px solid #305782;width:100px;height:30px;" align="center">');
document.write('<a href="/cbcbin/searchproperty?t=s"><u><b>Saved Listings</b></u></a>');
document.write('</td>');
}
}
}
function ShowSavedListingLink( bShowSeperator )
{
var strPropString = GetCookie("ListingSave");
if( strPropString ) {
if( strPropString.length > 1 ) {
if( bShowSeperator ) {
document.write(' <font class="bodySmallText">&nbsp;|&nbsp;</font> ');
}
document.write('<a href="/cbcbin/searchproperty?t=s" class="bodySmallHref"><u><b>Saved Listings</b></u></a>');
}
}
}
function ShowLargePhoto( strId, strCaptionId )
{
var strCaption = '';
var pCaption = document.getElementById(strCaptionId);
if( pCaption ) {
strCaption = pCaption.innerHTML;
}
pImg = document.getElementById(strId);
if( pImg ) {
var strUrl = pImg.largephotourl;
if( !strUrl ) strUrl = pImg.src;
if( strUrl) {
var pWinPop = window.open('', 'largeImage', 'width=660,height=540,scrollbars=yes');
if( pWinPop ) {
pWinPop.document.write('<html><head>');
pWinPop.document.write('</head><body>');
pWinPop.document.write('<p align=center><img src="'+strUrl+'"></p><p align=center style="font-family:arial;">');
pWinPop.document.write(strCaption + '</p><p align=center style="font-family:arial;">');
pWinPop.document.write('<a href="Javascript:window.close()">Close Window</a></p>');
pWinPop.document.write(' </body></html>');
setTimeout( function(){ fitWinToPic(pWinPop); }, 250 );
}
}
}
}
function fitWinToPic( pWinHandle )
{
if( pWinHandle ) {
if( document.images[0].complete ) {
var NS = (navigator.appName=="Netscape")?true:false;
var iWidth = (NS)?pWinHandle.innerWidth:pWinHandle.document.body.clientWidth;
var iHeight = (NS)?pWinHandle.innerHeight:pWinHandle.document.body.clientHeight;
var iThisWidth = (NS)?window.innerWidth:document.body.clientWidth;
var iThisHeight = (NS)?window.innerHeight:document.body.clientHeight;
if( iWidth > iThisWidth ) iWidth = iThisWidth + 20;
if( iHeight > iThisHeight ) iHeight = iThisHeight + 100;
if( pWinHandle.document.images[0].width > iThisWidth ) pWinHandle.document.images[0].width = iThisWidth - 30;
else if( pWinHandle.document.images[0].height > iThisHeight) pWinHandle.document.images[0].height = iThisHeight - 30;
iWidth = (pWinHandle.document.images[0].width - iWidth) + 20;
iHeight = (pWinHandle.document.images[0].height - iHeight) + 100;
if( (iWidth > 0) || (iHeight > 0) ) {
pWinHandle.resizeBy(iWidth, iHeight);
pWinHandle.focus();
}
} else if ( pWinHandle.document.images[0] ) {
setTimeout( function(){ fitWinToPic(pWinPop); }, 250 );
}
}
}
function ShowLargePhotoUrl( strUrl, strCaptionId )
{
var strCaption = '';
var pCaption = document.getElementById(strCaptionId);
if( pCaption ) {
strCaption = pCaption.innerHTML;
}
if( strUrl != '' ) {
var pWinPop = window.open('', 'largeImage', 'width=660,height=540,resizeable=yes');
if( pWinPop ) {
pWinPop.document.write('<html><head>');
pWinPop.document.write('</head><body>');
pWinPop.document.write('<p align=center><img src="'+strUrl+'"></p><p align=center>');
pWinPop.document.write(strCaption + '</p><p align=center>');
pWinPop.document.write('<a href="Javascript:window.close()">Close Window</a></p>');
pWinPop.document.write(' </body></html>');
setTimeout( function(){ fitWinToPic(pWinPop); }, 250 );
}
}
}
function WriteSpBcHomeLink()
{
if( window.location ) {
var strLocation = '' + window.location;
if( strLocation.indexOf("poweredby") < 0 ) {
document.write('<a href="/" class="cbcbreadcrumbnav">Home</a>');
}
} else {
document.write('<a href="/" class="cbcbreadcrumbnav">Home</a>');
}
}
function ToggleCompare( lProperty, strProperty, strCityState, strPrice, bSuppressBeaconUpdate )
{
var bAlreadyInCart = false;
var iCartLocation = 0;
var bNotify = false;
var strPropString = GetCookie("PropCompare");
var iCurr;
var aPropertyArray;
var strNewString;
var bFirst = true;
var dtExpiration = (new Date((new Date()).getTime() + 30*150000));
aPropertyArray = GetCompareArrayFromString( strPropString );
if (bSuppressBeaconUpdate == 'false') {
bSuppressBeaconUpdate = false;
}
strNewString = "";
for ( iCurr=0; iCurr < aPropertyArray.length; iCurr++ ) {
if ( lProperty == aPropertyArray[iCurr]['lProperty'] ) {
bAlreadyInCart = true;
iCartLocation = iCurr;
aPropertyArray.splice(iCartLocation, 1);
break;
}
}
if ( !bAlreadyInCart ) {
if( aPropertyArray.length > (g_iTotalCompareProperties - 1) ) {
alert("You may only compare up to 3 properties at a time. Please remove one or more proeprties from the comparison before trying to add more.");
return;
} else {
iCartLocation = aPropertyArray.length;
aPropertyArray[iCartLocation] = new Array();
aPropertyArray[iCartLocation]['lProperty'] = lProperty;
aPropertyArray[iCartLocation]['strProperty'] = strProperty;
aPropertyArray[iCartLocation]['strCityState'] = strCityState;
aPropertyArray[iCartLocation]['strPrice'] = strPrice;
}
}
strNewString = GetCompareStringFromArray( aPropertyArray );
SetCookie("PropCompare", strNewString, dtExpiration, "/", null, false);
if ( document.getElementById ) {
pDiv = document.getElementById('pcdcmp' + lProperty);
if ( pDiv && pDiv.length && pDiv.length > 1 ) {
for ( iCurr = 0; iCurr < pDiv.length; iCurr++ ) {
pSubDiv = pDiv[iCurr];
if ( pSubDiv ) {
if ( bAlreadyInCart ) {
if (!bSuppressBeaconUpdate) {
DisplayCompareBox();
pSubDiv.innerHTML = "<img src=\"/images/cpadd.gif\" border=0 align=middle width=19 height=19>";
} else {
pSubDiv.innerHTML = "(Add to Compare Listings)";
}
} else {
if (!bSuppressBeaconUpdate) {
DisplayCompareBox();
pSubDiv.innerHTML = "<img src=\"/images/cprem.gif\" border=0 align=middle width=19 height=19>";
} else {
pSubDiv.innerHTML = "(Remove from Compare Listings)";
}
}
bNotify = false;
} else {
if (!bSuppressBeaconUpdate) {
DisplayCompareBox();
}
bNotify = false;
}
}
} else {
if ( pDiv ) {
if ( bAlreadyInCart ) {
if (!bSuppressBeaconUpdate) {
DisplayCompareBox();
pDiv.innerHTML = "<img src=\"/images/cpadd.gif\" border=0 align=middle width=19 height=19>";
} else {
pDiv.innerHTML = "(Add to Compare Listings)";
}
} else {
if (!bSuppressBeaconUpdate) {
DisplayCompareBox();
pDiv.innerHTML = "<img src=\"/images/cprem.gif\" border=0 align=middle width=19 height=19>";
} else {
pDiv.innerHTML = "(Remove from Compare Listings)";
}
}
bNotify = false;
} else {
if (!bSuppressBeaconUpdate) {
DisplayCompareBox();
}
bNotify = false;
}
}
}
if ( bNotify ) {
if ( bAlreadyInCart ) {
alert("You have removed this property from your comparison list.");
} else {
alert("You have added this property to your comparison list.");
}
}
if( !bAlreadyInCart ){
strPropString = GetCookie("PropCompare");
if( strPropString == null || strPropString == '' )
alert("You must have cookies enabled in your browser to use this feature.");
}
}
function RemoveCompare(lPropertyId,lat,lon,type,price){
var bAlreadyInCart = false;
var iCartLocation = 0;
var bNotify = false;
var strPropString = GetCookie("PropCompare");
var iCurr;
var aPropertyArray;
var strNewString;
var dtExpiration = (new Date((new Date()).getTime() + 30*150000));
aPropertyArray = GetCompareArrayFromString( strPropString );
strNewString = "";
for ( iCurr=0; iCurr < aPropertyArray.length; iCurr++ ) {
if ( lPropertyId == aPropertyArray[iCurr]['lProperty'] ) {
bAlreadyInCart = true;
iCartLocation = iCurr;
aPropertyArray.splice(iCartLocation, 1);
break;
}
}
strNewString = GetCompareStringFromArray( aPropertyArray );
SetCookie("PropCompare", strNewString, dtExpiration, "/", null, false);
if ( bNotify ) {
if ( bAlreadyInCart ) {
alert("You have removed this property from your comparison list.");
}
}
window.location.reload();
}
function DisplayCompareBox()
{
var i = 0;
var iNumberFound = 0;
var strPropString = GetCookie("PropCompare");
var aPropertyArray;
var strProperty;
var strCityState;
var lProperty;
var strPrice;
aPropertyArray = GetCompareArrayFromString( strPropString );
pCompareBox = document.getElementById('comparebox');
if( pCompareBox ) {
iNumberFound = aPropertyArray.length;
if ( iNumberFound > 0 ) {
var strCpHtml;
strCpHtml = "<table cellspacing=\"0\" cellpadding=\"0\">" +
" <tr>" +
" <td background=\"/images/navtop.gif\" class=\"bodySmallText\" align=\"center\" colspan=\"2\">" +
" <br><font color=\"#FFFFFF\"><b>Properties To Compare</b></font>" +
" </td>" +
" </tr>" +
" <tr>" +
" <td style=\"border-collapse: collapse; border: 1px solid black;\">" +
" <table cellspacing=\"0\" cellpadding=\"0\">" +
" <tr bgcolor=\"#E9E9E7\">" +
" <td>&nbsp;</td>" +
" <td>" +
"<div id=\"comparepropbutton\">";
for( i=0; i < iNumberFound; i++ ) {
lProperty = aPropertyArray[i]['lProperty'];
strProperty = aPropertyArray[i]['strProperty'];
strCityState = aPropertyArray[i]['strCityState'];
strPrice = aPropertyArray[i]['strPrice'];
strCpHtml += "<table cellspacing=\"0\" cellpadding=\"0\" width=\"160\">";
strCpHtml += "<tr><td background=\"/images/bckgrn_dot.gif\" colspan=2>&nbsp;</td></tr>";
strCpHtml += " <tr> ";
strCpHtml += " <td class=\"bodySmallText\" valign=top>";
strCpHtml += " <b>" + strProperty + "</b>, ";
strCpHtml += " <font color=#666666>" + strPrice + "</font><br>";
strCpHtml += " <font color=#666666>" + strCityState + "</font>";
strCpHtml += " </td>";
strCpHtml += " <td class=\"bodySmallText\" valign=top width=10>";
strCpHtml += " <a class=eratool href=\"Javascript:ToggleCompare( '" + lProperty + "', '" + strProperty + "', '" + strCityState + "', '" + strPrice + "', false );\" title=\"Remove from Compare Listings\"><img src=\"/images/cpsprem.gif\" width=10 height=10 border=0 align=middle width=20 height=19 Alt=\"Remove From Compare Listings\"></a>";
strCpHtml += " </td>";
strCpHtml += " </tr>";
strCpHtml += "</table>";
}
if ( iNumberFound > 1 ) {
strCpHtml += "<table width=100%><tr><td background=/images/bckgrn_dot.gif >&nbsp;</td></tr><tr><td><input type=submit value=\"Compare Properties\" style=\"background-color:#61809F; color: #ffffff; font-weight: bold;width:150px;height:21px;\" onClick=\"location.href='/cbcbin/compare';\"></td></tr></table>";
}
strCpHtml += "</div>" +
"</td><td>&nbsp;</td></tr></table></td></tr></table>";
pCompareBox.innerHTML = strCpHtml;
} else {
pCompareBox.innerHTML = '';
}
}
}
function MapProperty( iCbcListingId, latitude, longitude, strType, strPrice ) {
try {
var strUrl = "/cbcbin/propertymap?cbclistingid=" + iCbcListingId;
FallBackPopup(strUrl, 950, 650);
} catch (e) {
alert("Could not map property, " + e.message);
}
}
function fitImageToContentArea(pImg, ContentAreaId){
return;
}
function logOfficeSite(eleLink) {
return;
}
function MarkAllInContainerChecked(strContainerId, bChecked)
{
var pObj = document.getElementById(strContainerId);
if ( pObj ) {
var aInput = pObj.getElementsByTagName('input');
for (var i=0; i< aInput.length; i++) {
if (aInput[i].type == 'checkbox') {
aInput[i].checked = bChecked;
}
}
return true;
}
return false;
}
function MarkChecked(strCheckboxId, bChecked)
{
var pCheckbox = document.getElementById(strCheckboxId);
if( pCheckbox ) {
pCheckbox.checked = bChecked;
}
}
