  var AJAXQUEUE_STATUS_PREPPING = 0;
    var AJAXQUEUE_STATUS_QUEUED = 1;
    var AJAXQUEUE_STATUS_PROCESSING = 2;
    var AJAXQUEUE_STATUS_SENT = 3;
    var AJAXQUEUE_STATUS_COMPLETE = 4;
    var AJAXQUEUE_STATUS_ERROR = 5;
    var AJAXQUEUE_STATUS_CANCELLED = 6;

    function AjaxQueue() {
        this.bDoCleanup = true;
        this.iAjaxCallInterval = 250;
        this.iIntervalId = 0;
        this.bIntervalStarted = false;
        this.locks = new Object;
        this.calls = new Object;
        this.strLastCall = null;
        this.iIteration = 0;
        this.errorHandler = null;
        this.RegisterErrorHandler = function (A) {this.errorHandler = A;};
        this.schedule = function (F, D, I, H, A, G) {if (this.calls[F] != undefined) {this.destroyCall(F);}var C = true;var B = new AjaxQueueCall(D, G);B.callback = I;B.priority = A == true ? true : false;if (H == true) {this.purgeAllCalls();}this.calls[F] = B;this.calls[F].state = AJAXQUEUE_STATUS_PREPPING;try {this.calls[F].xmlObject = this.getNewXMLObject();this.calls[F].xmlObject.onreadystatechange = function () {onReadyStateChangeHelper(F, D);};} catch (E) {if (this.errorHandler) {this.errorHandler(E);} else {alert("AjaxQueue Scheduling Failed for [" + F + "]: " + E.message);}bRetrun = false;}this.calls[F].state = AJAXQUEUE_STATUS_QUEUED;return C;};
        this.isLocked = function (B) {if (B != undefined) {if (this.locks[B] != undefined) {return this.locks[B].state;} else {return false;}} else {for (var A in this.locks) {if (this.locks[A].state == true) {return true;}}return false;}};
        this.registerLock = function (B) {var A = new AjaxQueueLock(B);this.locks[B] = A;return;};
        this.unregisterLock = function (B) {try {delete this.locks[B];} catch (A) {}return;};
        this.engageLock = function (A) {return this.changeLockState(A, true);};
        this.disengageLock = function (A) {return this.changeLockState(A, false);};
        this.changeLockState = function (C, A) {try {this.locks[C].state = A;} catch (B) {if (this.errorHandler) {this.errorHandler(B);} else {alert("AjaxQueue: cannot change lock [" + C + "]: " + B.message);}}return;};
        this.destroyCall = function (A) {if (this.calls[A] != undefined) {this.calls[A].state = AJAXQUEUE_STATUS_CANCELLED;this.abortCall(A);if (this.bDoCleanup == true) {this.purgeCall(A);}}};
        this.purgeCall = function (A) {try {delete this.calls[A];} catch (B) {}return;};
        this.abortCall = function (A) {this.calls[A].xmlObject.abort();return;};
        this.purgeAllCalls = function () {for (var A in this.calls) {this.destroyCall(A);}if (this.bDoCleanup == true) {this.calls = new Object;}};
        this.getNewXMLObject = function () {var A = null;try {if (window.XMLHttpRequest) {A = new XMLHttpRequest;} else {A = new ActiveXObject("Microsoft.XMLHTTP");}if (A == undefined || A == null) {alert("This website requires that your browser support AJAX.  Please update your browser, or use the accesible site links at the bottom of the page to continue.");}} catch (B) {alert("This website requires that your browser support AJAX.  Please update your browser, or use the accesible site links at the bottom of the page to continue.");}return A;};
        this.doAjaxHandling = function () {var A = this.getNextPriorityOpenCall();if (A == null) {A = this.getNextOpenCall();}this.strLastCall = A;this.iIteration++;if (A != null) {if (this.isLocked() == true && this.calls[A].priority == false) {this.strLastCall = "skip! " + this.isLocked() + " " + this.calls[A].priority;return;}this.calls[A].state = AJAXQUEUE_STATUS_PROCESSING;try {var C = this.calls[A];if (C.postData == null) {C.xmlObject.open("GET", C.url, true);C.xmlObject.send("");} else {C.xmlObject.open("POST", C.url, true);C.xmlObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");C.xmlObject.setRequestHeader("Content-length", C.postData.length);C.xmlObject.setRequestHeader("Connection", "close");C.xmlObject.send(C.postData);}} catch (B) {C.state = AJAXQUEUE_STATUS_ERROR;if (this.errorHandler) {this.errorHandler(B);} else {alert("AjaxQueue: Could not act on [" + A + "]:" + B.message);}}}this.cleanUpCalls();};
        this.getNextOpenCall = function () {for (var A in this.calls) {if (this.calls[A].state == AJAXQUEUE_STATUS_QUEUED) {return A;}}return null;};
        this.getNextPriorityOpenCall = function () {for (var A in this.calls) {if (this.calls[A].state == AJAXQUEUE_STATUS_QUEUED && this.calls[A].priority == true) {return A;}}return null;};
        this.cleanUpCalls = function () {if (this.bDoCleanup == true) {for (var A in this.calls) {if (this.calls[A].state > AJAXQUEUE_STATUS_SENT) {this.destroyCall(A);}}return;}};
        this.IsAjaxCapable = function () {var A = this.getNewXMLObject();if (A == undefined || A == null) {return false;}A = null;return true;};
    }


    function onReadyStateChangeHelper(A, C) {
        if (g_AjaxQueue.calls[A]) {
            if (g_AjaxQueue.calls[A].state != AJAXQUEUE_STATUS_PROCESSING) {
                return;
            }
            if (g_AjaxQueue.calls[A].xmlObject.readyState == 4) {
                if (g_AjaxQueue.calls[A].xmlObject.status &&
                    g_AjaxQueue.calls[A].xmlObject.status == 200) {
                    try {
                        g_AjaxQueue.calls[A].callback(g_AjaxQueue.calls[A].xmlObject);
                        g_AjaxQueue.calls[A].state = AJAXQUEUE_STATUS_COMPLETE;
                    } catch (B) {
                        g_AjaxQueue.calls[A].state = AJAXQUEUE_STATUS_ERROR;
                        if (this.errorHandler) {
                            this.errorHandler(B);
                        } else {
                            alert("AjaxQueue: callback for [" + A + "] failed: " + B.message);
                        }
                    }
                } else {
                    if (g_AjaxQueue.calls[A].xmlObject.status == 404) {
                        g_AjaxQueue.calls[A].state = AJAXQUEUE_STATUS_ERROR;
                        if (this.errorHandler) {
                            var B = new Error("404: Page not found, " + C);
                            this.errorHandler(B);
                        } else {
                            alert("AjaxQueue Call Failed for [" + A + "]: [" + C + "] Does Not Exist!");
                        }
                    } else {
                        if (g_AjaxQueue.calls[A].xmlObject.status == 500) {
                            g_AjaxQueue.calls[A].state = AJAXQUEUE_STATUS_ERROR;
                            if (this.errorHandler) {
                                var B = new Error("500: Internal server error, " + C);
                                this.errorHandler(B);
                            } else {
                                alert("AjaxQueue Call Failed for [" + A + "]: [" + C + "] Server Error!");
                            }
                        }
                    }
                }
            }
        }
    }


    function AjaxQueueCall(B, A) {
        this.url = B;
        this.postData = A;
        this.xmlObject = null;
        this.state = AJAXQUEUE_STATUS_PREPPING;
        this.callback = null;
        this.priority = 0;
    }


    function AjaxQueueLock(A) {
        this.name = A;
        this.state = false;
    }


    function CyberGetNodeValue(D, A) {
        try {
            if (D) {
                var B = D.getElementsByTagName(A);
                if (B && B[0]) {
                    if (B[0].firstChild) {
                        return B[0].firstChild.nodeValue;
                    }
                }
            }
        } catch (C) {
        }
        return "";
    }


    function CyberUrlEncode(G) {
        var C = "";
        var A = 0;
        G = G.toString();
        var F = /(^[a-zA-Z0-9_.]*)/;
        while (A < G.length) {
            var D = F.exec(G.substr(A));
            if (D != null && D.length > 1 && D[1] != "") {
                C += D[1];
                A += D[1].length;
            } else {
                if (G[A] == " ") {
                    C += "+";
                } else {
                    var B = G.charCodeAt(A);
                    var E = B.toString(16);
                    C += "%" + (E.length < 2 ? "0" : "") + E.toUpperCase();
                }
                A++;
            }
        }
        return C;
    }

    g_AjaxQueue = new AjaxQueue;
    g_bAjaxEnabled = g_AjaxQueue.IsAjaxCapable();

    function fireAjaxQueue() {
        if (g_AjaxQueue.bIntervalStarted == false) {
            g_AjaxQueue.iIntervalId = setInterval(function () {g_AjaxQueue.doAjaxHandling();}, g_AjaxQueue.iAjaxCallInterval);
            g_AjaxQueue.bIntervalStarted == true;
        }
    }

    RfgQueueCommand("fireAjaxQueue();");

    function CyberC21Slider(B, M, D, L, T, Q, R, Y, H, C, J, S, P, E, X, G, W, Z, V, F) {
        this.pContainer = document.getElementById(B);
        if (!this.pContainer) {
            throw new TypeError("Container ID must exist, could not create slider object");
        }
        this.pContainer.style.cssFloat = "left";
        this.pContainer.style.margin = "0";
        this.pContainer.style.width = C;
        this.pContainer.style.height = J;
        var U = B + "_lowpointer";
        var K = B + "_highpointer";
        var I = B + "_track";
        var O = B + "_activeoverlay";
        var N = false;
        if (H != null && H != "") {
            N = true;
        }
        var A = "<div id=\"" + I + "\" style=\"height:" + J + "px;width:" + C + "px;background:url(" + Y + ");position:relative;overflow:hidden;" + S + "\">" + (N ? "   <div id=\"" + O + "\" style=\"background:url(" + H + ");width:0px; height:" + J + "px;position:absolute;\"></div>" : "") + "   <div id=\"" + U + "\" style=\"background:url(" + P + ");width:" + X + "px; height:" + G + "px;position:absolute; cursor: pointer;\"></div>" + (M ? "   <div id=\"" + K + "\" style=\"background:url(" + E + ");width:" + X + "px; height:" + G + "px;position:absolute; cursor: pointer;\"></div>" : "") + "</div>";
        this.pContainer.innerHTML = A;
        this.pTrack = document.getElementById(I);
        if (!this.pTrack) {
            throw new TypeError("Could not create new slider track.");
        }
        this.pTrack.iRealLowBound = D;
        this.pTrack.iRealHighBound = L;
        if (T <= 0) {
            T = 1;
        }
        D = Math.round(parseFloat(D) / parseFloat(T));
        L = Math.round(parseFloat(L) / parseFloat(T));
        Q = Math.round(parseFloat(Q) / parseFloat(T));
        R = Math.round(parseFloat(R) / parseFloat(T));
        this.pTrack.strContainerId = B;
        this.pTrack.iLowBound = D;
        this.pTrack.iHighBound = L;
        this.pTrack.iResolution = T;
        this.pTrack.iStartLowAt = Q;
        this.pTrack.iStartHighAt = R;
        this.pTrack.strBgImage = Y;
        this.pTrack.iBgWidth = C - W - Z;
        this.pTrack.iBgHeight = J;
        this.pTrack.iFgWidth = X;
        this.pTrack.iFgHeight = G;
        this.pTrack.onMoveComplete = V;
        this.pTrack.onMove = F;
        this.pTrack.pMyself = this;
        this.pTrack.iDistance = this.pTrack.iBgWidth - X;
        this.pTrack.xMax = 0;
        this.pTrack.yMax = 0;
        this.pTrack.xMin = W;
        this.pTrack.yMin = 0;
        this.pTrack.bInDrag = false;
        this.pTrack.iNumElements = L - D;
        this.pTrack.fLowValue = Q;
        this.pTrack.fHighValue = R;
        this.pTrack.iEffectiveBound = 0;
        this.pTrack.bRangeSlider = M;
        this.pTrack.bActiveOverlay = N;
        this.pTrack.scale = (this.pTrack.iHighBound - this.pTrack.iLowBound) / this.pTrack.iDistance;
        this.pTrack.iEffectiveBound = D;
        this.pTrack.xMax = this.pTrack.iDistance;
        this.pTrack.yMax = 0;
        this.pTrack.pLowPointer = document.getElementById(U);
        if (!this.pTrack.pLowPointer) {
            throw new TypeError("Could not create new low slider pointer.");
        }
        if (this.pTrack.bRangeSlider) {
            this.pTrack.pHighPointer = document.getElementById(K);
            if (!this.pTrack.pHighPointer) {
                throw new TypeError("Could not create new high slider pointer.");
            }
        }
        if (this.pTrack.bActiveOverlay) {
            this.pTrack.pActiveOverlayPointer = document.getElementById(O);
            if (!this.pTrack.pActiveOverlayPointer) {
                throw new TypeError("Could not create new active overlay pointer.");
            }
            this.pTrack.pActiveOverlayPointer.pTrack = this.pTrack;
        }
        this.pTrack.pLowPointer.pTrack = this.pTrack;
        if (this.pTrack.bRangeSlider) {
            this.pTrack.pHighPointer.pTrack = this.pTrack;
        }
        this.pTrack.pLowPointer.startOffsetX = 0;
        this.pTrack.pLowPointer.startOffsetY = 0;
        this.pTrack.pLowPointer.iHiLoInd = 0;
        if (this.pTrack.bRangeSlider) {
            this.pTrack.pHighPointer.startOffsetX = 0;
            this.pTrack.pHighPointer.startOffsetY = 0;
            this.pTrack.pHighPointer.iHiLoInd = 1;
            this.pTrack.pHighPointer.onmousedown = cyberC21SliderHandleOnMouseDown;
        }
        this.pTrack.pLowPointer.onmousedown = cyberC21SliderHandleOnMouseDown;
        this.pTrack.onmousedown = cyberC21SliderHandleTrackOnClick;
        if (this.pTrack.bActiveOverlay) {
            this.pTrack.pActiveOverlayPointer.onmousedown = cyberC21SliderHandleOverlayOnClick;
        }
        this.SetValues = function (a, e, c) {var b = Math.round(parseFloat(a) / parseFloat(T));var d = Math.round(parseFloat(e) / parseFloat(T));this.realSetValues(b, d, c);};
        this.realSetValues = function (a, f, d) {if (this.pTrack.bRangeSlider && a > f) {var c = a;a = f;f = c;}if (a > this.pTrack.iHighBound) {a = this.pTrack.iHighBound;}if (a < this.pTrack.iLowBound) {a = this.pTrack.iLowBound;}if (this.pTrack.bRangeSlider) {if (f > this.pTrack.iHighBound) {f = this.pTrack.iHighBound;}if (f < this.pTrack.iLowBound) {f = this.pTrack.iLowBound;}this.pTrack.fHighValue = f;}this.pTrack.fLowValue = a;var e = (a - this.pTrack.iEffectiveBound) / this.pTrack.scale;if (this.pTrack.bRangeSlider) {var b = (f - this.pTrack.iEffectiveBound) / this.pTrack.scale;}this.getSetObjectLeft(this.pTrack.pLowPointer, Math.round(e + this.pTrack.xMin));if (this.pTrack.bRangeSlider) {this.getSetObjectLeft(this.pTrack.pHighPointer, Math.round(b + this.pTrack.xMin));}if (this.pTrack.bActiveOverlay) {if (this.pTrack.bRangeSlider) {this.pTrack.pActiveOverlayPointer.style.left = this.getSetObjectLeft(this.pTrack.pLowPointer) + this.pTrack.iFgWidth + ("px");this.pTrack.pActiveOverlayPointer.style.width = this.getSetObjectLeft(this.pTrack.pHighPointer) - this.getSetObjectLeft(this.pTrack.pLowPointer) + "px";} else {this.pTrack.pActiveOverlayPointer.style.left = this.pTrack.xMin;this.pTrack.pActiveOverlayPointer.style.width = this.getSetObjectLeft(this.pTrack.pLowPointer) + "px";}}if (d && this.pTrack.onMoveComplete) {this.pTrack.onMoveComplete(this);}};
        this.GetLowValue = function () {var a = this.pTrack.fLowValue * this.pTrack.iResolution;if (a < this.pTrack.iRealLowBound) {a = this.pTrack.iRealLowBound;}return a;};
        this.GetHighValue = function () {var a = this.pTrack.fHighValue * this.pTrack.iResolution;if (a > this.pTrack.iRealHighBound) {a = this.pTrack.iRealHighBound;}return a;};
        this.Destroy = function () {if (document.removeEventListener) {document.removeEventListener("mousemove", cyberC21SliderHandleOnMouseMove, false);document.removeEventListener("mouseup", cyberC21SliderHandleOnMouseUp, false);} else {if (document.detachEvent) {document.detachEvent("onmousemove", cyberC21SliderHandleOnMouseMove);document.detachEvent("onmouseup", cyberC21SliderHandleOnMouseUp);}}this.pTrack.pLowPointer.onmousedown = null;if (this.pTrack.bRangeSlider) {this.pTrack.pHighPointer.onmousedown = null;}this.pTrack.onclick = null;this.pContainer.innerHTML = "";};
        this.getSetObjectLeft = function (a, b) {if (a.style && typeof a.style.left == "string") {if (typeof b == "number") {a.style.left = b + "px";} else {b = parseInt(a.style.left);if (isNaN(b)) {b = 0;}}} else {if (a.style && a.style.pixelLeft) {if (typeof b == "number") {a.style.pixelLeft = b;} else {b = a.style.pixelLeft;}}}return b;};
        this.findPosY = function (b) {var a = 0;if (document.getElementById || document.all) {if (!b.offsetParent) {a += b.offsetTop;}while (b.offsetParent) {a += b.offsetTop;b = b.offsetParent;}} else {if (document.layers) {a += b.y;}}return a;};
        this.findPosX = function (a) {var b = 0;if (document.getElementById || document.all) {while (a.offsetParent) {b += a.offsetLeft;a = a.offsetParent;}} else {if (document.layers) {b += a.x;}}return b;};
        this.getSetObjectTop = function (a, b) {if (a.style && typeof a.style.top == "string") {if (typeof b == "number") {a.style.top = b + "px";} else {b = parseInt(a.style.top);if (isNaN(b)) {b = 0;}}} else {if (a.style && a.style.pixelTop) {if (typeof b == "number") {a.style.pixelTop = b;} else {b = a.style.pixelTop;}}}return b;};
        this.HandleTrackOnClick = function (b) {var g = 0;if (b.pageX) {g = b.pageX;} else {if (b.clientX) {g = b.clientX + (document.body.scrollLeft ? document.body.scrollLeft : 0);}}var e = g - this.findPosX(this.pTrack) - this.pTrack.iFgWidth / 2 - this.pTrack.xMin;var c = Math.round(e * this.pTrack.scale + this.pTrack.iEffectiveBound);var d = (c - this.pTrack.iEffectiveBound) / this.pTrack.scale;if (d > this.pTrack.xMax) {d = this.pTrack.xMax;}if (d < this.pTrack.xMin) {d = 0;}if (this.pTrack.bRangeSlider) {var f = this.findPosX(this.pTrack.pLowPointer);var a = this.findPosX(this.pTrack.pHighPointer);if (Math.abs(g - f) > Math.abs(g - a)) {this.getSetObjectLeft(this.pTrack.pHighPointer, Math.round(d + this.pTrack.xMin));this.pTrack.fHighValue = c;} else {this.getSetObjectLeft(this.pTrack.pLowPointer, Math.round(d + this.pTrack.xMin));if (this.getSetObjectLeft(this.pTrack.pLowPointer) > this.getSetObjectLeft(this.pTrack.pHighPointer)) {this.getSetObjectLeft(this.pTrack.pLowPointer, this.getSetObjectLeft(this.pTrack.pHighPointer));this.getSetObjectLeft(this.pTrack.pHighPointer, Math.round(d + this.pTrack.xMin));this.pTrack.fHighValue = c;} else {this.pTrack.fLowValue = c;}}} else {this.getSetObjectLeft(this.pTrack.pLowPointer, Math.round(d + this.pTrack.xMin));this.pTrack.fLowValue = c;}if (this.pTrack.bActiveOverlay) {if (this.pTrack.bRangeSlider) {this.pTrack.pActiveOverlayPointer.style.left = this.getSetObjectLeft(this.pTrack.pLowPointer) + this.pTrack.iFgWidth + ("px");this.pTrack.pActiveOverlayPointer.style.width = this.getSetObjectLeft(this.pTrack.pHighPointer) - this.getSetObjectLeft(this.pTrack.pLowPointer) + "px";} else {this.pTrack.pActiveOverlayPointer.style.left = this.pTrack.xMin;this.pTrack.pActiveOverlayPointer.style.width = this.getSetObjectLeft(this.pTrack.pLowPointer) + "px";}}if (this.pTrack.onMoveComplete) {this.pTrack.onMoveComplete(this);}};
        this.HandleOnMouseDown = function (a) {if (g_pCurrentMovingPointer) {g_pCurrentMovingPointer.startOffsetX = this.getSetObjectLeft(g_pCurrentMovingPointer) - a.screenX;g_pCurrentMovingPointer.startOffsetY = this.getSetObjectTop(g_pCurrentMovingPointer) - a.screenY;if (this.pTrack.pHighPointer) {g_pCurrentMovingPointer.startHiX = this.getSetObjectLeft(this.pTrack.pHighPointer);} else {g_pCurrentMovingPointer.startHiX = this.pTrack.xMax;}if (this.pTrack.pLowPointer) {g_pCurrentMovingPointer.startLoX = this.getSetObjectLeft(this.pTrack.pLowPointer);} else {g_pCurrentMovingPointer.startHiX = this.pTrack.xMin;}this.pTrack.bInDrag = true;if (window.addEventListener) {document.addEventListener("mousemove", cyberC21SliderHandleOnMouseMove, false);document.addEventListener("mouseup", cyberC21SliderHandleOnMouseUp, false);} else {document.attachEvent("onmouseup", cyberC21SliderHandleOnMouseUp);document.attachEvent("onmousemove", cyberC21SliderHandleOnMouseMove);}}return false;};
        this.HandleOnMouseMove = function (b) {if (this.pTrack.bInDrag && g_pCurrentMovingPointer) {var a = g_pCurrentMovingPointer.startOffsetX + b.screenX;if (a > this.pTrack.xMax + this.pTrack.xMin) {a = this.pTrack.xMax + this.pTrack.xMin;}if (a < this.pTrack.xMin) {a = this.pTrack.xMin;}var d = a;var e = parseFloat(this.pTrack.iDistance) / parseFloat(this.pTrack.iNumElements) * Math.round(parseFloat(this.pTrack.iNumElements) * parseFloat(d) / parseFloat(this.pTrack.iDistance));var c = Math.round(e * this.pTrack.scale + this.pTrack.iEffectiveBound);if (g_pCurrentMovingPointer.iHiLoInd) {if (c < this.pTrack.fLowValue) {return;}this.pTrack.fHighValue = c;if (this.pTrack.bRangeSlider && a < g_pCurrentMovingPointer.startLoX) {a = this.getSetObjectLeft(this.pTrack.pLowPointer);}} else {if (this.pTrack.bRangeSlider && c > this.pTrack.fHighValue) {return;}this.pTrack.fLowValue = c;if (this.pTrack.bRangeSlider && a > g_pCurrentMovingPointer.startHiX) {a = this.getSetObjectLeft(this.pTrack.pHighPointer);}}this.getSetObjectLeft(g_pCurrentMovingPointer, a);if (this.pTrack.bActiveOverlay) {if (this.pTrack.bRangeSlider) {this.pTrack.pActiveOverlayPointer.style.left = this.getSetObjectLeft(this.pTrack.pLowPointer) + this.pTrack.iFgWidth + ("px");this.pTrack.pActiveOverlayPointer.style.width = this.getSetObjectLeft(this.pTrack.pHighPointer) - this.getSetObjectLeft(this.pTrack.pLowPointer) + "px";} else {this.pTrack.pActiveOverlayPointer.style.left = this.pTrack.xMin;this.pTrack.pActiveOverlayPointer.style.width = this.getSetObjectLeft(this.pTrack.pLowPointer) + "px";}}if (this.pTrack.onMove) {this.pTrack.onMove(this);}return false;}return;};
        this.HandleOnMouseUp = function (a) {if (this.pTrack.bInDrag && g_pCurrentMovingPointer) {var c = null;if (g_pCurrentMovingPointer.iHiLoInd) {c = this.pTrack.fHighValue ? this.pTrack.fHighValue : 0;} else {c = this.pTrack.fLowValue ? this.pTrack.fLowValue : 0;}var f = (c - this.pTrack.iEffectiveBound) / this.pTrack.scale;f = f > this.pTrack.xMax ? this.pTrack.xMax : f;f = f < this.pTrack.xMin ? this.pTrack.xMin : f;if (g_pCurrentMovingPointer) {var b = this.findPosX(g_pCurrentMovingPointer);if (!this.pTrack.bRangeSlider || g_pCurrentMovingPointer.iHiLoInd) {var e = this.findPosX(this.pTrack.pLowPointer);if (b < e) {f += this.pTrack.iFgWidth / 2;}} else {var d = this.findPosX(this.pTrack.pHighPointer);if (b >= d) {f -= this.pTrack.iFgWidth / 2;}}this.getSetObjectLeft(g_pCurrentMovingPointer, f);}if (document.removeEventListener) {document.removeEventListener("mousemove", cyberC21SliderHandleOnMouseMove, false);document.removeEventListener("mouseup", cyberC21SliderHandleOnMouseUp, false);} else {if (document.detachEvent) {document.detachEvent("onmousemove", cyberC21SliderHandleOnMouseMove);document.detachEvent("onmouseup", cyberC21SliderHandleOnMouseUp);}}}this.pTrack.bInDrag = false;this.realSetValues(this.pTrack.fLowValue, this.pTrack.fHighValue, true);};
        this.realSetValues(Q, R, false);
    }

    var g_pCurrentMovingPointer = null;

    function cyberC21SliderHandleOnMouseDown(A) {
        if (!A) {
            A = window.event;
        }
        var B = A.target ? A.target : A.srcElement;
        if (B && B.pTrack) {
            g_pCurrentMovingPointer = B;
            return B.pTrack.pMyself.HandleOnMouseDown(A);
        }
    }


    function cyberC21SliderHandleOnMouseMove(A) {
        if (!A) {
            A = window.event;
        }
        var B = g_pCurrentMovingPointer;
        if (B && B.pTrack) {
            return B.pTrack.pMyself.HandleOnMouseMove(A);
        }
    }


    function cyberC21SliderHandleOnMouseUp(A) {
        if (!A) {
            A = window.event;
        }
        var B = g_pCurrentMovingPointer;
        if (B && B.pTrack) {
            return B.pTrack.pMyself.HandleOnMouseUp(A);
        }
    }


    function cyberC21SliderHandleTrackOnClick(A) {
        if (!A) {
            A = window.event;
        }
        var B = A.target ? A.target : A.srcElement;
        if (B && B.pMyself) {
            return B.pMyself.HandleTrackOnClick(A);
        }
    }


    function cyberC21SliderHandleOverlayOnClick(A) {
        if (!A) {
            A = window.event;
        }
        var B = A.target ? A.target : A.srcElement;
        if (B && B.pTrack) {
            return B.pTrack.pMyself.HandleTrackOnClick(A);
        }
    }


    function SmoothMovement(_1, _2, _3) {
        _1 = Math.round(_1);
        _2 = Math.round(_2);
        _3 = _3 ? Math.round(_3) : 0;
        this.updatePosition = function () {_1 += _3;if (_3 < 0) {if (_1 - _3 * (_3 - 1) / 2 < _2) {_3++;} else {if (_1 - (_3 - 1) * (_3 - 2) / 2 >= _2) {_3--;}}} else {if (_1 + _3 * (_3 + 1) / 2 > _2) {_3--;} else {if (_1 + (_3 + 1) * (_3 + 2) / 2 <= _2) {_3++;}}}return _1;};
        this.changeTarget = function (_4) {_2 = Math.round(_4);};
        this.getPosition = function () {return _1;};
        this.getVelocity = function () {return _3;};
        this.hasStopped = function () {return _1 == _2 && _3 == 0;};
    }

    var g_pBrowser = new Object;
    g_pBrowser.bIsMsIe = false;
    g_pBrowser.bIsFirefox = false;
    g_pBrowser.bIsSafari = false;
    g_pBrowser.bIsOpera = false;
    g_pBrowser.fVersionMajor = 1;
    try {
        if (navigator.appName == "Microsoft Internet Explorer") {
            if (navigator.userAgent.indexOf("Opera") == -1) {
                g_pBrowser.bIsMsIe = true;
                document.execCommand("BackgroundImageCache", false, true);
            }
        }
        if (navigator.userAgent.indexOf("Opera") != -1) {
            g_pBrowser.bIsOpera = true;
        }
        if (navigator.userAgent.indexOf("Firefox") != -1) {
            g_pBrowser.bIsFirefox = true;
        }
        if (navigator.userAgent.indexOf("Safari") != -1) {
            g_pBrowser.bIsSafari = true;
        }
        if (g_pBrowser.bIsMsIe) {
            g_pBrowser.fVersionMajor = parseFloat(navigator.appVersion.split("MSIE")[1]);
        } else {
            g_pBrowser.fVersionMajor = parseInt(navigator.appVersion);
        }
    } catch (err) {
    }

    function HasClass(A, B) {
        if (typeof A == "string") {
            A = document.getElementById(A);
        }
        if (A && A.className) {
            return A.className.match(new RegExp("(\\s|^)" + B + "(\\s|$)"));
        }
        return false;
    }


    function AddClass(A, B) {
        if (typeof A == "string") {
            A = document.getElementById(A);
        }
        if (A) {
            if (!this.HasClass(A, B)) {
                A.className += " " + B;
                return true;
            }
        }
        return false;
    }


    function RemoveClass(A, C) {
        if (typeof A == "string") {
            A = document.getElementById(A);
        }
        if (A) {
            if (HasClass(A, C)) {
                var B = new RegExp("(\\s|^)" + C + "(\\s|$)");
                A.className = A.className.replace(B, " ");
                return true;
            }
        }
        return false;
    }


    function AddClassToChildTags(B, D, E) {
        if (typeof B == "string") {
            B = document.getElementById(B);
        }
        var C = B.getElementsByTagName(D);
        if (C && C.length > 0) {
            for (var A = 0; A < C.length; A++) {
                AddClass(C[A], E);
            }
        }
    }


    function RemoveClassFromChildTags(B, D, E) {
        if (typeof B == "string") {
            B = document.getElementById(B);
        }
        var C = B.getElementsByTagName(D);
        if (C && C.length > 0) {
            for (var A = 0; A < C.length; A++) {
                RemoveClass(C[A], E);
            }
        }
    }


    function ltrim(A) {
        return A.replace(/^\s+/, "");
    }


    function rtrim(A) {
        return A.replace(/\s+$/, "");
    }


    function GetNodeValue(C, A) {
        if (C) {
            var B = C.getElementsByTagName(A);
            if (B && B[0]) {
                if (B[0].firstChild) {
                    return B[0].firstChild.nodeValue;
                }
            }
        }
        return "";
    }


    function AddCommas(B) {
        B += "";
        x = B.split(".");
        x1 = x[0];
        x2 = x.length > 1 ? "." + x[1] : "";
        var A = /(\d+)(\d{3})/;
        while (A.test(x1)) {
            x1 = x1.replace(A, "$1,$2");
        }
        return x1 + x2;
    }


    function CyberCoreFindWidth(B) {
        var A = 0;
        if (document.getElementById || document.all) {
            A = B.offsetWidth;
        } else {
            if (document.layers) {
                A = B.width;
            }
        }
        return A;
    }


    function CyberCoreFindHeight(B) {
        var A = 0;
        if (document.getElementById || document.all) {
            A = B.offsetHeight;
        } else {
            if (document.layers) {
                A = B.height;
            }
        }
        return A;
    }


    function CyberCoreFindPosX(A) {
        var B = 0;
        if (document.getElementById || document.all) {
            while (A.offsetParent) {
                B += A.offsetLeft;
                A = A.offsetParent;
            }
        } else {
            if (document.layers) {
                B += A.x;
            }
        }
        return B;
    }


    function CyberCoreFindPosY(B) {
        var A = 0;
        if (document.getElementById || document.all) {
            if (!B.offsetParent) {
                A += B.offsetTop;
            }
            while (B.offsetParent) {
                A += B.offsetTop;
                B = B.offsetParent;
            }
        } else {
            if (document.layers) {
                A += B.y;
            }
        }
        return A;
    }


    function CyberCoreAddEvent(B, E, A, C) {
        if (B.addEventListener) {
            B.addEventListener(E, A, C);
            return true;
        } else {
            if (B.attachEvent) {
                var D = B.attachEvent("on" + E, A);
                return D;
            } else {
                return false;
            }
        }
    }


    function GetScrollTop() {
        return this.pageYOffset ||
            document.documentElement.scrollTop || document.body.scrollTop;
    }


    function DisableFormElements(C, B) {
        if (typeof C == "string") {
            C = document.getElementById(C);
        }
        var D = C.getElementsByTagName("input");
        if (D && D.length > 0) {
            for (var A = 0; A < D.length; A++) {
                D[A].disabled = B;
            }
        }
        D = C.getElementsByTagName("select");
        if (D && D.length > 0) {
            for (var A = 0; A < D.length; A++) {
                D[A].disabled = B;
            }
        }
        D = C.getElementsByTagName("checkbox");
        if (D && D.length > 0) {
            for (var A = 0; A < D.length; A++) {
                D[A].disabled = B;
            }
        }
    }


    function GetElementsByClassName(B) {
        var A = [];
        var F = new RegExp("\\b" + B + "\\b");
        var E = this.getElementsByTagName("*");
        for (var D = 0; D < E.length; D++) {
            var C = E[D].className;
            if (F.test(C)) {
                A.push(E[D]);
            }
        }
        return A;
    }


    function GetEventInformation(B) {
        var C = new Object;
        var A = 0;
        var D = 0;
        if (!B) {
            var B = window.event;
        }
        if (B.pageX || B.pageY) {
            A = B.pageX;
            D = B.pageY;
        } else {
            if (B.clientX || B.clientY) {
                A = B.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
                D = B.clientY + document.body.scrollTop + document.documentElement.scrollTop;
            }
        }
        C.iPosX = A;
        C.iPosY = D;
        C.pTarget = B.relatedTarget || B.fromElement;
        return C;
    }


    function FormDataEnteredInContainer(C) {
        if (typeof C == "string") {
            C = document.getElementById(C);
        }
        if (!C) {
            return false;
        }

        var B = false;
        var D = C.getElementsByTagName("input");
        for (var A = 0; A < D.length; A++) {
            if ((D[A].type == "text" || D[A].type == "hidden") &&
                D[A].name != "svf") {
                if (D[A].strDefaultValue) {
                    if (!(D[A].value == D[A].strDefaultValue ||
                        D[A].value == "")) {
                        B = true;
                    }
                } else {
                    if (D[A].value != "") {
                        B = true;
                    }
                }
            }
            return B;
        }
        return false;
    }


    function clearDefaultValue(B) {
        var A = window.event ? window.event.srcElement : B ? B.target : null;
        if (!A) {
            return;
        }
        if (A.value == A.strDefaultValue) {
            A.value = "";
        }
    }


    function setDefaultValue(B) {
        var A = window.event ? window.event.srcElement : B ? B.target : null;
        if (!A) {
            return;
        }
        if (A.value == "" && A.strDefaultValue) {
            A.value = A.strDefaultValue;
        }
    }


    function BindDefaultValue(F, D, A) {
        var C = document.getElementById(F);
        if (C) {
            var E = C.getElementsByTagName("input");
            if (E && E.length > 0) {
                for (var B = 0; B < E.length; B++) {
                    if (E[B].name == D) {
                        E[B].strDefaultValue = A;
                        CyberCoreAddEvent(E[B], "focus", clearDefaultValue, false);
                        CyberCoreAddEvent(E[B], "blur", setDefaultValue, false);
                    }
                }
            }
        }
    }


    function RemoveAllDefaultData(B) {
        if (B) {
            for (var A = 0; A < B.elements.length; A++) {
                if (B.elements[A].type == "text" ||
                    B.elements[A].type == "hidden") {
                    if (B.elements[A].strDefaultValue) {
                        if (B.elements[A].value == B.elements[A].strDefaultValue) {
                            B.elements[A].value = "";
                        }
                    }
                }
            }
        }
    }


    function SetInnerHtml(A, C) {
        var B = document.getElementById(A);
        if (B) {
            B.innerHTML = C;
        }
    }


    function KeystokeWasEnter(B) {
        var A = B.which == undefined ? B.keyCode : B.which;
        if (A == 13) {
            return true;
        }
        return false;
    }


    function SetOnEmpty(A, C) {
        var B = document.getElementById(A);
        if (B) {
            if (B.value == "") {
                B.value = C;
            }
        }
    }


    function GetHiddenFieldIntValue(C, B) {
        if (B == null) {
            B = 0;
        }
        var A = document.getElementById(C);
        if (A) {
            if (A.value != "") {
                return parseInt(A.value);
            }
        }
        return B;
    }


    function GetHiddenFieldFloatValue(B) {
        var A = document.getElementById(B);
        if (A) {
            if (A.value != "") {
                return parseFloat(A.value);
            }
        }
        return 0;
    }


    function getCookieVal(B) {
        var A = document.cookie.indexOf(";", B);
        if (A == -1) {
            A = document.cookie.length;
        }
        return unescape(document.cookie.substring(B, A));
    }


    function GetCookie(D) {
        var B = D + "=";
        var F = B.length;
        var A = document.cookie.length;
        var E = 0;
        while (E < A) {
            var C = E + F;
            if (document.cookie.substring(E, C) == B) {
                return getCookieVal(C);
            }
            E = document.cookie.indexOf(" ", E) + 1;
            if (E == 0) {
                break;
            }
        }
        return null;
    }


    function SetCookie(B, D, A, F, C, E) {
        document.cookie = B + ("=" + escape(D) + (A ? "; expires=" + A.toGMTString() : "") + (F ? "; path=" + F : "") + (C ? "; domain=" + C : "") + (E ? "; secure" : ""));
    }


    function SubmitFormOnEnter(B, A) {
        if (A) {
            if (KeystokeWasEnter(B)) {
                if (A.form) {
                    if (A.form.onsubmit) {
                        A.form.onsubmit();
                    }
                    A.form.submit();
                }
            }
        }
    }


    function callFunctionOnEnter(B, A) {
        var D;
        var C;
        if (window.event) {
            D = B.keyCode;
        } else {
            if (B.which) {
                D = B.which;
            }
        }
        if (D == 13) {
            A();
            return false;
        }
        return true;
    }

    var g_pDragObject = null;

    function clFinishDrag(G) {
        document.onmouseup = null;
        if (!G) {
            G = window.event;
        }
        if (!G) {
            return;
        }
        var F = G.target != null ? G.target : G.srcElement;
        while (F) {
            if (F.className.search("draggable_row") >= 0) {
                if (g_pDragObject.rowIndex == F.rowIndex) {
                    return false;
                }
                var E = false;
                var C = document.getElementsByTagName("table");
                for (var B = 0; B < C.length && !E; B++) {
                    if (C[B].className.search("draggable_table") >= 0) {
                        var D = C[B];
                        E = true;
                    }
                }
                if (!D) {
                    alert("couldn't find table");
                }
                var A = g_pDragObject.cloneNode(true);
                if (g_pDragObject.rowIndex < F.rowIndex) {
                    F = F.nextSibling;
                }
                D.getElementsByTagName("tbody")[0].insertBefore(g_pDragObject, F);
                return false;
            }
            F = F.parentNode;
        }
        return false;
    }


    function clStartDrag(B) {
        if (!B) {
            B = window.event;
        }
        if (!B) {
            return;
        }
        var A = B.target != null ? B.target : B.srcElement;
        while (A) {
            if (A.className.search("draggable_row") >= 0) {
                g_pDragObject = A;
                document.onmouseup = clFinishDrag;
                B.returnValue = false;
                return false;
            }
            A = A.parentNode;
        }
        return false;
    }


    function MoveFeaturesLeft(A) {
        if (g_bInMove) {
            return;
        }
        g_bInMove = true;
        var C = document.getElementById("featurescontainer");
        if (C) {
            var H = 0;
            var F = 0;
            if (!C.style.width || C.style.width == "") {
                var E = C.getElementsByTagName("div");
                if (E && E.length > 0) {
                    for (var D = 0; D < E.length; D++) {
                        F += CyberCoreFindWidth(E[D]) + 8;
                    }
                }
                C.style.width = F + "px";
            } else {
                F = parseInt(C.style.width);
            }
            if (C.style.marginLeft != null && C.style.marginLeft != "") {
                H = parseInt(C.style.marginLeft);
            }
            C.style.marginLeft = H + "px";
            if (H < 0) {
                var G = H + A * 95;
                var B = new SmoothMovement(H, G, -7);
                window.setTimeout(function () {UpdateFeatureSlide(C, B, G);}, 20);
            } else {
                g_bInMove = false;
            }
        }
    }


    function MoveFeaturesRight(C) {
        if (g_bInMove) {
            return;
        }
        g_bInMove = true;
        var I = document.getElementById("featurescontainer");
        if (I) {
            var G = 0;
            var D = 0;
            if (!I.style.width || I.style.width == "") {
                var A = I.getElementsByTagName("div");
                if (A && A.length > 0) {
                    for (var F = 0; F < A.length; F++) {
                        if (A[F].className == "feature") {
                            D += CyberCoreFindWidth(A[F]) + 10;
                        }
                    }
                }
                I.style.width = D + "px";
            } else {
                D = parseInt(I.style.width);
            }
            if (I.style.marginLeft != null && I.style.marginLeft != "") {
                G = parseInt(I.style.marginLeft);
            }
            I.style.marginLeft = G + "px";
            var E = G - C * 95;
            D = D - 24;
            if (Math.abs(E) < D) {
                var H = new SmoothMovement(G, E, 7);
                window.setTimeout(function () {UpdateFeatureSlide(I, H, E);}, 20);
            } else {
                g_bInMove = false;
                var B = document.getElementById("featuresnextbtn");
                B.src = "/images/detail/nextphoto_disabled.gif";
            }
        }
    }


    function UpdateFeatureSlide(C, A, E) {
        var F = A.updatePosition();
        C.style.marginLeft = F + "px";
        if (F != E) {
            window.setTimeout(function () {UpdateFeatureSlide(C, A, E);}, 20);
        } else {
            g_bInMove = false;
            var D = document.getElementById("featurespreviousbtn");
            if (E >= 0) {
                D.src = "/images/detail/previousphoto_disabled.gif";
            } else {
                D.src = "/images/detail/previousphoto.gif";
            }
            var B = document.getElementById("featuresnextbtn");
            if (Math.abs(E) >= parseInt(C.style.width) / 2) {
                B.src = "/images/detail/nextphoto_disabled.gif";
            } else {
                B.src = "/images/detail/nextphoto.gif";
            }
        }
    }


    function ClickFeature(A) {
        dcsMultiTrack("DCS.dcsuri", A, "WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "View Featured Property");
        return true;
    }


    function InitializeHeros(D, A) {
        var C = document.getElementById(D);
        if (C) {
            var E = C.getElementsByTagName("div");
            C.rotationalhero = new Object;
            C.rotationalhero.iSelectInterval = A;
            C.rotationalhero.iCurrentHero = 1;
            C.rotationalhero.aHeros = new Array;
            C.rotationalhero.aControls = new Array;
            C.rotationalhero.iWidth = CyberCoreFindWidth(C);
            C.rotationalhero.pSmoothMovement = null;
            C.rotationalhero.pAnimatingTimer = null;
            for (var B = 0; B < E.length; B++) {
                if (HasClass(E[B], "rotationalhero")) {
                    C.rotationalhero.aHeros.push(E[B]);
                }
                if (HasClass(E[B], "control")) {
                    C.rotationalhero.aControls.push(E[B]);
                }
            }
            C.rotationalhero.pRotateInterval = window.setTimeout(function () {SelectHero(D, C.rotationalhero.iCurrentHero % C.rotationalhero.aHeros.length + 1, true);}, C.rotationalhero.iSelectInterval * 1000);
        }
    }


    function SelectHero(H, E, C) {
        var A = document.getElementById(H);
        if (A && A.rotationalhero) {
            try {
                if (A.rotationalhero.pRotateInterval != null) {
                    clearTimeout(A.rotationalhero.pRotateInterval);
                }
                if (A.rotationalhero.pAnimatingTimer != null) {
                    clearTimeout(A.rotationalhero.pAnimatingTimer);
                    for (var B = 0; B < A.rotationalhero.aHeros.length; B++) {
                        if (B == A.rotationalhero.iCurrentHero - 1) {
                            RemoveClass(A.rotationalhero.aHeros[B], "hide");
                        } else {
                            AddClass(A.rotationalhero.aHeros[B], "hide");
                        }
                        A.rotationalhero.aHeros[B].style.width = A.rotationalhero.iWidth + "px";
                        A.rotationalhero.aHeros[B].style.left = "0px";
                        A.rotationalhero.aHeros[B].getElementsByTagName("*")[0].style.marginLeft = "";
                    }
                }
                A.rotationalhero.pRotateInterval = null;
                A.rotationalhero.pAnimatingTimer = null;
            } catch (F) {
            }
            var I = A.rotationalhero.aHeros[A.rotationalhero.iCurrentHero - 1];
            var D = A.rotationalhero.aHeros[E - 1];
            var G = 0;
            if (E > A.rotationalhero.iCurrentHero) {
                D.style.width = "0px";
                G = A.rotationalhero.iWidth;
            } else {
                D.style.width = A.rotationalhero.iWidth + "px";
                G = 0;
            }
            RemoveClass(I, "hide");
            RemoveClass(D, "hide");
            if (E > A.rotationalhero.iCurrentHero) {
                A.rotationalhero.pSmoothMovement = new SmoothMovement(0, A.rotationalhero.iWidth);
            } else {
                A.rotationalhero.pSmoothMovement = new SmoothMovement(A.rotationalhero.iWidth, 0);
            }
            A.rotationalhero.pAnimatingTimer = window.setTimeout(function () {SlideInHero(A, I, D, G, C);}, 20);
            RemoveClass(A.rotationalhero.aControls[A.rotationalhero.iCurrentHero - 1], "active_control");
            AddClass(A.rotationalhero.aControls[E - 1], "active_control");
            A.rotationalhero.iCurrentHero = E;
        }
    }


    function SlideInHero(C, D, B, F, A) {
        var E = C.rotationalhero.pSmoothMovement.updatePosition();
        if (F > 0 && E >= F) {
            B.style.width = C.rotationalhero.iWidth + "px";
            AddClass(D, "hide");
            C.rotationalhero.pAnimatingTimer = null;
            if (A) {
                C.rotationalhero.pRotateInterval = window.setTimeout(function () {SelectHero(C.id, C.rotationalhero.iCurrentHero % C.rotationalhero.aHeros.length + 1, true);}, C.rotationalhero.iSelectInterval * 1000);
            }
        } else {
            if (F < 1 && E <= F) {
                D.style.width = "0px";
                AddClass(D, "hide");
                D.style.width = C.rotationalhero.iWidth + "px";
                D.style.left = "0px";
                D.getElementsByTagName("*")[0].style.marginLeft = "";
                C.rotationalhero.pAnimatingTimer = null;
                if (A) {
                    C.rotationalhero.pRotateInterval = window.setTimeout(function () {SelectHero(C.id, C.rotationalhero.iCurrentHero % C.rotationalhero.aHeros.length + 1, true);}, C.rotationalhero.iSelectInterval * 1000);
                }
            } else {
                if (F > 0) {
                    B.style.width = E + "px";
                } else {
                    D.style.width = E + "px";
                    D.style.left = C.rotationalhero.iWidth - E + "px";
                    D.getElementsByTagName("*")[0].style.marginLeft = E - C.rotationalhero.iWidth + "px";
                }
                C.rotationalhero.pAnimatingTimer = window.setTimeout(function () {SlideInHero(C, D, B, F, A);}, 30);
            }
        }
    }


    function StopHeroes(B) {
        var A = document.getElementById(B);
        if (A && A.rotationalhero) {
            if (A.rotationalhero.pRotateInterval != null) {
                clearTimeout(A.rotationalhero.pRotateInterval);
            }
        }
    }


    function ReplaceHeroWithIFrame(C, B, D) {
        var A = document.getElementById(B);
        if (A) {
            StopHeroes(C);
            A.innerHTML = "<iframe src=\"" + D + "\" width=\"460\" height=\"384\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\"></iframe>";
        }
        return false;
    }

    var g_pProxSlider;
    var g_pBedSlider;
    var g_pBathSlider;
    var g_pPriceSlider;
    var g_pSqFtSlider;
    var g_pAreaPriceSlider;
    var g_pAreaEduAtmSlider;
    var g_pAreaAgeSlider;
    var g_pAreaIncomeSlider;
    var g_pAreaEduLevelSlider;
    var g_pAreaWKidsSlider;
    var g_pAreaDensitySlider;
    var g_bInitializeComplete = false;
    var g_strLastSearchUrl = "";
    var g_bIgnoreSearchInput = false;
    var g_iPriceLowBound = 0;
    var g_iPriceHighBound = 950000;
    var g_iPriceIncrement = 50000;
    RfgQueueCommand("InitializeSliders%28%29%3B");

    function SidebarTabOnClick(C) {
        var D = document.getElementById("sidebar_tabframe");
        if (D) {
            var A = D.getElementsByTagName("div");
            if (A && A.length > 0) {
                for (var B = 0; B < A.length; B++) {
                    if (A[B].id == C) {
                        AddClass(A[B], "active_tab");
                        A[B].style.zIndex = 5;
                        RemoveClass(A[B].id + "_content", "hide");
                    } else {
                        RemoveClass(A[B], "active_tab");
                        A[B].style.zIndex = A.length - B;
                        AddClass(A[B].id + "_content", "hide");
                    }
                }
            }
        }
        return false;
    }


    function ShowPropertyMapSearch() {
        var B = document.getElementById("propertywhere_1");
        var A = "/search/map.jsp";
        if (B && B.value) {
            A += "?wheresync=" + B.value;
        }
        document.location.href = A;
    }


    function ReviseMapSelections() {
        var A = document.getElementById("sidebar_form_property");
        if (A) {
            A.action = "/search/map.jsp";
            A.submit();
        }
    }


    function ShowPropertyLocationSearch(E) {
        if (E != null) {
            E.returnValue = false;
        }
        for (var B = 1; B <= 4; B++) {
            var D = document.getElementById("propertyshape_" + B);
            if (D) {
                D.value = "";
            }
        }
        AddClass("propertybymap", "hide");
        RemoveClass("propertybylocation", "hide");
        var C = document.getElementById("sidebar_drawer_property_1_handle");
        var A = document.getElementById("sidebar_drawer_property_1_content");
        if (C) {
            C.style.display = "";
        }
        if (A) {
            A.style.display = "";
        }
        if (window.ShowShapeList) {
            if (g_pMainSearchMap) {
                g_pMainSearchMap.DeleteAllPolygons();
            }
            ShowShapeList();
            if (window.RestoreSavedShapes) {
                RestoreSavedShapes();
            }
        }
        return true;
    }


    function ResetAllFormData(B) {
        var C = g_bIgnoreSearchInput;
        g_bIgnoreSearchInput = true;
        if (B) {
            for (var A = 0; A < B.elements.length; A++) {
                if ((B.elements[A].type == "text" ||
                    B.elements[A].type == "hidden") &&
                    B.elements[A].name != "svf") {
                    if (B.elements[A].strDefaultValue) {
                        B.elements[A].value = B.elements[A].strDefaultValue;
                    } else {
                        if (B.elements[A].name != "svf") {
                            B.elements[A].value = "";
                        }
                    }
                } else {
                    if (B.elements[A].type == "checkbox") {
                        B.elements[A].checked = false;
                    } else {
                        if (B.elements[A].type == "select-one") {
                            B.elements[A].selectedIndex = 0;
                        }
                    }
                }
            }
        }
        g_bIgnoreSearchInput = C;
    }


    function ResetPropertySearch(H) {
        var C = g_bIgnoreSearchInput;
        g_bIgnoreSearchInput = true;
        H.returnValue = false;
        ResetAllFormData(document.getElementById("sidebar_form_property"));
        TogglePropertySearchType(null);
        UpdateInputGroupStatus("property", "1");
        UpdateInputGroupStatus("property", "2");
        UpdateInputGroupStatus("property", "3");
        UpdateInputGroupStatus("property", "4");
        var G = GetHiddenFieldIntValue("propertyminbeds");
        var B = GetHiddenFieldIntValue("propertymaxbeds");
        var F = GetHiddenFieldIntValue("propertyminbaths");
        var K = GetHiddenFieldIntValue("propertymaxbaths");
        var I = GetHiddenFieldIntValue("propertyminprice");
        var D = GetHiddenFieldIntValue("propertymaxprice");
        var A = GetHiddenFieldIntValue("propertyminsqft");
        var J = GetHiddenFieldIntValue("propertymaxsqft");
        var E = GetHiddenFieldIntValue("propertyproximity");
        g_pBedSlider.SetValues(G, B > 0 ? B : 6, true);
        g_pBathSlider.SetValues(F, K > 0 ? K : 6, true);
        g_pPriceSlider.SetValues(I, D > 0 ? D : g_iPriceHighBound, true);
        g_pSqFtSlider.SetValues(A, J > 0 ? J : 5000, true);
        g_pProxSlider.SetValues(E, 0, true);
        if (window.ShowShapeList) {
            if (g_pMainSearchMap) {
                g_pMainSearchMap.DeleteAllPolygons();
            }
            ShowShapeList();
            if (window.RestoreSavedShapes) {
                RestoreSavedShapes();
            }
        } else {
            if (document.getElementById("propertybymap")) {
                ShowPropertyLocationSearch(H);
            }
        }
        g_bIgnoreSearchInput = C;
        return false;
    }


    function ResetAgentSearch(B) {
        var A = g_bIgnoreSearchInput;
        g_bIgnoreSearchInput = true;
        B.returnValue = false;
        ResetAllFormData(document.getElementById("sidebar_form_agent"));
        UpdateInputGroupStatus("agent", "1");
        g_bIgnoreSearchInput = A;
        return false;
    }


    function ResetOfficeSearch(B) {
        var A = g_bIgnoreSearchInput;
        g_bIgnoreSearchInput = true;
        B.returnValue = false;
        ResetAllFormData(document.getElementById("sidebar_form_office"));
        UpdateInputGroupStatus("office", "1");
        UpdateInputGroupStatus("office", "2");
        g_bIgnoreSearchInput = A;
        return false;
    }


    function ResetAreaSearch(H) {
        var C = g_bIgnoreSearchInput;
        g_bIgnoreSearchInput = true;
        ResetAllFormData(document.getElementById("sidebar_form_area"));
        document.getElementById("areaop").value = "y";
        var I = GetHiddenFieldIntValue("areaminprice");
        var G = GetHiddenFieldIntValue("areamaxprice");
        var A = GetHiddenFieldIntValue("areaeduatm", 50);
        var B = GetHiddenFieldIntValue("areaage", 50);
        var J = GetHiddenFieldIntValue("areaincome", 50);
        var E = GetHiddenFieldIntValue("areaedulevel", 50);
        var D = GetHiddenFieldIntValue("areawkids", 50);
        var F = GetHiddenFieldIntValue("areadensity", 50);
        g_pAreaPriceSlider.SetValues(I, G > 0 ? G : g_iPriceHighBound, true);
        g_pAreaEduAtmSlider.SetValues(A, 0, true);
        g_pAreaAgeSlider.SetValues(B, 0, true);
        g_pAreaIncomeSlider.SetValues(J, 0, true);
        g_pAreaEduLevelSlider.SetValues(E, 0, true);
        g_pAreaWKidsSlider.SetValues(D, 0, true);
        g_pAreaDensitySlider.SetValues(F, 0, true);
        UpdateInputGroupStatus("area", "1");
        UpdateInputGroupStatus("area", "2");
        UpdateInputGroupStatus("area", "3");
        g_bIgnoreSearchInput = C;
        return false;
    }


    function UpdateInputGroupStatus(B, F) {
        var I = document.getElementById("sidebar_drawer_" + B + "_" + F + "_openmarker");
        var G = document.getElementById("sidebar_drawer_" + B + "_" + F + "_closedmarker");
        if (I || G) {
            var H = "sidebar_drawer_" + B + "_" + F + "_content";
            var C = document.getElementById(H);
            if (C) {
                var D = false;
                var A = C.getElementsByTagName("input");
                if (A && A.length > 0) {
                    for (var E = 0; E < A.length; E++) {
                        if (A[E].type == "checkbox" || A[E].type == "radio") {
                            if (A[E].checked) {
                                D = true;
                            }
                        } else {
                            if (A[E].type == "text" ||
                                A[E].type == "hidden") {
                                if (A[E].value != "") {
                                    if (A[E].strDefaultValue) {
                                        if (A[E].value != A[E].strDefaultValue) {
                                            D = true;
                                        }
                                    } else {
                                        D = true;
                                    }
                                }
                            }
                        }
                    }
                }
                A = C.getElementsByTagName("select");
                if (A && A.length > 0) {
                    for (var E = 0; E < A.length; E++) {
                        if (A[E].options[A[E].selectedIndex].value != "") {
                            D = true;
                        }
                    }
                }
                if (D) {
                    if (I) {
                        I.innerHTML = "<img src=\"/images/sidebar/checkmark.gif\" width=\"14\" height=\"14\" border=\"0\">";
                    }
                    if (G) {
                        G.innerHTML = "<img src=\"/images/sidebar/checkmark.gif\" width=\"14\" height=\"14\" border=\"0\">";
                    }
                } else {
                    if (I) {
                        I.innerHTML = "";
                    }
                    if (G) {
                        G.innerHTML = "";
                    }
                }
            }
        }
    }


    function syncOpenHouseSelector(C) {
        dcsMultiTrack("DCS.dcsuri", location.href, "WT.cg_n", "Indirect Conversion", "WT.z_engage_type", "Indirect", "WT.z_engage_event", "Open House");
        var B = document.getElementById("openhousecb_1");
        var A = document.getElementById("openhousecb_2");
        if (B) {
            B.checked = C;
        }
        if (A) {
            A.checked = C;
        }
        UpdatePropertySearchLimits();
    }


    function enablePropertyMlsSearch(B, A) {
        if (B) {
            if (RemoveClass("propertymlsgroupcontainer", "disabled") || A) {
                DisableFormElements("propertymlsgroupcontainer", false);
            }
        } else {
            if (AddClass("propertymlsgroupcontainer", "disabled") || A) {
                DisableFormElements("propertymlsgroupcontainer", true);
            }
        }
    }


    function enablePropertyWhereSearch(B, A) {
        if (B) {
            if (RemoveClass("propertywheregroupcontainer", "disabled") || A) {
                DisableFormElements("propertywheregroupcontainer", false);
            }
        } else {
            if (AddClass("propertywheregroupcontainer", "disabled") || A) {
                DisableFormElements("propertywheregroupcontainer", true);
            }
        }
    }


    function TogglePropertySearchType(C) {
        var B = false;
        if (C && (C.name == "mls" || C.name == "where")) {
            if (C.strDefaultValue) {
                if (C.value == C.strDefaultValue || C.value == "") {
                    B = false;
                } else {
                    B = true;
                }
            } else {
                B = trim(C.value) != "";
            }
            if (B) {
                if (C.name == "mls") {
                    enablePropertyWhereSearch(false, false);
                } else {
                    enablePropertyMlsSearch(false, false);
                }
                return;
            }
        }
        var A = document.getElementById("propertywheregroupcontainer");
        var D = document.getElementById("propertymlsgroupcontainer");
        if (A && D) {
            var B = false;
            B = FormDataEnteredInContainer(A);
            if (B) {
                enablePropertyMlsSearch(false, true);
                enablePropertyWhereSearch(true, true);
                return;
            }
            B = FormDataEnteredInContainer(D);
            if (B) {
                enablePropertyMlsSearch(true, true);
                enablePropertyWhereSearch(false, true);
                return;
            }
            enablePropertyMlsSearch(true, true);
            enablePropertyWhereSearch(true, true);
        }
    }


    function SidebarExpandAllDrawers(B) {
        var C = document.getElementById("sidebar_drawer_" + B + "_container");
        if (C) {
            var D = C.getElementsByTagName("div");
            if (D && D.length > 0) {
                for (var A = 0; A < D.length; A++) {
                    if (D[A].id) {
                        if (D[A].id.match(/sidebar_drawer_.*_.*_content/) != null) {
                            RemoveClass(D[A], "hide");
                        } else {
                            if (D[A].id.match(/sidebar_drawer_.*_.*_handle/) != null) {
                                AddClass(D[A], "hide");
                            }
                        }
                    }
                }
            }
        }
        return false;
    }


    function SidebarExpandDrawer(B, E) {
        var F = "sidebar_drawer_" + B + "_" + E + "_content";
        var H = "sidebar_drawer_" + B + "_" + E + "_handle";
        var G = "sidebar_drawer_" + B + "_" + E + "_handle_functions";
        var A = document.getElementById("sidebar_drawer_" + B + "_container");
        if (A) {
            var C = A.getElementsByTagName("div");
            if (C && C.length > 0) {
                for (var D = 0; D < C.length; D++) {
                    if (C[D].id) {
                        if (C[D].id.match(/sidebar_drawer_.*_.*_content/) != null) {
                            AddClass(C[D], "hide");
                        } else {
                            if (C[D].id.match(/sidebar_drawer_.*_.*_handle/) != null) {
                                RemoveClass(C[D], "hide");
                            }
                        }
                    }
                }
            }
            var I = document.getElementById(F);
            I.parentNode.style.visibility = "hidden";
            RemoveClass(I, "hide");
            AddClass(H, "hide");
            AddClass(G, "hide");
            StartDrawerOpenLoop(I);
        }
        return false;
    }


    function SidebarCollapseDrawer(A, D) {
        var J = "sidebar_drawer_" + A + "_" + D + "_handle";
        var G = "sidebar_drawer_" + A + "_" + D + "_content";
        var H = "sidebar_drawer_" + A + "_" + D + "_handle_functions";
        var F = document.getElementById(G);
        if (F) {
            var K = CyberCoreFindHeight(F);
            var E = CyberCoreFindPosY(F);
            var I = F.getElementsByTagName("div");
            var M = null;
            var B = new Array;
            for (var C = I.length - 1; C >= 0; C--) {
                if (HasClass(I[C], "slidercontainer")) {
                    B.push(I[C]);
                    I[C].originalBottom = CyberCoreFindPosY(I[C]) + CyberCoreFindHeight(I[C]) - E;
                }
            }
            F.style.height = K + "px";
            var L = new SmoothMovement(K, 0, 7);
            window.setTimeout(function () {UpdateDrawerClose(F, B, L, K, J, H);}, 0);
        }
        return false;
    }


    function UpdateDrawerOpen(A, D, B, E, F) {
        var F = B.updatePosition();
        if (F >= E) {
            for (var C = 0; C < D.length; C++) {
                if (HasClass(D[C], "slidercontainer")) {
                    RemoveClass(D[C], "hide");
                }
            }
            A.style.height = "";
        } else {
            for (var C = 0; C < D.length; C++) {
                if (D[C].originalBottom < F) {
                    RemoveClass(D[C], "hide");
                }
            }
            A.style.height = F + "px";
            window.setTimeout(function () {UpdateDrawerOpen(A, D, B, E, F);}, 20);
        }
    }


    function UpdateDrawerClose(A, D, B, G, E, F) {
        var G = B.updatePosition();
        if (G <= 1) {
            AddClass(A, "hide");
            RemoveClass(E, "hide");
            RemoveClass(F, "hide");
            A.style.height = "";
            for (var C = 0; C < D.length; C++) {
                if (HasClass(D[C], "slidercontainer")) {
                    RemoveClass(D[C], "hide");
                }
            }
        } else {
            for (var C = 0; C < D.length; C++) {
                if (D[C].originalBottom >= G) {
                    AddClass(D[C], "hide");
                }
            }
            A.style.height = G + "px";
            window.setTimeout(function () {UpdateDrawerClose(A, D, B, G, E, F);}, 20);
        }
    }


    function StartDrawerOpenLoop(A) {
        if (A) {
            var F = CyberCoreFindHeight(A);
            var E = CyberCoreFindPosY(A);
            var G = A.getElementsByTagName("div");
            var H = null;
            var D = new Array;
            for (var C = G.length - 1; C >= 0; C--) {
                if (HasClass(G[C], "slidercontainer")) {
                    D.push(G[C]);
                    G[C].originalBottom = CyberCoreFindPosY(G[C]) + CyberCoreFindHeight(G[C]) - E;
                    AddClass(G[C], "hide");
                }
            }
            A.style.height = 0;
            A.parentNode.style.visibility = "visible";
            var B = new SmoothMovement(0, F, 10);
            window.setTimeout(function () {UpdateDrawerOpen(A, D, B, F, 0);}, 20);
        }
    }


    function ExtendSidebarSelection(E) {
        try {
            try {
                if (HasClass(E + "groupcontainer", "disabled")) {
                    alert("You may only select either a location or an MLS/Listing ID#.");
                    return false;
                }
            } catch (F) {
            }
            var G = new Array;
            var C = document.getElementById(E + "groupcontainer");
            var D = C.getElementsByTagName("div");
            if (D && D.length > 0) {
                var A = new RegExp("^" + E + "container_\\d+$");
                for (var B = 0; B < D.length; B++) {
                    if (D[B].id.search(A) != -1) {
                        G.push(D[B]);
                    }
                }
            }
            for (var B in G) {
                if (HasClass(G[B], "hide")) {
                    RemoveClass(G[B], "hide");
                    if (B == G.length - 1) {
                        AddClass(E + "extendaction", "hide");
                    }
                    var D = C.getElementsByTagName("*");
                    for (var B = 0; B < D.length; B++) {
                        if (HasClass(D[B], "sidebaractionbutton")) {
                            RemoveClass(D[B], "hide");
                        }
                    }
                    return false;
                }
            }
        } catch (F) {
            alert(F.message);
        }
        return false;
    }


    function WithdrawSidebarSelection(A, E) {
        try {
            var I = new Array;
            var K = document.getElementById(A + "groupcontainer");
            var B = K.getElementsByTagName("div");
            if (B && B.length > 0) {
                var C = new RegExp("^" + A + "container_\\d+$");
                for (var H = 0; H < B.length; H++) {
                    if (B[H].id.search(C) != -1) {
                        I.push(B[H]);
                    }
                }
            }
        } catch (J) {
            alert(J.message);
        }
        var F = 0;
        for (var H in I) {
            if (!HasClass(I[H], "hide")) {
                F++;
            }
        }
        if (E < F) {
            for (var H = E; H < F; H++) {
                var L = new Array;
                var D = I[H - 1].getElementsByTagName("input");
                var M = I[H].getElementsByTagName("input");
                if (D && M && D.length == M.length) {
                    for (var G = 0; G < D.length; G++) {
                        if (D[G].type == "text" || D[G].type == "hidden") {
                            D[G].value = M[G].value;
                        }
                    }
                }
            }
        }
        var B = I[F - 1].getElementsByTagName("input");
        if (B && B.length > 0) {
            for (var H = 0; H < B.length; H++) {
                if (B[H].type == "text" || B[H].type == "hidden") {
                    if (B[H].strDefaultValue) {
                        B[H].value = B[H].strDefaultValue;
                    } else {
                        B[H].value = "";
                    }
                }
            }
        }
        AddClass(I[F - 1], "hide");
        if (F <= 2) {
            var B = I[0].getElementsByTagName("*");
            for (var H = 0; H < B.length; H++) {
                if (HasClass(B[H], "sidebaractionbutton")) {
                    AddClass(B[H], "hide");
                }
            }
        }
        RemoveClass(A + "extendaction", "hide");
        TogglePropertySearchType();
        return false;
    }


    function UpdateAreaSearchLimits() {
        if (!g_bInitializeComplete) {
            return;
        }
        if (g_bIgnoreSearchInput) {
            return;
        }
        var A = document.getElementById("searchresultscontainer");
        if (A && document.forms.sidebar_form_area) {
            if (window.DoAjaxAreaSearch) {
                DoAjaxAreaSearch();
            } else {
                if (document.forms.sidebar_form_area.onsubmit) {
                    document.forms.sidebar_form_area.onsubmit();
                }
                document.forms.sidebar_form_area.submit();
            }
        }
    }


    function UpdatePropertySearchLimits() {
        if (!g_bInitializeComplete) {
            return;
        }
        if (g_bIgnoreSearchInput) {
            return;
        }
        var A = document.getElementById("searchresultscontainer");
        if (A && document.forms.sidebar_form_property) {
            if (document.forms.sidebar_form_property.onsubmit) {
                document.forms.sidebar_form_property.onsubmit();
            }
            document.forms.sidebar_form_property.submit();
        }
    }


    function onChangeBedSlider(A) {
        onMovingBedSlider(A);
        UpdateInputGroupStatus("property", "2", null);
        UpdatePropertySearchLimits();
    }


    function onChangeBathSlider(A) {
        onMovingBathSlider(A);
        UpdateInputGroupStatus("property", "2", null);
        UpdatePropertySearchLimits();
    }


    function onChangeProxSlider(A) {
        onMovingProxSlider(A);
        UpdateInputGroupStatus("property", "1", null);
        UpdatePropertySearchLimits();
    }


    function onChangePriceSlider(A) {
        onMovingPriceSlider(A);
        UpdateInputGroupStatus("property", "2", null);
        UpdatePropertySearchLimits();
    }


    function onChangeSqFtSlider(A) {
        onMovingSqFtSlider(A);
        UpdateInputGroupStatus("property", "2", null);
        UpdatePropertySearchLimits();
    }


    function onMovingBedSlider(B) {
        var C = B.GetLowValue();
        var A = B.GetHighValue();
        if (A >= 6) {
            document.getElementById("propertybedslabel").innerHTML = C + " to No limit";
            document.getElementById("propertymaxbeds").value = "";
        } else {
            document.getElementById("propertybedslabel").innerHTML = C + (" to " + A);
            document.getElementById("propertymaxbeds").value = A;
        }
        if (C > 1) {
            document.getElementById("propertyminbeds").value = C;
        } else {
            document.getElementById("propertyminbeds").value = "";
        }
    }


    function onMovingBathSlider(B) {
        var C = B.GetLowValue();
        var A = B.GetHighValue();
        if (A >= 6) {
            document.getElementById("propertybathslabel").innerHTML = C + " to No limit";
            document.getElementById("propertymaxbaths").value = "";
        } else {
            document.getElementById("propertybathslabel").innerHTML = C + (" to " + A);
            document.getElementById("propertymaxbaths").value = A;
        }
        if (C > 1) {
            document.getElementById("propertyminbaths").value = C;
        } else {
            document.getElementById("propertyminbaths").value = "";
        }
    }


    function onMovingProxSlider(A) {
        var B = A.GetLowValue();
        if (B < 1) {
            document.getElementById("propertyproximitylabel").innerHTML = "Exact area";
            document.getElementById("propertyproximity").value = "";
        } else {
            document.getElementById("propertyproximitylabel").innerHTML = B + " miles";
            document.getElementById("propertyproximity").value = B;
        }
    }


    function onMovingPriceSlider(B) {
        var C = B.GetLowValue();
        var A = B.GetHighValue();
        if (A > g_iPriceHighBound - g_iPriceIncrement) {
            document.getElementById("propertypricelabel").innerHTML = "$" + AddCommas(C) + " to No limit";
            document.getElementById("propertymaxprice").value = "";
        } else {
            document.getElementById("propertypricelabel").innerHTML = "$" + AddCommas(C) + " to $" + AddCommas(A);
            document.getElementById("propertymaxprice").value = A;
        }
        if (C > 10000) {
            document.getElementById("propertyminprice").value = C;
        } else {
            document.getElementById("propertyminprice").value = "";
        }
    }


    function onMovingSqFtSlider(B) {
        var C = B.GetLowValue();
        var A = B.GetHighValue();
        if (A >= 5000) {
            document.getElementById("propertysqftlabel").innerHTML = AddCommas(C) + " to No limit";
            document.getElementById("propertymaxsqft").value = "";
        } else {
            document.getElementById("propertysqftlabel").innerHTML = AddCommas(C) + (" to " + AddCommas(A));
            document.getElementById("propertymaxsqft").value = A;
        }
        if (C > 1) {
            document.getElementById("propertyminsqft").value = C;
        } else {
            document.getElementById("propertyminsqft").value = "";
        }
    }


    function onChangeAreaPriceSlider(A) {
        onMovingAreaPriceSlider(A);
        UpdateInputGroupStatus("area", "1", null);
        UpdateAreaSearchLimits();
    }


    function onMovingAreaPriceSlider(B) {
        var C = B.GetLowValue();
        var A = B.GetHighValue();
        if (A > 900000) {
            document.getElementById("areapricelabel").innerHTML = "$" + AddCommas(C) + " to No limit";
            document.getElementById("areamaxprice").value = "";
        } else {
            document.getElementById("areapricelabel").innerHTML = "$" + AddCommas(C) + " to $" + AddCommas(A);
            document.getElementById("areamaxprice").value = A;
        }
        if (C > 10000) {
            document.getElementById("areaminprice").value = C;
        } else {
            document.getElementById("areaminprice").value = "";
        }
    }


    function onChangeAreaEduAtm(A) {
        onMovingAreaEduAtm(A);
        UpdateInputGroupStatus("area", "2", null);
        UpdateAreaSearchLimits();
    }


    function onMovingAreaEduAtm(A) {
        document.getElementById("areaeduatm").value = A.GetLowValue();
    }


    function onChangeAreaAge(A) {
        onMovingAreaAge(A);
        UpdateInputGroupStatus("area", "3", null);
        UpdateAreaSearchLimits();
    }


    function onMovingAreaAge(A) {
        document.getElementById("areaage").value = A.GetLowValue();
    }


    function onChangeAreaIncome(A) {
        onMovingAreaIncome(A);
        UpdateInputGroupStatus("area", "3", null);
        UpdateAreaSearchLimits();
    }


    function onMovingAreaIncome(A) {
        document.getElementById("areaincome").value = A.GetLowValue();
    }


    function onChangeAreaEduLevel(A) {
        onMovingAreaEduLevel(A);
        UpdateInputGroupStatus("area", "3", null);
        UpdateAreaSearchLimits();
    }


    function onMovingAreaEduLevel(A) {
        document.getElementById("areaedulevel").value = A.GetLowValue();
    }


    function onChangeAreaWKids(A) {
        onMovingAreaWKids(A);
        UpdateInputGroupStatus("area", "3", null);
        UpdateAreaSearchLimits();
    }


    function onMovingAreaWKids(A) {
        document.getElementById("areawkids").value = A.GetLowValue();
    }


    function onChangeAreaDensity(A) {
        onMovingAreaDensity(A);
        UpdateInputGroupStatus("area", "3", null);
        UpdateAreaSearchLimits();
    }


    function onMovingAreaDensity(A) {
        document.getElementById("areadensity").value = A.GetLowValue();
    }


    function InitializeSliders() {
        if (document.getElementById) {
            var M = GetHiddenFieldIntValue("propertyminbeds");
            var S = GetHiddenFieldIntValue("propertymaxbeds");
            var Z = GetHiddenFieldIntValue("propertyminbaths");
            var V = GetHiddenFieldIntValue("propertymaxbaths");
            var R = GetHiddenFieldIntValue("propertyminprice");
            var J = GetHiddenFieldIntValue("propertymaxprice");
            var I = GetHiddenFieldIntValue("propertyminsqft");
            var Q = GetHiddenFieldIntValue("propertymaxsqft");
            var P = GetHiddenFieldIntValue("propertyproximity");
            var O = document.getElementById("propertypriceslide");
            var d = document.getElementById("propertybedsslide");
            var X = document.getElementById("propertybathsslide");
            var Y = document.getElementById("propertyproximityslide");
            var a = document.getElementById("propertysqftslide");
            if (g_iPriceLowBound > R) {
                R = Math.max(R, g_iPriceLowBound);
                document.getElementById("propertyminprice").value = R;
            }
            if (O && d && X && Y && a) {
                if (M == 0 && S == 0) {
                    document.getElementById("propertybedslabel").innerHTML = "No limit";
                } else {
                    if (S == 0) {
                        document.getElementById("propertybedslabel").innerHTML = M + " to No limit";
                    } else {
                        document.getElementById("propertybedslabel").innerHTML = M + (" to " + S);
                    }
                }
                if (Z == 0 && V == 0) {
                    document.getElementById("propertybathslabel").innerHTML = "No limit";
                } else {
                    if (V == 0) {
                        document.getElementById("propertybathslabel").innerHTML = Z + " to No limit";
                    } else {
                        document.getElementById("propertybathslabel").innerHTML = Z + (" to " + V);
                    }
                }
                if (P < 1) {
                    document.getElementById("propertyproximitylabel").innerHTML = "Exact area";
                } else {
                    document.getElementById("propertyproximitylabel").innerHTML = P + " miles";
                }
                if (J > 0) {
                    document.getElementById("propertypricelabel").innerHTML = "$" + AddCommas(R) + " to $" + AddCommas(J);
                } else {
                    document.getElementById("propertypricelabel").innerHTML = "$" + AddCommas(R) + " to No limit";
                }
                if (Q > 0) {
                    document.getElementById("propertysqftlabel").innerHTML = AddCommas(I) + (" to " + AddCommas(Q));
                } else {
                    document.getElementById("propertysqftlabel").innerHTML = AddCommas(I) + " to No limit";
                }
                try {
                    g_pProxSlider = new CyberC21Slider(Y.id, false, 0, 50, 1, P, 0, "/images/sidebar/sliderbg_148.gif", "/images/sidebar/slideractivearea.gif", 148, 16, "", "/images/sidebar/grabwidget.gif", "", 15, 16, 1, 1, onChangeProxSlider, onMovingProxSlider);
                    g_pBedSlider = new CyberC21Slider(d.id, true, 1, 6, 1, M, S > 0 ? S : 6, "/images/sidebar/sliderbg_122_g6.gif", "/images/sidebar/slideractivearea.gif", 122, 16, "", "/images/sidebar/grabwidget.gif", "/images/sidebar/grabwidget.gif", 15, 16, 1, 1, onChangeBedSlider, onMovingBedSlider);
                    g_pBathSlider = new CyberC21Slider(X.id, true, 1, 6, 1, Z, V > 0 ? V : 6, "/images/sidebar/sliderbg_122_g6.gif", "/images/sidebar/slideractivearea.gif", 122, 16, "", "/images/sidebar/grabwidget.gif", "/images/sidebar/grabwidget.gif", 15, 16, 1, 1, onChangeBathSlider, onMovingBathSlider);
                    g_pPriceSlider = new CyberC21Slider(O.id, true, g_iPriceLowBound, g_iPriceHighBound, g_iPriceIncrement, R, J > 0 ? J : g_iPriceHighBound, "/images/sidebar/sliderbg_122.gif", "/images/sidebar/slideractivearea.gif", 122, 16, "", "/images/sidebar/grabwidget.gif", "/images/sidebar/grabwidget.gif", 15, 16, 1, 1, onChangePriceSlider, onMovingPriceSlider);
                    g_pSqFtSlider = new CyberC21Slider(a.id, true, 0, 5000, 500, I, Q > 0 ? Q : 5000, "/images/sidebar/sliderbg_122.gif", "/images/sidebar/slideractivearea.gif", 122, 16, "", "/images/sidebar/grabwidget.gif", "/images/sidebar/grabwidget.gif", 15, 16, 1, 1, onChangeSqFtSlider, onMovingSqFtSlider);
                } catch (W) {
                    g_bAjaxEnabled = false;
                }
            }
            var b = GetHiddenFieldIntValue("areaminprice");
            var E = GetHiddenFieldIntValue("areamaxprice");
            var G = GetHiddenFieldIntValue("areaeduatm", 50);
            var H = GetHiddenFieldIntValue("areaage", 50);
            var N = GetHiddenFieldIntValue("areaincome", 50);
            var K = GetHiddenFieldIntValue("areaedulevel", 50);
            var L = GetHiddenFieldIntValue("areawkids", 50);
            var B = GetHiddenFieldIntValue("areadensity", 50);
            var C = document.getElementById("areapriceslide");
            var c = document.getElementById("areaeduatmslide");
            var T = document.getElementById("areaageslide");
            var D = document.getElementById("areaincomeslide");
            var F = document.getElementById("areaedulevelslide");
            var U = document.getElementById("areawkidsslide");
            var A = document.getElementById("areadensityslide");
            if (document.getElementById("areapricelabel")) {
                if (E > 0) {
                    document.getElementById("areapricelabel").innerHTML = "$" + AddCommas(b) + " to $" + AddCommas(E);
                } else {
                    document.getElementById("areapricelabel").innerHTML = "$" + AddCommas(b) + " to No limit";
                }
            }
            if (C && c && T && D && F && U && A) {
                g_pAreaPriceSlider = new CyberC21Slider(C.id, true, 0, 950000, 50000, b, E > 0 ? E : 950000, "/images/sidebar/sliderbg_122.gif", "/images/sidebar/slideractivearea.gif", 122, 16, "", "/images/sidebar/grabwidget.gif", "/images/sidebar/grabwidget.gif", 15, 16, 1, 1, onChangeAreaPriceSlider, onMovingAreaPriceSlider);
                g_pAreaEduAtmSlider = new CyberC21Slider(c.id, false, 0, 100, 1, G, 0, "/images/sidebar/sliderbg_210_weakstrong.gif", null, 210, 30, "", "/images/sidebar/grabwidget.gif", "", 15, 16, 1, 1, onChangeAreaEduAtm, onMovingAreaEduAtm);

                g_pAreaAgeSlider = new CyberC21Slider(T.id, false, 0, 100, 1, H, 0, "/images/sidebar/sliderbg_122_youngold.gif", null, 122, 24, "", "/images/sidebar/grabwidget.gif", "", 15, 16, 1, 1, onChangeAreaAge, onMovingAreaAge);
                g_pAreaIncomeSlider = new CyberC21Slider(D.id, false, 0, 100, 1, N, 0, "/images/sidebar/sliderbg_122_plusminus.gif", null, 122, 24, "", "/images/sidebar/grabwidget.gif", "", 15, 16, 1, 1, onChangeAreaIncome, onMovingAreaIncome);
                g_pAreaEduLevelSlider = new CyberC21Slider(F.id, false, 0, 100, 1, K, 0, "/images/sidebar/sliderbg_89_plusminus.gif", null, 89, 20, "", "/images/sidebar/grabwidget.gif", "", 15, 16, 1, 1, onChangeAreaEduLevel, onMovingAreaEduLevel);
                g_pAreaWKidsSlider = new CyberC21Slider(U.id, false, 0, 100, 1, L, 0, "/images/sidebar/sliderbg_89_plusminus.gif", null, 89, 20, "", "/images/sidebar/grabwidget.gif", "", 15, 16, 1, 1, onChangeAreaWKids, onMovingAreaWKids);
                g_pAreaDensitySlider = new CyberC21Slider(A.id, false, 0, 100, 1, B, 0, "/images/sidebar/sliderbg_89_plusminus.gif", null, 89, 20, "", "/images/sidebar/grabwidget.gif", "", 15, 16, 1, 1, onChangeAreaDensity, onMovingAreaDensity);
            }
            g_bInitializeComplete = true;
        } else {
            g_bAjaxEnabled = false;
        }
    }

    var g_pMainSearchMap = null;
    var g_iMapPreviewPosLeft = 0;
    var g_iMapPreviewPosRight = 0;
    var g_iMapPreviewPosTop = 0;
    var g_iMapPreviewPosBottom = 0;
    var g_bMapPreviewCancelCloseRequest = false;
    var g_bMapPreviewTimeoutActive = false;
    var g_bMapPreviewVisible = false;
    var g_objMapPreview = new Object;
    var g_iIEMapOffsetX = 260;
    var g_iIEMapOffsetY = 160;

    function InitializeAllSearches() {
        if (!g_AjaxQueue) {
            alert("Could not initialize AJAX.  An AJAX capable browser is required to use the advanced features on C21.com");
            return;
        }
        g_AjaxQueue.registerLock("DoingPropertySearch");
        g_AjaxQueue.registerLock("DoingAgentSearch");
        g_AjaxQueue.registerLock("DoingOfficeSearch");
    }


    function DoPropertySearch(A) {
        try {
            if (!FormDataEnteredInContainer("propertywheregroupcontainer")) {
                if (!FormDataEnteredInContainer("propertymlsgroupcontainer")) {
                    if (!FormDataEnteredInContainer("propertyshapegroupcontainer")) {
                        return false;
                    }
                }
            }
            RemoveAllDefaultData(A);
            RewritePropertySearchURL(A);
        } catch (B) {
        }
        return true;
    }


    function RewritePropertySearchURL(C) {
        var G = "";
        var A = document.getElementById("propertywhere_1");
        var E = A.value;
        var B = E.split(",");
        if (B.length == 2) {
            G = "/realestatesearch/" + trim(B[0]) + "-" + trim(B[1]);
        } else {
            if (B.length == 1) {
                var B = E.split(" ");
                if (B.length == 1) {
                    G = "/realestatesearch/" + B[0];
                } else {
                    if (B.length == 2) {
                        G = "/realestatesearch/" + trim(B[0]) + "-" + trim(B[1]);
                    } else {
                        var D = B.pop();
                        var F = B.join(" ");
                        G = "/realestatesearch/" + F + "-" + D;
                    }
                }
            } else {
                G = "/realestatesearch/";
            }
        }
        A.value = "";
        C.action = G;
    }


    function LTrim(B) {
        var A = /\s*((\S+\s*)*)/;
        return B.replace(A, "$1");
    }


    function RTrim(B) {
        var A = /((\s*\S+)*)\s*/;
        return B.replace(A, "$1");
    }


    function trim(A) {
        return LTrim(RTrim(A));
    }


    function DoAgentSearch(A) {
        try {
            if (!FormDataEnteredInContainer("agentwheregroupcontainer")) {
                if (!FormDataEnteredInContainer("agentwhatgroupcontainer")) {
                    return false;
                }
            }
            RemoveAllDefaultData(A);
            RewriteAgentSearchURL(A);
        } catch (B) {
        }
        return true;
    }


    function RewriteAgentSearchURL(D) {
        var H = "";
        var B = window.location.href;
        var A = document.getElementById("agentwhere_1");
        var F = A.value;
        var C = F.split(",");
        if (ContainsCommercial(B)) {
            return;
        }
        if (C.length == 2) {
            H = "/realestateagents/" + trim(C[0]) + "-" + trim(C[1]);
        } else {
            if (C.length == 1) {
                var C = F.split(" ");
                if (C.length == 1) {
                    H = "/realestateagents/" + C[0];
                } else {
                    if (C.length == 2) {
                        H = "/realestateagents/" + trim(C[0]) + "-" + trim(C[1]);
                    } else {
                        var E = C.pop();
                        var G = C.join(" ");
                        H = "/realestateagents/" + G + "-" + E;
                    }
                }
            } else {
                H = "/realestateagents/";
            }
        }
        A.value = "";
        D.action = H;
    }


    function DoOfficeSearch(A) {
        try {
            if (!FormDataEnteredInContainer("officewheregroupcontainer")) {
                if (!FormDataEnteredInContainer("officewhatgroupcontainer")) {
                    return false;
                }
            }
            RemoveAllDefaultData(A);
            RewriteOfficeSearchURL(A);
        } catch (B) {
        }
        return true;
    }


    function RewriteOfficeSearchURL(D) {
        var H = "";
        var B = window.location.href;
        var A = document.getElementById("officewhere_1");
        var F = A.value;
        var C = F.split(",");
        if (ContainsCommercial(B)) {
            return;
        } else {
            if (C.length == 2) {
                H = "/realestateoffices/" + trim(C[0]) + "-" + trim(C[1]);
            } else {
                if (C.length == 1) {
                    var C = F.split(" ");
                    if (C.length == 1) {
                        H = "/realestateoffices/" + C[0];
                    } else {
                        if (C.length == 2) {
                            H = "/realestateoffices/" + trim(C[0]) + "-" + trim(C[1]);
                        } else {
                            var E = C.pop();
                            var G = C.join(" ");
                            H = "/realestateoffices/" + G + "-" + E;
                        }
                    }
                } else {
                    H = "/realestateoffices/";
                }
            }
        }
        A.value = "";
        D.action = H;
    }


    function ContainsCommercial(A) {
        var B = false;
        if (A.search("commercial") > -1) {
            B = true;
        }
        return B;
    }


    function DoAreaSearch(A) {
        try {
            if (!FormDataEnteredInContainer("areawheregroupcontainer")) {
                if (!FormDataEnteredInContainer("areawhatgroupcontainer")) {
                    alert("You must enter a location to start your search.");
                    return false;
                }
            }
            RemoveAllDefaultData(A);
            if (A.north) {
                A.north.value = "";
            }
            if (A.south) {
                A.south.value = "";
            }
            if (A.east) {
                A.east.value = "";
            }
            if (A.west) {
                A.west.value = "";
            }
            if (A.zoom) {
                A.zoom.value = "";
            }
        } catch (B) {
        }
        return true;
    }


    function ShowSearchResultMapMouseOver(C, K, H, J) {
        strTrKey = unescape(H);
        var F = document.getElementById(g_objMapPreview.popupname);
        if (F) {
            if (g_bMapPreviewVisible) {
                if (g_objMapPreview) {
                    if (g_objMapPreview.iXPos == C &&
                        g_objMapPreview.iYPos == K &&
                        g_objMapPreview.strTrKey == strTrKey) {
                        return;
                    }
                }
                HideMapPreview();
            }
            g_bMapPreviewVisible = true;
            g_bMapPreviewCancelCloseRequest = true;
            g_bMapPreviewTimeoutActive = true;
            g_bMapPreviewNeedsRepositioned = false;
            if (g_objMapPreview) {
                g_objMapPreview.iXPos = C;
                g_objMapPreview.iYPos = K;
                g_objMapPreview.strTrKey = strTrKey;
            }
            var I;
            I = document.getElementById("officemapviewpreviewname_" + strTrKey);
            if (I) {
                SetInnerHtml("officemapviewpreviewname", I.innerHTML);
            }
            I = document.getElementById("officemapviewpreviewdetails_" + strTrKey);
            if (I) {
                SetInnerHtml("officemapviewpreviewdetails", I.innerHTML);
            }
            I = document.getElementById("propertymapviewpreviewprice_" + strTrKey);
            if (I) {
                SetInnerHtml("propertymapviewpreviewprice", I.innerHTML);
            }
            I = document.getElementById("propertymapviewpreviewdetails_" + strTrKey);
            if (I) {
                SetInnerHtml("propertymapviewpreviewdetails", I.innerHTML);
            }
            I = document.getElementById("propertymapviewpreviewoffice_" + strTrKey);
            if (I) {
                SetInnerHtml("propertymapviewpreviewoffice", I.innerHTML);
            }
            I = document.getElementById("areamapviewpreviewname_" + strTrKey);
            if (I) {
                SetInnerHtml("areamapviewpreviewname", I.innerHTML);
            }
            I = document.getElementById("areamapviewpreviewdetails_" + strTrKey);
            if (I) {
                SetInnerHtml("areamapviewpreviewdetails", I.innerHTML);
            }
            var A = 0;
            var G = 0;
            I = document.getElementById("propertymapviewpreviewlat_" + strTrKey);
            if (I) {
                A = document.getElementById("propertymapviewpreviewlat_" + strTrKey).innerHTML;
                G = document.getElementById("propertymapviewpreviewlon_" + strTrKey).innerHTML;
            }
            I = document.getElementById("officemapviewpreviewlat_" + strTrKey);
            if (I) {
                A = document.getElementById("officemapviewpreviewlat_" + strTrKey).innerHTML;
                G = document.getElementById("officemapviewpreviewlon_" + strTrKey).innerHTML;
            }
            I = document.getElementById("areamapviewpreviewlat_" + strTrKey);
            if (I) {
                A = document.getElementById("areamapviewpreviewlat_" + strTrKey).innerHTML;
                G = document.getElementById("areamapviewpreviewlon_" + strTrKey).innerHTML;
            }
            var B = RfgPixelFromLatLong("resultmap", A, G);
            var E = B.x;
            var D = B.y;
            RfgSetObjectPosition(F, E - 5, D - 20);
            F.style.display = "block";
            RemoveClass(g_objMapPreview.popupname, "hide");
            if (!window.event) {
                if (document.addEventListener) {
                    document.addEventListener("mousemove", MoveMapPreview, true);
                } else {
                    document.attachEvent("onmousemove", MoveMapPreview);
                    document.attachEvent("onmouseover", MoveMapPreview);
                    document.attachEvent("onmouseout", MoveMapPreview);
                }
            } else {
                setTimeout(BeginShowMapPreview, 400);
            }
        }
    }


    function TrackMapPreview(D) {
        var C = document.getElementById(g_objMapPreview.popupname);
        if (C != null) {
            var B = RfgGetMouseXPosition(D, 0);
            var A = RfgGetMouseYPosition(D, 0);
            if (g_pBrowser.bIsMsIe && g_pBrowser.fVersionMajor > 6) {
                B = B - g_iIEMapOffsetX;
                A = A - g_iIEMapOffsetY;
            }
            if (B < g_iMapPreviewPosLeft || B > g_iMapPreviewPosRight) {
                if (!g_bMapPreviewTimeoutActive) {
                    g_bMapPreviewCancelCloseRequest = false;
                    setTimeout(RequestHideMapPreview, 400);
                    g_bMapPreviewTimeoutActive = true;
                }
                return;
            }
            if (A < g_iMapPreviewPosTop || A > g_iMapPreviewPosBottom) {
                if (!g_bMapPreviewTimeoutActive) {
                    g_bMapPreviewCancelCloseRequest = false;
                    setTimeout(RequestHideMapPreview, 400);
                    g_bMapPreviewTimeoutActive = true;
                }
                return;
            }
            g_bMapPreviewCancelCloseRequest = true;
        }
    }


    function RequestHideMapPreview() {
        var A = document.getElementById(g_objMapPreview.popupname);
        if (A != null) {
            g_bMapPreviewTimeoutActive = false;
            if (!g_bMapPreviewCancelCloseRequest) {
                HideMapPreview();
            }
        }
    }


    function HideMapPreview() {
        var A = document.getElementById(g_objMapPreview.popupname);
        if (A != null) {
            if (document.removeEventListener) {
                document.removeEventListener("mousemove", TrackMapPreview, true);
            } else {
                document.detachEvent("onmousemove", TrackMapPreview);
                document.detachEvent("onmouseover", TrackMapPreview);
                document.detachEvent("onmouseout", TrackMapPreview);
            }
            A.style.display = "none";
            g_bMapPreviewVisible = false;
            g_bMapPreviewCurrentId = "";
            g_objMapPreview.strTrKey = "";
        }
    }


    function MoveMapPreview(A) {
        if (document.removeEventListener) {
            document.removeEventListener("mousemove", MoveMapPreview, true);
            document.removeEventListener("mousemove", MoveMapPreview, true);
            document.removeEventListener("mousemove", MoveMapPreview, true);
        } else {
            document.detachEvent("onmousemove", MoveMapPreview);
        }
        setTimeout(BeginShowMapPreview, 400);
    }


    function BeginShowMapPreview() {
        var A = document.getElementById(g_objMapPreview.popupname);
        if (A != null) {
            g_iMapPreviewPosLeft = RfgFindPosX(A);
            g_iMapPreviewPosRight = g_iMapPreviewPosLeft + RfgFindWidth(A);
            g_iMapPreviewPosTop = RfgFindPosY(A) - 30;
            g_iMapPreviewPosBottom = g_iMapPreviewPosTop + RfgFindHeight(A) + 30;
            if (document.addEventListener) {
                document.addEventListener("mousemove", TrackMapPreview, true);
            } else {
                document.attachEvent("onmousemove", TrackMapPreview);
            }
            setTimeout(RequestHideMapPreview, 400);
        }
    }


    function ShowPropertyGridViewPreview(E, A) {
        var B = document.getElementById("propertygridviewpreview");
        if (B) {
            var D = document.getElementById("property_" + A);
            var G = CyberCoreFindPosX(D);
            var C = CyberCoreFindPosY(D);
            if (g_pBrowser.bIsMsIe) {
                G -= 260;
            }
            B.style.left = G - 200 + "px";
            B.style.top = C - 99 + "px";
            B.style.display = "block";
            if (g_ObjHide.bOpen) {
                HidePropertyGridViewPreview();
            }
            g_ObjHide.bOpen = true;
            g_ObjHide.iTrKey = A;
            g_ObjHide.iMinX = G;
            g_ObjHide.iMaxX = G + 100;
            g_ObjHide.iMinY = C;
            g_ObjHide.iMaxY = C + 100;
            SetInnerHtml("propertygridviewpreviewimage", document.getElementById("propertygridviewpreviewimage_" + A).innerHTML);
            SetInnerHtml("propertygridviewpreviewdetails", document.getElementById("propertygridviewpreviewdetails_" + A).innerHTML);
            SetInnerHtml("propertygridviewpreviewdescription", document.getElementById("propertygridviewpreviewdescription_" + A).innerHTML);
            var F = document.getElementById("propertygridviewpreviewcourtesy_" + A).innerHTML;
            if (F != "") {
                SetInnerHtml("propertygridviewpreviewcourtesycontainer", F);
                document.getElementById("propertygridviewpreviewcourtesycontainer").style.height = "12px";
                document.getElementById("propertygridviewpreviewdesccontainer").style.top = "102px";
                B.style.top = C - 116 + "px";
                B.style.height = "185px";
            } else {
                SetInnerHtml("propertygridviewpreviewcourtesycontainer", "");
                document.getElementById("propertygridviewpreviewcourtesycontainer").style.height = "0px";
                document.getElementById("propertygridviewpreviewdesccontainer").style.top = "88px";
                B.style.height = "168px";
            }
            RemoveClass("propertygridviewpreview", "hide");
            document.onmousemove = CheckForPropertyGridViewPreviewHide;
        }
    }


    function HidePropertyGridViewPreview() {
        var A = document.getElementById("propertygridviewpreview");
        if (A) {
            AddClass("propertygridviewpreview", "hide");
            A.style.display = "none";
            g_ObjHide.bOpen = false;
            g_ObjHide.iTrKey = -1;
            document.onmousemove = null;
        }
    }

    var g_ObjHide = new Object;
    g_ObjHide.bOpen = false;

    function CheckForPropertyGridViewPreviewHide(A) {
        if (g_ObjHide.bOpen) {
            var C = GetEventInformation(A);
            var D = C.iPosX;
            var B = C.iPosY;
            if (D < g_ObjHide.iMinX || D > g_ObjHide.iMaxX) {
                HidePropertyGridViewPreview();
            }
            if (B < g_ObjHide.iMinY || B > g_ObjHide.iMaxY) {
                HidePropertyGridViewPreview();
            }
        }
    }


    function TogglePropertyListViewPreview(B, A) {
        if (HasClass("property_" + A + "_previewrow", "hide")) {
            ShowPropertyListViewPreview(A);
        } else {
            HidePropertyListViewPreview(A);
        }
        B.returnValue = false;
        return false;
    }


    function ShowPropertyListViewPreview(A) {
        var B = document.getElementById("property_" + A + "_previewrow");
        if (B) {
            RemoveClass(B, "hide");
        }
        return false;
    }


    function HidePropertyListViewPreview(A) {
        AddClass("property_" + A + "_previewrow", "hide");
    }


    function ShowNextPreviewPhoto(E) {
        var F = document.getElementById("photopreviewscrollcontainer_" + E);
        if (F) {
            var A = -1;
            var H = F.getElementsByTagName("div");
            var G = new Array;
            if (H && H.length > 0) {
                for (var D = 0; D < H.length; D++) {
                    if (HasClass(H[D], "landscapethumbnailcontainer")) {
                        G.push(H[D]);
                        if (A == -1 && H[D].style.display != "none") {
                            A = G.length - 1;
                        }
                    }
                }
                if (G.length > 0 && A < G.length - 2) {
                    G[A].style.display = "none";
                    G[A + 1].style.display = "block";
                    G[A + 2].style.display = "block";
                }
                if (A >= G.length - 2) {
                    var B = document.getElementById("photonextbtn_" + E);
                    B.src = "/images/detail/nextphoto_disabled.gif";
                }
                if (A > 0) {
                    var C = document.getElementById("photopreviousbtn_" + E);
                    C.src = "/images/detail/previousphoto.gif";
                }
            }
        }
    }


    function ShowPreviousPreviewPhoto(E) {
        var F = document.getElementById("photopreviewscrollcontainer_" + E);
        if (F) {
            var A = -1;
            var H = F.getElementsByTagName("div");
            var G = new Array;
            if (H && H.length > 0) {
                for (var D = 0; D < H.length; D++) {
                    if (HasClass(H[D], "landscapethumbnailcontainer")) {
                        G.push(H[D]);
                        if (A == -1 && H[D].style.display != "none") {
                            A = G.length - 1;
                        }
                    }
                }
                if (G.length > 0 && A > 0) {
                    G[A + 1].style.display = "none";
                    G[A].style.display = "block";
                    G[A - 1].style.display = "block";
                }
                if (A <= 1) {
                    var C = document.getElementById("photopreviousbtn_" + E);
                    C.src = "/images/detail/previousphoto_disabled.gif";
                }
                if (A < G.length - 2) {
                    var B = document.getElementById("photonextbtn_" + E);
                    B.src = "/images/detail/nextphoto.gif";
                }
            }
        }
    }


    function OnCompleteShowPropertyListViewPreview(J) {
        if (J.readyState != 4) {
            return;
        }
        var A = J.responseXML.getElementsByTagName("property");
        if (!A.length || A.length == 0) {
            alert("Could not load property preview.");
            return;
        }
        var C = GetNodeValue(J.responseXML, "provider-listingid");
        var D = GetNodeValue(J.responseXML, "description");
        if (!C || C == "") {
            alert("Could not load property preview.");
            return;
        }
        if (D == "") {
            var M = GetNodeValue(J.responseXML, "agent-name");
            D = "Please contact " + M + " for more information.";
        }
        var B = "<div style=\"float:left;\"><a href=\"Javascript:ShowPreviousPreviewPhoto('" + C + "');\"><img src=\"/images/detail/previousphoto_disabled.gif\" id=\"photopreviousbtn_" + C + "\" border=\"0\"></a></div><div id=\"photopreviewscrollcontainer_" + C + "\" style=\"position:relative;left:-5px\">";
        var L = J.responseXML.getElementsByTagName("picture");
        for (var G = 0; G < L.length; G++) {
            var I = GetNodeValue(L[G], "picture-url");
            var F = "";
            if (G > 1) {
                F = "display: none;";
            }
            B += "<div class=\"landscapethumbnailcontainer\" style=\"float:left;margin-left:10px;" + F + "\"><a href=\"/property/index.jsp?id=" + C + "\"><img src=\"" + I + "\" width=\"118\" height=\"79\" alt=\"\" border=\"0\" class=\"landscapethumbnail\"></a><div class=\"tl\"></div><div class=\"tr\"></div><div class=\"bl\"></div><div class=\"br\"></div></div>";
        }
        B += "</div><div style=\"float:left;\"><a href=\"Javascript:ShowNextPreviewPhoto('" + C + "');\"><img src=\"/images/detail/nextphoto.gif\" id=\"photonextbtn_" + C + "\" border=\"0\"></a></div>";
        if (L.length == 0) {
            B = "";
        }
        var H = document.getElementById("property_" + C + "_previewbutton");
        if (H) {
            H.src = "/images/search/listingpreviewclose.gif";
        }
        var E = document.getElementById("property_" + C + "_photopreview");
        var K = document.getElementById("property_" + C + "_description");
        if (E && K) {
            E.innerHTML = B;
            K.innerHTML = D;
        }
        return true;
    }


    function ShowContactAgentForm(D, B, A, C) {
        var E = "/contactus/contactagentpopup.jsp?id=" + B;
        if (A) {
            E += "&trkey=" + A;
        }
        if (C) {
            E += "&source=" + C;
        }
        return ShowContactForm(D, E);
    }


    function ShowContactIdxPropertyForm(B, A) {
        var C = "/contactus/contactidxpropertypopup.jsp?id=" + A;
        return ShowContactForm(B, C);
    }


    function ShowContactPuertoRicoForm(B, A) {
        var C = "/contactus/contactpuertoricopopup.jsp?id=" + A;
        return ShowContactForm(B, C);
    }


    function ShowContactOfficeForm(D, B, A, C) {
        var E = "/contactus/contactofficepopup.jsp?id=" + B;
        if (A) {
            E += "&trkey=" + A;
        }
        if (C) {
            E += "&source=" + C;
        }
        return ShowContactForm(D, E);
    }


    function ShowContactTeamForm(D, A, B, C) {
        var E = "/contactus/contactteampopup.jsp?id=" + A;
        if (B) {
            E += "&trkey=" + B;
        }
        if (C) {
            E += "&source=" + C;
        }
        return ShowContactForm(D, E);
    }


    function CommercialShowContactAgentForm(D, B, A, C) {
        var E = "/contactus/contactagentpopup.jsp?id=" + B;
        if (A) {
            E += "&commkey=" + A;
        }
        if (C) {
            E += "&type=" + C;
        }
        return ShowContactForm(D, E);
    }


    function CommercialShowContactOfficeForm(D, B, A, C) {
        var E = "/contactus/contactofficepopup.jsp?id=" + B;
        if (A) {
            E += "&commkey=" + A;
        }
        if (C) {
            E += "&type=" + C;
        }
        return ShowContactForm(D, E);
    }


    function CommercialShowContactTeamForm(D, A, B, C) {
        var E = "/contactus/contactteampopup.jsp?id=" + A;
        if (B) {
            E += "&commkey=" + B;
        }
        if (C) {
            E += "&type=" + C;
        }
        return ShowContactForm(D, E);
    }


    function ShowContactForm(G, H) {
        var F = document.getElementById("contactpopupbody");
        if (!F) {
            return true;
        }
        var C = window.innerHeight;
        if (navigator.appName.indexOf("Microsoft") != -1) {
            C = document.documentElement.clientHeight;
        }
        var E = C - 50;
        var B = 490;
        var A = 540;
        if (E - A < 0) {
            A = E;
        }
        strHtml = "<div id=\"PopupFrameContainer\" class=\"calloutgrey\" style=\"position:relative;background: #ffffff;\">   <iframe id=\"PopupIframe\" src=\"" + H + "\" width=\"" + B + "\" height=\"" + A + "\" scrolling=\"auto\" frameborder=\"0\"></iframe></div>";
        F.innerHTML = strHtml;
        var D = document.getElementById("contactpopup");
        if (!D) {
            return true;
        }
        try {
            if (window.innerWidth) {
                D.style.left = window.innerWidth / 2 - 209 + "px";
            } else {
                if (document.body && document.body.clientWidth) {
                    D.style.left = document.body.clientWidth / 2 - 209 + "px";
                } else {
                    D.style.left = "300px";
                }
            }
        } catch (G) {
        }
        D.style.display = "block";
        G.returnValue = false;
        return false;
    }


    function HideContactForm() {
        var B = document.getElementById("contactpopup");
        if (B) {
            B.style.display = "none";
        }
        var A = document.getElementById("PopupIframe");
        if (A) {
            A.src = "/blank.html";
        }
        return false;
    }


    function HideContactOfficeForm() {
        return HideContactForm();
    }


    function HideContactAgentForm() {
        return HideContactForm();
    }


    function getPageSize() {
        var A = {x: 0, y: 0};
        if (window.innerHeight && window.scrollMaxY) {
            A.x = window.innerWidth + window.scrollMaxX;
            A.y = window.innerHeight + window.scrollMaxY;
        } else {
            if (document.body.scrollHeight > document.body.offsetHeight) {
                A.x = document.body.scrollWidth;
                A.y = document.body.scrollHeight;
            } else {
                A.x = document.body.offsetWidth + document.body.offsetLeft;
                A.y = document.body.offsetHeight + document.body.offsetTop;
            }
        }
        return A;
    }


    function getViewport() {
        var A = {x: 1024, y: 768};
        try {
            if (typeof window.innerWidth == "number") {
                A.x = window.innerWidth;
                A.y = window.innerHeight;
            } else {
                if (document.documentElement &&
                    document.documentElement.clientWidth) {
                    A.x = document.documentElement.clientWidth;
                    A.y = document.documentElement.clientHeight;
                } else {
                    if (document.body && document.body.clientWidth) {
                        A.x = document.body.clientWidth;
                        A.y = document.body.clientHeight;
                    }
                }
            }
        } catch (B) {
        }
        return A;
    }


    function getScrollOffset() {
        var A = {x: 0, y: 0};
        if (typeof window.pageXOffset == "number") {
            A.x = window.pageXOffset;
            A.y = window.pageYOffset;
        } else {
            if (document.body && document.body.scrollLeft) {
                A.x = document.body.scrollLeft;
                A.y = document.body.scrollTop;
            } else {
                if (document.documentElement &&
                    document.documentElement.scrollLeft) {
                    A.x = document.documentElement.scrollLeft;
                    A.y = document.documentElement.scrollTop;
                }
            }
        }
        return A;
    }


    function ShowFullPageWaitDialog() {
        var E = getPageSize();
        var C = getViewport();
        var I = getScrollOffset();
        var B = C.x / 2 + I.x;
        var A = C.y / 2 + I.y;
        var F = document.createElement("div");
        F.id = "fullpagewait";
        F.style.width = E.x + "px";
        F.style.height = E.y + "px";
        var D = document.createElement("div");
        D.className = "shader";
        D.innerHTML = " &nbsp; ";
        F.appendChild(D);
        var G = document.createElement("div");
        G.className = "calloutblack";
        G.style.position = "fixed";
        G.style.width = "300px";
        G.style.height = "110px";
        G.style.marginRight = "20px";
        G.style.color = "white";
        G.style.top = A - 55 + "px";
        G.style.left = B - 150 + "px";
        var H = "<div class=\"label\"><div class=\"tl\"></div><div class=\"tr\"></div><b>Please Wait...</b>      </div><div class=\"body\" style=\"color:white\">   <div style=\"height:90px;padding-left:16px;margin-right:5px;\">      <div style=\"float:right\"><a href=\"#\" onClick=\"return HideFullPageWaitDialog();\"><img src=\"/images/close.gif\" width=20 height=20></a></div>      Please wait while we perform your search.      <br><br>      <img src=\"/images/loading.gif\">   </div></div><div class=\"bl\"></div><div class=\"bm\"></div><div class=\"br\"></div>";
        G.innerHTML = H;
        F.appendChild(G);
        document.body.appendChild(F);
    }


    function HideFullPageWaitDialog() {
        var A = document.getElementById("fullpagewait");
        if (A) {
            document.body.removeChild(A);
        }
        return false;
    }


    function closeENIDXChooser() {
        document.body.removeChild(document.getElementById("enidxmls_chooser"));
    }


    function doENIDXChooser(D) {
        var A = "/enidx/chooser.jsp?";
        var C = D.split("?");
        if (C.length == 2) {
            A += C[1];
            var B = (new Date).getTime();
            A += "&rid=" + escape(B);
            location.href = A;
        }
        return true;
    }


    function finishENIDXChooserDisplay() {
        HideFullPageWaitDialog();
        var A = document.getElementById("myc21popup");
        if (A) {
            A.style.display = "block";
        }
    }


    function handleENIDXRedirect(E, B, C, A) {
        var D = function (J) {if (J.readyState == 4) {var I = false;if (J.status == 200) {var F = GetNodeValue(J.responseXML, "results");if (F && F == "success") {var K = GetNodeValue(J.responseXML, "url");var H = GetNodeValue(J.responseXML, "query");if (K != "") {var G = document.getElementById("enidxsearchhandlerform");if (G) {G.action = K + ("?c21numzones=" + C + "&c21thiszone=" + A + "&WT.ac=C21IDXlinkIDX");G.query.value = H;G.submit();I = true;}}}}if (!I) {HideFullPageWaitDialog();alert("Sorry, your request could not be completed.  Please try again.");}}};
        ShowFullPageWaitDialog();
        g_AjaxQueue.schedule("enidxmlsurl", E, D, true, true, B);
        return false;
    }


    function doENIDXRedirect(C, D, F, E, A) {
        var G = "/ajaxservlet/enidx/getmlsurl";
        var B = "mlsid=" + C + "&z=" + escape(D) + "&addl=" + escape(F);
        return handleENIDXRedirect(G, B, E, A);
    }


    function doENIDXRedirectByCity(D, C, F, E, A) {
        var G = "/ajaxservlet/enidx/getmlsurl";
        var B = "mlsid=" + D + "&c=" + escape(C) + "&addl=" + escape(F);
        return handleENIDXRedirect(G, B, E, A);
    }


    function enidxGetListingCount(A) {
        var C = "/ajaxservlet/enidx/getidxmlsarea?where=" + A + "&limit=1000";
        var B = function (L) {if (L.readyState == 4) {if (L.status == 200) {var J = 0;var I = L.responseXML;if (I) {var M = I.getElementsByTagName("listingcount");for (i = 0; i < M.length; i++) {var F = M[i].firstChild.nodeValue;try {J = J + parseInt(F);} catch (K) {J = J + 0;}}}if (J > 0) {J = addCommas(J);var H = document.getElementById("idxsearchlinkcontainer1");var E = document.getElementById("idxsearchlinkcontainer2");if (H) {H.style.display = "inline";}if (E) {E.style.display = "inline";}var G = document.getElementById("enidxcount1");var D = document.getElementById("enidxcount2");if (G) {G.innerHTML = J;}if (D) {D.innerHTML = J;}}}}};
        g_AjaxQueue.schedule("enidxlistingcount", C, B);
    }


    function addCommas(B) {
        B += "";
        x = B.split(".");
        x1 = x[0];
        x2 = x.length > 1 ? "." + x[1] : "";
        var A = /(\d+)(\d{3})/;
        while (A.test(x1)) {
            x1 = x1.replace(A, "$1,$2");
        }
        return x1 + x2;
    }


    function printSearch() {
        if (window.location.href.search("display=photoflow") >= 0) {
            var C = document.getElementById("listingid").innerHTML;
            var A = document.getElementById("propertyType").innerHTML;
            if (A == "idx") {
                var B = "/idxproperty/print.jsp?id=" + C;
            } else {
                var B = "/property/print.jsp?id=" + C;
            }
            document.getElementById("main_print").href = B;
            return true;
        } else {
            document.getElementById("print_select").style.display = "inline";
            document.getElementById("close_print").style.display = "inline";
        }
        return false;
    }


    function cancelPrintSearch() {
        document.getElementById("print_select").style.display = "none";
        document.getElementById("close_print").style.display = "none";
    }


    function printPage(D, F) {
        var E = window.location.href;
        E = E.replace("#", "");
        var C = document.print_form.print_type;
        var A = "";
        for (var B = 0; B < C.length; B++) {
            if (C[B].checked) {
                A = C[B].value;
            }
        }
        if (A == "all") {
            E = E + "&rpp=100";
            E = E.replace("pg=", "");
        }
        var D = "";
        if (E.search("property.jsp") >= 0) {
            D = "property";
        } else {
            if (E.search("agent.jsp") >= 0) {
                D = "agent";
            } else {
                if (E.search("area.jsp") >= 0) {
                    D = "area";
                } else {
                    if (E.search("office.jsp") >= 0) {
                        D = "office";
                    }
                }
            }
        }
        switch (D) {
          case "property":
            E = E.replace("property.jsp", "property_print.jsp");
            document.getElementById("print_link").href = E;
            break;
          case "agent":
            E = E.replace("agent.jsp", "agent_print.jsp");
            document.getElementById("print_link").href = E;
            break;
          case "area":
            E = E.replace("area.jsp", "area_print.jsp");
            document.getElementById("print_link").href = E;
            break;
          case "office":
            E = E.replace("office.jsp", "office_print.jsp");
            document.getElementById("print_link").href = E;
            break;
          default:
            window.print();
        }
        cancelPrintSearch();
        return true;
    }


    function ReturnTrue() {
        return true;
    }


    function ConfigureMapPopup() {
        RfgShowMapDashboard("resultmap", false);
        RfgShowDetailOnMouseOver(false);
        RfgAddVEPushpinOnMouseOver(ShowSearchResultMapMouseOver);
        g_pMainSearchMap = RfgGetMapById("resultmap");
    }


    function ShowOpenHouseDateDisplay(C, B) {
        var A = document.getElementById("addlopenhouses_popup");
        if (A) {
            var D = document.getElementById("searchresults_addlopenhouses_" + B);
            if (D) {
                SetInnerHtml("addlopenhouses_content", D.innerHTML);
                ShowModal();
                positionPopup(C, A);
                RemoveClass(A, "hide");
            }
        }
        return false;
    }


    function HideOpenHouseDateDisplay() {
        HideModal();
        AddClass("addlopenhouses_popup", "hide");
        return false;
    }


    function ShowModal() {
        var A = document.getElementById("modalBackground");
        if (A) {
            RemoveClass(A, "hide");
        }
    }


    function HideModal() {
        var A = document.getElementById("modalBackground");
        if (A) {
            AddClass(A, "hide");
        }
    }


    function enidxContactOffice(B) {
        var A = window.open(B, "enidxoffice" + (new Date).getTime(), "width=600,height=600");
        return false;
    }


    function toggleOverflow(D, A) {
        var B = document.getElementById(D);
        var C = document.getElementById(A);
        if (B) {
            if (B.style.overflow == "hidden" || B.style.overflow == "") {
                B.style.overflow = "visible";
                if (C) {
                    if (C.style.backgroundImage.indexOf("topbar_arrow.gif") >= 0) {
                        C.style.backgroundImage = "url(/images/search/topbar_arrow_on.gif)";
                    } else {
                        C.style.backgroundImage = "url(/images/search/h_arrow_up.gif)";
                    }
                }
            } else {
                B.style.overflow = "hidden";
                if (C) {
                    if (C.style.backgroundImage.indexOf("topbar_arrow_on.gif") >= 0) {
                        C.style.backgroundImage = "url(/images/search/topbar_arrow.gif)";
                    } else {
                        C.style.backgroundImage = "url(/images/search/h_arrow_down.gif)";
                    }
                }
            }
        }
    }


    function getIndexInArray(C, B) {
        for (var A = 0; A < C.length; A++) {
            if (C[A] == B) {
                return A;
            }
        }
        return -1;
    }

    var g_aDropdowns = new Array;
    var g_aDropdownActions = new Array;

    function requestMenuOverflowOff(C, B) {
        var A = getIndexInArray(g_aDropdowns, C);
        A = A < 0 ? g_aDropdowns.length : A;
        g_aDropdowns[A] = C;
        if (!g_aDropdownActions[A]) {
            g_aDropdownActions[A] = new Array;
        }
        g_aDropdownActions[A].action = "close";
        g_aDropdownActions[A].elem_id = C;
        g_aDropdownActions[A].arrow_id = B;
        setTimeout(menuOverflowOff, 400);
    }


    function menuOverflowOff() {
        for (var A = 0; A < g_aDropdowns.length; A++) {
            var E = g_aDropdownActions[A].action;
            var F = g_aDropdownActions[A].elem_id;
            var B = g_aDropdownActions[A].arrow_id;
            var C = document.getElementById(F);
            var D = document.getElementById(B);
            if (C && E == "close") {
                C.style.overflow = "hidden";
                if (D) {
                    D.style.backgroundImage = "url(/images/search/topbar_arrow.gif)";
                }
            }
        }
    }


    function menuOverflowOn(F, C) {
        var B = new Date;
        var A = getIndexInArray(g_aDropdowns, F);
        A = A < 0 ? g_aDropdowns.length : A;
        g_aDropdowns[A] = F;
        if (!g_aDropdownActions[A]) {
            g_aDropdownActions[A] = new Array;
        }
        g_aDropdownActions[A].action = "open";
        g_aDropdownActions[A].elem_id = F;
        g_aDropdownActions[A].arrow_id = C;
        var D = document.getElementById(F);
        var E = document.getElementById(C);
        if (D) {
            D.style.overflow = "visible";
        }
    }


    function highlightOption(G, C) {
        var E = document.getElementById(G + C);
        var D = document.getElementById(G + C + ("_link"));
        var B = document.getElementById(G + C + ("_icon"));
        var A = document.getElementById(G + C + ("_dot"));
        var F = document.getElementById(G + C + ("_arrow"));
        if (E) {
            E.style.backgroundImage = "url(/images/search/h_yel_bg.gif)";
            E.style.color = "#000000";
            if (D) {
                D.style.color = "#000000";
            }
            if (A) {
                A.style.backgroundImage = "url(/images/search/h_yel_dot.gif)";
            }
            if (F) {
                if (F.style.backgroundImage.indexOf("topbar_arrow_on.gif") >= 0) {
                    F.style.backgroundImage = "url(/images/search/h_arrow_up.gif)";
                } else {
                    F.style.backgroundImage = "url(/images/search/h_arrow_down.gif)";
                }
            }
            if (B) {
                switch (C) {
                  case "list":
                    B.src = "/images/search/h_list_icon.gif";
                    break;
                  case "map":
                    B.src = "/images/search/h_map_icon.gif";
                    break;
                  case "grid":
                    B.src = "/images/search/h_grid_icon.gif";
                    break;
                  case "photo":
                    B.src = "/images/search/h_photo_icon.gif";
                    break;
                  case "save":
                    if (B.src.indexOf("h_check_icon.gif") >= 0) {
                        B.src = "/images/search/h_check_icon_blk.gif";
                    } else {
                        B.src = "/images/search/h_save_icon_blk.gif";
                    }
                    break;
                  case "print":
                    B.src = "/images/search/h_print_icon_blk.gif";
                    break;
                  case "email":
                    B.src = "/images/search/h_save_icon_blk.gif";
                    break;
                  case "rss":
                    B.src = "/images/search/h_rss_icon_blk.gif";
                    break;
                  default:;
                }
            }
        }
    }


    function endHighlightOption(G, C) {
        var E = document.getElementById(G + C);
        var D = document.getElementById(G + C + ("_link"));
        var B = document.getElementById(G + C + ("_icon"));
        var A = document.getElementById(G + C + ("_dot"));
        var F = document.getElementById(G + C + ("_arrow"));
        if (E) {
            E.style.backgroundImage = "url(/images/search/topbar_mid.gif)";
            E.style.color = "#FECE02";
            if (D) {
                D.style.color = "#FECE02";
            }
            if (A) {
                A.style.backgroundImage = "url(/images/search/h_pag_dot.gif)";
            }
            if (F) {
                if (F.style.backgroundImage.indexOf("h_arrow_up.gif") >= 0) {
                    F.style.backgroundImage = "url(/images/search/topbar_arrow_on.gif)";
                } else {
                    F.style.backgroundImage = "url(/images/search/topbar_arrow.gif)";
                }
            }
            if (B) {
                switch (C) {
                  case "list":
                    B.src = "/images/search/list_icon.gif";
                    break;
                  case "map":
                    B.src = "/images/search/map_icon.gif";
                    break;
                  case "grid":
                    B.src = "/images/search/grid_icon.gif";
                    break;
                  case "photo":
                    B.src = "/images/search/photoflow.gif";
                    break;
                  case "save":
                    if (B.src.indexOf("h_check_icon_blk.gif") >= 0) {
                        B.src = "/images/search/h_check_icon.gif";
                    } else {
                        B.src = "/images/search/h_save_icon.gif";
                    }
                    break;
                  case "print":
                    B.src = "/images/search/h_print_icon.gif";
                    break;
                  case "email":
                    B.src = "/images/search/h_save_icon.gif";
                    break;
                  case "rss":
                    B.src = "/images/search/h_rss_icon.gif";
                    break;
                  default:;
                }
            }
        }
    }


    function InitOffsiteLinks() {
        var E;
        if (document.getElementsByTagName) {
            var G = document.getElementsByTagName("a");
            var F = G.length;
            for (var C = 0; C < F; C++) {
                if (G[C].href) {
                    E = getServerName(G[C].getAttribute("href"));
                    if (E.length > 0) {
                        if (!isValidC21Server(E)) {
                            var B = G[C].getAttribute("linktype");
                            switch (B) {
                              case "property":
                                G[C].onclick = function () {dcsMultiTrack("DCS.dcsuri", location.href, "WT.cg_n", "Property Listing Search", "WT.z_engage_type", "Indirect", "WT.z_engage_event", "Search Router");};
                                break;
                              case "agent":
                                G[C].onclick = function () {dcsMultiTrack("DCS.dcsuri", location.href, "WT.cg_n", "Agent Search", "WT.z_engage_type", "Indirect", "WT.z_engage_event", "Agent Weblink");};
                                break;
                              case "office":
                                G[C].onclick = function () {dcsMultiTrack("DCS.dcsuri", location.href, "WT.cg_n", "Office Listing Search", "WT.z_engage_type", "Indirect", "WT.z_engage_event", "Office Weblink");};
                                break;
                              default:
                                break;
                            }
                            var D = G[C].getAttribute("title");
                            var A = "You have selected a link to a website that is not owned or maintained by Century21.com.  Different terms of use and privacy policies will apply.";
                            if (D) {
                                A += " " + D;
                            }
                            G[C].setAttribute("title", A);
                        }
                    }
                }
            }
        }
    }


    function getServerName(C) {
        var B;
        var A;
        B = C.toLowerCase();
        A = B.indexOf("?");
        if (A >= 0) {
            B = B.substring(0, A);
        }
        if (B.indexOf("http") == 0) {
            A = B.indexOf("https://");
            if (A >= 0) {
                B = B.substring(A + 8, B.length);
            }
            A = B.indexOf("http://");
            if (A >= 0) {
                B = B.substring(A + 7, B.length);
            }
            A = B.indexOf("/");
            if (A >= 0) {
                B = B.substring(0, A);
            }
        } else {
            B = "";
        }
        return B;
    }


    function isValidC21Server(B) {
        var A = document.location.host.toLowerCase();
        if (B.indexOf(".c21.com") >= 0) {
            return true;
        }
        if (B == "c21.com") {
            return true;
        }
        if (B.indexOf(".century21.com") >= 0) {
            return true;
        }
        if (B == "century21.com") {
            return true;
        }
        if (B.indexOf(".netmovein.com") >= 0) {
            return true;
        }
        if (B.indexOf(".century21mortgage.com") >= 0) {
            return false;
        }
        if (B == A) {
            return true;
        }
        return false;
    }


    function c21Reporting(E, C, D) {
        if (D.charAt(0) >= "A" && D.charAt(0) <= "Z") {
            return;
        }
        var B = document.getElementById("messagequeueiframe");
        if (B) {
            var A = "" + Math.random() * 10000000000000;
            B.src = "/reporting/" + E + "?id=" + D + "&type=" + C + "&rnd=" + A;
        }
        return true;
    }

    RfgQueueCommand("InitOffsiteLinks%28%29%3B");
    var g_bInMove = false;

    function MoveSliderLeft(D) {
        if (g_bInMove) {
            return;
        }
        if (D == null || D <= 0) {
            D = 258;
        }
        g_bInMove = true;
        var I = document.getElementById("photoselectioncontainer");
        if (I) {
            var F = 0;
            var B = 0;
            if (!I.style.width || I.style.width == "") {
                var A = I.getElementsByTagName("div");
                if (A && A.length > 0) {
                    for (var E = 0; E < A.length; E++) {
                        var G = A[E].className;
                        if (G.search("slide") > 0) {
                            B += CyberCoreFindWidth(A[E]);
                        }
                    }
                }
                I.style.width = B + "px";
            } else {
                B = parseInt(I.style.width);
            }
            if (I.style.marginLeft != null && I.style.marginLeft != "") {
                F = parseInt(I.style.marginLeft);
            }
            I.style.marginLeft = F + "px";
            if (F < 0) {
                var C = F + D;
                var H = new SmoothMovement(F, C, -7);
                window.setTimeout(function () {UpdateSlider(I, H, C, D);}, 20);
            } else {
                g_bInMove = false;
            }
        }
    }


    function MoveSliderRight(E) {
        if (g_bInMove) {
            return;
        }
        if (E == null || E <= 0) {
            E = 258;
        }
        g_bInMove = true;
        var J = document.getElementById("photoselectioncontainer");
        if (J) {
            var G = 0;
            var C = 0;
            if (!J.style.width || J.style.width == "") {
                var A = J.getElementsByTagName("div");
                if (A && A.length > 0) {
                    for (var F = 0; F < A.length; F++) {
                        var H = A[F].className;
                        if (H.search("slide") > 0) {
                            C += CyberCoreFindWidth(A[F]);
                        }
                    }
                }
                J.style.width = C + "px";
            } else {
                C = parseInt(J.style.width);
            }
            if (J.style.marginLeft != null && J.style.marginLeft != "") {
                G = parseInt(J.style.marginLeft);
            }
            J.style.marginLeft = G + "px";
            var D = G - E;
            if (Math.abs(D) < C) {
                var I = new SmoothMovement(G, D, 7);
                window.setTimeout(function () {UpdateSlider(J, I, D, E);}, 20);
            } else {
                g_bInMove = false;
                var B = document.getElementById("collectionnextbtn");
                B.src = "/images/detail/nextphoto_disabled.gif";
            }
        }
    }


    function InitSlider(G) {
        if (G == null || G <= 0) {
            G = 258;
        }
        var B = document.getElementById("photoselectioncontainer");
        if (B) {
            var F = 0;
            if (!B.style.width || B.style.width == "") {
                var E = B.getElementsByTagName("div");
                if (E && E.length > 0) {
                    for (var C = 0; C < E.length; C++) {
                        var D = E[C].className;
                        if (D.search("slide") > 0) {
                            F += CyberCoreFindWidth(E[C]);
                        }
                    }
                }
                B.style.width = F + "px";
            } else {
                F = parseInt(B.style.width);
            }
            var A = document.getElementById("collectionnextbtn");
            if (G >= parseInt(F)) {
                A.src = "/images/detail/nextphoto_disabled.gif";
            } else {
                A.src = "/images/detail/nextphoto.gif";
            }
        }
    }


    function UpdateSlider(C, A, E, G) {
        if (G == null || G <= 0) {
            G = 258;
        }
        var F = A.updatePosition();
        C.style.marginLeft = F + "px";
        if (F != E) {
            window.setTimeout(function () {UpdateSlider(C, A, E, G);}, 20);
        } else {
            g_bInMove = false;
            var D = document.getElementById("collectionpreviousbtn");
            if (E >= 0) {
                D.src = "/images/detail/previousphoto_disabled.gif";
            } else {
                D.src = "/images/detail/previousphoto.gif";
            }
            var B = document.getElementById("collectionnextbtn");
            if (Math.abs(E - G) >= parseInt(C.style.width)) {
                B.src = "/images/detail/nextphoto_disabled.gif";
            } else {
                B.src = "/images/detail/nextphoto.gif";
            }
        }
    }


    function SwapMainImage(D, C) {
        var B = document.getElementById("mainimageimg");
        if (B) {
            B.src = D;
        }
        var A = document.getElementById("mainimage_caption");
        if (A) {
            A.innerHTML = C;
        }
        return false;
    }


    function MoveCollectionLeft(G) {
        if (g_bInMove) {
            return;
        }
        if (G == null || G <= 0) {
            G = 258;
        }
        g_bInMove = true;
        var B = document.getElementById("photoselectioncontainer");
        if (B) {
            var H = 0;
            var E = 0;
            if (!B.style.width || B.style.width == "") {
                var D = B.getElementsByTagName("div");
                if (D && D.length > 0) {
                    for (var C = 0; C < D.length; C++) {
                        E += CyberCoreFindWidth(D[C]) + 8;
                    }
                }
                B.style.width = E + "px";
            } else {
                E = parseInt(B.style.width);
            }
            if (B.style.marginLeft != null && B.style.marginLeft != "") {
                H = parseInt(B.style.marginLeft);
            }
            B.style.marginLeft = H + "px";
            if (H < 0) {
                var F = H + G;
                var A = new SmoothMovement(H, F, -7);
                window.setTimeout(function () {UpdateCollectionSlide(B, A, F);}, 20);
            } else {
                g_bInMove = false;
            }
        }
    }


    function MoveCollectionRight(E) {
        if (g_bInMove) {
            return;
        }
        if (E == null || E <= 0) {
            E = 258;
        }
        g_bInMove = true;
        var I = document.getElementById("photoselectioncontainer");
        if (I) {
            var G = 0;
            var C = 0;
            if (!I.style.width || I.style.width == "") {
                var A = I.getElementsByTagName("div");
                if (A && A.length > 0) {
                    for (var F = 0; F < A.length; F++) {
                        C += CyberCoreFindWidth(A[F]) + 8;
                    }
                }
                I.style.width = C + "px";
            } else {
                C = parseInt(I.style.width);
            }
            if (I.style.marginLeft != null && I.style.marginLeft != "") {
                G = parseInt(I.style.marginLeft);
            }
            I.style.marginLeft = G + "px";
            var D = G - E;
            if (Math.abs(D) < C) {
                var H = new SmoothMovement(G, D, 7);
                window.setTimeout(function () {UpdateCollectionSlide(I, H, D);}, 20);
            } else {
                g_bInMove = false;
                var B = document.getElementById("collectionnextbtn");
                B.src = "/images/detail/nextphoto_disabled.gif";
            }
        }
    }


    function InitCollectionSlide(C) {
        if (C == null || C <= 0) {
            C = 258;
        }
        var B = document.getElementById("photoselectioncontainer");
        if (B) {
            var A = document.getElementById("collectionnextbtn");
            if (C >= parseInt(B.style.width)) {
                A.src = "/images/detail/nextphoto_disabled.gif";
            } else {
                A.src = "/images/detail/nextphoto.gif";
            }
        }
    }


    function UpdateCollectionSlide(C, A, E, G) {
        if (G == null || G <= 0) {
            G = 258;
        }
        var F = A.updatePosition();
        C.style.marginLeft = F + "px";
        if (F != E) {
            window.setTimeout(function () {UpdateCollectionSlide(C, A, E);}, 20);
        } else {
            g_bInMove = false;
            var D = document.getElementById("collectionpreviousbtn");
            if (E >= 0) {
                D.src = "/images/detail/previousphoto_disabled.gif";
            } else {
                D.src = "/images/detail/previousphoto.gif";
            }
            var B = document.getElementById("collectionnextbtn");
            if (Math.abs(E - G) >= parseInt(C.style.width)) {
                B.src = "/images/detail/nextphoto_disabled.gif";
            } else {
                B.src = "/images/detail/nextphoto.gif";
            }
        }
    }


    function processMiniNav(K, B) {
        var A = null;
        var I = null;
        var C = null;
        var F = null;
        try {
            var D = K.getElementsByTagName("property");
            if (D.length < 1) {
                return;
            }
            for (var G = 0; G < D.length; G++) {
                var E = GetNodeValue(D[G], "id");
                if (E == B) {
                    if (G > 0) {
                        A = GetNodeValue(D[G - 1], "id");
                        I = GetNodeValue(D[G - 1], "picture-url");
                    }
                    if (G < D.length - 1) {
                        C = GetNodeValue(D[G + 1], "id");
                        F = GetNodeValue(D[G + 1], "picture-url");
                    }
                    break;
                }
            }
        } catch (J) {
            return;
        }
        if (A && I) {
            var H = "/property/index.jsp?id=" + A + "";
            if (A.charAt(0) >= "A" && A.charAt(0) <= "Z") {
                H = "/idxproperty/index.jsp?id=" + A;
            }
            SetInnerHtml("mininavprevtxt", "<a href=\"" + H + "\">Previous<br/>result</a>");
            SetInnerHtml("mininavprevbtn", "<a href=\"" + H + "\"><img src=\"/images/detail/previousresult.gif\" width=\"18\" height=\"18\" border=\"0\"></a>");
            SetInnerHtml("mininavprevimg", "<a href=\"" + H + "\"><img src=\"" + I + "\" width=\"43\" height=\"29\" border=\"0\"></a>");
        } else {
            SetInnerHtml("mininavprevbtn", "<img src=\"/images/detail/previousphoto_disabled.gif\" width=\"18\" height=\"18\" border=\"0\">");
        }
        if (C && F) {
            var H = "/property/index.jsp?id=" + C + "";
            if (C.charAt(0) >= "A" && C.charAt(0) <= "Z") {
                H = "/idxproperty/index.jsp?id=" + C;
            }
            SetInnerHtml("mininavnexttxt", "<a href=\"" + H + "\">Next<br/>result</a>");
            SetInnerHtml("mininavnextbtn", "<a href=\"" + H + "\"><img src=\"/images/detail/nextresult.gif\" width=\"18\" height=\"18\" border=\"0\"></a>");
            SetInnerHtml("mininavnextimg", "<a href=\"" + H + "\"><img src=\"" + F + "\" width=\"43\" height=\"29\" border=\"0\"></a>");
        } else {
            SetInnerHtml("mininavnextbtn", "<img src=\"/images/detail/nextphoto_disabled.gif\" width=\"18\" height=\"18\" border=\"0\">");
        }
    }


    function doMiniNav(B) {
        var A = GetCookie("lsp");
        if (A) {
            A = unescape(A);
            var D = "/xml-bin/propertymininav?id=" + B + "&" + A;
            var C = function (E) {if (E.readyState == 4 && E.status == 200) {processMiniNav(E.responseXML, B);}};
            g_AjaxQueue.schedule("propertymininav", D, C);
        }
    }


    function doSlideshow(C, B) {
        c21Reporting("listing", "Slides", B);
        var D = "/property/slideshow.jsp?id=" + B;
        var A = window.open(D, "_blank", "height=600,width=800,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
        dcsMultiTrack("DCS.dcsuri", location.href, "WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "View Prop Multimedia");
        return false;
    }


    function displayMedianAgeChartPopup() {
        return false;
    }


    function doVirtualTour(B) {
        var A = window.open(B, "_blank", "height=525,width=525,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no");
        dcsMultiTrack("DCS.dcsuri", location.href, "WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "View Prop Multimedia");
        return false;
    }


    function displayVirtualTourPopup(E, A, D) {
        c21Reporting("listing", "Virtual", D);
        if (A == 1) {
            doVirtualTour(g_strFirstVirtualTour);
        } else {
            var B = document.getElementById("virtualtourspopup");
            if (B) {
                try {
                    positionPopup(E, B);
                } catch (C) {
                }
                B.style.display = "block";
                B.style.zIndex = 50000;
            }
        }
        return false;
    }


    function doFloorPlan(B) {
        var A = window.open(B, "_blank", "height=525,width=525,resizable=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no");
        return false;
    }


    function displayFloorPlanPopup(E, D, C) {
        c21Reporting("listing", "Floor", C);
        if (D == 1) {
            doFloorPlan(g_strFirstFloorPlan);
        } else {
            var A = document.getElementById("floorplanspopup");
            if (A) {
                try {
                    positionPopup(E, A);
                } catch (B) {
                }
                A.style.display = "block";
                A.style.zIndex = 50000;
            }
        }
        return false;
    }


    function ShowC21Connection(A, B) {
        return true;
    }


    function showEmailDialog(G, F, A) {
        var D = document.getElementById("emailafriendpopup");
        if (D) {
            try {
                positionPopup(G, D);
            } catch (E) {
            }
            D.style.display = "block";
            D.style.zIndex = 50000;
            var C = (new Date).getTime();
            var B = document.getElementById("emailafriendframe");
            if (B) {
                B.src = "/emailafriend/property.jsp?id=" + escape(F) + "&officeid=" + escape(A) + "&rid=" + escape(C);
            }
        }
        return false;
    }


    function showSearchEmailDialog(G) {
        var F = "";
        var C = document.getElementById("emailpropertyids");
        if (C) {
            F = C.value;
        }
        var D = document.getElementById("emailafriendpopup");
        if (D) {
            try {
                positionPopup(G, D);
            } catch (E) {
            }
            D.style.display = "block";
            D.style.zIndex = 50000;
            var B = (new Date).getTime();
            var A = document.getElementById("emailafriendframe");
            if (A) {
                A.src = "/emailafriend/search.jsp?ids=" + escape(F) + "&rid=" + escape(B);
            }
        }
        return false;
    }


    function removeDefaultText(B, A) {
        if (B) {
            if (B.value == A) {
                B.value = "";
            }
        }
        return false;
    }


    function ShowComingSoonDialog() {
        var A = document.getElementById("comingsoonpopup");
        if (A) {
            A.style.top = "125px";
            try {
                if (window.innerWidth) {
                    A.style.left = window.innerWidth / 2 - 209 + "px";
                } else {
                    if (document.body && document.body.clientWidth) {
                        A.style.left = document.body.clientWidth / 2 - 209 + "px";
                    } else {
                        A.style.left = "300px";
                    }
                }
            } catch (B) {
            }
            A.style.display = "block";
        }
        return false;
    }


    function HideComingSoonDialog() {
        var A = document.getElementById("comingsoonpopup");
        if (A) {
            A.style.display = "none";
        }
        return false;
    }

    var ignoreMe;
    if (document.body) {
        ignoreMe = document.body.scrollTop;
    }
    if (document.documentElement.scrollTop) {
        ignoreMe = document.documentElement.scrollTop;
    }
    var g_lMyC21Account = null;
    var g_strMyC21FName = null;
    var g_cMyC21AccountType = null;
    var g_globalAfterLoginCallback = null;
    var g_globalAfterLoginCallbackArgs = null;

    function MyC21AccountLogout() {
        document.cookie = "talksacct=; expires=Thu, 1 Jan 70 00:00:01 GMT; path=/communities/";
        document.cookie = "myc21=; expires=Thu, 1 Jan 70 00:00:01 GMT; path=/";
        document.cookie = "myc21auth=; expires=Thu, 1 Jan 70 00:00:01 GMT; path=/";
        var A = document.getElementById("beacontext");
        if (A) {
            A.innerHTML = "<a onClick=\"return displayMyC21Login(null);\" href=\"/myc21/standalone/login.jsp\">Sign in</a><br>Not registered? <a href=\"/myc21/standalone/register.jsp\" onClick=\"return DisplayRegisterPopup();\">Sign up</a>";
        }
        SetInnerHtml("openhouseplancount", "");
        var B = location.href;
        if (B.search(/myc21/) > -1) {
            location.href = "/";
        }
        g_lMyC21Account = null;
        g_strMyC21FName = null;
    }


    function processMyC21Account() {
        var A = GetCookie("myc21");
        if (A) {
            A = A.replace("\"", "");
            A = A.replace("\"", "");
            if (A) {
                var B = A.split(":");
                if (B.length > 3) {
                    g_lMyC21Account = B[0];
                    if (g_lMyC21Account > 0) {
                        g_cMyC21AccountType = B[1];
                        if (g_cMyC21AccountType == "G") {
                            g_strMyC21FName = "Guest";
                        } else {
                            if (g_cMyC21AccountType == "R") {
                                g_strMyC21FName = B[2].replace(/\+/g, " ");
                                g_strMyC21FName = unescape(g_strMyC21FName);
                            } else {
                                g_lMyC21Account = null;
                                return false;
                            }
                        }
                        count = B[3];
                        if (count != "") {
                            SetInnerHtml("openhouseplancount", "(" + count + ")");
                        }
                        return true;
                    }
                }
            }
        }
        return false;
    }


    function updateOpenHousePlanCount(A) {
        processMyC21Account();
        document.cookie = "myc21=\"" + g_lMyC21Account + ":" + g_cMyC21AccountType + ":" + escape(g_strMyC21FName) + ":" + A + "\"; path=/";
        SetInnerHtml("openhouseplancount", "(" + A + ")");
    }


    function loginMyC21AccountAndPerformAction(C, B, A) {
        if (g_lMyC21Account == null) {
            if (!processMyC21Account()) {
                HideOpenHouseDateDisplay();
                g_globalAfterLoginCallback = C;
                g_globalAfterLoginCallbackArgs = B;
                displayMyC21Login();
                return false;
            }
        }
        if (g_cMyC21AccountType == "G" && (A == null || !A)) {
            displayGuestRestriction();
            return false;
        }
        C(B);
        return false;
    }


    function setMyC21TabContent(B) {
        var A = document.getElementById("beacontext");
        if (A) {
            A.innerHTML = B;
        }
    }


    function setMyC21TabLoggedIn() {
        setMyC21TabLoggedInWithValue(g_strMyC21FName);
    }


    function setMyC21TabLoggedInWithValue(A) {
        var A = "Welcome " + A + "<br/>";
        A += "<a href=\"#\" onclick=\"return MyC21AccountLogout();\">Logout</a> &nbsp; ";
        A += "<a href=\"/myc21/results/properties.jsp\">Go to My C21 page</a>";
        setMyC21TabContent(A);
    }


    function setMyC21TabGuestLoggedIn() {
        var A = "Welcome Guest<br/>";
        A += "<a href=\"/myc21/standalone/register.jsp\" onClick=\"return DisplayRegisterPopup();\">Register</a>";
        setMyC21TabContent(A);
    }


    function setSavedImage(B) {
        var A = document.getElementById(B);
        if (A) {
            if (B == "option_save_icon") {
                A.src = "/images/search/h_check_icon.gif";
            } else {
                if (B == "save_img") {
                    A.src = "/images/search/topbar_save_on.gif";
                } else {
                    if (B.indexOf("save_img_v2_") >= 0) {
                        A.src = "/images/search/save_check_but_yel.gif";
                    } else {
                        A.src = "/images/myc21/save_but_on.gif";
                    }
                }
            }
        }
    }


    function getInputValue(B) {
        var A = document.getElementById(B);
        if (A) {
            return A.value;
        }
        return "";
    }


    function setFocus(B) {
        var A = document.getElementById(B);
        if (A) {
            A.focus();
        }
    }


    function clearInputValue(B) {
        var A = document.getElementById(B);
        if (A) {
            A.value = "";
        }
    }


    function setInputValue(B, C) {
        var A = document.getElementById(B);
        if (A) {
            A.value = C;
        }
    }


    function getCenterPosition() {
        try {
            if (window.innerWidth) {
                return window.innerWidth / 2 - 120 + "px";
            } else {
                if (document.body && document.body.clientWidth) {
                    return document.body.clientWidth / 2 - 120 + "px";
                } else {
                    return "125px";
                }
            }
        } catch (A) {
        }
        return "125px";
    }


    function positionPopup(D, C) {
        if (D && !(g_pBrowser.bIsMsIe && g_pBrowser.fVersionMajor)) {
            var B = CyberCoreFindPosX(D) - 100;
            if (g_pBrowser.bIsMsIe) {
                if (document.getElementById("page_sidebar")) {
                    B -= CyberCoreFindWidth(document.getElementById("page_sidebar")) + 10;
                }
            }
            var A = CyberCoreFindPosY(D);
            C.style.left = B + "px";
            C.style.top = A + "px";
            if (parseInt(C.style.left) < 0) {
                C.style.left = "125px";
            }
            if (parseInt(C.style.top) < 0) {
                C.style.top = "65px";
            }
        } else {
            if (D) {
                var A = CyberCoreFindPosY(D);
                C.style.top = A + "px";
                C.style.left = getCenterPosition();
            } else {
                C.style.top = "125px";
                C.style.left = getCenterPosition();
            }
        }
    }


    function doMyC21Login() {
        RemoveClass("myc21loginload", "hide");
        AddClass("myc21loginsubmit", "hide");
        setTimeout(window.parent.doCallbackAfterLogin, 100);
        return true;
    }


    function doCallbackAfterLogin() {
        g_globalAfterLoginCallback(g_globalAfterLoginCallbackArgs);
    }


    function doMortgageRecalculation() {
        var C = parseFloat(document.getElementById("mortgageamt").value);
        var B = parseFloat(document.getElementById("mortgagerate").value) / 100;
        var D = parseInt(document.getElementById("mortgageterm").value);
        var A = C * (B / 12 / (1 - Math.pow(1 + B / 12, -12 * D)));
        HidePopup("mortgagepopup");
        var E = document.getElementById("propertyMonthlyPayment");
        if (E) {
            E.innerHTML = "$" + AddCommas(A.toFixed(2));
        }
    }


    function displayMortgageRecalculator(D, C) {
        var A = document.getElementById("mortgagepopup");
        if (A) {
            try {
                positionPopup(D, A);
                A.style.left = parseInt(A.style.left) - 100 + "px";
                setInputValue("mortgageamt", C);
                setInputValue("mortgagerate", "6.25");
                setInputValue("mortgageterm", "30");
            } catch (B) {
            }
            A.style.display = "block";
            A.style.zIndex = 50000;
        }
        return false;
    }


    function displayGuestRestriction() {
        var C = document.getElementById("myc21popup");
        if (C) {
            try {
                positionPopup(pObj, C);
                C.style.left = parseInt(C.style.left) - 250 + "px";
            } catch (D) {
            }
            ShowModal();
            C.style.display = "block";
            C.style.zIndex = 50000;
            var B = (new Date).getTime();
            var A = document.getElementById("myc21frame");
            if (A) {
                A.src = "/myc21/forms/guestrestriction.jsp?rid=" + escape(B);
            }
        }
        return false;
    }


    function displayMyC21Login(E) {
        var C = document.getElementById("myc21popup");
        if (C) {
            try {
                positionPopup(E, C);
                C.style.left = parseInt(C.style.left) - 250 + "px";
            } catch (D) {
            }
            ShowModal();
            C.style.display = "block";
            C.style.zIndex = 50000;
            var B = (new Date).getTime();
            var A = document.getElementById("myc21frame");
            if (A) {
                A.src = "/myc21/forms/login.jsp?rid=" + escape(B);
            }
        }
        return false;
    }


    function hideAndResetAddItemPopup() {
        HidePopup("myc21addpopup");
        clearInputValue("myc21addnickname");
        clearInputValue("myc21addnotes");
        clearInputValue("myc21addparms");
        DisableFormElements("myc21addpopup", false);
        AddClass("myc21addsaved", "hide");
        RemoveClass("myc21addsubmit", "hide");
    }


    function doMyC21AddItem() {
        var C = getInputValue("myc21addnickname");
        var D = getInputValue("myc21addnotes");
        var E = getInputValue("myc21addparms");
        var A = getInputValue("myc21addimgid");
        var B = (new Date).getTime();
        var G = "/ajaxservlet/myc21/saveitem?" + E + "&nickname=" + escape(C) + "&notes=" + escape(D) + "&rid=" + escape(B);
        var F = function (K) {if (K.readyState == 4 && K.status == 200) {var H = GetNodeValue(K.responseXML, "results");if (H && H == "success") {AddClass("myc21addload", "hide");RemoveClass("myc21addsaved", "hide");var J = GetNodeValue(K.responseXML, "type");var L = GetNodeValue(K.responseXML, "key");if (J && J != "" && L && L != "") {c21Reporting(J, "Saved", L);}setSavedImage(A);window.setTimeout(hideAndResetAddItemPopup, 2000);} else {var I = GetNodeValue(K.responseXML, "message");if (!I) {I = "An error occurred while processing your request.  Please try again.";}SetInnerHtml("myc21adderror", I);DisableFormElements("myc21addpopup", false);AddClass("myc21addload", "hide");RemoveClass("myc21addsubmit", "hide");}}};
        DisableFormElements("myc21addpopup", true);
        RemoveClass("myc21addload", "hide");
        AddClass("myc21addsubmit", "hide");
        g_AjaxQueue.schedule("myc21add", G, F);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Add Note");
        return false;
    }


    function displayMyC21SaveItemPopup(E, C, A) {
        var B = document.getElementById("myc21addpopup");
        if (B) {
            try {
                positionPopup(E, B);
                ShowModal();
                setInputValue("myc21addparms", C);
                setInputValue("myc21addimgid", A);
                AddClass("myc21addload", "hide");
                RemoveClass("myc21addsubmit", "hide");
                SetInnerHtml("myc21adderror", "");
                setFocus("myc21addnickname");
            } catch (D) {
            }
            B.style.display = "block";
            B.style.zIndex = 50000;
        }
        return false;
    }


    function saveOfficeToMyC21(B, A) {
        loginMyC21AccountAndPerformAction(this.saveOfficeToMyC21Body, arguments);
    }


    function saveOfficeToMyC21Body(A) {
        var C = A[0];
        var B = A[1];
        displayMyC21SaveItemPopup(C, "type=O&office_key=" + escape(B), "save_img" + B);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Save Office");
        return false;
    }


    function saveAgentToMyC21(B, A) {
        loginMyC21AccountAndPerformAction(this.saveAgentToMyC21Body, arguments);
    }


    function saveAgentToMyC21Body(A) {
        var C = A[0];
        var B = A[1];
        displayMyC21SaveItemPopup(C, "type=A&sa_key=" + escape(B), "save_img" + B);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Save Agent");
        return false;
    }


    function saveOpenHouseToMyC21(D, B, C, A) {
        loginMyC21AccountAndPerformAction(this.saveOpenHouseToMyC21Body, arguments, true);
    }


    function saveOpenHouseToMyC21Body(C) {
        var F = C[0];
        var B = C[1];
        var E = C[2];
        var A = C[3];
        var D = (new Date).getTime();
        var H = "/ajaxservlet/openhouse/saveevent?tr_key=" + escape(F) + "&start=" + escape(B) + "&rid=" + escape(D);
        var G = function (L) {if (L.readyState == 4 && L.status == 200) {var I = GetNodeValue(L.responseXML, "result");if (I && I == "success") {var K = document.getElementById("openhouse_save_" + F + "_" + B);if (K) {K.innerHTML = "<img src=\"/images/myc21/save_but_on.gif\" alt=\"saved\" align=\"top\" />";}var M = GetNodeValue(L.responseXML, "message");HideOpenHouseDateDisplay();displaySavedOpenHousePopup(M, B, E, A);} else {var J = GetNodeValue(L.responseXML, "message");if (!J) {J = "An error occurred while processing your request.  Please try again.";}alert(J);}}};
        g_AjaxQueue.schedule("myc21add", H, G);
        return false;
    }


    function printCommercialListing(A, B) {
        window.print();
    }


    function printListing(A) {
        c21Reporting("listing", "PropPrinted", A);
        window.print();
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Print Listing");
    }


    function printListingUpdated(F) {
        var A = false;
        if (window.location.href.search("directions.jsp") >= 0) {
            var B = document.forms.directionsform.faddress.value;
            var G = document.forms.directionsform.fcity.value;
            var E = document.forms.directionsform.fstate.value;
            var D = document.forms.directionsform.fzip.value;
            var C = getDirectionErrors(B, G, E, D);
            if (C != "") {
                alert(C);
                return true;
            } else {
                button = document.getElementById("print_button");
                button.href = button.href + ("&faddress=" + B + "&fcity=" + G + "&fstate=" + E + "&fzip=" + D);
            }
        } else {
            if (!window.location.href.search("index.jsp") &&
                !window.location.href.search("heighborhoods.jsp")) {
                window.print();
                A = true;
            }
        }
        c21Reporting("listing", "PropPrinted", F);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Print Listing");
        return !A;
    }


    function printAgent(A) {
        window.print();
        c21Reporting("agent", "Printed", A);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Print Agent");
    }


    function printAgentUpdated(D) {
        if (window.location.href.search("directions.jsp") >= 0) {
            var A = document.forms.directionsform.faddress.value;
            var F = document.forms.directionsform.fcity.value;
            var E = document.forms.directionsform.fstate.value;
            var C = document.forms.directionsform.fzip.value;
            var B = getDirectionErrors(A, F, E, C);
            if (B != "") {
                alert(B);
                return true;
            } else {
                button = document.getElementById("print_button");
                button.href = button.href + ("&faddress=" + A + "&fcity=" + F + "&fstate=" + E + "&fzip=" + C);
            }
        } else {
            window.print();
        }
        c21Reporting("agent", "Printed", D);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Print Agent");
        return false;
    }


    function printOffice(A) {
        c21Reporting("office", "Printed", A);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Print Office");
        window.print();
    }


    function printOfficeUpdated(D) {
        if (window.location.href.search("directions.jsp") >= 0) {
            var A = document.forms.directionsform.faddress.value;
            var F = document.forms.directionsform.fcity.value;
            var E = document.forms.directionsform.fstate.value;
            var C = document.forms.directionsform.fzip.value;
            var B = getDirectionErrors(A, F, E, C);
            if (B != "") {
                alert(B);
                return false;
            } else {
                button = document.getElementById("print_button");
                button.href = button.href + ("&faddress=" + A + "&fcity=" + F + "&fstate=" + E + "&fzip=" + C);
            }
        } else {
            window.print();
        }
        c21Reporting("office", "Printed", D);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Print Office");
        return false;
    }


    function printTeam(A) {
        window.print();
    }


    function printTeamUpdated(E) {
        if (window.location.href.search("directions.jsp") >= 0) {
            var A = document.forms.directionsform.faddress.value;
            var F = document.forms.directionsform.fcity.value;
            var D = document.forms.directionsform.fstate.value;
            var C = document.forms.directionsform.fzip.value;
            var B = getDirectionErrors(A, F, D, C);
            if (B != "") {
                alert(B);
                return true;
            } else {
                button = document.getElementById("print_button");
                button.href = button.href + ("&faddress=" + A + "&fcity=" + F + "&fstate=" + D + "&fzip=" + C);
            }
        } else {
            window.print();
        }
        return false;
    }


    function getDirectionErrors(A, F, E, D) {
        var C = "";
        var B = false;
        if (A == "" || F == "" || E == "" || D == "") {
            B = true;
        }
        if (B) {
            C = "Please correct the following problems to go to the print view:\n";
            if (A == "") {
                C += "\nPlease fill in an address.";
            }
            if (F == "") {
                C += "\nPlease fill in a city.";
            }
            if (E == "") {
                C += "\nPlease fill in a state.";
            }
            if (D == "") {
                C += "\nPlease fill in a zip code.";
            }
        }
        return C;
    }


    function savePressReleaseToMyC21(B, A) {
        loginMyC21AccountAndPerformAction(this.savePressReleaseToMyC21Body, arguments);
    }


    function savePressReleaseToMyC21Body(B) {
        var C = B[0];
        var A = B[1];
        displayMyC21SaveItemPopup(C, "type=R&pr_id=" + escape(A), "this_pr_save");
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Save Press Release");
        return false;
    }


    function savePropertyToMyC21(C, B, A) {
        loginMyC21AccountAndPerformAction(this.savePropertyToMyC21Body, arguments);
    }


    function savePropertyToMyC21Body(A) {
        var E = A[0];
        var D = A[1];
        var B = "save_img";
        try {
            B = A[2];
        } catch (C) {
            B = "save_img";
        }
        if (B == null || B == "") {
            B = "save_img";
        }
        displayMyC21SaveItemPopup(E, "type=P&tr_key=" + escape(D), B + D);
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Save Property");
        return false;
    }


    function saveSearchToMyC21(C, B, A) {
        loginMyC21AccountAndPerformAction(this.saveSearchToMyC21Body, arguments);
    }


    function saveSearchToMyC21Body(C) {
        var E = C[0];
        var B = C[1];
        var A = C[2];
        var D = A;
        displayMyC21SaveItemPopup(E, "type=S&search_type=" + escape(B) + "&query=" + escape(D), "option_save_icon");
        dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Save Search");
        return false;
    }


    function saveCalculatorToMyC21(C, A, B) {
        loginMyC21AccountAndPerformAction(this.saveCalculatorToMyC21Body, arguments);
    }


    function saveCalculatorToMyC21Body(A) {
        var D = A[0];
        var B = A[1];
        var C = A[2];
        displayMyC21SaveItemPopup(D, "type=C&calc_type=" + escape(B) + "&url=" + escape(C), "save_img");
        return false;
    }


    function saveDirectionsToMyC21(A) {
        loginMyC21AccountAndPerformAction(this.saveDirectionsToMyC21Body, arguments);
    }


    function saveDirectionsToMyC21Body(d) {
        var a = d[0];
        var V = document.getElementById("endAddress");
        var g = document.getElementById("endCity");
        var X = document.getElementById("endState");
        var J = document.getElementById("endZip");
        var Q = document.getElementById("endLat");
        var A = document.getElementById("endLong");
        var C = document.getElementById("endProvince");
        var M = document.getElementById("endCountry");
        var H = document.getElementById("startAddress");
        var Z = document.getElementById("startCity");
        var e = document.getElementById("startState");
        var h = document.getElementById("startZip");
        var D = document.getElementById("startLat");
        var b = document.getElementById("startLong");
        var F = document.getElementById("startProvince");
        var E = document.getElementById("startCountry");
        var T = document.getElementById("distance");
        if (V &&
            g &&
            X &&
            J &&
            Q && A && C && M && H && Z && e && h && D && b && F && E && T) {
            var B = V.value;
            var I = g.value;
            var O = X.value;
            var f = J.value;
            var U = Q.value;
            var Y = A.value;
            var W = C.value;
            var j = M.value;
            var N = H.value;
            var i = Z.value;
            var P = e.value;
            var c = h.value;
            var S = D.value;
            var L = b.value;
            var R = F.value;
            var K = E.value;
            var G = T.value;
            displayMyC21SaveItemPopup(a, "type=D&endaddress=" + escape(B) + "&endcity=" + escape(I) + "&endstate=" + escape(O) + "&endzip=" + escape(f) + "&endlat=" + escape(U) + "&endlong=" + escape(Y) + "&endprovince=" + escape(W) + "&endcountry=" + escape(j) + "&startaddress=" + escape(N) + "&startcity=" + escape(i) + "&startstate=" + escape(P) + "&startzip=" + escape(c) + "&startlat=" + escape(S) + "&startlong=" + escape(L) + "&startprovince=" + escape(R) + "&startcountry=" + escape(K) + "&distance=" + escape(G) + "", "save_directions_button");
            dcsMultiTrack("WT.cg_n", "Engage", "WT.z_engage_type", "Engage", "WT.z_engage_event", "Save Directions");
        } else {
            alert("We could not save your directions.  Please try again later.");
        }
        return false;
    }


    function updateStateDisplayForCountry() {
        var C = document.getElementById("country");
        if (C) {
            var B = document.getElementById("provincefield");
            var A = document.getElementById("statedropdown");
            if (B && A) {
                if (C.value != "US") {
                    B.style.display = "";
                    A.style.display = "none";
                } else {
                    var D = document.getElementById("province");
                    if (D) {
                        D.value = "";
                    }
                    B.style.display = "none";
                    A.style.display = "";
                }
            }
        }
    }


    function processUserTypeChange() {
        var C = document.getElementById("usertypeselect");
        var A = document.getElementById("emailoptin_section");
        var B = document.getElementById("emailoptin");
        if (C && B) {
            if (C.options[C.selectedIndex].value == "O") {
                B.checked = false;
                A.style.visibility = "hidden";
            } else {
                A.style.visibility = "visible";
            }
        }
    }


    function toggleEmailUsername() {
        var B = document.getElementById("emailusername");
        if (B) {
            if (B.checked) {
                var C = document.getElementById("email");
                var A = document.getElementById("username");
                if (C && A) {
                    A.value = C.value;
                }
            }
        }
    }


    function clearEmailUsernameCb() {
        var A = document.getElementById("emailusername");
        if (A) {
            A.checked = false;
        }
    }


    function DisplayNotes(E, B) {
        var C = document.getElementById("notespopup");
        if (C) {
            try {
                positionPopup(E, C);
                C.style.left = parseInt(C.style.left) - 100 + "px";
                var A = document.getElementById("notescontent");
                if (A) {
                    A.innerHTML = B;
                }
            } catch (D) {
            }
            C.style.display = "block";
            C.style.zIndex = 50000;
        }
        return false;
    }


    function DisplayRegisterPopup() {
        var C = document.getElementById("myc21popup");
        if (C) {
            C.style.top = "60px";
            try {
                if (window.innerWidth) {
                    C.style.left = window.innerWidth / 2 - 321 + "px";
                } else {
                    if (document.body && document.body.clientWidth) {
                        C.style.left = document.body.clientWidth / 2 - 321 + "px";
                    } else {
                        C.style.left = "150px";
                    }
                }
            } catch (D) {
            }
            ShowModal();
            C.style.display = "block";
            C.style.zIndex = 50000;
            var B = (new Date).getTime();
            var A = document.getElementById("myc21frame");
            if (A) {
                A.src = "/myc21/forms/register.jsp?rid=" + escape(B);
            }
        }
        return false;
    }


    function HidePopup(A) {
        if (typeof A == "string") {
            A = document.getElementById(A);
        }
        if (A) {
            A.style.display = "none";
            A.style.zIndex = 0;
        }
        HideModal();
        return false;
    }


    function resizeDialog(C, D, A) {
        var E = document.getElementById(C + "outer");
        if (E) {
            E.style.height = D + 99 + ("px");
            E.style.width = A + 51 + ("px");
        }
        var B = document.getElementById(C + "inner");
        if (B) {
            B.style.height = D + 48 + ("px");
        }
        var B = document.getElementById(C + "frame");
        if (B) {
            B.style.height = "100%";
        }
    }


    function ShowTutorial(A) {
        var B = document.getElementById("PopupWrapper");
        if (B) {
            strHtml = "<div id=\"PopupMask\"></div><div id=\"TutorialFrameContainer\" style=\"background-color:#000000;\">   <iframe id=\"TutorialIframe\" src=\"/flash/tutorials/blank.html\" width=\"730\" height=\"540\" scrolling=\"no\" frameborder=\"0\"></iframe></div>";
            B.innerHTML = strHtml;
            setTimeout(function () {writeTutorial(A);}, 100);
        }
    }


    function writeTutorial(D) {
        var E = document.getElementById("PopupWrapper");
        if (E) {
            var A = document.getElementById("TutorialIframe");
            StopHeroes("homepageheroes");
            if (A) {
                A.src = "/tutorials/maptool/";
            }
            var B = document.getElementById("TutorialFrameContainer");
            if (B) {
                B.style.zIndex = "99999999";
                B.style.background = "#000000";
                B.style.position = "absolute";
                B.style.top = "100px";
                B.style.left = "50%";
                B.style.marginLeft = "-395px";
                setTimeout(function () {TutorialBackgroundFixup(0, "homepageheroes");}, 500);
            }
            var C = document.getElementById("PopupMask");
            if (C) {
                C.style.position = "absolute";
                C.style.top = "0";
                C.style.left = "0";
                C.style.width = "100%";
                C.style.height = "100%";
                C.style.zIndex = "99999999";
                C.style.background = "#000000";
            }
            RemoveClass(E, "hide");
        }
    }


    function TutorialBackgroundFixup(C, B) {
        var A = document.getElementById("TutorialFrameContainer");
        if (A) {
            A.style.zIndex = "99999999";
            A.style.background = "#000000";
            if (B) {
                StopHeroes(B);
            }
            if (C != null && C < 10) {
                setTimeout(function () {TutorialBackgroundFixup(C + 1, "homepageheroes");}, 500);
            }
        }
    }


    function CloseTutorial() {
        var A = document.getElementById("TutorialIframe");
        if (A) {
            A.src = "/flash/tutorials/blank.html";
        }
        var B = document.getElementById("PopupWrapper");
        if (B) {
            B.innerHTML = "";
            AddClass(B, "hide");
        }
    }

    var g_aPOIs = new Array;
    g_aPOIs.coffee = new Array;
    g_aPOIs.school = new Array;
    g_aPOIs.transportation = new Array;
    g_aPOIs.park = new Array;
    g_aPOIs.restaurant = new Array;

    function setOpenHousePopupSrc(A) {
        var B = document.getElementById("ohppopupcontent");
        if (B) {
            B.src = A;
        }
    }


    function displayOpenHousePopup() {
        ShowModal();
        RemoveClass("ohppopup", "hide");
        var A = "/openhouse/popup/listplans.jsp";
        setOpenHousePopupSrc(A);
        return false;
    }


    function displaySavedOpenHousePopup(C, E, D, A) {
        ShowModal();
        RemoveClass("ohppopup", "hide");
        var B = "/openhouse/popup/listplans.jsp?planid=" + escape(C) + "&starttime=" + escape(E) + "&endtime=" + escape(D);
        if (A != null && A != "") {
            B += "&address=" + escape(A);
        }
        setOpenHousePopupSrc(B);
        return false;
    }


    function closeOpenHousePopup() {
        HideModal();
        AddClass("ohppopup", "hide");
        return false;
    }
