﻿if (typeof emlakrex === "undefined" || !emlakrex) {
    var emlakrex = window.emlakrex || {}
}
emlakrex.log = function () {
    var b = arguments;
    if (window.console && console.log) {
        console.log(b[0])
    } else {
        if (YAHOO && YAHOO.log) {
            YAHOO.log(b[0])
        }
    }
    return
};
emlakrex.callbacks = {
    login: [],
    logout: []
};
emlakrex.events = {};
emlakrex.util = {};
emlakrex.namespace = function () {
    var b = arguments,
        g = null,
        e, c, f;
    for (e = 0; e < b.length; e = e + 1) {
        f = b[e].split(".");
        g = emlakrex;
        for (c = (f[0] == "emlakrex") ? 1 : 0; c < f.length; c = c + 1) {
            g[f[c]] = g[f[c]] || {};
            g = g[f[c]]
        }
    }
    return g
};
(function () {
    YUI2 = function (f) {
        var e = this;
        if (!(e instanceof YUI2)) {
            e = new YUI2(f);
            e._init(f)
        }
        return e
    };
    YUI2.prototype = {
        _init: function (e) {
            this.u = YAHOO.util;
            this.w = YAHOO.widget;
            this.lang = YAHOO.lang;
            this.useCallbackStack = new Array()
        },
        get: function (e, f, g) {
            return this.u.Selector.query(e, f, g)
        },
        getId: function (e) {
            return this.u.Dom.get(e)
        },
        iterate: function (e, h, f) {
            f = f || document.body;
            var j = this.get(e, f, false);
            if (j != null) {
                for (var g = 0; g < j.length; g++) {
                    h(j[g])
                }
            }
        },
        use: function () {
            var g = this,
                f = Array.prototype.slice.call(arguments, 0),
                e = f[0],
                h = f[f.length - 1];
            this.ready(function () {
                if (typeof h === "function") {
                    f.pop()
                } else {
                    h = null
                }
                if (f.length == 1 && f[0] == "*") {
                    return h(g)
                }
                if (typeof(g.useCallbackStack[f.join()]) == "undefined") {
                    g.useCallbackStack[f.join()] = new Array()
                }
                var m = g.useCallbackStack[f.join()];
                m.push(h);
                if (m.length > 1) {
                    return
                }
                if (window.location.protocol.indexOf("https") != -1) {
                    var k = "https://ajax.googleapis.com/ajax/libs/yui/2.8.1/build/";
                    var p = false
                } else {
                    var k = null;
                    var p = true
                }
                var l = true;
                for (a = 0; a < f.length; a++) {
                    if (!YAHOO.env.modules[f[a]]) {
                        l = false
                    }
                }
                var n = function () {
                    while (m.length) {
                        m.shift()(g)
                    }
                };
                if (l) {
                    return n()
                }
                var j = new YAHOO.util.YUILoader({
                    require: f,
                    base: k,
                    combine: p,
                    onSuccess: function () {
                        n()
                    },
                    onProgress: function (q) {},
                    onFailure: function (t, r) {
                        var q = "LOAD FAILED: " + t.msg;
                        if (r) {
                            q += ", " + YAHOO.lang.dump(r)
                        }
                        emlakrex.log(q)
                    }
                });
                j.insert()
            })
        },
        ready: function (e) {
            this.u.Event.onDOMReady(e)
        }
    };
    var c = YUI2,
        b = c.prototype,
        a;
    for (a in b) {
        c[a] = b[a]
    }
})();
if (typeof YUI === "undefined" || !YUI) {
    var YUI = YUI2()
}
emlakrex.ui = emlakrex.ui || {};
emlakrex.ui.initHooks = [];
emlakrex.ui.init = function (c) {
    for (var b = 0, a = emlakrex.ui.initHooks.length; b < a; b++) {
        emlakrex.ui.initHooks[b].call(window)
    }
};
emlakrex.ui.buttonDropdown = function (g) {
    if (g.getAttribute("buttonwithdropdown") !== null) {
        return
    }
    this.closeTimer = null;
    var f = this;
    g.setAttribute("buttonwithdropdown", true);
    var e = YUI.get("ul", g, true);
    var b = YUI.get("a", g, true);
    var h = YUI.u.Dom.getRegion(b);
    var c = (h.right - h.left) - 9;
    YUI.u.Event.on(g, "mouseover", function () {
        f.open();
        clearTimeout(f.closeTimer)
    });
    YUI.u.Event.on(g, "mouseout", function () {
        f.closeTimer = setTimeout(function () {
            f.close()
        }, 750)
    });
    this.open = function () {
        if (e.style.display == "block") {
            return
        }
        e.style.display = "block";
        var a = YUI.u.Dom.getRegion(e);
        var j = (a.right - a.left);
        if (j < c) {
            e.style.width = c + "px"
        }
        b.className = b.className.replace(/\b(gray|orange)\b/, "$1_dropdown_open")
    };
    this.close = function () {
        e.style.display = "none";
        b.className = b.className.replace(/\b(orange|gray)_dropdown_open\b/, "$1")
    }
};
emlakrex.ui.initHooks.push(function () {
    var b = YUI.get(".button_with_dropdown");
    for (var a = 0; a < b.length; a++) {
        new emlakrex.ui.buttonDropdown(b[a])
    }
});
YUI.ready(function () {
    emlakrex.ui.init()
});
if (typeof(_emlakrex_logged_in) == undefined) {
    var _emlakrex_logged_in = 0
}
var _w = null;
var _nw;
var chghrid = "";
var _num_friend_emails = 1;
var _max_num_friend_emails = 6;
var VIEW_EV_KONUT = "konut_ev";
var VIEW_ISYERI = "isyeri";
var VIEW_ARSA = "arsa";
var VIEW_FOR_RENT = "for_rent";
var VIEW_ASSESSOR = "assessor";
var VIEW_CLASSIFIED = "classified";
var NO_SAVED_PROPERTIES = "You have no saved properties.";
var NO_RECENT_PROPERTIES = "You have no recently viewed properties.";
var NO_SAVED_SEARCHES = "You have no saved searches.";
var NO_RECENT_SEARCHES = "You have no recent searches.";
var SEARCH_SAVED = "Search saved.";
var SEARCH_DELETED = "Search deleted.";
var PROPERTY_SAVED = "Property saved.";
var PROPERTY_DELETED = "Property deleted.";
var ALERT_UPDATED = "Email alert updated.";
var SETTING_UPDATED = "Setting updated.";
var SETTINGS_UPDATED = "Settings updated.";
var SETTING_ERROR = "An error occurred. No change was made.";
var SETTING_NO_CHANGE = "No change was made.";
var SETTING_EMAIL_UNAVAILABLE = "This email is not available. No change was made.";
var SETTING_BAD_EMAIL = "Lütfen E-Posta adresinizi giriniz, such as name@domain.com.";
var SETTING_BAD_PASSWORD = "Your password should be between 5 and 15 characters long.";
var SETTING_EASY_PASSWORD = "Your password is too easy to guess.";
var VOICES_SAVED_QUESTION_DELETED = qpn_NAMES.voices + " question deleted.";
var VOICES_ALERT_DELETED = qpn_NAMES.voices + " alert deleted.";
var VOICES_ALERTS_DELETED = qpn_NAMES.voices + " alerts deleted.";
var VOICES_ALERT_SAVED = qpn_NAMES.voices + " alert saved.";
var VOICES_ALERT_UPDATED = qpn_NAMES.voices + " alert updated.";
var PROPERTY_ALERT_DELETED = "Property alert deleted.";
var PROPERTY_ALERT_UPDATED = "Property alert updated.";
var CLOSE_FEEDBACK = '&nbsp;&nbsp;&nbsp;&nbsp;<span class="pseudolink f10" onclick="kill_feedback(true)">[x]&nbsp;close</span>';
var _QA_ERROR_LABELS = {
    question: "Please enter a question.",
    profanity: "No profanity - please!",
    question_too_short: "Sorry, your question is too short. A minimum of 5 characters is needed.",
    question_too_long: "Sorry, your question is too long. Questions cannot be longer than 150 characters.",
    body_too_short: "Sorry, your question is too short. A minimum of 5 characters is needed.",
    body_too_long: "Sorry, your question is too long. Questions cannot be longer than 1000 characters.",
    location: "No location match found for İlçe veya Şehir Giriniz.",
    no_location: "Please Tercih bölgenizi giriniz.",
    category: "Birini Seçin a category.",
    captcha: "Please enter the correct text in the input box.",
    no_captcha: "Please enter the correct text in the input box.",
    default_error: "Sorry--an error occurred.",
    not_allowed: "Sorry--you are not allowed to perform this operation.",
    bad_friend_email: "Lütfen geçerli bir e-posta adresi giriniz",
    error_summary: '<span class="error_title"><strong>Üzgünüz!</strong> Bazı problemler bulduk.Kırmızı uyarılara dikkat edin..</span>',
    must_have_account: "Click OK to log in or sign up for a " + qpn_NAMES.myemlakrex + " account--it only takes a minute!"
};
var _ANSWER_ERROR_LABELS = {
    answer: "Please enter an answer.",
    answer_too_short: "Sorry, your answer is too short. A minimum of 25 characters is needed.",
    answer_too_long: "Sorry, your answer is too long. Answers cannot be longer than 5000 characters.",
    captcha: "Please enter the correct text in the input box.",
    no_captcha: "Please enter the correct text in the input box."
};
var _qpn_MESSAGES = {
    saved_property: "Property saved to " + qpn_NAMES.myemlakrex
};
var znczdef = "İlçe adını giriniz";
var znczdef2 = "İlçe adını giriniz";
var zsbdef = "İlçe";
var zsbdef2 = "Adres,Sokak,İlçe veya Şehir";
var zsbdef3 = "İlçe veya İli giriniz";
var zsbdef4 = "Anahtar kelime veya adı giriniz";
var znfdef = "City & State, Neighborhood, or ZIP";
var zhmsbdef = "City, County or State";
var zaldef = "your email address";
var zefdef = "Your friend's email address";
var _STATES = {
Id1: "Adana",
 Id2: "Adıyaman", 
 Id3: "Afyonkarahisar",
  Id4: "Ağrı", 
  Id68: "Aksaray",
   Id5: "Amasya",
    Id6: "Ankara",
     Id7: "Antalya",
      Id75: "Ardahan",
       Id8: "Artvin",
        Id9: "Aydın",
         Id10: "Balıkesir", 
         Id74: "Bartın", 
         Id72: "Batman", 
         Id69: "Bayburt", 
         Id11: "Bilecik", 
         Id12: "Bingöl", 
         Id13: "Bitlis", 
         Id14: "Bolu", 
         Id15: "Burdur",
          Id16: "Bursa", 
          Id17: "Çanakkale", 
          Id18: "Çankırı", 
          Id19: "Çorum", 
          Id20: "Denizli", 
          Id21: "Diyarbakır", 
          Id81: "Düzce", 
          Id22: "Edirne", 
          Id23: "Elazığ", 
          Id24: "Erzincan", 
          Id25: "Erzurum",
           Id26: "Eskişehir", 
          Id27: "Gaziantep", 
          Id28: "Giresun", 
          Id29: "Gümüşhane", 
          Id30: "Hakkari", 
          Id31: "Hatay", 
          Id76: "Iğdır", 
          Id32: "Isparta",
           Id34: "İstanbul", 
          Id35: "İzmir", 
          Id46: "Kahramanmaraş", 
          Id78: "Karabük", 
          Id70: "Karaman", 
          Id36: "Kars", 
          Id37: "Kastamonu", 
          Id38: "Kayseri", 
          Id79: "Kilis", 
          Id71: "Kırıkkale", 
          Id39: "Kırklareli", 
          Id40: "Kırşehir", 
          Id41: "Kocaeli", 
          Id42: "Konya", 
          Id43: "Kütahya", 
          Id44: "Malatya", 
          Id45: "Manisa", 
          Id47: "Mardin",
           Id33: "Mersin(İçel)", 
          Id48: "Muğla",
           Id49: "Muş", 
          Id50: "Nevşehir", 
          Id51: "Niğde", 
          Id52: "Ordu",
           Id80: "Osmaniye", 
          Id53: "Rize", 
          Id54: "Sakarya", 
          Id55: "Samsun", 
          Id63: "Şanlıurfa", 
          Id56: "Siirt",
           Id57: "Sinop", 
          Id73: "Şırnak",
           Id58: "Sivas", 
          Id59: "Tekirdağ", 
          Id60: "Tokat", 
          Id61: "Trabzon", 
          Id62: "Tunceli", 
          Id64: "Uşak", 
          Id65: "Van",
           Id77: "Yalova", 
          Id66: "Yozgat", 
          Id67: "Zonguldak"
};
var NOT_EXIST_MSG = "Unknown user.";
var EXIST_MSG = "User already exists.";
var zevt = null;
var zlishow = getCookie("show_li_box") != "0" && (getCookie("lgi") == null);
var mutexes = new Array();
var _MENU_MUTEX = 1;
var _SAVE_MUTEX = 2;
var _EDITOR_MUTEX = 3;
var _editor;
var z_link_labels = {
    saved: "[+]&nbsp;Saved&nbsp;",
    save: "[+]&nbsp;Save&nbsp;",
    saved_graphic: '<img src="/Content/images/prop_saved.gif" border="0" />',
    save_graphic: '<img src="/Content/images/prop_save_off.gif" border="0" onmouseover="highlight_save_icon(this,true)" onmouseout="highlight_save_icon(this,false)" />',
    save_this_search: "Bu aramayı kaydet"
};
var prompt_login = false;
var _last_register_form_source = "other";
var prompt_login = false;

function build_cookie_exp_date(b) {
    if (typeof(b) === "undefined" || !b) {
        b = 30
    }
    var a = new Date();
    a.setTime(a.getTime() + (b * 24 * 60 * 60 * 1000));
    return a.toGMTString()
}
function is_tpp() {
    return (qpn_NAMES.account_source != "emlakrex")
}
function map_iw_set_index() {
    var a = YUI.getId("iw_address_url");
    if (!a) {
        return
    }
    var b = a.getAttribute("rel");
    if (!b) {
        return
    }
    set_index(b)
}
emlakrex.util.normalizePropertyType = function (a) {
    switch (a.toLowerCase().replace(/[_ ]/, "")) {
    case "forsale":
        return "Satılık";
    case "unknown":
        return "Unknown";
    case "forrent":
        return "Kiralık";
    case "assessor":
        return "Assessor";
    case "isyeri":
        return "İşyeri";
        case "arsa":
        return "Arsa";
    default:
        return "Classified"
    }
};

function set_index(h, l, e) {
    if (h == "") {
        return false
    }
    var b = build_cookie_exp_date(1);
    var k = getCookie("last_search");
    var a = getCookie("l_carousel");
    var g = getCookie("mini_pagination");
    if (typeof l !== "undefined" && l != null) {
        var f = build_cookie_exp_date(30);
        setCookie("last_search", l, f);
        k = l
    }
    if (typeof e === "undefined" && typeof k !== "undefined" && k != null) {
        var c = ";;" + h + "&s=" + k;
        if (typeof(a) != "undefined" && a != null) {
            c = c + a
        }
        var j = c.split(";;");
        if (j.length > 1) {
            j = j.slice(0, 2);
            c = j.join(";;")
        }
        setCookie("l_carousel", c, b)
    }
    if (typeof(k) != "undefined" && k != null) {
        var c = ";;" + h + "&s=" + k;
        if (typeof g !== "undefined" && g != null && typeof e !== "undefined") {
            c = c + g
        }
        setCookie("mini_pagination", c, b)
    }
    return false
}
emlakrex.callbacks.login.push(function () {
    if (YUI.getId("load_my_searches_link")) {
        remove_class(YUI.getId("load_my_searches_link"), "hidden")
    }
});
emlakrex.callbacks.logout.push(function () {
    if (YUI.getId("load_my_searches_link")) {
        add_class(YUI.getId("load_my_searches_link"), "hidden")
    }
});

function xb_get_element(a) {
    return YUI.getId(a)
}
function addLoadEvent(a) {
    YUI.u.Event.on(window, "load", a)
}
function mkEl(b, c, f, e) {
    var a = document.createElement(b);
    if (typeof(c) != "undefined" && c != null) {
        a.innerHTML = c
    }
    if (typeof(f) != "undefined" && f != null) {
        a.id = f
    }
    if (typeof(e) != "undefined" && e != null) {
        a.className = e
    }
    return a
}
function $$(a, b, e, c) {
    return mkEl(a, b, e, c)
}
emlakrex.get_app = function (a) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[a]
    } else {
        return document[a]
    }
};
OOP = {};
OOP.extend = function (c, a) {
    function b() {}
    b.prototype = a.prototype;
    c.prototype = new b();
    c.prototype.constructor = c;
    c.baseConstructor = a;
    c.superClass = a.prototype
};

function handle_edit_box(f, a, g, c) {
    var f = YUI.getId(f);
    var e = typeof c != "undefined" && c == true ? "disabled_txt_vivid" : "disabled_txt";
    if (!f) {
        return
    }
    var h = trim(f.value).toLowerCase();
    if (h == zsbdef.toLowerCase()) {
        a = zsbdef
    } else {
        if (h == zsbdef2.toLowerCase()) {
            a = zsbdef2
        } else {
            if (h == zhmsbdef.toLowerCase()) {
                a = zhmsbdef
            }
        }
    }
    var b = a.toLowerCase();
    if (h !== b && h !== "") {
        if (f.style.color) {
            f.style.color = "#000"
        }
        YUI.u.Dom.removeClass(f, e);
        return
    }
    if (g && (h === b || h === "")) {
        if (f.style.color) {
            f.style.color = "#000"
        }
        YUI.u.Dom.removeClass(f, e);
        f.value = "";
        return
    }
    if (!g) {
        if (h === b || h === "") {
            if (f.style.color) {
                f.style.color = "#999"
            }
            YUI.u.Dom.addClass(f, e);
            f.value = a
        } else {
            if (f.style.color) {
                f.style.color = "#000"
            }
            YUI.u.Dom.removeClass(f, e)
        }
        return
    }
}
function highlight_tab(a, c, b, e) {
    var f = YUI.getId(c + "search_type").value;
    if (f == b) {
        return
    }
    if (e) {
        a.className = "hilite"
    } else {
        a.className = ""
    }
}
function submit_topnav_search_box(e, a) {
    if (!validate_sb(e)) {
        return false
    }
    if (typeof(a) != "undefined" && a == "srp") {
        var b = YUI.getId("topnav_extra" + e);
        if (b && typeof(RFilters) != "undefined") {
            b.value = RFilters.getFilterUrl()
        }
        if (typeof show_results_interstitial_promo_once_cookied == "function") {
            show_results_interstitial_promo_once_cookied(false)
        }
    }
    var c = YUI.getId("navform" + e);
    if (c) {
        c.submit()
    }
}
function validate_sb(f) {
    var h = "";
    var j = "";
    var c = YUI.getId("t_search_type" + f);
    if (c) {
        j = c.value
    }
    if (typeof(f) == "undefined" || !f) {
        var e = "t_navsearch"
    } else {
        var e = "t_navsearch" + f
    }
    var g = YUI.getId(e);
    if (!g) {
       /* if (typeof(_pageTracker() != "undefined") {
            _pageTracker(j, h, null, f)
        }*/
        return false
    }
    var b = trim(g.value);
    h = g.value;
    if (j != "v" && j != "f") {
        if (b == "" || b == zsbdef || b == zsbdef2) {
            if (b == zsbdef2) {
                alert("Please enter " + zsbdef2 + ".")
            } else {
                alert("Please enter " + zsbdef + ".")
            }
            YUI.u.Dom.addClass(g, "disabled_txt");
            g.focus();
            return false
        }
    }
   /* if (typeof(_pageTracker() != "undefined") {
        var a = YUI.getId("t_navsearch_keyword" + f);
        if (a && a.value && a.value != zsbdef4) {
            _pageTracker(j, h, a.value, f)
        } else {
            _pageTracker(j, h, null, f)
        }
    }*/
    return true
}
function toggle_element(j, e, h, a) {
    var f = YUI.getId(j);
    var b = YUI.getId(j + "_less");
    var c = YUI.getId(j + "_more");
    var g = YUI.getId(e);
    if (b && c) {
        if (c.style.display == "none" || YUI.u.Dom.hasClass(c, "hidden") || YUI.u.Dom.hasClass(c, "gone")) {
            hide(b);
            unhide(c, "");
            if (g) {
                g.innerHTML = a
            }
        } else {
            hide(c);
            unhide(b, "");
            if (g) {
                g.innerHTML = h
            }
        }
    } else {
        if (f) {
            if (f.style.display == "none" || YUI.u.Dom.hasClass(f, "hidden") || YUI.u.Dom.hasClass(f, "gone")) {
                unhide(f, "");
                if (g) {
                    g.innerHTML = a
                }
            } else {
                hide(f);
                if (g) {
                    g.innerHTML = h
                }
            }
        } else {
            return false
        }
    }
}
function toggle_elements(b, k, h, a) {
    var l = false;
    for (var g = 0, j = b.length; g < j; ++g) {
        var f = b[g];
        var c = YUI.getId(f);
        if (c) {
            var e = YUI.getId(k);
            if (c.style.display == "none" || YUI.u.Dom.hasClass(c, "hidden")) {
                l = true;
                unhide(c, "")
            } else {
                hide(c)
            }
        }
    }
    if (l !== true && e && h) {
        e.innerHTML = h
    } else {
        if (e && a) {
            e.innerHTML = a
        }
    }
}
function toggle_elments_by_class_name(g, b, a, f, h, e) {
    var c = YUI.u.Dom.getElementsByClassName(g, a, b);
    if (c && c.length) {
        toggle_elements(c, f, h, e)
    }
}
function toggle_element_triangle(c, a) {
    var b = YUI.getId(c);
    if (!b) {
        return
    }
    if (b.style.display == "none") {
        unhide(c);
        toggle_class(a, "srp_filter_open", "srp_filter_closed")
    } else {
        hide(c);
        toggle_class(a, "srp_filter_closed", "srp_filter_open")
    }
}
function generic_rounded_corners_box_toggle(c) {
    var b = "inner_" + c;
    var a = xb_get_element(b);
    if (!a) {
        return
    }
    if (a.className.match(/hidden/)) {
        remove_class(a, "hidden");
        unhide(c + "_minimize");
        hide(c + "_maximize")
    } else {
        add_class(a, "hidden");
        unhide(c + "_maximize");
        hide(c + "_minimize")
    }
}
function clear(b) {
    var a = YUI.getId(b);
    if (a) {
        a.value = ""
    }
}
function unhide(c, e) {
    var b = YUI.getId(c);
    if (b) {
        var a = YUI.u.Dom.getStyle(b, "display");
        if (typeof(e) == "undefined" || (!e && !(e === "")) || e == "none") {
            if (a == "none") {
                e = "inline"
            } else {
                e = ""
            }
        }
        if (a) {
            YUI.u.Dom.setStyle(b, "display", e)
        }
        YUI.u.Dom.removeClass(b, "hidden");
        YUI.u.Dom.removeClass(b, "gone")
    }
}
emlakrex.unhide = unhide;

function hide(c) {
    var b = YUI.getId(c);
    if (b) {
        var a = YUI.u.Dom.getStyle(b, "display");
        if (!a) {
            YUI.u.Dom.setStyle(b, "display", "")
        }
        YUI.u.Dom.addClass(b, "hidden")
    }
}
emlakrex.hide = hide;

function setCookie(f, e, a, c) {
    if (typeof(a) == "undefined") {
        var a = ""
    }
    if (typeof(c) == "undefined") {
        var c = "/"
    }
    var b = f + "=" + escape(e);
    if (a !== "") {
        b += ";expires=" + a
    }
    b += ";path=" + c + ";";
    document.cookie = b
}
function getCookie(c) {
    var e = document.cookie.indexOf(c + "=");
    var a = e + c.length + 1;
    if ((!e) && (c != document.cookie.substring(0, c.length))) {
        return null
    }
    if (e == -1) {
        return null
    }
    var b = document.cookie.indexOf(";", a);
    if (b == -1) {
        b = document.cookie.length
    }
    return unescape(document.cookie.substring(a, b))
}
function clear_element(a) {
    if (a = YUI.getId(a)) {
        a.innerHTML = "";
        if (a.id == "email_message") {
            YUI.u.Dom.addClass("login_prompt", "hidden")
        } else {
            if (a.id == "login_email_message") {
                YUI.u.Dom.addClass("register_prompt", "hidden")
            }
        }
    }
}
emlakrex.effects = emlakrex.effects || {};
emlakrex.effects.hilite = function (c, e, b, f, a) {
    e = e || "#ffffe0";
    b = b || "#ffffe0";
    f = f || 1;
    a = a || 1;
    YUI.use("animation", function () {
        var g = new YAHOO.util.ColorAnim(c, {
            backgroundColor: {
                to: e
            }
        }, f, YAHOO.util.Easing.easeOut);
        var h = new YAHOO.util.ColorAnim(c, {
            backgroundColor: {
                to: b
            }
        }, a, YAHOO.util.Easing.easeOut);
        g.onComplete.subscribe(function () {
            h.animate()
        });
        g.animate()
    })
};

function getHTTPObject() {
    var xmlhttp;
/*@cc_on
  @if (@_jscript_version >= 5)
    try
    {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e)
    {
      try
      {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (E)
      {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != "undefined") {
        try {
            xmlhttp = new XMLHttpRequest()
        } catch (e) {
            xmlhttp = false
        }
    }
    return xmlhttp
}
function doNothing(a) {
    if (typeof(a) == "undefined" || !a) {
        var a = window.event
    }
    if (a && typeof(a) != "undefined") {
        a.cancelBubble = true;
        if (a.stopPropagation) {
            a.stopPropagation()
        }
    }
    return false
}
function trim(a) {
    if (!a) {
        return ""
    }
    return a.replace(/^\s*|\s*$/g, "")
}
function is_valid_email(a) {
    a = trim(a).toLowerCase();
    if (a == "") {
        return false
    }
    regex = /^([a-z0-9])+([a-z0-9\._+-])*@([a-z0-9_-]+\.)+([a-z]{2,4})$/i;
    if (!regex.test(a)) {
        return false
    }
    return true
}
function is_valid_phone(a) {
    var b = a.replace(/[\(\)\.\-\A-Z\a-z\ ]/g, "");
    if (isNaN(parseInt(b))) {
        return false
    }
    if (!(b.length == 10)) {
        return false
    }
    return true
}
function pull_address(a) {
    if (a.indexOf("@") == 0) {
        return a
    } else {
        return a.substring(0, a.indexOf("@"))
    }
}
function mel(a, c, g) {
    var b = a + "@" + qpn_NAMES.email_domain;
    var e = (typeof(g) == "undefined") ? b : g;
    document.write('<a href="mailto:' + b + (c ? "?subject=" + c : "") + '">' + e + "</a>")
}
function bad_email_alert() {
    alert("Lütfen E-Posta adresinizi giriniz, such as name@domain.com.")
}
var user_email = "";
var field_to_focus = "";

function do_login(c, f, e) {
    if (typeof(f) == "undefined" || !f) {
        f = ""
    }
    if (validate_login(c, f, e)) {
        var g = (typeof(c) != "undefined" ? "login_email_field" + f : "login_email" + f);
        var a = (typeof(c) != "undefined" ? "login_password_field" + f : "login_pass" + f);
        lf_em = trim(YUI.getId(g).value);
        lf_ps = trim(YUI.getId(a).value);
        var b = new QAjax();
        b.set_script_info({
            script: "Sorgu/q_validate_login/",
            method: "POST",
            output: "xml"
        });
        d = new Date();
        b.set_value("ts", d.valueOf());
        b.set_value("e", lf_em);
        b.set_value("p", lf_ps);
        b.set_value("sc", 1);
        b.set_callback(function (k) {
            p = 0;
            var l = YUI.getId("login_box_msg_txt" + f);
            var h = k.documentElement.getElementsByTagName("v")[0];
            var p = h.getAttribute("u");
            var n = h.getAttribute("s");
            var j = h.getAttribute("n");
            var m = k.documentElement.getElementsByTagName("sp")[0].childNodes[0].nodeValue;
            if (n == "1") {
                user_email = lf_em;
                do_post_login(lf_em, m, f, j, "login")
            } else {
                YUI.getId(a).value = "";
                YUI.getId("login_box_msg_txt" + f).className = "ErrorMessage";
                if (n == "-1") {
                    YUI.getId(g).focus();
                    YUI.getId("login_box_msg_txt" + f).innerHTML = "Bilinmeyen kullanıcı."
                } else {
                    if (n == "0") {
                        YUI.getId(a).focus();
                        YUI.getId("login_box_msg_txt" + f).innerHTML = "Şifreniz yanlış."
                    }
                }
                unhide("login_box_msg_txt" + f)
            }
        });
        b.go()
    }
    return false
}
function do_post_logout() {
    if (typeof(_emlakrex_logged_in) != "undefined") {
        _emlakrex_logged_in = 0
    }
    for (var a = 0; a < emlakrex.callbacks.logout.length; a++) {
        emlakrex.callbacks.logout[a]()
    }
    clear_form_by_id("register_form");
    clear_form_by_id("login_form");
    clear_form_by_id("password_form");
    var e = ["details", "property_photos", "sls_signup", "blog", "blog_post", "guide_post", "question_answer", "tools_generic_index"];
    var c = YUI.getId("lpg");
    var b;
    if (typeof c == "undefined" || !c) {
        if (emlakrex.page_name) {
            b = emlakrex.page_name
        } else {
            b = ""
        }
    } else {
        b = c.value
    }
    if (b == "account/details/" || b == "Hesabim/profilim_ayarlar/") {
        go_to_page("logout/")
    } else {
        if (b == "account" || b == "myprofile/" || b.indexOf("account/") >= 0 || b.indexOf("agents/feature") >= 0 || b.indexOf("register") >= 0 || b.indexOf("tools/buttons/profile") >= 0 || b.indexOf("emlakrexpro") >= 0 || b.indexOf("submit_listings/") >= 0 || b.indexOf("wizard/Tavsiye/") >= 0 || (b.indexOf("results/") >= 0 && b != "results/")) {
            go_to_page(b)
        } else {
            if (b == "home") {
                location.replace(site_root)
            } else {
                if (b.indexOf("emlakrexmap") >= 0) {
                    go_to_page("emlakrexmap")
                } else {
                    if (b.indexOf("myemlakrex") >= 0) {
                        go_to_page("myemlakrex/")
                    } else {
                        if (e.contains(b)) {
                            window.location.reload()
                        } else {
                            if (YUI.getId("hlgin")) {
                                YUI.getId("hlgin").value = 0
                            }
                            set_email_alert_forms(true);
                            set_save_property_links("");
                            reset_save_search();
                            clear_login_forms();
                            zlishow = getCookie("show_li_box") != "0";
                            if (YUI.getId("nav_profile_link_id")) {
                                YUI.getId("nav_profile_link_id").innerHTML = "Create a Profile"
                            }
                        }
                    }
                }
            }
        }
    }
    if (b.indexOf("newsletter/") >= 0) {
        populate_archive_header()
    }
    if (typeof(s) != "undefined") {
        s.eVar10 = "not logged in";
        s.prop9 = "not logged in"
    }
    unhide_selects();
    login_reset()
}
function do_post_login(lf_em, saved, suffix, name, from) {
    if (typeof(_emlakrex_logged_in) != "undefined") {
        _emlakrex_logged_in = 1
    }
    unhide_selects();
    if (typeof(suffix) == "undefined" || !suffix) {
        suffix = ""
    }
    for (var i = 0; i < emlakrex.callbacks.login.length; i++) {
        emlakrex.callbacks.login[i]()
    }
    user_email = lf_em;
    var fpwe = YUI.getId("forgot_password_email_field" + suffix);
    var flag_email = YUI.getId("flag_email");
    var sp_s_email = YUI.getId("sp_s_email");
    var nav_profile_link_id = YUI.getId("nav_profile_link_id");
    if (fpwe) {
        fpwe.value = user_email
    }
    if (flag_email) {
        flag_email.value = user_email
    }
    if (sp_s_email) {
        sp_s_email.value = user_email
    }
    if (nav_profile_link_id) {
        nav_profile_link_id.innerHTML = "My Profile"
    }
    hide("qa_answer_registration");
    hide("qa_answer_login");
    show_logout_link();
    process_save_queue();
    process_subscribe_queue(from);
    process_alert_queue(from);
    process_price_queue(from);
    var element = get_login_form_config();
    if (element && typeof element.post_login_callback != "undefined") {
        eval(element.post_login_callback + "('" + from + "')")
    }
    clear_form_by_id("register_form" + suffix);
    clear_form_by_id("login_form" + suffix);
    clear_form_by_id("password_form" + suffix);
    if (typeof(login_next_step_global) != "undefined" && login_next_step_global == "claiming") {
        login_next_step_global = ""
    }
    var refresh_pages = ["sls_signup", "blog_view", "find_a_pro", "blog", "blog_post", "guide_post", "question_answer", "tools_generic_index"];
    var lpgv_el = YUI.getId("lpg" + suffix);
    var lpgv;
    if (typeof lpgv_el == "undefined" || !lpgv_el) {
        lpgv = ""
    } else {
        lpgv = lpgv_el.value
    }
    if (lpgv == "account" || lpgv.indexOf("register") >= 0 || lpgv == "agents/feature/profil/" || lpgv.indexOf("account/") >= 0 || lpgv.indexOf("tools/ambassador/") >= 0 || lpgv.indexOf("wizard/Tavsiye/") >= 0 || lpgv.indexOf("feature/") >= 0) {
        go_to_page(lpgv)
    } else {
        if (lpgv == "emlakrexmap") {
            hide("step3_login");
            unhide("step3_tos")
        } else {
            if (lpgv == "home") {
                go_to_page("")
            } else {
                if (lpgv.indexOf("newsletter/") >= 0) {
                    populate_archive_header()
                } else {
                    if (lpgv == "emlakrexpro_signup" || typeof _TP_redirect_url !== "undefined") {
                        var redir = "user_credit_card_profile.php?p=1";
                        if (typeof _TP_redirect_url !== "undefined") {
                            redir += _TP_redirect_url
                        }
                        go_to_page(redir)
                    } else {
                        if (refresh_pages.contains(lpgv)) {
                            destroy_popup("login_box");
                            window.location.reload()
                        } else {
                            if (typeof(RFilters) != "undefined" && RFilters) {
                                clear_mysearches_popup()
                            } else {
                                set_email_alert_forms(false, lf_em)
                            }
                        }
                    }
                }
            }
        }
    }
    destroy_popup("login_box");
    login_reset()
}
function position_at_event(a, b, g, c, f) {
    if (typeof(f) == "undefined") {
        f = -10
    }
    pos_menuyu_goster(c, a, 50, f)
}
function show_login(g, h, a, j, f) {
    close_all_menus();
    var c = "login_box_c";
    var b = YUI.getId(c);
    if (b == null) {
        toggle_login_form(h, f)
    }
    return
}
function login_reset() {
    sub_queue.clear();
    sub_recent_queue.clear();
    alert_queue.clear();
    price_queue.clear();
    _emlakrex_lf_custom_element = "";
    return
}
function show_login_link() {
    YUI.u.Dom.addClass("logout_toggle_link", "hidden");
    YUI.u.Dom.addClass("top_nav_my_emlakrex", "short");
    YUI.u.Dom.addClass("top_nav_my_emlakrex_links", "hidden");
    YUI.u.Dom.addClass("top_nav_my_emlakrex_name", "hidden");
    YUI.u.Dom.addClass("nav_my_homes_srp_link", "hidden");
    YUI.u.Dom.addClass("nav_my_email_alerts", "hidden");
    YUI.u.Dom.addClass("nav_my_searches_srp_link", "hidden");
    YUI.u.Dom.addClass("nav_view_profile_link", "hidden");
    YUI.u.Dom.addClass("nav_view_QnA_link", "hidden");
    YUI.u.Dom.removeClass("login_toggle_link", "hidden");
    YUI.u.Dom.removeClass("register_link", "hidden");
    var a = null;
    if (a = YUI.getId("my_emlakrex_header_link")) {
        a.href = site_root + "login"
    }
}
function show_logout() {
    destroy_popup("login_box")
}
function show_logout_link() {
    new_populate_my_emlakrex();
    YUI.u.Dom.removeClass("logout_toggle_link", "hidden");
    YUI.u.Dom.removeClass("top_nav_my_emlakrex", "short");
    YUI.u.Dom.removeClass("top_nav_my_emlakrex_links", "hidden");
    YUI.u.Dom.removeClass("top_nav_my_emlakrex_name", "hidden");
    var b = null;
    if (b = YUI.getId("my_emlakrex_header_link")) {
        b.href = site_root + "Hesabim/profilim_ayarlar/"
    }
    var e = YUI.getId("nav_my_homes_srp_link");
    if (e) {
        var c = e.parentNode;
        YUI.u.Dom.removeClass(c, "hidden");
        YUI.u.Dom.removeClass(e, "hidden")
    }
    YUI.u.Dom.removeClass("nav_my_email_alerts", "hidden");
    YUI.u.Dom.removeClass("nav_my_searches_srp_link", "hidden");
    var a = YUI.getId("nav_view_profile_link");
    if (a) {
        var f = a.parentNode;
        YUI.u.Dom.removeClass(f, "hidden");
        YUI.u.Dom.removeClass(a, "hidden")
    }
    YUI.u.Dom.removeClass("nav_view_QnA_link", "hidden");
    YUI.u.Dom.addClass("login_toggle_link", "hidden");
    YUI.u.Dom.addClass("register_link", "hidden")
}
function new_populate_my_emlakrex() {
    var my_emlakrex = YUI.getId("top_nav_my_emlakrex_links");
    if (!my_emlakrex) {
        return false
    }
    var name = YUI.getId("navtab_my_emlakrex_username");
    var top_nav_my_emlakrex = YUI.getId("top_nav_my_emlakrex");
    var link_array_length = 3;
    my_emlakrex.innerHTML = "";
    var ajax = new QAjax();
    ajax.set_script_info({
        script: "Sorgu/q_populate_my_emlakrex/?ts=" + new Date().valueOf(),
        method: "get",
        output: "text"
    });
    ajax.set_callback(function (response) {
        if (response) {
            eval("var returned_data=" + response);
            if (returned_data.my_emlakrex_home_link && top_nav_my_emlakrex) {
                var a_tags = top_nav_my_emlakrex.getElementsByTagName("A");
                for (var i = 0; i < a_tags.length; i++) {
                    if (YUI.u.Dom.hasClass(a_tags[i], "my_account_link") && YUI.u.Dom.hasClass(a_tags[i], "menu_title")) {
                        a_tags[i].href = returned_data.my_emlakrex_home_link;
                        break
                    }
                }
            }
            if (returned_data.link_html) {
                my_emlakrex.innerHTML = returned_data.link_html
            }
            if (returned_data.name && name) {
                name.innerHTML = returned_data.name
            }
            if (typeof returned_data.my_leads_id != "undefined") {
                emlakrex.remove_class(returned_data.my_leads_id, "hidden");
                emlakrex.show_lead_indicator(true)
            }
            if (typeof returned_data.show_my_listings != "undefined") {
                if (returned_data.show_my_listings == 1) {
                    emlakrex.remove_class("ml_tn_link", "gone")
                } else {
                    emlakrex.add_class("ml_tn_link", "gone")
                }
            }
            if (typeof returned_data.show_pro != "undefined") {
                if (returned_data.show_pro == 1) {
                    hide("top_nav_pro_link")
                } else {
                    unhide("top_nav_pro_link")
                }
            }
        }
    });
    ajax.go()
}
function clear_login_form() {
    clear("login_email");
    clear("login_pass");
    if ((fpwe = YUI.getId("forgot_password_email_field"))) {
        fpwe.value = ""
    }
    hide("login_box_msg")
}
function do_logout() {
    var a = new QAjax();
    a.set_script_info({
        script: "Sorgu/q_logout/?ts=" + new Date().valueOf(),
        method: "get",
        output: "xml"
    });
    a.set_callback(function (b) {
        do_post_logout()
    });
    a.go();
    destroy_popup("login_box");
    clear_login_form();
    show_login_link()
}
function do_email_password(c, a) {
    var e;
    if (!(e = YUI.getId("forgot_password_email_field"))) {
        return false
    }
    var f = YUI.getId(c);
    var b = trim(e.value);
    if (!is_valid_email(b)) {
        f.innerHTML = "Lütfen geçerli bir e-posta adresi giriniz";
        return false
    }
    f.className = "";
    f.innerHTML = "Lütfen bekleyiniz...";
    var g = new QAjax();
    g.set_script_info({
        script: "q_email_password.php",
        method: "get",
        output: "text"
    });
    g.set_value("ts", new Date().valueOf());
    g.set_value("email", b);
    g.set_callback(function (h) {
        if (h == "1") {
            if (YUI.getId("redirect_url_id")) {
                YUI.getId("login_email_field").value = b;
                clear("login_password_field");
                f.innerHTML = "Password emailed. <a href=\"javascript:open_in_login_module('', '" + b + "');\">Giriş Yap</a>"
            } else {
                if (YUI.getId("login_email_field")) {
                    YUI.getId("login_email_field").value = b;
                    clear("login_password_field");
                    f.innerHTML = "Password emailed. <a href=\"javascript:toggle_login_form('login');\">Giriş Yap</a>"
                } else {
                    f.innerHTML = 'Password emailed. <a href="' + site_root + "login/e/" + b + '">Giriş Yap</a>'
                }
            }
        } else {
            if (h == "0") {
                f.className = "ErrorMessage";
                f.innerHTML = "There was a problem emailing your password."
            } else {
                if (h == "-1") {
                    f.className = "ErrorMessage";
                    f.innerHTML = NOT_EXIST_MSG
                } else {
                    f.innerHTML = ""
                }
            }
        }
    });
    g.go()
}
function open_in_login_module(a) {
    hide_login_form();
    YUI.getId("sls_signup_module").style.display = "none";
    YUI.getId("sls_login_module").style.display = "block";
    YUI.getId("login_email_field_id").value = a
}
function clear_login_forms() {
    if (document.register_form) {
        clear_form(document.register_form)
    }
    if (document.login_form) {
        clear_form(document.login_form)
    }
    if (document.forgot_password_form) {
        clear_form(document.forgot_password_form)
    }
    clear("login_password_field");
    clear("password_field");
    clear("password_verify_field");
    clear("forgot_password_email_field");
    clear("flag_email");
    clear("sp_s_email")
}
function clear_form(b, e) {
    b = YUI.getId(b);
    if (!b) {
        return false
    }
    if (typeof(e) == "undefined" || !e) {
        e = Array()
    }
    var a;
    for (var c = 0; c < b.elements.length; ++c) {
        if (b.elements[c].name && e.contains(b.elements[c].name)) {
            continue
        }
        a = b.elements[c].type;
        if (a == "text" || a == "password") {
            b.elements[c].value = ""
        }
    }
}
function clear_form_by_id(a) {
    if (YUI.getId(a)) {
        YUI.getId(a).reset()
    }
}
function set_email_alert_forms(f, a) {
    var e = document.getElementsByTagName("input");
    if (!f) {
        for (var c = 0; c < e.length; ++c) {
            if (e[c].id && (e[c].id).indexOf("ea_email_field") > -1) {
                e[c].value = a;
                e[c].disabled = true;
                e[c].style.color = "#000000"
            }
        }
        hide("qa_email_alert_quick_email");
        if (YUI.getId("qa_email_alert_quick_email_id")) {
            YUI.getId("qa_email_alert_quick_email_id").value = "-1"
        }
    } else {
        for (var c = 0; c < e.length; ++c) {
            if (e[c].id && (e[c].id).indexOf("ea_email_field") > -1) {
                e[c].value = zaldef;
                e[c].disabled = false;
                e[c].style.color = "#999999"
            }
        }
        var b = YUI.getId("qa_email_alert_quick_email_input");
        if (b) {
            unhide("qa_email_alert_quick_email");
            b.value = "your email address";
            handle_edit_box(b, "your email address", false)
        }
    }
    if (YUI.getId("email_alert_subscribe_status_1")) {
        YUI.getId("email_alert_subscribe_status_1").innerHTML = ""
    }
    if (YUI.getId("email_alert_subscribe_status_2")) {
        YUI.getId("email_alert_subscribe_status_2").innerHTML = ""
    }
}
function set_save_property_links(f) {
    var c = get_ids_with_prefix("a", "save_property_link");
    var b = "";
    var a;
    for (var e = 0; e < c.length; ++e) {
        a = YUI.getId(c[e]);
        b = c[e].replace(/\D/g, "");
        toggle_link(b, (f.indexOf("," + b + ",") >= 0))
    }
}
function reset_save_search() {
    var a = YUI.getId("save_search_link");
    if (a) {
        a.innerHTML = z_link_labels.save_this_search;
        a.onclick = function (b) {
            subscribe(-1, b);
            return false
        }
    }
    reset_subscribe()
}
function reset_subscribe() {
    if (!is_tpp() && !YUI.u.Dom.hasClass("filters_body", "newfrail")) {
        YUI.u.Dom.removeClass("center_rail", "srp_promo_bg_not_default")
    }
}
function set_subscribe() {
    YUI.u.Dom.addClass("center_rail", "srp_promo_bg_not_default")
}
function isSponsoredListing(c, f) {
    if (typeof(f) == "undefined") {
        var f = false
    }
    var b = Array();
    if (typeof(zpgprop) != "undefined") {
        var a = (vw == "pic" ? "pic" : "default");
        if (zpgprop.spl[a][cpgn]) {
            if (zpgprop.spl[a][cpgn].length > 0) {
                var e = zpgprop.spl[a][cpgn];
                if (e.indexOf(",") > -1) {
                    b = e.split(",")
                } else {
                    b.push(e)
                }
                if (b.contains(c)) {
                    if (f) {
                        return b.indexOf(c)
                    } else {
                        return true
                    }
                }
            }
        }
    }
    if (f) {
        return -1
    } else {
        return false
    }
}
function pull_file(a) {
    var b = a.split("/");
    return b[b.length - 1]
}
function get_class_info(g, b) {
    if (typeof(b) == "undefined") {
        var b = false
    }
    var f = (b) ? "sponsored_" : "";
    if (g.indexOf("flrow_") > -1) {
        var f = "fl_"
    }
    var c = "";
    if (typeof(top5pids) != "undefined") {
        var c = "_emlakrex_trends"
    }
    var a = YUI.getId(g);
    if (!a) {
        return null
    }
    var e = new Object;
    e.highlight_class = f + "listing_highlight" + c;
    if (!a.className) {
        e.cell_type = "default";
        e.active_class = f + "listing_active" + c;
        e.base_class = "listing_cell" + c
    } else {
        e.cell_type = YUI.u.Dom.hasClass(a, "pic_view") ? "picture" : "default";
        e.active_class = (e.cell_type == "picture" ? "" : f + "listing_active" + c);
        e.base_class = a.className.replace(e.highlight_class, "").replace(e.active_class, "")
    }
    return e
}
var _default_login_copy = null;
var _default_register_copy = null;
var _emlakrex_lf_cfg = {};
var _emlakrex_lf_custom_element = "";
var _emlakrex_reg_form = "login";
var _emlakrex_lf = null;

function add_login_form_config(b, a) {
    if (typeof(_emlakrex_lf_cfg) != "undefined") {
        _emlakrex_lf_cfg[b] = a
    }
}
function get_login_form_config(b) {
    var a = b || _emlakrex_lf_custom_element;
    if (typeof _emlakrex_lf_cfg[a] != "undefined") {
        return _emlakrex_lf_cfg[a]
    }
    return null
}
function LoginForm(c, a) {
    this.addl = a;
    this.popup_name = c;
    this.login_header = "Giriş Yap";
    this.register_header = "Hesap yarat";
    this.password_header = "Şifremi unuttum?";
    this.cfg = {
        id: "login_box",
        width: "410px",
        close: true,
        cache_endpoint: false,
        use_cancel_link: true,
        destroy_on_cancel: true
    };
    var b = this;
    var e = function () {
        var g = "";
        if (typeof(b.addl) !== "undefined" && typeof(b.addl.custom_vars) !== "undefined") {
            g = YUI.lang.JSON.stringify(b.addl.custom_vars)
        }
        var f = "page_name=" + emlakrex.page_name + "&popup_name=" + b.popup_name + "&custom_vars=" + g;
        b.popup = new emlakrex.Popup(b.cfg);
        b.popup.setContentSource("Sorgu/q_show_login_popup/?" + f);
        b.popup.show()
    };
    YUI.use("json", e)
}
LoginForm.prototype.init = function (a) {
    this.box = YUI.getId("login_box_c");
    this.lt = YUI.getId("login_form");
    this.rt = YUI.getId("register_form");
    this.pt = YUI.getId("password_form");
    this.header = YUI.u.Dom.getElementsByClassName("hd", "div", "login_box")[0];
    this.pw_prompt = YUI.getId("enter_password_prompt");
    this.reg_name = YUI.getId("name_field");
    this.reg_e = YUI.getId("email_field");
    this.reg_p = YUI.getId("password_field");
    this.log_e = YUI.getId("login_email_field");
    this.log_p = YUI.getId("login_password_field");
    this.pw_e = YUI.getId("forgot_password_email_field");
    this.pr_login = YUI.getId("login_prompt");
    this.privacy = YUI.getId("signup_privacy");
    this.search_info = YUI.getId("search_info_section");
    this.elements = typeof(_emlakrex_lf_cfg) == "undefined" ? {} : _emlakrex_lf_cfg;
    if (typeof(this.elements[a]) != "undefined" && this.elements[a].header) {
        this.login_header = this.elements[a].header;
        this.register_header = this.elements[a].header
    }
    if (typeof(this.addl) !== "undefined" && typeof(this.addl.email) !== "undefined") {
        DOMUtils.set_value(this.log_e, this.addl.email);
        DOMUtils.set_value(this.pw_e, this.addl.email)
    }
};
LoginForm.prototype.show = function (b) {
    unhide_selects();
    clear_element("reg_box_msg_txt");
    clear_element("login_box_msg_txt");
    clear_element("password_box_msg_txt");
    var a = YUI.getId("us_pro");
    if (a) {
        if (typeof(login_next_step_global) != "undefined" && login_next_step_global == "claiming") {
            a.checked = true
        } else {
            a.checked = false
        }
    }
    YUI.u.Dom.addClass(this.pr_login, "hidden");
    YUI.u.Dom.addClass("register_prompt", "hidden");
    YUI.u.Dom.addClass(this.privacy, "hidden");
    if (this.box) {
        this.box.style.zIndex = "9999"
    }
    if (typeof(b) != "undefined" && b != null && b != "") {
        switch (b) {
        case "property_email_alert":
        case "login":
            this.show_login();
            break;
        case "password":
            this.show_password();
            break;
        case "save_search":
            this.show_custom("save_search", false);
            break;
        case "save_search_logged_in":
            this.show_custom("save_search", true);
            break;
        case "save_recent_search":
            this.show_custom("save_recent_search", false);
            break;
        case "save_recent_search_logged_in":
            this.show_custom("save_recent_search", true);
            break;
        case "email_alert":
            this.show_custom("email_alert", false);
            break;
        case "email_alert_logged_in":
            this.show_custom("email_alert", true);
            break;
        case "signup":
        default:
            if (typeof(this.elements[b]) != "undefined") {
                this.show_custom(b, _emlakrex_logged_in)
            } else {
                this.show_register()
            }
            break
        }
    } else {
        if (this.now_showing != "login") {
            this.show_login()
        } else {
            this.show_register()
        }
    }
};
LoginForm.prototype.show_custom = function (type, logged_in) {
    _emlakrex_lf_custom_element = type;
    if (in_array(type, ["save_search", "save_recent_search", "email_alert", "email_alerts_form"])) {
        YUI.u.Dom.removeClass(this.privacy, "hidden");
        YUI.u.Dom.removeClass(this.search_info, "hidden")
    }
    var elem = YUI.getId("login_popup_content_custom");
    if (elem) {
        elem.innerHTML = this.elements[type].html
    }
    YUI.u.Dom.removeClass(this.elements[type].form, "hidden");
    if (typeof(this.elements[type].show) == "object") {
        for (i in this.elements[type].show) {
            YUI.u.Dom.removeClass(this.elements[type].show[i], "hidden")
        }
    }
    switch (type) {
    case "pdp_claim_home_login":
        var reg_frm = YUI.getId("register_form");
        if (reg_frm) {
            reg_frm.user_status.selectedIndex = 7
        }
        break;
    case "save_search":
    case "save_recent_search":
        YUI.getId("save_search_checkbox").checked = true;
        break;
    case "email_alert":
        YUI.getId("alertPropertiesFrequency").value = "gunluk";
        //YUI.getId("alertOpenFrequency").value = "gunluk";
        if (typeof(RFilters) != "undefined" && RFilters.active_tab == VIEW_FOR_RENT) {
            YUI.u.Dom.addClass("email_alert_non_rental", "gone");
            YUI.u.Dom.addClass("email_alert_open_house", "gone");
           // YUI.u.Dom.removeClass("email_alert_rental", "gone");
            //YUI.getId("alertPropertiesRental").checked = true;
            YUI.getId("alertPropertiesListed").checked = false;
            YUI.getId("alertPropertiesSold").checked = false;
            //YUI.getId("alertOpenHouses").checked = false
        } else {
            if (typeof(RFilters) != "undefined" && RFilters.active_tab == VIEW_EV_KONUT && !RFilters.isForeclosureOnlySearch()) {
                YUI.u.Dom.removeClass("email_alert_open_house", "gone")
            } else {
                YUI.u.Dom.addClass("email_alert_open_house", "gone")
            }
            YUI.u.Dom.removeClass("email_alert_non_rental", "gone");
            //YUI.u.Dom.addClass("email_alert_rental", "gone");
            //YUI.getId("alertPropertiesRental").checked = false;
            YUI.getId("alertPropertiesListed").checked = true;
            YUI.getId("alertPropertiesSold").checked = true;
            //YUI.getId("alertOpenHouses").checked = true
        }
        break;
    case "contact_save_property":
        var frm = YUI.getId("contact_agent_form");
        var reg_frm = YUI.getId("register_form");
        var property_location_id = _PROPERTY_LOCATION_ID;
        reg_frm.name_field.value = frm.u_name.value;
        reg_frm.email_field.value = frm.u_email.value;
        reg_frm.phone.value = frm.u_phone.value;
        reg_frm.user_status.selectedIndex = 1;
        if (property_location_id != "" && the_city && the_state_code) {
            reg_frm.autocomplete_location.value = property_location_id;
            reg_frm.location_field.value = the_city + ", " + the_state_code
        }
        break;
    case "send_to_friend_save_property":
        var frm = YUI.getId("email_property_form");
        var reg_frm = YUI.getId("register_form");
        var property_location_id = _PROPERTY_LOCATION_ID;
        reg_frm.name_field.value = frm.sp_s_name.value;
        reg_frm.email_field.value = frm.sp_s_email.value;
        reg_frm.user_status.selectedIndex = 1;
        if (property_location_id != "" && the_city && the_state_code) {
            reg_frm.autocomplete_location.value = property_location_id;
            reg_frm.location_field.value = the_city + ", " + the_state_code
        }
        break
    }
    if (typeof(logged_in) != "undefined" && logged_in) {
        YUI.u.Dom.removeClass(this.elements[type].buttons, "hidden");
        YUI.u.Dom.addClass("login_form", "hidden")
    } else {
        var login_copy = YUI.getId("login_copy");
        var register_copy = YUI.getId("register_copy");
        if (login_copy && this.elements[type] && this.elements[type].login_copy) {
            if (!_default_login_copy) {
                _default_login_copy = login_copy.innerHTML
            }
            login_copy.innerHTML = this.elements[type].login_copy
        }
        if (register_copy && this.elements[type] && this.elements[type].register_copy) {
            if (!_default_register_copy) {
                _default_register_copy = register_copy.innerHTML
            }
            register_copy.innerHTML = this.elements[type].register_copy
        }
    }
    if (typeof(this.elements[type].show_custom_callback) != "undefined") {
        eval(this.elements[type].show_custom_callback + "()")
    }
    if (_emlakrex_reg_form == "register" || ["login_ask_form", "login_ask_toolbox_form", "join_find_a_pro", "contact_save_property", "send_to_friend_save_property", "login_write_review_form"].contains(type)) {
        _emlakrex_reg_form = "login";
        this.show_register()
    } else {
        this.show_login()
    }
};
LoginForm.prototype.toggle_header = function (b) {
    if (this.header) {
        for (element in this.elements) {
            var a = YUI.getId(this.elements[element].form);
            if (a && !YUI.u.Dom.hasClass(a, "hidden")) {
                this.header.innerHTML = this.elements[element].header;
                return
            }
        }
        this.header.innerHTML = b
    }
};
LoginForm.prototype.show_login = function () {
    this.toggle_header(this.login_header);
    YUI.u.Dom.addClass(this.rt, "hidden");
    if (this.pt) {
        YUI.u.Dom.addClass(this.pt, "hidden")
    }
    if (is_valid_email(this.reg_e.value)) {
        this.log_e.value = this.reg_e.value
    }
    if (!YUI.u.Dom.removeClass(this.box, "hidden") || this.box.style.display == "none") {
        unhide(this.box)
    }
    if (!_emlakrex_logged_in) {
        if (!YUI.u.Dom.removeClass(this.lt, "hidden")) {
            unhide(this.lt, "")
        }
        if (this.log_e.value != "") {
            this.log_p.select()
        } else {
            this.log_e.select()
        }
    }
    this.popup.position();
    this.now_showing = "login"
};
LoginForm.prototype.show_register = function () {
    this.toggle_header(this.register_header);
    YUI.u.Dom.addClass(this.lt, "hidden");
    hide(this.pw_prompt);
    if (this.pt) {
        YUI.u.Dom.addClass(this.pt, "hidden")
    }
    if (!YUI.u.Dom.removeClass(this.rt, "hidden")) {
        unhide(this.rt, "")
    }
    if (is_valid_email(this.log_e.value)) {
        this.reg_e.value = this.log_e.value
    }
    if (!YUI.u.Dom.removeClass(this.box, "hidden") && this.box.style.display == "none") {
        unhide(this.box)
    }
    if (this.popup.P.cfg.getProperty("visible") === false) {
        this.popup.show()
    }
    if (this.reg_name.value != "") {
        if (this.reg_e.value != "") {
            this.reg_p.focus()
        } else {
            this.reg_e.focus()
        }
    } else {
        this.reg_name.focus()
    }
    this.popup.position();
    this.now_showing = "register"
};
LoginForm.prototype.show_password = function () {
    if (!this.pt) {
        return
    }
    login_reset();
    if (this.header) {
        this.header.innerHTML = this.password_header
    }
    YUI.u.Dom.addClass(this.lt, "hidden");
    YUI.u.Dom.addClass(this.rt, "hidden");
    hide(this.pw_prompt);
    if (!YUI.u.Dom.removeClass(this.pt, "hidden")) {
        unhide(this.pt, "")
    }
    if (is_valid_email(this.reg_e.value)) {
        this.pw_e.value = this.reg_e.value
    }
    if (is_valid_email(this.log_e.value)) {
        this.pw_e.value = this.log_e.value
    }
    if (!YUI.u.Dom.removeClass(this.box, "hidden") && this.box.style.display == "none") {
        unhide(this.box)
    }
    this.pw_e.focus();
    this.popup.position();
    this.now_showing = "password"
};

function toggle_login_form(c, b) {
    if (typeof(c) == "undefined") {
        c = null
    }
    if (_emlakrex_lf == null || _emlakrex_lf.popup.bDestroyed) {
        var a = function () {
            _emlakrex_lf = new LoginForm(c, b)
        };
        if (!YAHOO.widget.Panel) {
            YUI.use("container", a)
        } else {
            a()
        }
        var e = function (f) {
            _emlakrex_lf.init(c);
            _emlakrex_lf.show(c)
        };
        YUI.u.Event.onAvailable("login_popup_content", e)
    } else {
        if (_emlakrex_lf) {
            _emlakrex_lf.popup.unhide()
        }
        _emlakrex_lf.show(c)
    }
}
function hide_login_form() {
    YUI.u.Dom.removeClass("register_form_container", "hidden");
    YUI.u.Dom.addClass("login_form_container", "hidden");
    YUI.u.Dom.addClass("password_form_container", "hidden");
    YUI.u.Dom.addClass("login_box_c", "hidden");
    unhide_selects()
}
function check_pw_match() {
    var e = YUI.getId("password_field").value;
    var c = YUI.getId("password_verify_field").value;
    var a = YUI.getId("reg_box_msg_txt");
    var b = "The passwords don't match.";
    if (a && e != c && e != "" && c != "") {
        YUI.u.Dom.addClass(a, "ErrorMessage");
        a.innerHTML = b
    } else {
        if (a && a.innerHTML == b) {
            a.innerHTML = ""
        }
    }
}
function check_exist(b, a, f) {
    var e = trim(b.email.value).toLowerCase();
    if (e == "") {
        return false
    }
    var h = YUI.getId(a);
    if (!h) {
        return false
    }
    var c = "";
    if (!is_valid_email(e)) {
        if (h) {
            h.innerHTML = "Geçerli bir e-posta adresi girin.";
            h.className = "ErrorMessage"
        }
        return false
    }
    var g = new QAjax();
    g.set_script_info({
        script: "Sorgu/q_user_exist/",
        method: "get",
        output: "text"
    });
    g.set_value("e", e);
    g.set_callback(function (j) {
        update_email_status_field(j, a, f)
    });
    g.go()
}
function update_email_status_field(b, p, l) {
    var k = /_[0-9]+$/;
    var f = p.match(k);
    var g = YUI.getId(p);
    if (!g) {
        return false
    }
    var e = (p.indexOf("reg_box_msg_txt") > -1);
    var n = (e ? "login_prompt" : "register_prompt");
    var j = YUI.getId(n);
    var c = "";
    if (b == "-1" || b == -999) {
        if (l) {
            if (e) {
                c = ""
            } else {
                c = NOT_EXIST_MSG
            }
        } else {
            c = NOT_EXIST_MSG
        }
    } else {
        if (b == "0") {
            if (l) {
                if (e) {
                    c = EXIST_MSG
                } else {
                    c = ""
                }
            }
        } else {
            c = ""
        }
    }
    if (c == "") {
        g.innerHTML = "";
        YUI.u.Dom.removeClass(g, "ErrorMessage")
    } else {
        g.innerHTML = c;
        YUI.u.Dom.addClass(g, "ErrorMessage")
    }
    if (l) {
        if (e) {
            if (b == "0") {
                var m = YUI.getId("login_email_field");
                var a = YUI.getId("email_field");
                if (m && a) {
                    m.value = a.value
                }
            } else {
                YUI.u.Dom.addClass(j, "hidden");
                clear("login_email_field")
            }
        } else {
            var h = YUI.getId("email_field");
            if (b == "-1") {
                if (!YUI.u.Dom.removeClass(j, "hidden")) {
                    unhide(j)
                }
                if (h) {
                    h.value = YUI.getId("login_email_field").value
                }
            } else {
                YUI.u.Dom.addClass(j, "hidden");
                if (h) {
                    h.value = ""
                }
            }
        }
    }
}
function get_radio_value(b) {
    var c = null;
    for (var a = 0; a < b.length; ++a) {
        if (b[a].checked) {
            c = b[a].value;
            break
        }
    }
    return c
}
function submit_register_form(frm, is_post) {
    var frm = YUI.getId(frm);
    if (frm) {
        if (is_post === true) {
            if (validate_register(frm)) {
                /*if (typeof o_track_signup_click != "undefined") {
                    _pageTracker()
                }*/
                eval("document.forms." + frm.name + ".submit();")
            }
        } else {
            do_register(frm)
        }
    }
    return false
}
function submit_login_form(frm, is_post) {
    var frm = YUI.getId(frm);
    if (frm) {
        if (is_post === true) {
            if (validate_login(frm)) {
                eval("document.forms." + frm.name + ".submit();")
            }
        } else {
            do_login(frm)
        }
    }
    return false
}
function submit_forgot_pwd_form(frm) {
    var frm = YUI.getId(frm);
    if (frm && typeof(frm.email) != "undefined") {
        if (!frm.email || !is_valid_email(frm.email.value)) {
            alert("Lütfen geçerli bir e-posta adresi giriniz")
        } else {
            frm.action = site_root + "Hesabim/SifremiUnuttum/";
            eval("document.forms." + frm.name + ".submit();")
        }
    }
}
function validate_register(frm, suffix, is_voices_embed) {
    _emlakrex_reg_form = "register";
    var reg_email, reg_email_confirm, reg_password, reg_password_verify, reg_name, reg_location, reg_auto_location, reg_status;
    var _REG_DEFAULT_FIELDS = {
        name: "Adınızı giriniz",
        email: "E-Posta adresinizi giriniz",
        broker: "Şirketinizin adını giriniz"
    };
    var omni_errors = new Array();
    if (typeof(suffix) == "undefined" || !suffix) {
        suffix = ""
    }
    if (typeof(frm) != "undefined" && frm != null) {
        if (is_voices_embed == true) {
            frm.password_verify.value = frm.password.value
        }
        reg_email = trim(frm.email.value).toLowerCase();
        reg_email_confirm = trim(frm.email_confirm.value).toLowerCase();
        reg_password = frm.password.value;
        reg_password_verify = frm.password_verify.value;
        reg_name = trim(frm.name_field.value);
        reg_location = trim(frm.location.value);
        reg_auto_location = frm.autocomplete_location.value;
        reg_status = frm.user_status.value;
        reg_pro_status = frm.pro_status.value;
        reg_broker = frm.broker.value
    } else {
        if (is_voices_embed == true) {
            frm.password_verify_field.value = frm.password_field.value
        }
        reg_email = trim(YUI.getId("email_field" + suffix).value).toLowerCase();
        reg_email_confirm = trim(YUI.getId("email_confirm_field" + suffix).value).toLowerCase();
        reg_password = YUI.getId("password_field" + suffix).value;
        reg_password_verify = YUI.getId("password_verify_field" + suffix).value;
        reg_name = trim(YUI.getId("name_field" + suffix).value);
        reg_location = trim(YUI.getId("location_field" + suffix).value);
        reg_auto_location = YUI.getId("autocomplete_location" + suffix).value;
        reg_status = YUI.getId("user_status" + suffix).value;
        reg_pro_status = YUI.getId("pro_status" + suffix).value;
        reg_broker = YUI.getId("broker" + suffix).value
    }
    var focus_field_ids = {
        email: "email_field" + suffix,
        email_confirm: "email_confirm_field" + suffix,
        pass: "password_field" + suffix,
        pass_verify: "password_verify_field" + suffix,
        name: "name_field" + suffix,
        location: "location_field" + suffix,
        user_status: "user_status_field" + suffix,
        pro_status: "pro_status_field" + suffix,
        broker: "broker_field" + suffix
    };
    var validate_error_message = "";
    var reg_errors = new Array();
    var reg_error_fields = new Array();
    var field_to_focus = "";
    if (is_voices_embed) {
        for (i in focus_field_ids) {
            var e = YUI.getId("error_" + focus_field_ids[i]);
            if (e) {
                hide("error_" + focus_field_ids[i]);
                e.innerHTML = ""
            }
        }
    }
    if (reg_name == "" || reg_name == _REG_DEFAULT_FIELDS.name) {
        reg_errors.push("Kullanıcı adınızı veya adınzı girin.");
        reg_error_fields.push(focus_field_ids.name);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.name
        }
        omni_errors.push("reg_sn_none")
    }
    if (!is_valid_email(reg_email)) {
        reg_errors.push("Geçerli bir e-posta adresi girin. Örnek:adim@domain.com.");
        reg_error_fields.push(focus_field_ids.email);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.email
        }
        omni_errors.push("reg_email_invalid")
    } else {
        if (reg_email == "" || reg_email == _REG_DEFAULT_FIELDS.email) {
            reg_errors.push("Lütfen E-Posta adresinizi girin.");
            reg_error_fields.push(focus_field_ids.email);
            if (field_to_focus == "") {
                field_to_focus = focus_field_ids.email
            }
            omni_errors.push("reg_email_none")
        }
    }
    if (!is_valid_email(reg_email_confirm)) {
        reg_errors.push("Geçerli bir e-posta adresi girin. Örnek:adim@domain.com.");
        reg_error_fields.push(focus_field_ids.email_confirm);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.email_confirm
        }
        omni_errors.push("reg_email_confirm_invalid")
    } else {
        if (reg_email_confirm == "" || reg_email_confirm == _REG_DEFAULT_FIELDS.email_confirm) {
            reg_errors.push("Lütfen E-Posta adresinizi girin.");
            reg_error_fields.push(focus_field_ids.email_confirm);
            if (field_to_focus == "") {
                field_to_focus = focus_field_ids.email_confirm
            }
            omni_errors.push("reg_email_confirm_none")
        } else {
            if (reg_email != reg_email_confirm) {
                reg_errors.push("Girdiğiniz e-posta adresleri birbiriyle aynı değil.");
                reg_error_fields.push(focus_field_ids.email_confirm);
                if (field_to_focus == "") {
                    field_to_focus = focus_field_ids.email_confirm
                }
                omni_errors.push("reg_email_confirm_none")
            }
        }
    }
    if (reg_password == "") {
        reg_errors.push("Şifrenizi girin.");
        reg_error_fields.push(focus_field_ids.pass);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.pass
        }
        omni_errors.push("reg_password_none")
    }
    if (reg_password_verify == "") {
        reg_errors.push("Kontrol için şifrenizi tekrar girin.");
        reg_error_fields.push(focus_field_ids.pass_verify);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.pass_verify
        }
        omni_errors.push("reg_password_no_2nd")
    }
    if (!reg_auto_location || reg_auto_location == "0") {
        reg_errors.push("Geçerli bir adres girin.");
        reg_error_fields.push(focus_field_ids.location);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.location
        }
        unhide("outside_us_error" + suffix, "");
        omni_errors.push("reg_location_invalid")
    }
    rgl = reg_password.length;
    rglv = reg_password_verify.length;
    if (reg_password != "" && reg_password_verify != "" && reg_password != reg_password_verify) {
        reg_errors.push("Girdiğiniz şifreler birbirini tutmuyor.");
        reg_error_fields.push(focus_field_ids.pass);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.pass
        }
        omni_errors.push("reg_password_mismatch")
    } else {
        if (rgl > 0 && (rgl < 5 || rgl > 15) || (rglv > 0 && (rglv < 5 || rglv > 15))) {
            reg_errors.push("Şifreniz 5 ila 15 karakter arasında olmalı.");
            reg_error_fields.push(focus_field_ids.pass);
            if (field_to_focus == "") {
                field_to_focus = focus_field_ids.pass
            }
            omni_errors.push("reg_password_invalid")
        }
    }
    if (reg_password != "" && reg_password_verify != "" && (reg_password.toLowerCase() == reg_email.toLowerCase() || reg_password.toLowerCase() == reg_email.toLowerCase().substring(0, reg_email.indexOf("@")))) {
        reg_errors.push("Şifrenizin tahmin edilmesi çok kolay. Lütfen farklı bir şifre deneyin.");
        reg_error_fields.push(focus_field_ids.pass);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.pass
        }
        omni_errors.push("reg_password_invalid")
    }
    if (!reg_status) {
        reg_errors.push("Kendinizi tanıtacak bir tanımlama seçin.");
        reg_error_fields.push(focus_field_ids.user_status);
        omni_errors.push("reg_user_status")
    } else {
        if (reg_status == "Emlak Uzmanı") {
            if (!reg_pro_status) {
                reg_errors.push("Lütfen nasıl bir profesyonelliğe sahip olduğunuzu belirtin.");
                reg_error_fields.push(focus_field_ids.pro_status);
                omni_errors.push("reg_pro_status")
            }
            if (reg_broker == "" || reg_broker == _REG_DEFAULT_FIELDS.broker) {
                reg_errors.push("Şirket adını girin.");
                reg_error_fields.push(focus_field_ids.broker);
                if (field_to_focus == "") {
                    field_to_focus = focus_field_ids.broker_field
                }
                omni_errors.push("reg_broker_none")
            }
        }
    }
    if (reg_errors.length > 0) {
        for (i = 0; i < reg_errors.length; ++i) {
            if (is_voices_embed) {
                var e = YUI.getId("error_" + reg_error_fields[i]);
                if (e) {
                    e.innerHTML = reg_errors[i];
                    block("error_" + reg_error_fields[i])
                }
            } else {
                validate_error_message += reg_errors[i] + "\n"
            }
        }
        if (is_voices_embed) {
            var err_summary = YUI.getId("error_summary");
            if (err_summary) {
                err_summary.innerHTML = "";
                err_summary.appendChild($$("span", _QA_ERROR_LABELS.error_summary));
                err_summary.className = "qa_error_summary"
            }
            //process_qa_omni_errors(omni_errors)
        } else {
            alert(validate_error_message)
        }
        var ff = YUI.getId(field_to_focus);
        if (field_to_focus != "" && ff) {
            ff.focus()
        }
        return false
    } else {
        var element = get_login_form_config();
        if (element && typeof element.validate_login_callback != "undefined") {
            var ret = true;
            eval("ret = " + element.validate_login_callback + "()");
            if (!ret) {
                return false
            }
        }
    }
    _emlakrex_reg_form = "login";
    return true
}
function outside_US_reg_form() {
    var e = YUI.getId("location_field");
    var c = YUI.getId("autocomplete_location");
    var b = YUI.getId("outside_us_link");
    var a = YUI.getId("outside_us");
    if (e && c) {
        if (e.disabled) {
            e.value = "";
            e.disabled = false;
            c.value = "";
            if (b) {
                b.innerHTML = "Türkiye dışındamı yaşıyorsunuz?";
                if (a) {
                    a.value = "";
                    a.checked = false
                }
            }
        } else {
            e.value = "Türkiye Dışından";
            e.disabled = true;
            c.value = "-1";
            if (b) {
                b.innerHTML = "Türkiye demi yaşıyorsunuz?";
                if (a) {
                    a.value = "on";
                    a.checked = true
                }
            }
        }
    }
}
function autocomplete_cleanup(visible_element, hidden_element, default_value, ajax_target) {
    var visible_value = visible_element.value;
    var hidden_value = hidden_element.value;
    if (visible_value === null || visible_value === "" || visible_value === default_value || (typeof(hidden_value) !== "undefined" && hidden_value !== null && hidden_value !== "")) {
        return
    }
    var ajax = new QAjax();
    ajax.set_value("q", visible_value);
    ajax.set_script_info({
        script: ajax_target,
        method: "post",
        output: "json"
    });
    ajax.set_callback(function (output) {
        try {
            eval("var output = " + output);
            if (typeof(output[0]) !== "undefined" && output[0] !== null) {
                hidden_element.value = output[0].value;
                visible_element.value = output[0].display;
                var tag = visible_element.parentNode.parentNode.lastChild;
                if (tag.tagName.toUpper() == "EM") {
                    tag.innerHTML = ""
                }
            }
        } catch (e) {}
    });
    ajax.go()
}
function validate_login(frm, suffix, is_voices_embed) {
    var omni_errors = new Array();
    if (typeof(suffix) == "undefined" || !suffix) {
        suffix = ""
    }
    var email_field, password_field;
    if (typeof(frm) != "undefined") {
        if (is_voices_embed) {
            email_field = frm.login_email;
            password_field = frm.login_password
        } else {
            email_field = frm.email;
            password_field = frm.password
        }
    } else {
        email_field = YUI.getId("login_email_field" + suffix);
        if (!email_field) {
            email_field = YUI.getId("login_email" + suffix)
        }
        password_field = YUI.getId("login_password_field" + suffix);
        if (!password_field) {
            password_field = YUI.getId("login_pass" + suffix)
        }
    }
    var focus_field_ids = {
        email: "login_email_field" + suffix,
        pass: "login_password_field" + suffix
    };
    var email = trim(email_field.value).toLowerCase();
    var password = password_field.value;
    var validate_error_message = "";
    var errors = new Array();
    var error_fields = new Array();
    if (is_voices_embed) {
        for (i in focus_field_ids) {
            var e = YUI.getId("error_" + focus_field_ids[i]);
            if (e) {
                hide("error_" + focus_field_ids[i]);
                e.innerHTML = ""
            }
        }
    }
    if (!is_valid_email(email)) {
        errors.push("Lütfen E-Posta adresinizi giriniz, such as name@domain.com.");
        error_fields.push(focus_field_ids.email);
        field_to_focus = focus_field_ids.email;
        omni_errors.push("log_email_invalid")
    } else {
        if (email == "") {
            errors.push("Please enter an email address.");
            error_fields.push(focus_field_ids.email);
            field_to_focus = focus_field_ids.email;
            omni_errors.push("log_email_none")
        }
    }
    if (password == "") {
        errors.push("Please enter a password.");
        error_fields.push(focus_field_ids.pass);
        if (field_to_focus == "") {
            field_to_focus = focus_field_ids.pass
        }
        omni_errors.push("log_password_none")
    }
    if (errors.length > 0) {
        for (i = 0; i < errors.length; ++i) {
            if (is_voices_embed) {
                var e = YUI.getId("error_" + error_fields[i]);
                if (e) {
                    e.innerHTML = errors[i];
                    block("error_" + error_fields[i])
                }
            } else {
                validate_error_message += errors[i] + "\n"
            }
        }
        if (is_voices_embed) {
            if (YUI.getId("error_summary")) {
                YUI.getId("error_summary").innerHTML = "";
                YUI.getId("error_summary").appendChild($$("span", _QA_ERROR_LABELS.error_summary));
                YUI.getId("error_summary").className = "qa_error_summary"
            }
            //process_qa_omni_errors(omni_errors)
        } else {
            alert(validate_error_message)
        }
        var ff = YUI.getId(field_to_focus);
        if (field_to_focus != "" && ff) {
            ff.focus()
        }
        return false
    }
    var element = get_login_form_config();
    if (element && typeof element.validate_login_callback != "undefined") {
        var ret = true;
        eval("ret = " + element.validate_login_callback + "()");
        if (!ret) {
            return false
        }
    }
    return true
}
function do_register(B) {
    if (!YUI.getId("email_field") || !YUI.getId("email_confirm_field") || !YUI.getId("password_field") || !YUI.getId("password_verify_field") || !YUI.getId("name_field") || !YUI.getId("location_field")) {
        return false
    }
    if (!validate_register(B)) {
        return false
    }
    var q = YUI.getId("reg_btn");
    if (q) {
        q.disabled = true
    }
    var b = YUI.getId("reg_box_msg_txt");
    if (b) {
        b.innerHTML = "Lütfen bekleyiniz...";
        unhide(b)
    }
    var A = trim(YUI.getId("email_field").value);
    var c = trim(YUI.getId("email_confirm_field").value);
    var m = YUI.getId("password_field").value;
    var k = YUI.getId("password_verify_field").value;
    var z = YUI.getId("contact_me_field");
    var a = YUI.getId("voices_alerts_field");
    var h = 0;
    var w = "";
    if (z) {
        if (z.type == "checkbox") {
            h = z.checked ? 1 : 0
        } else {
            h = z.value
        }
       /* if (h == 1) {
            _pageTracker("/newsletter")
        }*/
    }
    if (a) {
        if (a.type == "checkbox") {
            vcb = a.checked ? 1 : 0
        } else {
            vcb = a.value
        }
        /*if (vcb == 1) {
            _pageTracker("/voices_alerts")
        }*/
    }
    var r = trim(YUI.getId("name_field").value);
    var u = trim(YUI.getId("location_field").value);
    var C = YUI.getId("autocomplete_location");
    var v = (C && C.value) ? C.value : "";
    var g = "";
    var t = "";
    if (typeof(B.user_status) != "undefined") {
        g = B.user_status.value
    } else {
        g = "radio_other"
    }
    if (typeof(B.pro_status) != "undefined") {
        t = B.pro_status.value
    } else {
        t = "other"
    }
    if (typeof(B.popup_name) != "undefined") {
        w = B.popup_name.value
    }
    var f = false;
    var j = new QAjax();
    j.set_script_info({
        script: "Sorgu/q_register/",
        method: "post",
        output: "text"
    });
    j.set_value("tp", "ur");
    j.set_value("e", A);
    j.set_value("ec", c);
    j.set_value("p", m);
    j.set_value("pv", k);
    j.set_value("ncb", h);
    j.set_value("vcb", vcb);
    j.set_value("n", r);
    j.set_value("l", u);
    j.set_value("us", g);
    j.set_value("ps", t);
    j.set_value("la", v);
    j.set_value("ph", B.phone.value);
    j.set_value("b", B.broker.value);
    j.set_value("pn", w);
    if (typeof(_DETAILS_PROPERTY_ID) != "undefined") {
        j.set_value("pid", _DETAILS_PROPERTY_ID)
    }
    if (typeof(_DETAILS_PROPERTY_HASH) != "undefined") {
        j.set_value("pha", _DETAILS_PROPERTY_HASH)
    }
    if (typeof(_PROPERTY_TYPE) != "undefined") {
        j.set_value("pt", _PROPERTY_TYPE)
    }
    if (typeof(the_state_code) != "undefined") {
        j.set_value("st", the_state_code)
    }
    j.set_callback(function (e) {
        if (q) {
            q.disabled = false
        }
        if (e) {
            if (trim(e) == "1") {
                f = true;
                if (b) {
                    b.innerHTML = "&nbsp;";
                    hide(b.id)
                }
                clear_form(YUI.getId("register_form"));
                if (YUI.getId("contact_me_field") && typeof("contact_me_field") == "checkbox") {
                    YUI.getId("contact_me_field").checked = true
                }
                do_post_login(A, "", "", null, "register");
                hide("reg_box_msg_txt");
               // _pageTracker("//");
               // _pageTracker(_last_register_form_source, g + "|" + t)
            } else {
                if (trim(e) == "-1") {
                    alert("Sorry, you may not register an account at this time.")
                } else {
                    if (trim(e) == "0") {
                        YUI.u.Dom.addClass("login_prompt", "hidden");
                        YUI.getId("password_field").value = "";
                        YUI.getId("password_verify_field").value = "";
                        YUI.getId("password_field").focus();
                        YUI.getId("reg_box_msg_txt").innerHTML = 'Şifreniz yanlış.<span style="background-color:white;"> <a href="javascript:toggle_login_form(\'password\');">Şifrenizi mi unuttunuz?</a></span>';
                        unhide("reg_box_msg_txt");
                        unhide("login_box_msg")
                    }
                }
            }
        } else {
            hide("reg_box_msg_txt");
            alert("An error occurred during the sign-up process.")
        }
    });
    j.go();
    return f
}
function go_to_page(a) {
    if (typeof(a) != "undefined") {
        destroy_popup("login_box");
        window.location.href = site_root + a
    }
}
function redirect(a) {
    if (typeof(a) != "undefined" && a != "") {
        window.location.href = a
    }
}
function resetif(f, a, b) {
    var c = YUI.getId(f);
    if (c && (c.value == b || trim(c.value) == "")) {
        c.value = a
    }
}
function clearif(c, b) {
    var a = YUI.getId(c);
    if (a && a.value == b) {
        a.value = ""
    }
}
function pull_select_value(a, c) {
    var b = YUI.getId(a);
    if (!b) {
        return ""
    }
    var f = b.options[b.selectedIndex];
    return (c == "text") ? f.text : f.value
}
function unhide_selects() {
    if (!is_IE6()) {
        return
    }
    var c = YUI.getId("ie_iframe");
    if (c) {
        c.parentNode.removeChild(c)
    } else {
        var b = document.getElementsByTagName("select");
        for (var a = 0; a < b.length; ++a) {
            b[a].style.display = ""
        }
    }
}
function getPosition(b) {
    var a = YUI.u.Event.getXY(b);
    return (a) ? {
        x: a[0],
        y: a[1]
    } : {
        x: 0,
        y: 0
    }
}
function capture_coords(a) {
    zevt = getPosition(a)
}
function set_show_prefs(b, e) {
    var c = YUI.getId(b);
    var a = YUI.getId(e);
    if (!c || !a) {
        return
    } else {
        setCookie("show_" + b, a.checked ? "0" : "1")
    }
    if (b == "li_box") {
        zlishow = !a.checked
    }
}
function textCounter(b, a, c) {
    if (b.value.length > c) {
        b.value = b.value.substring(0, c);
        return false
    } else {
        if (YUI.getId(a)) {
            YUI.getId(a).innerHTML = c - b.value.length
        }
    }
    return true
}
function show_emlakrex_pro_help_box(j, c) {
    var h = YUI.getId("emlakrex_pro_help_sub_module");
    var g = YUI.getId("emlakrex_pro_help_thanks");
    var b = YUI.getId("emlakrex_pro_help_form_box");
    if (h) {
        if (h.value == c) {
            if (g) {
                YUI.u.Dom.removeClass(g, "hidden")
            }
            if (b) {
                YUI.u.Dom.addClass(b, "hidden")
            }
        } else {
            if (g) {
                YUI.u.Dom.addClass(g, "hidden")
            }
            if (b) {
                YUI.u.Dom.removeClass(b, "hidden")
            }
            var f = YUI.getId("us_module");
            if (f) {
                f.value = c
            }
        }
    }
    var a = -140;
    var k = 10;
    pos_menuyu_goster(j, "pro_help_popup", a, k);
    doNothing(j);
    return false
}
function submit_pro_help_popup(u, m, t) {
    var n = YUI.getId("emlakrex_pro_help_sub_module");
    var j = YUI.getId("emlakrex_pro_help_module");
    if (n && j) {
        n.value = j.value
    }
    var p = YUI.getId("emlakrex_pro_help_city").value;
    var b = YUI.getId("emlakrex_pro_help_state_code").value;
    var f = YUI.getId("emlakrex_pro_help_page").value;
    var h = YUI.getId("emlakrex_pro_help_message").value;
    var w = YUI.getId("emlakrex_pro_help_name").value;
    var l = YUI.getId("emlakrex_pro_help_email").value;
    var v = is_valid_email(l);
    if (!v) {
        if (m != 0) {
            if (YUI.getId("emlakrex_pro_help_error")) {
                YUI.u.Dom.removeClass("emlakrex_pro_help_error", "hidden")
            }
            return false
        } else {
            l = ""
        }
    }
    h = h.substr(0, 200);
    var g = "page=" + f + "&comments=" + h + "&e=" + l;
    var c = site_root + "q_email_customer_service.php?" + g;
    var r = YUI.getId("emlakrex_pro_help_message");
    if (r) {
        r.value = ""
    }
    if (m == "0") {
        toggle_menu(t, "pro_help_popup", 0)
    } else {
        var q = getHTTPObject();
        q.open("POST", c, true);
        q.send(null);
        var k = YUI.getId("emlakrex_pro_help_thanks");
        if (k) {
            YUI.u.Dom.removeClass(k, "hidden")
        }
        var a = YUI.getId("emlakrex_pro_help_form_box");
        if (a) {
            YUI.u.Dom.addClass(a, "hidden")
        }
        DOMUtils.hide_selects_by_el("pro_help_popup")
    }
    return false
}
function show_property_map_popup(c, e, b) {
    var h = null;
    if (h = xb_get_element(e + "_static_url")) {
        var f = h.innerHTML;
        if (f != "") {
            h.innerHTML = "";
            var g = /&amp;/gi;
            f = f.replace(g, "&");
            if (h = xb_get_element("static_map_" + e + "_img")) {
                h.src = f
            }
        }
    }
    x = -150;
    y = -340;
    var a = xb_get_element(e + "_static_map");
    add_class("generic_confirmation_popup", "srp_map_popup");
    emlakrex.generic_popup_is_map = true;
    if (a) {
        show_generic_popup(b, a.innerHTML, c, x, y)
    }
    emlakrex.generic_popup_is_map = false
}
function do_email_content(e, b) {
    var F = YUI.getId(b);
    if (!F) {
        return
    }
    var A = F.sp_s_name ? trim(F.sp_s_name.value) : "";
    var p = F.sp_s_email ? trim(F.sp_s_email.value) : "";
    var j = new Array();
    var k = "";
    if (typeof(F.elements["sp_r_email[]"]) != "undefined") {
        var f = F.elements["sp_r_email[]"];
        var E = 0;
        if (f.length) {
            for (var C = 0; C < f.length; C++) {
                k = trim(f[C].value);
                if (is_valid_email(k)) {
                    j[E] = k;
                    ++E
                }
            }
        } else {
            k = trim(f.value);
            if (is_valid_email(k)) {
                j[E] = k;
                ++E
            }
        }
    } else {
        if (F.elements.sp_r_email) {
            k = trim(F.elements.sp_r_email.value);
            if (is_valid_email(k)) {
                j[0] = k
            }
        }
    }
    var t = trim(F.sp_message.value);
    var n = typeof(F.ruid) != "undefined" ? F.ruid.value : 0;
    var I = typeof(F.email_subject) != "undefined" ? trim(F.email_subject.value) : 0;
    var q = F.sp_copy_me.checked ? "Y" : "";
    if (e == "property") {
        var H = F.sp_propertyId.value;
        var w = false;
        if (typeof(F.is_rental_community) != "undefined") {
            var w = true
        }
        var z = F.sp_city.value;
        var h = F.sp_state.value;
        var m = F.sp_listingtype.value;
        var a = (typeof(F.u_save_property) != "undefined" && F.u_save_property.checked == true) ? true : false
    } else {
        if (e == "contact_agent") {
            var H = F.sp_propertyId.value
        } else {
            if (e == "url") {
                var g = F.sp_url.value
            }
        }
    }
    if (e == "contact_user") {
        if (t == "") {
            alert("Please enter a message.");
            if (F.sp_message) {
                F.sp_message.focus()
            }
            return false
        }
    } else {
        var u = 0;
        for (var C = 0; C < j.length; ++C) {
            var r = j[C];
            if (r != "" && !is_valid_email(r)) {
                bad_email_alert();
                if (typeof(F["sp_r_email[]"]) != "undefined" && !F["sp_r_email[]"].length) {
                    F["sp_r_email[]"].focus()
                } else {
                    if (typeof(F.sp_r_email) != "undefined") {
                        F.sp_r_email.focus()
                    }
                }
                return false
            } else {
                if (r != "") {
                    ++u
                }
            }
        }
        if (u < 1) {
            bad_email_alert();
            if (typeof(F["sp_r_email[]"]) != "undefined" && !F["sp_r_email[]"].length) {
                F["sp_r_email[]"].focus()
            } else {
                if (typeof(F.sp_r_email) != "undefined") {
                    F.sp_r_email.focus()
                }
            }
            return false
        }
        if (p != "" && !is_valid_email(p)) {
            bad_email_alert();
            F.sp_s_email.focus();
            return false
        }
        if (p == "" || j.length < 1) {
            bad_email_alert();
            if (j.length < 1) {
                if (typeof(F["sp_r_email[]"]) != "undefined" && !F["sp_r_email[]"].length) {
                    F["sp_r_email[]"].focus()
                } else {
                    if (typeof(F.sp_r_email) != "undefined") {
                        F.sp_r_email.focus()
                    }
                }
            } else {
                F.sp_s_email.focus()
            }
            return false
        }
    }
    var v = location.href;
    var D = new Date();
    var G;
    var c = "s=" + D.valueOf() + "&copyme=" + q + "&s_email=" + encodeURIComponent(p) + "&s_name=" + encodeURIComponent(A) + "&message=" + encodeURIComponent(t);
    if (YUI.getId("sp_optin")) {
        c += YUI.getId("sp_optin").checked ? "&optin=Y" : "&optin=N"
    }
    for (var C = 0; C < j.length; ++C) {
        c += "&r_email[" + C + "]=" + encodeURIComponent(j[C].toLowerCase())
    }
    switch (e) {
    case "property":
        G = site_root + "email_page_property.php";
        c += "&propertyId=" + encodeURIComponent(H) + "&lt=" + encodeURIComponent(m);
        c += "&city=" + encodeURIComponent(z) + "&state=" + encodeURIComponent(h);
        if (w) {
            c += "&is_rental_community=true"
        }
        if (v) {
            c += "&current_url=" + encodeURIComponent(v)
        }
        break;
    case "url":
        G = site_root + "Sorgu/email_page_url/";
        if (typeof(F.qid) != "undefined" && parseInt(F.qid.value) > 0) {
            c += "&qid=" + encodeURIComponent(F.qid.value)
        }
        c += "&u=" + encodeURIComponent(g) + "&t=" + encodeURIComponent(document.title);
        break;
    case "property_list":
        G = site_root + "email_list.php";
        c += "&s=1&ptype=" + F.ptype.value;
        break;
    case "contact_user":
        G = site_root + "Sorgu/q_email_user/";
        c += "&s=1&ruid=" + encodeURIComponent(n) + "&t=" + encodeURIComponent(I);
        break;
    case "contact_agent":
        G = site_root + "Sorgu/q_email_agent/";
        c += "&propertyId=" + encodeURIComponent(H);
        var l = F.sp_s_phone ? trim(F.sp_s_phone.value) : "";
        if (l != "") {
            c += "&phone=" + encodeURIComponent(l)
        }
        break;
    default:
        return
    }
    var B = getHTTPObject();
    B.open("POST", G, true);
    B.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    B.send(c);
    B.onreadystatechange = function () {
        if (B.readyState == 4) {
            var K = B.responseText;
            var M;
            switch (K) {
            case "1":
              /*  if (e == "contact_user" || e == "contact_agent") {
                    _pageTracker(e)
                }*/
                M = "Tebrikler!  E-Postanız gönderilmiştir.";
                break;
            case "-1":
                M = "Sorry&#8212An error occurred while sending your email.";
                break;
            default:
               /* if (e == "contact_user" || e == "contact_agent") {
                    _pageTracker(e)
                }*/
                M = "Thank you.";
                break
            }
            if (e == "property" && F.id == "email_property_form") {
                if (a && !_emlakrex_logged_in) {
                    destroy_popup("contact_send_to_friend_popup");
                    show_login(null, "send_to_friend_save_property", true)
                } else {
                    DOMUtils.fill_element("send_property_to_friend_email_popup_popup_header", "Tebrikler! ");
                    DOMUtils.fill_element("send_property_email_box_status_msg", "Mesajınız gönderildi.");
                    hide("send_property_email_box_form");
                    remove_class("send_property_mail_box_status", "gone");
                    if (a && _emlakrex_logged_in && typeof(save_this_property) == "function") {
                        save_this_property()
                    }
                }
            } else {
                DOMUtils.fill_element("email_box_status_msg", M);
                hide("email_box_form");
                unhide("email_box_status")
            }
            _num_friend_emails = 1;
            var J = YUI.getId("email_box");
            if (J) {
                DOMUtils.hide_selects_by_el(J);
                J.style.height = "";
                if (e == "url" && F.id == "send_url_form") {
                    var L = YUI.getId("send_page_to_friend_popup");
                    if (L) {
                        DOMUtils.hide_selects_by_el(L)
                    }
                }
            } else {
                var L = YUI.getId("send_property_to_friend_email_popup");
                if (L) {
                    DOMUtils.hide_selects_by_el(L)
                }
            }
            clear_form(F);
            YUI.getId("sp_copy_me").checked = false
        }
    }
}
function reset_email_box(a) {
    if (a == "property") {
        DOMUtils.fill_element("send_property_to_friend_email_popup_popup_header", "Bu emlağı arkadaşına gönder!");
        DOMUtils.set_value("sp_message", "");
        unhide("send_property_email_box_form");
        add_class("send_property_mail_box_status", "gone")
    }
}
function build_email_property_div(j, f, k, h, g, e, a) {
    if (typeof(g) == "undefined") {
        g = "Satılık"
    }
    var b = YUI.getId("email_property_url");
    var c;
    if (!b && typeof(f) == "undefined") {
        return
    }
    if (typeof(f) != "undefined") {
        c = site_root + "email_page_property.php?type=" + encodeURIComponent(g) + "&propertyId=" + encodeURIComponent(f);
        if (typeof(e) != "undefined" && typeof(a) != "undefined") {
            c += "&city=" + encodeURIComponent(e) + "&state=" + encodeURIComponent(a)
        }
    } else {
        c = site_root + "email_page_property.php?" + b.value
    }
    if (k != "-1" && h != "-1") {
        build_email_div(j, "property", c, k, h)
    } else {
        build_email_div(j, "property", c)
    }
}
function build_email_page_url(h, b, c, j, a, k) {
    if (typeof(b) == "undefined" || !b) {
        var b = location.href
    }
    var f = clone_obj(h);
    doNothing(h);
    var g = new QAjax();
    g.set_value("u", b);
    g.set_value("t", c);
    if (typeof(j) != "undefined" && j) {
        g.set_value("qid", j)
    }
    g.set_script_info({
        script: "Sorgu/email_page_url/",
        method: "get",
        output: "text"
    });
    g.set_callback(function (e) {
        if (typeof(e) == "undefined" || !e) {
            return false
        }
        var l = YUI.getId("email_box");
        if (l) {
            l.parentNode.removeChild(l)
        }
        l = document.createElement("div");
        l.id = "email_box";
        l.innerHTML = e;
        document.body.appendChild(l);
        pos_menuyu_goster(f, "send_page_to_friend_popup", -380, 10)
    });
    g.go()
}
function build_email_div(g, e, a, j, f) {
    close_modals_except("email_box");
    var l = clone_obj(g);
    doNothing(g);
    var h = YUI.getId("email_box");
    if (h) {
        h.parentNode.removeChild(h)
    }
    var c = document.createElement("div");
    document.body.appendChild(c);
    var b, m;
    switch (e) {
    case "page_url":
        b = 302;
        break;
    case "property":
        b = 432;
        break;
    case "property_list":
        b = 335;
        break;
    default:
        return
    }
    c.id = "email_box";
    c.style.display = "inline";
    var k = getHTTPObject();
    k.open("POST", a, true);
    k.onreadystatechange = function () {
        if (k.readyState == 4) {
            c.innerHTML = k.responseText;
            c.className = "drop_shadow";
            c.style.position = "absolute";
            c.style.zIndex = "1600";
            c.style.width = b + "px";
            if (typeof(j) != "undefined" || typeof(f) != "undefined") {
                pos_menuyu_goster(l, "email_box", j, f)
            } else {
                if (e == "page_url") {
                    pos_menuyu_goster(l, "email_box", -b, 10)
                } else {
                    if (e == "property") {
                        pos_menuyu_goster(l, "email_box", -50, -241)
                    } else {
                        if (e == "property_list") {
                            pos_menuyu_goster(l, "email_box", 0, 0)
                        } else {
                            pos_menuyu_goster(l, "email_box", -50, -341)
                        }
                    }
                }
            }
        }
    };
    k.send(null)
}
function add_friend_edit(k, j, h, c, l) {
    var n = YUI.getId(k);
    if (!n) {
        return false
    }
    var m = YUI.getId(j);
    if (!m) {
        return false
    }
    if (typeof(h) == "undefined") {
        h = "popup"
    }
    if (c == undefined) {
        c = "sp_r_email[]"
    }
    if (l == undefined) {
        l = _max_num_friend_emails
    }
    var f = m.elements[c];
    if (!f) {
        return false
    }
    if (f.length) {
        el = f[f.length - 1];
        var g = f.length
    } else {
        el = f;
        var g = 1
    }
    if (!is_valid_email(el.value)) {
        alert("Lütfen E-Posta adresinizi giriniz before adding another one.");
        return false
    }
    if (g >= l) {
        return false
    }++_num_friend_emails;
    var a = "friend_email_" + _num_friend_emails;
    var b = build_friend_edit(_num_friend_emails, a, h);
    var e = $$("div", b, a);
    n.appendChild(e);
    YUI.getId(a).focus()
}
function build_friend_edit(a, f, b) {
    var c = "";
    var e = '<a class="delete_link" href="javascript:remove_friend_edit(\'' + f + "')\">[x]</a>";
    switch (b) {
    case "details_send_property":
        c = '<div class="input_row_label">Friend\'s email:</div><div class="input_row_input"><div class="clearfix"><div class="fleft"><input id="sp_r_email" name="sp_r_email[]" type="text" value="" /></div><div class="fleft padt5">' + e + "</div>";
        break;
    case "qa":
        c = '<span style="float:left;width:300px"><input type="text" size="25" style="width:265px;" id="' + f + '" name="sp_r_email[]" />' + e + "</span>";
        break;
    case "clr":
        c = '<div><input type="text" name="recipient_name[' + a + ']" value="Recipient\'s name" style="width: 200px;" class="client_text_box disabled_txt mart5" ';
        c = c + "onfocus=\"handle_edit_box(this,'Recipient\\'s name',true);\" onblur=\"handle_edit_box(this,'Recipient\\'s name',false);\"> ";
        c = c + '<input type="text" name="recipient_email[' + a + ']" value="Recipient\'s email" style="width: 200px; margin-left: 15px;" class="client_text_box disabled_txt mart5" ';
        c = c + "onfocus=\"handle_edit_box(this,'Recipient\\'s email',true);\" onblur=\"handle_edit_box(this,'Recipient\\'s email',false);\"> ";
        c = c + '<input id="recipient_schedule_cb_' + a + '" type="checkbox" checked="checked" name="recipient_schedule[' + a + ']" /> <label class="f11" for="recipient_schedule_cb_' + a + '"">Email weekly</label>&nbsp;&nbsp;&nbsp;<a class="delete_link tiny" href="#" onclick="remove_friend_edit(\'' + f + "');return false\">[x]</a></div>";
        break;
    case "popup":
    default:
        c = '<input type="text" value="" name="sp_r_email[]" />&nbsp;' + e
    }
    return c
}
function remove_friend_edit(b) {
    var a = YUI.getId(b);
    if (a) {
        a.parentNode.removeChild(a)
    }
}
function close_email_property_window() {
    var a = YUI.getId("send_property_to_friend_email_popup");
    if (a) {
        add_class("send_property_mail_box_status", "gone");
        unhide("send_property_email_box_form");
        toggle_menu(null, a, 0)
    }
    a = YUI.getId("email_box");
    if (a) {
        hide("email_box_status");
        unhide("email_box_form");
        toggle_menu(null, a, 0)
    }
}
function close_email_search_window() {
    if (!YUI.getId("email_search_box")) {
        return
    }
    hide("email_search_box_status");
    unhide("email_search_box_form");
    hide("email_search_box")
}
function close_modals_except(a) {
    switch (a) {
    case "email_box":
        if (emlakrex.report_listing) {
            emlakrex.report_listing.close()
        }
        set_show_prefs("li_box", "li_show");
        hide("li_box");
        break;
    case "error_box":
        set_show_prefs("li_box", "li_show");
        hide("li_box");
        close_email_property_window();
        break;
    case "login_box_c":
        if (emlakrex.report_listing) {
            emlakrex.report_listing.close()
        }
        close_email_property_window();
        close_email_search_window();
        break;
    case "email_search_box":
        if (_emlakrex_lf && _emlakrex_lf.popup) {
            destroy_popup("login_box")
        }
        hide("ea_form_top");
    default:
        break
    }
}
function cloneObject(a) {
    for (i in a) {
        this[i] = a[i]
    }
}
if (!Array.indexOf) {
    Array.prototype.indexOf = function (c) {
        var a = this.length;
        for (var b = 0; b < a; b++) {
            if (this[b] == c) {
                return b
            }
        }
        return -1
    }
}
Array.prototype.contains = function (a) {
    return this.indexOf(a) != -1
};
Array.prototype.unique = function (c) {
    var a = this.length;
    var b = new Array();
    while (a--) {
        if (b.indexOf(this[a]) == -1) {
            b.push(this[a])
        }
    }
    return b.reverse()
};

function in_array(c, b) {
    return b.indexOf(c) != -1
}
function array_unique(b) {
    return b.unique()
}
function get_array_index(c, b) {
    return b.indexOf(c)
}
function f_clientSize() {
    var a = new Object;
    a.width = f_clientWidth();
    a.height = f_clientHeight();
    a.scrollLeft = f_scrollLeft();
    a.scrollTop = f_scrollTop();
    return a
}
function f_clientWidth() {
    return f_filterResults(window.innerWidth ? window.innerWidth : 0, document.documentElement ? document.documentElement.clientWidth : 0, document.body ? document.body.clientWidth : 0)
}
function f_clientHeight() {
    return f_filterResults(window.innerHeight ? window.innerHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0, document.body ? document.body.clientHeight : 0)
}
function f_scrollLeft() {
    return f_filterResults(window.pageXOffset ? window.pageXOffset : 0, document.documentElement ? document.documentElement.scrollLeft : 0, document.body ? document.body.scrollLeft : 0)
}
function f_scrollTop() {
    return f_filterResults(window.pageYOffset ? window.pageYOffset : 0, document.documentElement ? document.documentElement.scrollTop : 0, document.body ? document.body.scrollTop : 0)
}
function f_filterResults(e, b, a) {
    var c = e ? e : 0;
    if (b && (!c || (c > b))) {
        c = b
    }
    return a && (!c || (c > a)) ? a : c
}
function get_ids_with_prefix(a, f) {
    var c = new Array();
    var g = document.getElementsByTagName(a);
    for (var b = 0; b < g.length; ++b) {
        if (g[b].id && g[b].id.indexOf(f) == 0) {
            c.push(g[b].id)
        }
    }
    return c
}
function toggle_search_dropdown(b, g, f) {
    if (typeof("suffix") == "undefined" || !f) {
        f = ""
    }
    var e = "t_navsearch_arrow" + f;
    var c = "search_type_dropdown" + f;
    var a = "pressed";
    if (g) {
        YUI.u.Dom.removeClass(e, a);
        return
    }
    if (YUI.u.Dom.hasClass(e, a) || YUI.getId(c).style.display != "none") {
        YUI.u.Dom.removeClass(e, a)
    } else {
        YUI.u.Dom.addClass(e, a)
    }
    if (YUI.getId(c).style.display == "none" || YUI.u.Dom.hasClass(c, "hidden")) {
        YUI.u.Dom.addClass(e, a)
    }
    toggle_menu(b, c)
}
function toggle_search_type(j, h, l) {
    var c = YUI.getId("t_search_type" + l);
    var f = "h";
    var b = zsbdef;
    if (c && !h) {
        var h = "h"
    }
    if (c && h) {
        f = c.value;
        c.value = h;
        if (f == "h" && h != "h") {
            var e = YUI.getId("t_navsearch" + l);
            e.value = "";
            handle_edit_box(e, t_navsearch_text, false)
        }
        if (h == "h" || h == "r") {
            YUI.u.Dom.removeClass("top_nav_as" + l, "hidden");
            YUI.getId("top_nav_as" + l).href = site_root + "advanced/" + (h == "r" ? "rent/" : "city/");
            b = zsbdef3
        } else {
            if (h == "v" || h == "f") {
                YUI.u.Dom.addClass("t_navsearch_keyword" + l, "t_navsearch_voice_text_width disabled_txt");
                YUI.u.Dom.addClass("t_navsearch" + l, "t_navsearch_voice_text_width");
                YUI.u.Dom.addClass("top_nav_as" + l, "hidden");
                YUI.u.Dom.removeClass("t_navsearch_keyword" + l, "hidden");
                var k = YUI.getId("t_navsearch_keyword" + l);
                if (k) {
                    k.value = zsbdef4
                }
                var a = YUI.getId("navform" + l);
                if (a) {
                    a.setAttribute("action", site_root + "Sorgu/voices_validate/")
                }
            } else {
                YUI.u.Dom.addClass("top_nav_as" + l, "hidden");
                b = zsbdef
            }
        }
        if (h != "v" && h != "f") {
            YUI.u.Dom.addClass("t_navsearch_keyword" + l, "hidden");
            YUI.u.Dom.removeClass("t_navsearch_keyword" + l, "t_navsearch_voice_text_width");
            YUI.u.Dom.removeClass("t_navsearch" + l, "t_navsearch_voice_text_width");
            var a = YUI.getId("navform" + l);
            if (a) {
                a.setAttribute("action", site_root + "Sorgu/validate/")
            }
        }
        var g = YUI.getId("t_navsearch" + l);
        if (g) {
            if (YUI.u.Dom.hasClass(g, "disabled_txt")) {
                g.value = b
            }
            t_navsearch_text = b
        }
    }
    var c = YUI.getId("t_navsearch_label" + l);
    if (c && j) {
        c.innerHTML = j
    }
    toggle_search_dropdown(null, false, l);
    YUI.u.Dom.removeClass("navsearch_option_" + f + l, "black");
    YUI.u.Dom.removeClass("navsearch_option_" + f + l, "bold");
    YUI.u.Dom.addClass("navsearch_option_" + h + l, "black");
    YUI.u.Dom.addClass("navsearch_option_" + h + l, "bold")
}
emlakrex.sort_by_click = function (f, a) {
    if (!a) {
        var c = YUI.u.Event.getTarget(f, 1)
    } else {
        var c = a
    }
    if (c.tagName.toLowerCase() != "li") {
        return false
    }
    if (emlakrex.selected_sort) {
        remove_class(emlakrex.selected_sort, "selected")
    }
    emlakrex.selected_sort = c;
    add_class(emlakrex.selected_sort, "selected");
    var b = YUI.u.Dom.getAttribute(c, "value");
    if (!a && !YUI.u.Dom.hasClass(c, "not_isyeri")) {
        emlakrex.previous_sort = {}
    }
      if (!a && !YUI.u.Dom.hasClass(c, "not_arsa")) {
        emlakrex.previous_sort = {}
    }
    var g = c.innerHTML;
    YUI.getId("sort_by_selected").innerHTML = g;
    if (!a) {
        toggle_menu(f, "sort_by_dropdown")
    }
    return b
};

function close_all_menus(a) {
    if (typeof(a) == "undefined") {
        var a = window.event
    }
    if (is_IE6() && a) {
        doNothing(a)
    }
    toggle_menu(a, mutexes[_MENU_MUTEX], 0);
    release_mutex(_MENU_MUTEX);
    toggle_search_dropdown(a, true);
    toggle_search_dropdown(a, true, "_footer")
}
var hide_menu_event = new YUI.u.CustomEvent("HideOldSchoolPopup");

function toggle_menu(c, a, b) {
    var f = YUI.getId(a);
    if (typeof(hide_menu_event) != "undefined" && (typeof(a) != "undefined" && a) && b == 0) {
        hide_menu_event.fire()
    }
    if (!f) {
        return
    }
    if (typeof(c) != "undefined" && c) {
        doNothing(c)
    }
    if (f.id.indexOf("login_box") > -1) {
        login_next_step_global = ""
    }
    if ((f.style.display == "none" || YUI.u.Dom.hasClass(f, "hidden")) && b !== 0 || b === 1 || b === 3) {
        if (b != 3 && !set_mutex(_MENU_MUTEX, a)) {
            hlt_menu(c, YUI.getId(mutexes[_MENU_MUTEX]), 0);
            hide(mutexes[_MENU_MUTEX]);
            release_mutex(_MENU_MUTEX)
        }
        unhide(a, "");
        hlt_menu(c, f, 2);
        if (b != 3) {
            set_mutex(_MENU_MUTEX, a)
        }
        if (is_IE6()) {
            DOMUtils.hide_selects_by_el(f)
        }
        return
    } else {
        if (f.style.display != "none" && !YUI.u.Dom.hasClass(f, "hidden") && b !== 1 || b === 0) {
            release_mutex(_MENU_MUTEX);
            unhide_selects();
            if (emlakrex._popup_panel_cache && emlakrex._popup_panel_cache[a]) {
                if (a == "login_box") {
                    destroy_popup("login_box")
                } else {
                    emlakrex._popup_panel_cache[a].hide()
                }
            } else {
                hide_all_open_popups();
                hide(a);
                hlt_menu(c, f, 0)
            }
        }
    }
}
function set_safe_popup_coords(B, C, m, k, c, f) {
    var A = {
        top: 0,
        left: 0
    };
    var D = f_clientWidth();
    var w = f_scrollLeft();
    var l = f_clientHeight();
    var a = f_scrollTop();
    var v = 40;
    var b = YUI.getId(C);
    if (!b) {
        return
    }
    var h = {
        x: 0,
        y: 0
    };
    if (B != null) {
        var h = getPosition(B)
    }
    var z = get_object_dimensions(b);
    if (!f && b.id != "f_rss" && b.id != "rss_pulldown" && b.id != "srp_property_compare_popup") {
        var j = f_clientSize();
        var u = Math.round((j.width - z.width) / 2);
        if (u < 0) {
            u = 0
        }
        var t = Math.round((j.height - z.height) / 2);
        if ((t + j.scrollTop) < 0) {
            t = 0
        }
        t += j.scrollTop;
        var n = YUI.u.Dom.getY("top_nav");
        if (n) {
            n += 40
        }
        if (n && t < n) {
            t = n
        }
        b.style.left = u + "px";
        b.style.top = t + "px";
        A.top = t;
        A.left = u
    } else {
        var p = (h.y ? h.y : 0) + (typeof(k) != "undefined" && k != 0 ? k : 5);
        var q = z.height;
        p = get_safe_coord(p, q, l, a, v);
        A.top = p;
        b.style.top = p + "px";
        var g = (h.x ? h.x : 0) + (typeof(m) != "undefined" && (c || m != 0) ? m : 5);
        var r = z.width;
        g = get_safe_coord(g, r, D, w, v);
        A.left = g;
        b.style.left = g + "px"
    }
    return A
}
function get_safe_coord(f, e, c, a, b) {
    if ((f + e + b) > c + a) {
        f = c + a - (e + b);
        if (f < a) {
            f = a + 10
        }
    }
    if (f < 0) {
        f = b
    }
    return f
}
var on_pos_menu_event = new YUI.u.CustomEvent("ShowOldSchoolPopup");

function pos_menuyu_goster(h, a, l, j, b, f) {
    if (on_pos_menu_event) {
        on_pos_menu_event.fire()
    }
    toggle_menu(h, a, 1);
    var c = YUI.getId(a);
    if (c && c.style.display != "none" && !YUI.u.Dom.hasClass(c, "hidden")) {
        var k = set_safe_popup_coords(h, c, l, j, b, f);
        var g = c.style.position.toLowerCase();
        if (g != "absolute" && g != "relative") {
            c.style.position = "absolute"
        }
        if (is_IE6()) {
            unhide_selects();
            DOMUtils.hide_selects_by_el(c)
        }
    }
}
function hlt_menu(c, f, b) {
    var a = f.previousSibling;
    if (typeof(a) == "undefined" || !a || typeof(a.className) == "undefined" || !YUI.u.Dom.hasClass(a, "menu_title")) {
        return
    }
    switch (b) {
    case 1:
        a.className = "menu_title_h";
        break;
    case 2:
        a.className = "menu_title_active";
        break;
    case 0:
    default:
        a.className = "menu_title";
        break
    }
}
function gcb_set_status(b, a) {
    if (YUI.getId(b)) {
        YUI.getId(b).src = YUI.getId("icon_cb_" + (a ? "c" : "u")).src
    }
}
function mapReady() {
    return (typeof(T_MAP) != "undefined" && T_MAP.map_initialized)
}
function toggle_plots(e, b) {
    if (typeof(zp_on_map) == "undefined") {
        return
    }
    if (e != "forsale" && e != "isyeri"&& e != "arsa" && e != "neighborhood_icon" && e != "school") {
        return
    }
    var a = (zp_on_map[e] ? "off" : "on");
    if (e == "school" && typeof(zp_sdid) != "undefined" && zp_sdid.length > 0) {
        for (var c = 0; c < zp_sdid.length; c++) {
            toggleMarkers("school", a, zp_sdid[c])
        }
    } else {
        toggleMarkers(e, a);
        if (YUI.getId("location_info")) {
            var f = "Showing <strong>Satılık Emlak</strong> in " + the_location_name;
            YUI.getId("location_info").innerHTML = f
        }
    }
    zp_on_map[e] = !zp_on_map[e];
    if (YUI.getId("plot_" + e)) {
        if (zp_on_map[e]) {
            YUI.getId("plot_" + e).innerHTML = "Hide";
            gcb_set_status("cb_p_" + e, true)
        } else {
            YUI.getId("plot_" + e).innerHTML = "See";
            gcb_set_status("cb_p_" + e, false)
        }
    }
    if (b) {
        gcb_set_status(b, zp_on_map[e])
    }
    if (typeof(ztop5active) != "undefined" && e == "forsale") {
        reset_top5_menus();
        ztop5active = null
    }
}
function set_search_type(a, e, f) {
    YUI.getId(a + "search_type").value = e;
    var c = Array("h", "g", "m");
    for (var b = 0; b < 3; ++b) {
        if (e == c[b]) {
            if (!f) {
                YUI.getId(a + "srch_" + c[b]).className = "search_tab search_tab_highlight"
            } else {
                YUI.getId(a + "srch_" + c[b]).className = "active"
            }
        } else {
            if (!f) {
                YUI.getId(a + "srch_" + c[b]).className = "search_tab"
            } else {
                YUI.getId(a + "srch_" + c[b]).className = ""
            }
        }
    }
}
function Queue(a) {
    this.elements = new Array();
    this.size = (typeof(a) != "undefined" && parseInt(a) > 0 ? parseInt(a) : 5);
    this.allow_dupes = false;
    this.cursor = 0
}
Queue.prototype.set_allow_dupes = function (a) {
    this.allow_dupes = a
};
Queue.prototype.set_size = function (a) {
    this.size = parseInt(a)
};
Queue.prototype.clear = function () {
    this.elements = new Array()
};
Queue.prototype.is_full = function () {
    return (this.get_size() >= this.size)
};
Queue.prototype.is_empty = function () {
    return (this.get_size() < 1)
};
Queue.prototype.add = function (a) {
    if (!this.is_full() && (this.allow_dupes || !this.contains(a))) {
        this.elements.push(a)
    }
};
Queue.prototype.contains = function (a) {
    return this.elements.contains(a)
};
Queue.prototype.get_size = function () {
    return this.elements.length
};
Queue.prototype.remove = function (c) {
    var f = this.get_size();
    if (f < 1) {
        return
    }
    var b = new Array();
    var e = false;
    for (var a = 0; a < f; ++a) {
        if (this.elements[a] == c) {
            e = true;
            continue
        } else {
            b.push(this.elements[a])
        }
    }
    this.elements = b;
    b = null;
    return e
};
Queue.prototype.it_next_element = function () {
    if (this.cursor >= this.get_size()) {
        return false
    } else {
        return this.elements[this.cursor++]
    }
};
Queue.prototype.it_start = function () {
    this.cursor = 0
};
var save_queue = new Queue();
var sub_queue = new Queue();
var sub_recent_queue = new Queue();
var alert_queue = new Queue();
var price_queue = new Queue();

function release_mutex(a) {
    set_mutex(a, null)
}
function is_mutex_free(a) {
    return (typeof(mutexes[a]) == "undefined" || mutexes[a] == null)
}
function set_mutex(a, b) {
    if (!is_mutex_free(a) && b != null) {
        return false
    } else {
        mutexes[a] = b;
        return true
    }
}
function newli(b) {
    var a = document.createElement("li");
    a.className = "small";
    a.innerHTML = b;
    return a
}
function query_available_heat_maps(c, b) {
    if (typeof(b) == "undefined") {
        var b = ""
    }
    if (b == zhmsbdef) {
        b = ""
    }
    if (!b) {
        YUI.getId("hm_location").value = ""
    }
    if (typeof(c) == "undefined") {
        var c = ""
    }
    if (b == "" && c == "") {
        YUI.getId("hm_search_form").submit();
        return true
    }
    var a = site_root + "q_available_heat_maps.php?s=" + encodeURIComponent(c) + "&l=" + encodeURIComponent(b);
    var e = getHTTPObject();
    e.open("POST", a, true);
    e.onreadystatechange = function () {
        if (e.readyState == 4) {
            var h = e.responseText;
            var g = h.split("|");
            var f = g[0];
            if (f == "1") {
                if (YUI.getId("hm_location") && g.length > 1) {
                    YUI.getId("hm_location").value = b + " County"
                }
                YUI.getId("hm_search_form").submit();
                return true
            } else {
                return false
            }
        }
    };
    e.send(null);
    return false
}
var num_of_times_carousel_nav_buttons_clicked = 0;
var NUM_OF_CLICKS_TO_TRIGGER_AD_REFRESH = 2;

function details_ad_ad_refresh_to_nav_clicks(g, b, a, l, p, u, e, m, q, k, f, j, h, n, t) {
    if (el = YUI.getId("listing_carousel_previous")) {
        var c = el.onclick;
        el.onclick = function () {
            c();
            refresh_details_ad_iframe(g, b, a, l, p, u, e, m, q, k, f, j, h, n, t)
        }
    }
    if (el = YUI.getId("listing_carousel_next")) {
        var r = el.onclick;
        el.onclick = function () {
            r();
            refresh_details_ad_iframe(g, b, a, l, p, u, e, m, q, k, f, j, h, n, t)
        }
    }
}
function refresh_details_ad_iframe(g, b, a, l, q, u, c, n, r, k, e, j, h, p, t) {
    if (++num_of_times_carousel_nav_buttons_clicked == NUM_OF_CLICKS_TO_TRIGGER_AD_REFRESH) {
        num_of_times_carousel_nav_buttons_clicked = 0;
        var m = new Date();
        var f = site_root + "Sorgu/q_details_reload_right_ad/?city=" + encodeURIComponent(g) + "&state=" + encodeURIComponent(b) + "&nh=" + encodeURIComponent(a) + "&county=" + encodeURIComponent(l) + "&zip=" + encodeURIComponent(q) + "&type=" + encodeURIComponent(u) + "&bed=" + encodeURIComponent(c) + "&bath=" + encodeURIComponent(n) + "&price=" + encodeURIComponent(k) + "&list_type=" + encodeURIComponent(e) + "&site_id=" + encodeURIComponent(r) + "&is_foreclosure=" + encodeURIComponent(j) + "&status=" + encodeURIComponent(h) + "&dma=" + encodeURIComponent(p) + "&loc=" + encodeURIComponent(t);
        if (el = YUI.getId("ad_rside_content")) {
            el.src = f
        }
    }
}
function kill(b) {
    var a = YUI.getId(b);
    if (a) {
        a.parentNode.removeChild(a)
    }
}
function EditBox(c, h, g) {
    this.id = c;
    this.saved_contents = "";
    this.max_length = 1500;
    this.container = document.createElement("div");
    this.container.id = "eb_container_" + this.id;
    this.container.className = "editor";
    var f = document.createElement("textarea");
    f.className = "editor_textarea";
    f.cols = 90;
    f.rows = 3;
    f.value = "new editor";
    this.container.appendChild(f);
    var j = document.createElement("p");
    this.container.appendChild(j);
    var a = document.createElement("a");
    a.className = "editor_link";
    a.href = "javascript:_editor.save()";
    a.innerHTML = "[+]&nbsp;Save";
    j.appendChild(a);
    var b = document.createElement("a");
    b.className = "editor_link";
    b.href = "javascript:_editor.cancel()";
    b.innerHTML = "[x]&nbsp;Cancel";
    j.appendChild(b);
    if (g) {
        var e = document.createElement("a");
        e.className = "delete_link editor_link";
        e.href = "javascript:_editor.delete_note()";
        e.innerHTML = "[-]&nbsp;Temizle";
        j.appendChild(e)
    }
    this.editor = this.get_editor();
    if (h != null) {
        this.add_to_parent(h);
        this.focus_editor()
    }
}
EditBox.prototype.destroy = function () {
    kill(this.container.id);
    release_mutex(_EDITOR_MUTEX);
    _editor = null
};
EditBox.prototype.get_editor = function () {
    return this.container.firstChild
};
EditBox.prototype.check_size = function () {
    return (trim(this.get_editor().value).length <= this.max_length)
};
EditBox.prototype.focus_editor = function () {
    this.editor.focus()
};
EditBox.prototype.is_dirty = function () {
    return (this.saved_contents != this.get_contents())
};
EditBox.prototype.save = function () {
    if (this.get_length() > this.max_length) {
        alert("Your note is a bit long. We'll have to truncate it.")
    }
    this.save_action(this)
};
EditBox.prototype.delete_note = function () {
    this.delete_action(this)
};
EditBox.prototype.cancel = function () {
    this.cancel_action(this)
};
EditBox.prototype.set_save_action = function (a) {
    this.save_action = a
};
EditBox.prototype.set_cancel_action = function (a) {
    this.cancel_action = a
};
EditBox.prototype.set_delete_action = function (a) {
    this.delete_action = a
};
EditBox.prototype.get_contents = function () {
    return trim(this.editor.value)
};
EditBox.prototype.get_length = function () {
    return trim(this.editor.value).length
};
EditBox.prototype.get_id = function () {
    return this.id
};
EditBox.prototype.add_to_parent = function (a) {
    if (YUI.getId(a)) {
        YUI.getId(a).appendChild(this.container)
    }
};
EditBox.prototype.set_contents = function (a) {
    this.editor.value = a
};
EditBox.prototype.set_undo_contents = function (a) {
    this.saved_contents = a
};
EditBox.prototype.undo = function (a) {
    this.set_contents(this.saved_contents)
};
EditBox.prototype.insert_at_caret = function (b) {
    if (document.selection) {
        this.focus_editor();
        var a = document.selection.createRange();
        a.text = b
    } else {
        if (this.editor.selectionStart || this.editor.selectionStart == "0") {
            this.editor.value = this.editor.value.substring(0, this.editor.selectionStart) + b + this.editor.value.substring(this.editor.selectionEnd)
        } else {
            this.editor.value += b
        }
    }
    this.focus_editor()
};

function check_editor() {
    if (is_mutex_free(_EDITOR_MUTEX)) {
        return true
    }
    if (!(_editor.is_dirty())) {
        return true
    }
    save_property_note(_editor);
    return true
}
function edit_property_note(c) {
    if (set_mutex(_EDITOR_MUTEX, c)) {
        var b = YUI.getId("note_c_" + c).innerHTML;
        var a = (b != "");
        hide("note_c_" + c);
        _editor = new EditBox(c, "note_container_" + c, a);
        _editor.set_contents(html_to_txt_br(b));
        _editor.set_undo_contents(b);
        _editor.set_save_action(function (e) {
            save_property_note(e, "save")
        });
        _editor.set_delete_action(function (e) {
            save_property_note(e, "delete")
        });
        _editor.set_cancel_action(function (e) {
            cancel_property_note(e)
        });
        hide("note_edit_link_container_" + c)
    } else {
        if (!_editor.is_dirty() || _editor.get_contents() == "") {
            cancel_property_note(_editor);
            edit_property_note(c)
        } else {
            save_property_note(_editor, "save", function () {
                edit_property_note(c)
            })
        }
    }
}
function save_property_note(g, a, b) {
    var e = g.get_id();
    var j = g.get_contents();
    if (j == "" && a != "delete") {
        g.focus_editor();
        return false
    }
    var c = site_root + "q_save_property_note.php";
    var f = "pid=" + encodeURIComponent(e) + "&utkn=" + encodeURIComponent(utkn);
    if (a == "delete") {
        f += "&action=delete"
    } else {
        f += "&n=" + encodeURIComponent(j)
    }
    var k = function (t) {
        var p = t.responseXML;
        if (p && p.documentElement) {
            var m = p.documentElement.getElementsByTagName("note")[0];
            var n = m.getAttribute("s");
            var l = m.getAttribute("n");
            var r = m.getAttribute("tsc");
            var q = m.getAttribute("tse");
            if (n == "1") {
                g.destroy();
                YUI.getId("note_c_" + e).innerHTML = txt_to_html_br(l);
                unhide("note_c_" + e);
                if (a == "delete") {
                    hide("note_header_" + e);
                    YUI.getId("note_c_" + e).innerHTML = "";
                    YUI.getId("note_edit_link_" + e).innerHTML = "Notlarım";
                    hide("note_delete_link_" + e)
                } else {
                    unhide("note_header_" + e, "block");
                    YUI.getId("note_edit_link_" + e).innerHTML = "Düzenle";
                    unhide("note_delete_link_" + e)
                }
                unhide("note_edit_link_container_" + e);
                if (b) {
                    b()
                }
            } else {
                alert("Sorry--we were unable to save your note.")
            }
        }
    };
    var h = {
        success: k,
        failure: function () {
            alert("Sorry--we were unable to save your note.")
        }
    };
    YUI.u.Connect.asyncRequest("POST", c, h, f)
}
function cancel_property_note(b) {
    var a = b.get_id();
    b.destroy();
    unhide("note_c_" + a);
    unhide("note_edit_link_container_" + a)
}
function delete_property_note(a) {
    var b = new EditBox(a, null, true);
    save_property_note(b, "delete");
    b = null
}
function toggle_property_note(c, f) {
    var a = "note_c_" + c;
    var b = YUI.getId(a);
    if (b) {
        var e = "hide";
        if (typeof(f) != "undefined") {
            if (f == true) {
                e = "show"
            } else {
                e = "hide"
            }
        } else {
            if (b.style.display == "" || b.style.display == "inline") {
                e = "hide"
            } else {
                e = "show"
            }
        }
        if (e == "show") {
            unhide(a)
        } else {
            hide(a)
        }
    }
}
function txt_to_html_br(a) {
    return trim(a).replace(/\n/g, "<br />")
}
function html_to_txt_br(a) {
    return a.replace(/<br(\s*\/?)?>/ig, "\n")
}
function format_date() {
    var c = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
    var a = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    var b = new Date();
    return c[b.getUTCDay()] + ", " + a[b.getUTCMonth()] + " " + b.getDate() + " " + b.getFullYear()
}
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 set_csp(b, h, e, g) {
    if (h != 1 && h != 0) {
        h = 0
    }
    if (e != 1 && e != 0) {
        e = 0
    }
    var f = getHTTPObject();
    var a = site_root + "q_set_csp.php?ts=" + (new Date().valueOf()) + "&c=" + h + "&s=" + e + "&key=" + b;
    if (typeof(g) != "undefined") {
        a += "&val=" + g
    }
    f.open("POST", a, true);
    f.onreadystatechange = function () {};
    f.send(null)
}
function alert_login(a) {
    var b = "You must be logged in to save " + a + ".\nClick OK to log in or sign up for an account--it only takes a minute!";
    return confirm(b)
}
function process_save_queue() {
    if (save_queue.is_empty()) {
        release_mutex(_SAVE_MUTEX);
        return
    }
    var a;
    save_queue.it_start();
    while ((a = save_queue.it_next_element())) {
        save_property(a)
    }
}
function process_subscribe_queue(a) {
    if (!sub_queue.is_empty()) {
        subscribe(-1, null, true, a)
    } else {
        if (!sub_recent_queue.is_empty()) {
            emlakrex.MySearches.subscribe_recent(null, sub_recent_queue.it_next_element(), "", true, a)
        }
    }
}
function process_alert_queue(a) {
    if (alert_queue.is_empty()) {
        return
    }
    email_search_subscribe(true, a)
}
function process_price_queue(a) {
    if (price_queue.is_empty()) {
        return
    }
    email_property_subscribe()
}
function display_adsense(b, e, c, h, j, g, k, f) {
    if (typeof(k) == "undefined") {
        var k = 1
    }
    if (typeof(e) == "undefined") {
        var e = "Real Estate"
    }
    if (typeof(f) == "undefined") {
        var f = 2
    }
    var a = (typeof(g) != "undefined") ? g : "";
    var l = getHTTPObject();
    l.open("POST", site_root + "q_adsense.php?state_format=" + encodeURIComponent(f) + "&template=" + encodeURIComponent(k) + "&q=" + encodeURIComponent(b) + "&topic=" + encodeURIComponent(e) + "&ads=" + encodeURIComponent(c) + "&p=" + encodeURIComponent(h) + "&ch=" + encodeURIComponent(a) + "&city=" + encodeURIComponent(_AD_CITY) + "&returntype=html");
    l.onreadystatechange = function () {
        if (l.readyState == 4) {
            var m = YUI.getId(j);
            if (m) {
                m.innerHTML = l.responseText
            }
        }
    };
    l.send(null)
}
function display_google_adsense(f, h, b, e, j, g) {
    if (typeof(b) == "undefined") {
        var b = 3
    }
    if (typeof(g) == "undefined" || !g) {
        var g = ""
    }
    var c = "AdsenseDisplay" + g;
    if (f == "AFS") {
        _AFSID = Math.floor(Math.random() * 11);
        if (typeof(j) == "undefined") {
            var j = "Real Estate"
        }
        var a = (typeof(_AD_TARGETING.city) !== "undefined") ? _AD_TARGETING.city : "";
        google_afs_query = a + " " + j;
        google_afs_ad = "w" + b;
        google_afs_client = h;
        if (e) {
            google_afs_channel = e
        }
        document.write('<div id="AFS' + _AFSID + '" class="' + c + '"></div>');
        document.write('<script language="JavaScript" src="http://www.google.com/afsonline/show_afs_ads.js"><\/script>')
    } else {
        _AFCID = Math.floor(Math.random() * 11);
        google_ad_client = h;
        if (e) {
            google_ad_channel = e
        }
        google_ad_output = "js";
        google_max_num_ads = b;
        google_ad_type = "text";
        google_feedback = "on";
        document.write('<div id="AFC' + _AFCID + '" class="' + c + '"></div>');
        document.write('<script language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><\/script>')
    }
}
function render_google_adsense(b, a, f) {
    var e = "";
    var c;
    if (a.length <= 0) {
        return ""
    }
    e += '<span class="ad_disclaimer"><a href="' + f + '" target="_blank">Ads by Google</a></span>';
    e += '<div class="ad_inner"><ul>';
    for (c = 0; c < a.length; c++) {
        e += '<li><span class="ad_title"><a href="' + a[c].url + '" target="_blank">' + a[c].line1 + '</a></span> <span class="ad_desc"><span class="ad_line2">' + (typeof(a[c].line2) == "undefined" ? "" : a[c].line2) + '</span> <span class="ad_line3">' + (typeof(a[c].line3) == "undefined" ? "" : a[c].line3) + '</span></span> <span class="ad_url"><a href="' + a[c].url + '" target="_blank">' + a[c].visible_url + "</a></span></li>"
    }
    e += "</ul></div>";
    return e
}
function google_afs_request_done(a) {
    var b = render_google_adsense("AFS", a, "https://www.google.com/adsense/support/bin/request.py?contact=afs_violation");
    YUI.getId("AFS" + _AFSID).innerHTML = b
}
function google_ad_request_done(a) {
    var b = render_google_adsense("AFC", a, google_info.feedback_url);
    YUI.getId("AFC" + _AFCID).innerHTML = b
}
function sortint(e, c) {
    return parseInt(e) - parseInt(c)
}
var _EMAIL_SIGNUP = new Object();

function show_email_property_alert_box(h, j, g, k, f, c, b) {
    if (typeof(b) == "undefined") {
        var b = 1
    }
    for (i in _EMAIL_SIGNUP) {
        delete _EMAIL_SIGNUP[i]
    }
    _EMAIL_SIGNUP.property_id = j;
    _EMAIL_SIGNUP.property_hash = g;
    _EMAIL_SIGNUP.state_code = k;
    _EMAIL_SIGNUP.price = f;
    _EMAIL_SIGNUP.status = c;
    var a = (c == "Satılık" ? "isyeri" : "listed for sale");
    if (YUI.getId("email_status_display")) {
        YUI.getId("email_status_display").innerHTML = a
    }
    if (!_emlakrex_logged_in) {
        price_queue.add(j);
        show_login(h, "property_email_alert");
        return
    }
    switch (b) {
    case 1:
        pos_menuyu_goster(h, "email_property_alert_form", 38, -223);
        break;
    case 2:
        pos_menuyu_goster(h, "email_property_alert_form", -330, -100);
        break;
    default:
        pos_menuyu_goster(h, "email_property_alert_form", -140, 10)
    }
    hide("email_property_subscribe_status")
}
function show_details_email_property_subscribe(a) {
    hide("email_property_subscribe_status");
    YUI.u.Dom.removeClass(YUI.getId("price_alerts_input"), "gone");
    YUI.u.Dom.addClass(YUI.getId("price_alerts_output"), "gone");
    pos_menuyu_goster(a, "price_alerts")
}
function details_email_property_subscribe(m) {
    var q = clone_obj(m);
    var n = site_root + "q_property_email_subscribe.php?";
    var h = YUI.getId("property_id").value;
    var p = YUI.getId("property_hash").value;
    var j = YUI.getId("state_code").value;
    var a = YUI.getId("price").value;
    var g = YUI.getId("status").value;
    var c = YUI.getId("alertPropertyStatus").checked;
    var l = YUI.getId("alertPropertyComps").checked;
    if (c) {
        c = 1
    } else {
        c = 0
    }
    if (l) {
        l = 1
    } else {
        l = 0
    }
    var k = YUI.getId("alertPropertyFrequency").value;
    if (!l && !c) {
        var f = YUI.getId("email_property_subscribe_status");
        f.innerHTML = "Birini Seçin an email alert option to subscribe to.";
        unhide("email_property_subscribe_status");
        return
    }
    var e = "";
    e += "ps=" + c + "&pf=" + k + "&cs=" + l + "&cf=" + k + "&pid=" + h + "&ph=" + p + "&st=" + j + "&pr=" + a + "&pst=" + g;
    var b = getHTTPObject();
    b.open("POST", n + e, true);
    b.onreadystatechange = function () {
        if (b.readyState == 4) {
            var w = b.responseXML;
            if (!w) {
                return
            }
            var t = w.documentElement.getElementsByTagName("o")[0];
            var v = t.getAttribute("ps");
            var r = t.getAttribute("cs");
            var u = YUI.getId("email_property_subscribe_status");
            if (v == 4) {
                u.innerHTML = 'Please <span class="pseudolink" onclick="show_login(event, \'property_email_alert\');">Giriş Yap</span> to subscribe.'
            } else {
                if (v > 0 || r > 0) {
                    u.innerHTML = "";
                    YUI.u.Dom.addClass(YUI.getId("price_alerts_input"), "gone");
                    YUI.u.Dom.removeClass(YUI.getId("price_alerts_output"), "gone");
                   /* if (c) {
                        _pageTracker("//status")
                    }*/
                    /*if (l) {
                        _pageTracker("//comps")
                    }*/
                } else {
                    if (v == 0 && r == 0) {
                        u.innerHTML = "You already have alerts saved for this property."
                    } else {
                        u.innerHTML = "ERROR"
                    }
                }
            }
            unhide("email_property_subscribe_status");
            DOMUtils.hide_selects_by_el("price_alerts")
        }
    };
    b.send(null)
}
function email_property_subscribe() {
    hide("email_property_subscribe_status");
    var l = site_root + "q_property_email_subscribe.php?";
    var h = _EMAIL_SIGNUP.property_id;
    var m = _EMAIL_SIGNUP.property_hash;
    var j = _EMAIL_SIGNUP.state_code;
    var a = _EMAIL_SIGNUP.price;
    var g = _EMAIL_SIGNUP.status;
    var c = YUI.getId("alertPropertyStatus").checked;
    var k = YUI.getId("alertPropertyComps").checked;
    if (c) {
        c = 1;
        frequencyPropStatus = YUI.getId("propertyStatusFrequency").value
    } else {
        c = 0;
        frequencyPropStatus = "none"
    }
    if (k) {
        k = 1;
        frequencyComps = YUI.getId("propertyCompsFrequency").value
    } else {
        k = 0;
        frequencyComps = "none"
    }
    if (!k && !c) {
        var f = YUI.getId("email_property_subscribe_status");
        f.innerHTML = "Birini Seçin an email alert option to subscribe to.";
        unhide("email_property_subscribe_status");
        return
    }
    var e = "";
    e += "ps=" + c + "&pf=" + frequencyPropStatus + "&cs=" + k + "&cf=" + frequencyComps + "&pid=" + h + "&ph=" + m + "&st=" + j + "&pr=" + a + "&pst=" + g;
    var b = getHTTPObject();
    b.open("POST", l + e, true);
    b.onreadystatechange = function () {
        if (b.readyState == 4) {
            var v = b.responseXML;
            if (!v) {
                return
            }
            var r = v.documentElement.getElementsByTagName("o")[0];
            var u = r.getAttribute("ps");
            var q = r.getAttribute("cs");
            var t = YUI.getId("email_property_subscribe_status");
            if (u == 4) {
                t.innerHTML = 'Please <span class="pseudolink" onclick="show_login(event, \'property_email_alert\');">Giriş Yap</span> to subscribe.'
            } else {
                if (u > 0 || q > 0) {
                    toggle_menu(null, "email_property_alert_form", 0);
                    if (typeof(sp_page_name) != "undefined" && sp_page_name == "homepage") {
                        YUI.u.Dom.addClass("email_sp_" + h, "hidden");
                        YUI.u.Dom.removeClass("emailed_sp_" + h, "hidden")
                    }
                    var p = "Tebrikler! ";
                    var n = "<div class='marb10'>Your email alert has been saved.  Access all your saved searches and E-Posta Uyarıları in your <a href=\"" + site_root + 'account/alerts">My EmlakRex</a> account anytime.</div>';
                    show_generic_popup(p, n);
                   /* if (c) {
                        _pageTracker("/status")
                    }
                    if (k) {
                        _pageTracker("/comps")
                    }*/
                } else {
                    if (u == 0 && q == 0) {
                        t.innerHTML = "You already have alerts saved for this property."
                    } else {
                        t.innerHTML = "ERROR"
                    }
                }
            }
            emlakrex.unhide(t, "block")
        }
    };
    b.send(null)
}
function close_price_alerts_window() {
    hide("email_property_subscribe_status");
    toggle_menu(null, "price_alerts", 0)
}
function get_object_dimensions(b) {
    b = YUI.getId(b);
    if (!b) {
        return {
            height: null,
            width: null
        }
    }
    var c = false;
    if (b.style.display == "none") {
        b.style.display = "";
        c = true
    }
    var a = 0;
    var e = 0;
    if (b.offsetWidth || b.offsetWidth === 0) {
        a = b.offsetWidth;
        e = b.offsetHeight
    } else {
        if (document.defaultView.getComputedStyle) {
            e = document.defaultView.getComputedStyle(b, "").getPropertyValue("height");
            a = document.defaultView.getComputedStyle(b, "").getPropertyValue("width")
        } else {
            if (b.clip) {
                a = b.clip.width;
                e = b.clip.height
            }
        }
    }
    if (c) {
        b.style.display = "none"
    }
    return {
        height: e,
        width: a
    }
}
function fade_effect(e, h, a, b, f) {
    var e = YUI.getId(e);
    if (!e) {
        return
    }
    var g = 0;
    if (typeof(f) == "undefined") {
        var f = 700
    } else {
        if (f > 1000) {
            f = 1000
        } else {
            if (f < 10) {
                f = 10
            }
        }
    }
    f = Math.round(f / 100);
    if (typeof(h) == "undefined") {
        if (a >= 50) {
            var h = 0
        } else {
            var h = 100
        }
    }
    if (typeof(a) == "undefined") {
        if (h >= 50) {
            var a = 0
        } else {
            var a = 100
        }
    }
    if (h > 100) {
        h = 100
    } else {
        if (h < 0) {
            h = 0
        }
    }
    if (a > 100) {
        a = 100
    } else {
        if (a < 0) {
            a = 0
        }
    }
    if (a > h) {
        var c = 1
    } else {
        var c = -1;
        b = "none"
    }
    while (c * h <= c * a) {
        setTimeout('set_opac("' + e.id + '",' + h + ',"' + b + '")', g * f);
        h = Math.round((h + c) * 100) / 100;
        g++
    }
}
function set_opac(b, c, a, g) {
    var b = YUI.getId(b);
    if (!b) {
        return false
    }
    if (is_IE6() && (typeof(b.style.width) == "undefined" || !b.style.width) && (typeof(b.style.height) == "undefined" || !b.style.height)) {
        var f = get_object_dimensions(b);
        var e = false;
        if (g == "height" && f.height) {
            b.style.height = f.height;
            e = true
        } else {
            if (g == "width" && f.width) {
                b.style.width = f.width;
                e = true
            }
        }
        if (!e) {
            if (f.height === 0) {
                if (f.width === 0) {
                    b.style.height = ""
                } else {
                    b.style.width = f.width
                }
            } else {
                b.style.height = f.height
            }
        }
    }
    if (typeof(c) == "undefined" || c >= 100) {
        moz_opac = "";
        ie_opac = ""
    } else {
        if (c <= 0) {
            moz_opac = 0;
            ie_opac = 0
        } else {
            moz_opac = c / 100;
            ie_opac = "alpha(opacity=" + c + ")"
        }
    }
    b.style.opacity = moz_opac;
    b.style.MozOpacity = moz_opac;
    b.style.KhtmlOpacity = moz_opac;
    b.style.filter = ie_opac;
    if (c <= 0) {
        if (typeof(a) == "undefined" || (a != "none" && a != "block" && a != "inline")) {
            b.style.display = ""
        } else {
            b.style.display = a
        }
    }
    return true
}
function has_class(a, b) {
    return YUI.u.Dom.hasClass(a, b)
}
function add_class(a, b) {
    return YUI.u.Dom.addClass(a, b)
}
emlakrex.add_class = add_class;
var foo = "bar";

function remove_class(a, b) {
    return YUI.u.Dom.removeClass(a, b)
}
emlakrex.remove_class = remove_class;

function toggle_class(b, c, a) {
    b = YUI.getId(b);
    if (b) {
        if (c && a) {
            return YUI.u.Dom.replaceClass(b, a, c)
        } else {
            if (c) {
                return YUI.u.Dom.addClass(b, c)
            } else {
                if (a) {
                    return YUI.u.Dom.removeClass(b, a)
                }
            }
        }
    }
}
function is_IE() {
    return (navigator.appName.indexOf("Microsoft Internet Explorer") > -1)
}
function is_IE6() {
    return (navigator.appName.indexOf("Microsoft Internet Explorer") > -1 && !window.XMLHttpRequest)
}
function is_IE7() {
    return (navigator.appName.indexOf("Microsoft Internet Explorer") > -1 && window.XMLHttpRequest)
}
function is_Chrome() {
    return navigator.userAgent.toLowerCase().indexOf("chrome") > -1
}
function is_Firefox() {
    return navigator.userAgent.toLowerCase().indexOf("firefox") > -1
}
function is_Safari() {
    return navigator.userAgent.toLowerCase().indexOf("safari") > -1
}
function clone_obj(b) {
    if (typeof(b) != "object") {
        return null
    }
    try {
        var c = new Object;
        if (typeof(b.pageX) != "undefined") {
            c.pageX = b.pageX
        }
        if (typeof(b.pageY) != "undefined") {
            c.pageY = b.pageY
        }
        if (typeof(b.clientX) != "undefined") {
            c.clientX = b.clientX
        }
        if (typeof(b.clientY) != "undefined") {
            c.clientY = b.clientY
        }
        return c
    } catch (a) {
        return null
    }
}
function DOMUtils() {}
DOMUtils.fill_element = function (c, a) {
    var b = YUI.getId(c);
    if (b && typeof(a) != "undefined" && a != null) {
        b.innerHTML = a
    }
};
DOMUtils.get_inner_html = function (b) {
    var a = YUI.getId(b);
    if (a && typeof(a.innerHTML) != "undefined") {
        return a.innerHTML
    }
    return ""
};
DOMUtils.remove_element = function (b) {
    var a = YUI.getId(b);
    if (a && a.parentNode) {
        a.parentNode.removeChild(a)
    }
};
DOMUtils.disable_button = function (b, a) {
    if (typeof(b) != "undefined" && b.disabled) {
        b.disabled = a
    }
};
DOMUtils.set_value = function (c, b) {
    var a = YUI.getId(c);
    if (a && typeof a.value !== "undefined") {
        a.value = b;
        return true
    }
    return false
};
DOMUtils.get_value = function (b) {
    var a = YUI.getId(b);
    return (a && typeof a.value != "undefined" ? a.value : null)
};
DOMUtils.focus = function (b) {
    var a = YUI.getId(b);
    if (typeof(a.focus) === "function") {
        a.focus()
    }
};
emlakrex.hide_selects_exclusions = ["rss_pulldown", "top_nav_account_ul", "srp_property_compare_popup", "sort_by_dropdown"];
DOMUtils.hide_selects_by_el = function (c, e, p, b, u) {
    if (!is_IE6()) {
        return false
    }
    var c = YUI.getId(c);
    if (!c) {
        return false
    }
    var t = c.id;
    for (j in emlakrex.hide_selects_exclusions) {
        if (t == emlakrex.hide_selects_exclusions[j]) {
            return false
        }
    }
    if (YUI.u.Dom.hasClass(c, "popup_table")) {
        var n = true
    } else {
        var n = false
    }
    var q = 0;
    var m = "ie_iframe";
    var h = t.indexOf("autocomplete_panel");
    var g = YUI.getId(m);
    if (g) {
        g.parentNode.removeChild(g);
        if (h !== 0) {
            var f = YUI.u.Dom.getElementsByClassName("autocomplete_panel");
            if (f.length > 0) {
                for (var j in f) {
                    hide(f[j])
                }
            }
        }
    }
    if (t.indexOf("search_type_dropdown") != -1) {
        e = "0";
        p = "25px"
    } else {
        if (typeof(e) == "undefined" || !e) {
            q = 0;
            if (t == "email_box" || t == "email_property_alert_form" || t == "upload") {
                q = -3
            } else {
                if (n && c.parentNode.id.indexOf("nav_") < 0 && t.indexOf("f_") !== 0) {
                    q = -3
                } else {
                    if (h === 0) {
                        q = 1
                    }
                }
            }
            var e = c.style.left;
            if (typeof(e) == "undefined" || !e) {
                e = YUI.u.Dom.getX(c) + q
            } else {
                e = parseInt(e) + q
            }
            if (isNaN(e)) {
                e = "0px"
            } else {
                e += "px"
            }
        }
        if (typeof(p) == "undefined" || !p) {
            q = 0;
            if (t == "location_manager_content") {
                q = 6
            } else {
                if (t == "email_property_alert_form") {
                    q = -3
                } else {
                    if (!n && h !== 0 && c.parentNode.id.indexOf("nav_") < 0 && t.indexOf("f_") !== 0) {
                        q = -3
                    }
                }
            }
            var p = c.style.top;
            if (typeof(p) == "undefined" || !p) {
                p = YUI.u.Dom.getY(c) + q
            } else {
                p = parseInt(p) + q
            }
            if (isNaN(p)) {
                p = "0px"
            } else {
                p += "px"
            }
        }
    }
    if (typeof(b) == "undefined" || !b || typeof(u) == "undefined" || !u) {
        var k = get_object_dimensions(c);
        if (t == "location_manager_content") {
            q = -4
        } else {
            if (t == "location_manager_content") {
                q = 2
            } else {
                if (t == "email_property_alert_form") {
                    q = -10
                } else {
                    if (h === 0) {
                        q = -4
                    } else {
                        if (c.parentNode.id.indexOf("nav_") < 0 && t.indexOf("f_") !== 0) {
                            q = 2
                        }
                    }
                }
            }
        }
        var b = k.width + q + "px";
        var u = k.height + q + "px"
    }
    var l = c.style.zIndex;
    if (typeof(l) == "undefined" || !l) {
        l = 995
    }
    g = document.createElement("iframe");
    g.id = m;
    g.src = "javascript:false;";
    g.style.position = "absolute";
    g.style.left = e;
    g.style.top = p;
    if (parseInt(u) > 0) {
        g.style.height = u
    } else {
        return
    }
    if (parseInt(b) > 0) {
        g.style.width = b
    } else {
        return
    }
    g.style.zIndex = l - 1;
    c.style.zIndex = l;
    var r = c.parentNode;
    if (h === 0) {
        var a = YUI.getId("nav_newsfeed");
        if (a) {
            r = a
        } else {
            if (r.id == "city_state_ac" || r.id == "zip_ac") {
                r = r.parentNode
            }
        }
    } else {
        if (t == "claim_learn_more_popup") {
            r = r.parentNode
        }
    }
    if (typeof(r) == "undefined" || !r || !r.tagName) {
        document.body.appendChild(g)
    } else {
        if (r.tagName == "LI") {
            r = r.parentNode;
            if (typeof(r) == "undefined" || !r) {
                document.body.appendChild(g)
            } else {
                r.appendChild(g)
            }
        } else {
            r.appendChild(g)
        }
    }
    return g
};

function QAjax(b, a) {
    this.values = new Object();
    this.script = "";
    this.method = "POST";
    this.output = "text";
    this.callback = function () {};
    if (typeof(b) != "undefined" && b != null && typeof(_aj_scripts[b]) != "undefined") {
        this.set_script_info(_aj_scripts[b])
    }
    if (typeof(a) != "undefined") {
        for (var c in a) {
            this.set_value(c, a[c])
        }
    }
}
QAjax.prototype.set_callback = function (a) {
    this.callback = a
};
QAjax.prototype.set_value = function (b, a) {
    this.values[b] = a
};
QAjax.prototype.break_cache = function () {
    this.set_value("nocache", new Date().valueOf())
};
QAjax.prototype.set_from_form = function (c) {
    for (var b = 0; b < c.length; ++b) {
        var a = c.elements[b];
        if ((a.type == "checkbox" || a.type == "radio") && !a.checked) {
            continue
        }
        this.set_value(a.name, a.value)
    }
    if (c.method) {
        this.method = c.method
    }
    if (c.action) {
        this.script = c.action
    }
};
QAjax.prototype.set_script_info = function (a) {
    this.script = a.script;
    this.method = a.method;
    this.output = a.output
};
QAjax.prototype.go = function () {
    var f = "";
    for (var c in this.values) {
        f += (c + "=" + encodeURIComponent(this.values[c]) + "&")
    }
    if (typeof(_qa_remct_tkn) != "undefined") {
        f += "tkn=" + encodeURIComponent(_qa_remct_tkn) + "&"
    }
    var a = this.callback;
    var e = this.output;
    var g = {
        success: function (h) {
            if (e == "xml") {
                a(h.responseXML)
            } else {
                a(h.responseText)
            }
        },
        failure: function () {}
    };
    var b = site_root + this.script;
    if (this.method == "get" || this.method == "POST") {
        b = b + "?" + f;
        YUI.u.Connect.asyncRequest(this.method, b, g)
    } else {
        YUI.u.Connect.asyncRequest(this.method, b, g, f)
    }
};
QAjax.prototype.gogogo = function () {
    var f = "";
    for (var c in this.values) {
        f += (c + "=" + encodeURIComponent(this.values[c]) + "&")
    }
    if (typeof(_qa_remct_tkn) != "undefined") {
        f += "tkn=" + encodeURIComponent(_qa_remct_tkn) + "&"
    }
    var a = this.callback;
    var e = this.output;
    var g = {
        success: function (h) {
            if (e == "xml") {
                a(h.responseXML)
            }
        },
        failure: function () {}
    };
    var b = site_root + this.script;
    if (this.method == "get" || this.method == "POST") {
        b = b + "?" + f;
        YUI.u.Connect.asyncRequest(this.method, b, g)
    } else {
        YUI.u.Connect.asyncRequest(this.method, b, g, f)
    }
};
QAjax.prototype.do_post = function (a) {
    this.go()
};
QAjax.prototype.do_get = function (a) {
    this.go()
};

function findPos(b) {
    var a = YUI.u.Dom.getXY(b);
    return (a) ? {
        x: a[0],
        y: a[1]
    } : {
        x: 0,
        y: 0
    }
}
function scrollToEl(a) {
    var b = findPos(a);
    window.scrollTo(b.x, b.y)
}
var autocomplete_instances = Array();
var autocomplete_loaded = false;

function Autocomplete(f, k, e, n, h, r, p, b, a) {
    this.oAC = null;
    var g = this;
    if (!YUI.getId(n)) {
        if (e.elements[n] === undefined) {
            emlakrex.log("Autocomplete fail: invalid source field.");
            return false
        }
        var c = e.elements[n].id;
        n = c
    }
    var t = YUI.getId(n);
    if (!t) {
        emlakrex.log("Autocomplete epic fail: invalid source field without ID.");
        return false
    }
    var u = new YUI.u.CustomEvent("one_result_event");
    this.oneResultEvent = u;
    var q = k + "::" + n + "::" + h + "::" + f;
    if (autocomplete_instances[q] === undefined || autocomplete_instances[q] === null) {
        this.value_field = h;
        this.field_el = t;
        if (typeof r !== "undefined") {
            r = ""
        }
        this.default_value = r;
        if (t.parentNode) {
            var l = t.parentNode;
            l.style.height = l.clientHeight + "px";
            l.style.width = l.clientWidth + "px"
        }
        var j = YUI.get("body")[0];
        if (!j.className.match(/yui-skin-sam/)) {
            j.className += " yui-skin-sam"
        }
        if (autocomplete_loaded === false) {
            YUI.use("connection", "datasource", "autocomplete", function () {
                autocomplete_loaded = true;
                g.oAC = m(f, n, h, k)
            })
        } else {
            g.oAC = m(f, n, h, k)
        }
        autocomplete_instances[q] = true
    }
    function m(E, J, z, L, Q) {
        var C = site_root + "Sorgu/q_suggestion/";
        var A = 50;
        var M = 10;
        var K = 20;
        var F = {
            responseType: YUI.u.XHRDataSource.TYPE_JSARRAY,
            responseSchema: {
                fields: [{
                    key: "display"
                },
                {
                    key: "value"
                },
                {
                    key: "altValue"
                },
                {
                    key: "type"
                },
                {
                    key: "city"
                },
                {
                    key: "state"
                },
                {
                    key: "county"
                }]
            },
            maxCacheEntries: 100
        };
        var O = new YUI.u.XHRDataSource(C, F);
        var G = {
            maxResultsDisplayed: K,
            minQueryLength: 3,
            autoHighlight: true,
            queryMatchSubset: false,
            useIFrame: true,
            animVert: false,
            animHoriz: false
        };
        var w = new YUI.w.AutoComplete(J, L, O, G);
        w.generateRequest = function (S) {
            var R = "?q=" + S + "&query_type=" + E + "&max=" + A;
            if (typeof p !== "undefined" && p != "" && p !== null) {
                R += "&location_type=" + p
            }
            if (typeof b !== "undefined" && b != "" && b !== null) {
                R += "&exclude_type=" + b
            }
            return R
        };
        var N = e[z];
        if (!N) {
            N = YUI.getId(z)
        }
        var v = e[J];
        if (!v) {
            v = YUI.getId(J)
        }
        var D = "";
        if (v.value !== Q && N.value !== "") {
            D = v.value
        }
        var H = function (R, U, X) {
            var V = U[0];
            var Y = U[1];
            var T = U[2];
            this.alwaysShowContainer = false;
            if (X == true) {
                var Z = T
            } else {
                var Z = {
                    display: T[0],
                    value: T[1],
                    altValue: T[2],
                    type: T[3],
                    city: T[4],
                    state: T[5],
                    county: T[6]
                }
            }
            switch (z) {
            case "hp_autocomplete_value":
                if (Z.type === "neighborhood") {
                    N.value = Z.altValue
                } else {
                    N.value = ""
                }
                break;
            case "srp_autocomplete_value":
            case "as_autocomplete_value":
                var S = "";
                if (Z.type == "neighborhood" || Z.type == "county" || Z.type == "school") {
                    N.value = Z.type + "|" + Z.altValue;
                    S = Z.altValue
                } else {
                    N.value = Z.type + "|" + Z.display;
                    S = Z.value
                }
                var W = YUI.getId(J);
                if (z == "srp_autocomplete_value" && S != 0) {
                    W.disabled = true;
                    W.value = Z.display;
                    srp_add_location();
                    W.disabled = false
                }
                break;
            case "heatmap_autocomplete_value":
                N.value = Z.display;
                e.hm_state.value = Z.state;
                switch (Z.type) {
                case "city":
                    e.hm_location.value = Z.city;
                    e.search.value = Z.city;
                    break;
                case "county":
                    e.hm_location.value = Z.county + " County";
                    e.search.value = Z.county + " County";
                    break;
                case "state":
                    e.search.value = "";
                    break;
                default:
                    e.hm_state.value = "all_states";
                    e.hm_location.value = "";
                    e.search.value = ""
                }
                e.submit();
                break;
            default:
                N.value = Z.value
            }
            D = Z.display
        };
        w.itemSelectEvent.subscribe(H);
        g.oAC = w;
        if (typeof(register_autocompletion_events) == "function") {
            register_autocompletion_events(g)
        }
        var B = function (U, T) {
            var S = T[0];
            var R = S.getInputEl();
            this.alwaysShowContainer = false;
            if (N.id === "srp_autocomplete_value") {
                return
            }
            if (R.value != D) {
                N.value = ""
            }
        };
        w.textboxChangeEvent.subscribe(B);
        var I = function (U, T) {
            var S = T[0];
            var R = S.getInputEl();
            if (R.value == Q) {
                R.value = ""
            }
        };
        w.textboxFocusEvent.subscribe(I);
        var P = function (U, T) {
            var S = T[0];
            var R = S.getInputEl();
            if (R.value === "" && Q !== undefined) {
                R.value = Q
            }
            autocomplete_cleanup(YUI.getId(J), YUI.getId(z), Q, "Sorgu/q_location/")
        };
        w.textboxBlurEvent.subscribe(P);
        w.doBeforeExpandContainer = function (V, S, U, T) {
            if (T.length == 1 && typeof(T[0]) != "undefined" && V.value.toLowerCase() == T[0]["display"].toLowerCase()) {
                var R = T[0];
                V.value = R.display;
                H("GO", [1, 2, R], true);
                if (typeof(u) != "undefined") {
                    u.fire(R)
                }
                return false
            } else {
                if (U.length >= M && T.length > K) {
                    this.queryMatchSubset = true;
                    this.maxResultsDisplayed = T.length
                } else {
                    this.queryMatchSubset = false;
                    this.maxResultsDisplayed = K
                }
            }
            return true
        };
        w.doBeforeLoadData = function (U, S, T) {
            var R = YUI.get("div.yui-ac-bd", L, 1);
            if (S.results.length == 0 && L != "location_rent_form_query") {
                this.setHeader('<div class="error pad10">Sorry—no matches found.</div>');
                this.alwaysShowContainer = true;
                YUI.u.Dom.setStyle(R, "display", "none");
                this._toggleContainerHelpers(false)
            } else {
                this.setHeader("");
                YUI.u.Dom.setStyle(R, "display", "block");
                this._toggleContainerHelpers(true)
            }
            return true
        };
        w._elTextbox.setAttribute("autocomplete", "off");
        w._bFocused = true;
        w._sInitInputValue = w._elTextbox.value;
        w.textboxFocusEvent.fire(w);
        return w
    }
}
Autocomplete.prototype.invalidate = function () {
if('undefined'!=typeof(this.value_field))
{
    var a = YUI.getId(this.value_field);
    a.value = "";
    this.field_el.value = this.default_value;
    }
};
Autocomplete.prototype.submit_on_enter = function (a) {
    emlakrex.log("Autocomplete.prototype.submit_on_enter is deprecated")
};
Autocomplete.prototype.function_on_enter = function (a) {
    emlakrex.log("Autocomplete.prototype.function_on_enter is deprecated")
};

function save_this_property() {
    var a = undefined;
    if (typeof(_DETAILS_PROPERTY_ID) != "undefined") {
        a = _DETAILS_PROPERTY_ID
    }
    if (typeof(a) != "undefined") {
        var b = "homes";
        var c = "";
        var g = "account/properties";
        var e = false;
        if (typeof(_PROPERTY_TYPE) != "undefined" && (_PROPERTY_TYPE == "For Rent" || _PROPERTY_TYPE == "community")) {
            g = "Hesabim/favorilerim/forrent";
            b = "properties"
        } else {
            e = true;
            c = '<div id="next_step_html"></div>'
        }
        var f = "<div>Teşekkürler, e-posta başarıyla gönderildi.  Find all your saved " + b + ', searches and E-Posta Uyarıları in your <a href="' + site_root + g + '">My EmlakRex</a> account.</div>';
        show_generic_popup("Tebrikler! ", f + c);
        if (e) {
            emlakrex.get_next_step_html()
        }
        save_property(a, 1);
       // oa_track_ql_click("ContactAgentPopup|Save_Link")
    }
}
emlakrex.get_next_step_html = function () {
    if (!YUI.getId("next_step_html")) {
        return
    }
    var c = YUI.getId("property_location_id") ? YUI.getId("property_location_id").value : _PROPERTY_LOCATION_ID;
    if (!YUI.lang.isString(the_city) || !YUI.lang.isString(the_state_code) || !YUI.lang.isString(c)) {
        return ""
    }
    var a = "";
    var b = new QAjax();
    b.set_value("city", the_city);
    b.set_value("state_code", the_state_code);
    b.set_value("location_id", c);
    b.set_script_info({
        script: "pdp_next_steps_content.php",
        method: "get",
        output: "text"
    });
    b.set_callback(function (e) {
        if (YUI.getId("next_step_html")) {
            YUI.getId("next_step_html").innerHTML = e
        }
    });
    b.go()
};
emlakrex.create_tracking_pixel = function (c) {
    var b = "";
    switch (c) {
    case "agent_email":
        b = "";
        break;
    default:
        b = c
    }
    var a = document.createElement("img");
    a.src = b;
    a.height = 1;
    a.width = 1;
    a.border = 0;
    return a
};
function format_phone_field(a) {
    if (a.value == "(isteye bağlı)") {
        add_class(a, "grey");
        add_class(a, "f10")
    } else {
        remove_class(a, "grey");
        remove_class(a, "f10")
    }
}
function pdp_phone_event_format(a, b) {
    phone_required_flag = $("#phone_required_flag").val();
    if (b.type == "focus" && phone_required_flag != 1) {
        (a.value == "(isteye bağlı)" ? a.value = "" : "")
    }
    if (b.type == "blur" && phone_required_flag != 1) {
        (a.value == "" ? a.value = "(isteye bağlı)" : "")
    }
    format_phone_field(a)
}
var previousEmailToAgentHash = "";

function send_email_to_agent(M, n, E, J, H, f, I) {
    if (typeof(H) == "undefined" || !H) {
        H = "agent"
    }
    if (typeof(f) == "undefined") {
        f = ""
    }
    var G = (J) ? J : "contact_agent_form_error_msg_part" + f;
    var e = YUI.getId(G);
    var k = YUI.getId("contact_agent_form_error_msg" + f);
    var F = YUI.getId("contact_agent_form_part" + f);
    var g = false;
    var b, t, B, r, h, w;
    if (M.phash) {
        h = trim(M.phash.value)
    }
    if (M.uid) {
        b = trim(M.uid.value)
    }
    if (M.user_status) {
        t = trim(M.user_status.value)
    }
    if (M.pro_status) {
        B = trim(M.pro_status.value)
    }
    if (M.from_where) {
        r = trim(M.from_where.value)
    }
    if (M.pid) {
        w = trim(M.pid.value)
    }
    if (typeof(M.lead_track) != "undefined") {
        g = M.lead_track.value
    }
    if ((qpn_NAMES.account_source != "emlakrex" && !b && !h) || (qpn_NAMES.account_source == "emlakrex" && !w)) {
        if (e) {
            YUI.u.Dom.addClass(F, "hidden");
            YUI.u.Dom.removeClass(e, "hidden");
            k.innerHTML = "Üzgünüz &#8212 e-postayı gönderirken hata oluştu."
        } else {
            alert("Sorry - An error occurred while sending your email.")
        }
        return false
    }
    if (typeof(M.u_name) != "undefined") {
        var L = trim(M.u_name.value);
        if (!L) {
            alert("Lütfen adınızı giriniz.");
            return false
        }
    }
    var a = trim(M.u_email.value);
    if (!a || !is_valid_email(a)) {
        bad_email_alert();
        return false
    }
    var q = trim(M.msg.value);
    if (!q) {
        alert("Please enter a message.");
        return false
    }
    var A = (M.u_phone) ? M.u_phone.value : "";
    if (I == 1 && !is_valid_phone(A)) {
        alert("Please enter a valid phone number. ");
        return false
    }
    var c = YUI.u.Connect.setForm(M);
    if (c === previousEmailToAgentHash) {
        show_generic_popup("Tebrikler! ", "Teşekkürler, e-posta başarıyla gönderildi.")
        return
    } else {
        previousEmailToAgentHash = c
    }
    var C = M.pid.value;
    var z = h;
    var j = M.u_name.value;
    var m = (typeof(M.u_copy_me) != "undefined" && M.u_copy_me.checked) ? "Y" : "";
    var N = DOMUtils.get_value(M.email_type) || "standard";
    var v = DOMUtils.get_value(M.mlsid);
    var l = parseInt(DOMUtils.get_value(M.is_srp_featured));
    var p = DOMUtils.get_value(M.agent_name);
    var D = (typeof(M.u_save_property) != "undefined" && M.u_save_property.checked == true && qpn_NAMES.account_source != "emlakrex") && !has_class(M.u_save_property.parentNode, "hidden") ? true : false;
    var K = new Date();
    var u = new QAjax();
    u.set_value("s", K.valueOf());
    u.set_value("propertyId", C);
    u.set_value("propertyHash", h);
    if (typeof(_PROPERTY_TYPE) != "undefined") {
        u.set_value("propertyStatus", _PROPERTY_TYPE)
    }
    u.set_value("s_email", a);
    u.set_value("s_name", j);
    u.set_value("phone", A);
    u.set_value("message", q);
    u.set_value("copyme", m);
   // u.set_value("email_type", N);
    u.set_value("mlsid", v);
    //u.set_value("agent_name", p);
    u.set_value("user_id", b);
    u.set_value("ruid", b);
    u.set_value("user_status", t);
    u.set_value("pro_status", B);
    u.set_value("page_location_url", window.location.href);
    u.set_value("from_where", r);
    u.set_value("s", "1");
    u.set_value("is_srp_featured", l === 1 ? 1 : 0);
    if (r == "voices") {
        u.set_script_info({
            script: "Sorgu/q_email_user/",
            method: "post",
            output: "text"
        })
    } else {
        u.set_script_info({
            script: "Sorgu/q_email_agent/",
            method: "post",
            output: "text"
        })
    }
    u.set_callback(function (Q) {
        var O = YUI.getId(G);
        var R;
        switch (Q) {
        case "1":
            if (n) {
                n.call()
            } else {
                if (r == "details" && D && _emlakrex_logged_in && typeof(save_this_property) == "function") {
                    save_this_property()
                } else {
                    if (r == "details" && D && !_emlakrex_logged_in) {
                        show_login(null, "contact_save_property", true)
                    } else {
                        if (typeof(_PROPERTY_TYPE) != "undefined" && (_PROPERTY_TYPE == "kiralik" || _PROPERTY_TYPE == "community")) {
                            show_generic_popup("Tebrikler! ", "Teşekkürler, e-posta başarıyla gönderildi.")
                        } else {
                            show_generic_popup("Tebrikler! ", "Teşekkürler, e-posta başarıyla " + H + " ya gönderildi.")
                        }
                    }
                }
            }
            if (r == "details") {
                var P = YUI.getId("generic_confirmation_popup_content");
                if (P) {
                    P.appendChild(emlakrex.create_tracking_pixel("agent_email"))
                }
            }
           /* if (b) {
                _pageTracker(g == false ? "LeadAskQuestion" : g, b)
            } else {
                _pageTracker(g == false ? "LeadAskQuestion" : g)
            }*/
            break;
        case "-1":
        default:
            if (E) {
                E.call()
            } else {
                show_generic_popup("Error", "Üzgünüz &#8212 e-postayı gönderirken hata oluştu.")
            }
            break
        }
        _num_friend_emails = 1
    });
    u.go()
}
function emlakci_iletisim_popup_formunu_sifirla(k, f, e, l) {
    if (typeof(e) == "undefined" || e !== false) {
        e = true
    }
    if (typeof(l) == "undefined") {
        l = ""
    }
    var g = YUI.getId("contact_agent_form" + l);
    var j = YUI.getId("contact_agent_form_popup" + l + "_popup_header");
    if (j) {
        if (f) {
            j.innerHTML = f
        } else {
            j.innerHTML = "İletişime Geç"
        }
    }
    if (!g || DOMUtils.get_value(g.email_type) == "no_account") {
        toolbox_ask_question(null, true);
        return false
    }
    var c = YUI.getId("contact_agent_form_error_msg_part" + l);
    var h = YUI.getId("contact_agent_form_error_msg" + l);
    var a = YUI.getId("contact_agent_form_part" + l);
    if (c) {
        if (h) {
            h.innerHTML = ""
        }
        YUI.u.Dom.addClass(c, "hidden")
    }
    if (a) {
        YUI.u.Dom.removeClass(a, "hidden")
    }
    if (e) {
        clear_form("contact_agent_form" + l)
    }
    var b = YUI.getId("lead_track" + l);
    if (typeof(k) != "undefined" && b) {
        b.value = k
    }
}
function send_email_to_isyeri_lead(j) {
    var l, a;
    if (j.uid) {
        l = trim(j.uid.value)
    }
    if (j.from_where) {
        a = trim(j.from_where.value)
    }
    var c = trim(j.lead_user_email.value);
    if (!c || !is_valid_email(c)) {
        bad_email_alert();
        return false
    }
    var m = j.email_msg.value;
    if (!m) {
        alert("Please enter a message.");
        return false
    }
    var f = j.pid.value;
    var g = j.lead_user_name.value;
    var b = j.lead_user_phone.value;
    if (!is_valid_phone(b)) {
        alert("Please enter a valid phone number. ");
        return false
    }
    var k = DOMUtils.get_value(j.address);
    var e = new Date();
    var h = new QAjax();
    h.set_from_form(j);
    h.set_script_info({
        script: "q_email_customer_service_lead.php",
        method: "post",
        output: "text"
    });
    h.set_callback(function (p) {
        var n = YUI.getId("isyeri_agent_lead_form_error_msg_part");
        var q;
        switch (p) {
        case "1":
            show_generic_popup("Tebrikler! ", "Teşekkürler, e-posta başarıyla gönderildi. An agent will contact you in the next 48 hours.");
           // _pageTracker("/SoldPropertyLead", "");
            break;
        case "-1":
        default:
            show_generic_popup("Error", "Üzgünüz &#8212 e-postayı gönderirken hata oluştu.");
            break
        }
    });
    h.go()
}
function details_open_home_submit() {}
details_open_home_submit.submission_dates = null;
details_open_home_submit.user_id = null;
details_open_home_submit.property_id = null;
details_open_home_submit.validate = function () {
    var a;
    var g;
    var h;
    var f = false;
    if (YUI.getId("details_open_homes_property_id")) {
        this.property_id = YUI.getId("details_open_homes_property_id").value
    }
    if (YUI.getId("details_open_homes_user_id")) {
        this.user_id = YUI.getId("details_open_homes_user_id").value
    }
    this.submission_dates = new Array();
    for (var c = 1; c <= 4; c++) {
        if (YUI.getId("open_home_date_" + c)) {
            a = YUI.getId("open_home_date_" + c)
        }
        if (YUI.getId("open_home_start_time_" + c)) {
            g = YUI.getId("open_home_start_time_" + c)
        }
        if (YUI.getId("open_home_end_time_" + c)) {
            h = YUI.getId("open_home_end_time_" + c)
        }
        var e = new Object;
        e.the_date = a.value;
        e.start_time_non_human = g[g.selectedIndex].value;
        e.start_time_human = g[g.selectedIndex].text;
        e.end_time_non_human = h[h.selectedIndex].value;
        e.end_time_human = h[h.selectedIndex].text;
        this.submission_dates.push(e)
    }
    var b = this.validate_if_date_entered();
    if (b) {
        b = !this.validate_time_conflicts()
    }
    if (b) {
        this.add_open_home_submission()
    }
};
details_open_home_submit.validate_if_date_entered = function () {
    var c = false;
    var e = true;
    for (index in this.submission_dates) {
        var b = this.submission_dates[index];
        if (b.the_date == "" && b.start_time_non_human == "" && b.end_time_non_human == "") {
            continue
        } else {
            var a = parseFloat(index) + 1;
            c = true;
            if (b.the_date == "") {
                e = false;
                this.switch_error(a, true, "Please enter the date")
            } else {
                if (b.start_time_non_human == "") {
                    e = false;
                    this.switch_error(a, true, "Please enter the start time")
                } else {
                    if (b.end_time_non_human == "") {
                        e = false;
                        this.switch_error(a, true, "Please enter the end time")
                    } else {
                        if (b.start_time_non_human >= b.end_time_non_human) {
                            e = false;
                            this.switch_error(a, true, "The end time must be later than start time")
                        } else {
                            this.switch_error(a, false, "")
                        }
                    }
                }
            }
        }
    }
    if (!c) {
        this.switch_error(0, true, "Please enter at least one date and times")
    } else {
        this.switch_error(0, false, "")
    }
    return c && e
};
details_open_home_submit.validate_time_conflicts = function () {
    var n = this.submission_dates.length;
    var m = false;
    var a = new Array();
    for (var f = 0; f < n; f++) {
        a[f] = false
    }
    for (var f = 0; f < n; f++) {
        for (var e = f + 1; e < n; e++) {
            var k = this.submission_dates[f].the_date;
            var g = this.submission_dates[e].the_date;
            var c = this.submission_dates[f].start_time_non_human;
            var l = this.submission_dates[f].end_time_non_human;
            var b = this.submission_dates[e].start_time_non_human;
            var h = this.submission_dates[e].end_time_non_human;
            if (k != "" && g != "" && c != "" && l != "" && b != "" && h != "") {
                if (this.has_time_conflict(k, g, c, l, b, h)) {
                    a[f] = true;
                    a[e] = true;
                    m = true;
                    this.switch_error(f + 1, true, "There is a time confict between date " + (f + 1) + " and date " + (e + 1));
                    this.switch_error(e + 1, true, "There is a time confict between date " + (f + 1) + " and date " + (e + 1))
                }
            }
        }
    }
    for (var f = 0; f < n; f++) {
        if (!a[f]) {
            this.switch_error(f + 1, false, "")
        }
    }
    return m
};
details_open_home_submit.has_time_conflict = function (c, b, a, g, f, e) {
    if ((c == b) && ((a >= f && a <= e) || (g >= f && g <= e) || (f >= a && f <= g) || (e >= a && e <= g))) {
        return true
    } else {
        return false
    }
};
details_open_home_submit.add_open_home_submission = function () {
    var c = YUI.getId("details_open_homes_status_msg");
    var e = this;
    hide("details_open_homes_input");
    unhide("details_open_homes_status", "block");
    DOMUtils.hide_selects_by_el("open_homes_submit");
    var b = "";
    date = new Date();
    var a = new QAjax();
    a.set_value("s", date.valueOf());
    a.set_value("user_id", this.user_id);
    a.set_value("property_id", this.property_id);
    for (submission_date in this.submission_dates) {
        a.set_value("date_" + submission_date, this.submission_dates[submission_date].the_date);
        a.set_value("start_time_" + submission_date, this.submission_dates[submission_date].start_time_human);
        a.set_value("end_time_" + submission_date, this.submission_dates[submission_date].end_time_human)
    }
    a.set_script_info({
        script: "q_add_open_homes_submission.php",
        method: "post",
        output: "text"
    });
    a.set_callback(function (f) {
        if (f == 1) {
            hide("details_open_homes_not_success");
            unhide("details_open_homes_success")
        } else {
            hide("details_open_homes_success");
            unhide("details_open_homes_not_success")
        }
        e.change_header("Tebrikler! ");
        hide("details_open_homes_description");
        DOMUtils.hide_selects_by_el("open_homes_submit")
    });
    a.go()
};
details_open_home_submit.change_header = function (a) {
    var b = YUI.getId("open_homes_submit_popup_header");
    if (b) {
        b.innerHTML = a
    }
};
details_open_home_submit.switch_error = function (b, f, c) {
    var e = YUI.getId("open_home_error_" + b);
    var a = YUI.getId("open_home_" + b);
    if (e) {
        e.innerHTML = c;
        if (f) {
            unhide(e, "block");
            if (a) {
                YUI.u.Dom.addClass(a, "error")
            }
        } else {
            hide(e);
            if (a) {
                YUI.u.Dom.removeClass(a, "error")
            }
        }
    }
};
details_open_home_submit.close_window = function () {
    var h = YUI.getId("open_home_error_0");
    if (h) {
        clear_element(h);
        hide(h)
    }
    for (var c = 1; c <= 4; c++) {
        var g = YUI.getId("open_home_date_" + c);
        var f = YUI.getId("open_home_start_time_" + c);
        var e = YUI.getId("open_home_end_time_" + c);
        var b = YUI.getId("open_home_error_" + c);
        var a = YUI.getId("open_home_" + c);
        if (g) {
            g.selectedIndex = 0
        }
        if (f) {
            f.selectedIndex = 0
        }
        if (e) {
            e.selectedIndex = 0
        }
        if (b) {
            clear_element(b);
            hide(b)
        }
        if (a) {
            YUI.u.Dom.removeClass(a, "error")
        }
    }
    toggle_menu("", "open_homes_submit", 0)
};
details_open_home_submit.close_status_window = function () {
    hide("details_open_homes_status");
    this.close_window();
    toggle_menu("", "open_homes_submit", 0);
    unhide("details_open_homes_input");
    unhide("details_open_homes_description");
    this.change_header("Open house times")
};

function show_generic_popup(f, j, e, l, k, h) {
    var c = YUI.getId("generic_confirmation_popup_content");
    var b = YUI.getId("generic_confirmation_popup_popup_header");
    var g = YUI.getId("generic_confirmation_popup_button_title");
    if (!c || !b) {
        alert("Missing generic popup.");
        return
    }
    if (g && typeof(e) == "string") {
        g.innerHTML = e
    }
    b.innerHTML = f;
    c.innerHTML = j;
    if (typeof(l) != "undefined" && k && h) {
        var a = true
    } else {
        var a = false;
        var l = null;
        var k = 0;
        var h = 0
    }
    if (!emlakrex.generic_popup_is_map) {
        remove_class("generic_confirmation_popup", "srp_map_popup")
    }
    pos_menuyu_goster(l, "generic_confirmation_popup", k, h, 0, a)
}
function show_emlak_okul_arasi_mesafe(f, j, e, l, k, h) {
    var c = YUI.getId("emlak_okul_arasi_mesafe_popup_content");
    var b = YUI.getId("emlak_okul_arasi_mesafe_popup_header");
    var g = YUI.getId("emlak_okul_arasi_mesafe_button_title");
    var s = YUI.getId("end_address");
    
    if (!c || !b) {
        alert("Missing generic popup.");
        return
    }
    if (g && typeof(e) == "string") {
        g.innerHTML = e
    }
    b.innerHTML = f;
    s.value=j;
    if (typeof(l) != "undefined" && k && h) {
        var a = true
    } else {
        var a = false;
        var l = null;
        var k = 0;
        var h = 0
    }
    if (!emlakrex.generic_popup_is_map) {
        remove_class("emlak_okul_arasi_mesafe", "srp_map_popup")
    }
    pos_menuyu_goster(l, "emlak_okul_arasi_mesafe", k, h, 0, a)
}
function ToolBoxActions() {}
ToolBoxActions.action = "";
ToolBoxActions.actions = {
    save: "save_property_form",
    alerts: "email_alerts_form"
};
ToolBoxActions.confirm_popup_id = "generic_confirmation_popup";
ToolBoxActions.process_alerts = 0;
ToolBoxActions.process_save = 0;
ToolBoxActions.process_alerts_result = true;
ToolBoxActions.property_id = "";
ToolBoxActions.property_address = "";
ToolBoxActions.property_hash = "";
ToolBoxActions.property_price = "";
ToolBoxActions.property_status = "";
ToolBoxActions.property_state = "";
ToolBoxActions.show = function (j, b, h, g, a, f, c, e) {
    if (typeof(e) == "undefined") {
        e = "Satılık"
    }
    this.action = j;
    this.property_id = b;
    this.property_address = h;
    this.property_hash = g;
    this.property_price = a;
    this.property_status = f;
    this.property_state = c;
    this.property_type = e;
    if (this.action == "alerts") {
        if (_emlakrex_logged_in) {
            emlakrex.emlagi_kaydet_ve_uyariyi_goster(this.property_id, this.property_hash, this.property_status, "alerts")
        } else {
            show_login(null, ToolBoxActions.actions[j], true)
        }
    } else {
        if (this.action == "save") {
            if (_emlakrex_logged_in && typeof(_PROPERTY_TYPE) != "undefined" && _PROPERTY_TYPE == "For Rent") {
                this.save_property();
                this.show_confirmation()
            } else {
                if (_emlakrex_logged_in) {
                    emlakrex.emlagi_kaydet_ve_uyariyi_goster(this.property_id, this.property_hash, this.property_status, "save_favorite")
                } else {
                    show_login(null, ToolBoxActions.actions[j], true)
                }
            }
        }
    }
};
ToolBoxActions.check_for_notification_type = function (b) {
    var a = "";
    var e = YUI.getId(b);
    if (e && !e.checked) {
        if (b == "ealerts_property_status_alert") {
            a = "ealerts_property_comps_alert"
        } else {
            if (b == "ealerts_property_comps_alert") {
                a = "ealerts_property_status_alert"
            }
        }
        if (a != "") {
            var c = YUI.getId(a);
            if (c && !c.checked) {
                e.checked = true
            }
        }
    }
};
ToolBoxActions.show_confirmation = function (e) {
    if (this.action == "save") {
        var b = "Tebrikler! ";
        var a = "<div class='marb10'><b>" + this.property_address + "</b> has been saved to your favorites.</div>";
        if (typeof(e) != "undefined" && e == "register") {
            b = "You're almost done...";
            a = "<div class='marb10'>We've sent an email to <span class='dark_hilite bold'>confirm your account.</span>  Your email alert settings will be saved once you click \"Confirm\".  So don't forget to check your email!</div>"
        }
        if (this.property_type == "For Rent" || this.property_type == "community") {
            var c = "Hesabim/favorilerim/forrent"
        } else {
            var c = "account/properties"
        }
        a += '<div>Find all your saved homes, searches and E-Posta Uyarıları in your <a href="' + site_root + c + '">My EmlakRex</a> account.</div>';
        show_generic_popup(b, a)
    } else {
        if (this.action == "alerts") {
            if (this.process_alerts_result) {
                var b = "Tebrikler! ";
                var a = "<div class='marb10'>Your price alert has been saved.  Access all your saved searches and E-Posta Uyarıları in your <a href=\"" + site_root + 'account/alerts/property/">My EmlakRex</a> account anytime.</div>'
            } else {
                var b = "Error!";
                var a = "<div class='marbl10'>Birini Seçin an email alert option to subscribe to</div>"
            }
            if (typeof(e) != "undefined" && e == "register") {
                b = "You're almost done...";
                a = "<div class='marb10'>We've sent an email to <span class='dark_hilite bold'>confirm your account.</span>";
                if (this.process_alerts_result) {
                    a += ' Your price alerts will be saved once you click "Confirm".</div><div>Find all your saved searches and E-Posta Uyarıları in your <b>My EmlakRex</b> account.  So don\'t forget to check your email!'
                }
            }
            show_generic_popup(b, a)
        }
    }
};
ToolBoxActions.process_email_alerts = function (a) {
    this.save_alerts();
    this.show_confirmation(a)
};
ToolBoxActions.process_save_property = function (a) {
    this.save_alerts();
    this.save_property();
    this.show_confirmation(a)
};
ToolBoxActions.save_property = function () {
    save_property(this.property_id, 1, undefined, undefined, this.property_type)
};
ToolBoxActions.save_alerts = function () {
    if (_emlakrex_logged_in == 0) {
        return
    }
    var a = false;
    var p = false;
    var l = "";
    if (this.action == "alerts") {
        a = YUI.getId("ealerts_property_comps_alert");
        p = YUI.getId("ealerts_property_status_alert");
        var j = YUI.getId("email_alerts_form_frequency");
        if (j) {
            l = j.value
        }
    } else {
        if (this.action == "save") {
            l = "gunluk";
            a = YUI.getId("save_property_comps_alert");
            p = YUI.getId("save_property_status_alert")
        }
    }
    if (typeof(_PROPERTY_TYPE) != "undefined" && _PROPERTY_TYPE == "For Rent") {
        this.process_alerts_result = false;
        return this.process_alerts_result
    }
    var m = 0;
    var b = 0;
    var f = this.property_id;
    var r = this.property_hash;
    var n = this.property_state;
    var g = this.property_price;
    var e = this.property_status;
    var q = "none";
    var h = "none";
    if (p && p.checked) {
        m = 1;
        if (l == "haftalik" || l == "gunluk") {
            q = l
        }
    }
    if (a && a.checked) {
        b = 1;
        if (l == "haftalik" || l == "gunluk") {
            h = l
        }
    }
    var k = site_root + "q_property_email_subscribe.php?";
    if (!m && !b) {
        this.process_alerts_result = false;
        return this.process_alerts_result
    } else {
        this.process_alerts_result = true
    }
    k += "ps=" + m + "&pf=" + q + "&cs=" + b + "&cf=" + h + "&pid=" + f + "&ph=" + r + "&st=" + n + "&pr=" + g + "&pst=" + e;
    var c = getHTTPObject();
    c.open("POST", k, true);
    c.onreadystatechange = function () {
        if (c.readyState == 4) {
            var v = c.responseXML;
            if (!v) {
                return
            }
            var t = v.documentElement.getElementsByTagName("o")[0];
            var u = t.getAttribute("ps");
            var w = t.getAttribute("cs");
           /* if (u > 0) {
                _pageTracker("/status")
            }
            if (w > 0) {
                _pageTracker("/comps")
            }*/
        }
    };
    c.send(null)
};
ToolBoxActions.post_login_callback = function (a) {
    if (this.process_save == 1 && this.action == "save") {
        this.process_save = 0;
        this.process_save_property(a)
    } else {
        if (this.process_alerts == 1 && this.action == "alerts") {
            this.process_alerts = 0;
            this.process_email_alerts(a)
        }
    }
};
ToolBoxActions.show_custom_callback = function () {
    if (this.action == "alerts") {
        var b = YUI.getId("ealerts_property_address");
        if (b && typeof(this.property_address) != "undefined") {
            b.innerHTML = this.property_address
        }
        this.process_alerts = 1
    } else {
        if (this.action == "save") {
            var c = YUI.getId("save_property_address");
            if (c && typeof(this.property_address) != "undefined") {
                c.innerHTML = this.property_address
            }
            if (typeof(_PROPERTY_TYPE) != "undefined" && _PROPERTY_TYPE == "For Rent") {
                save_alert_section = YUI.getId("save_property_alert_checkboxes");
                var a = YUI.getId("save_prop_extra_copy");
                if (typeof(a) != "undefined") {
                    emlakrex.hide(a)
                }
                if (save_alert_section) {
                    emlakrex.hide(save_alert_section)
                } else {
                    emlakrex.unhide(save_alert_section)
                }
            }
            this.process_save = 1
        }
    }
};
ToolBoxActions.reset_login_callback = function () {
    this.process_alerts = 0;
    this.process_save = 0;
    this.action = ""
};
emlakrex.property_data = {};
emlakrex.emlagi_kaydet_post_login_callback = function (c) {
    if (typeof(emlakrex.property_data) != "undefined") {
        var a = null,
            b = "Template";
        if (emlakrex.property_data.action == "alerts") {
            if (c == "register") {
                b += "6"
            } else {
                b += "7"
            }
            a = document.global_email_alerts_form
        } else {
            if (emlakrex.property_data.action == "save_favorite") {
                if (c == "register") {
                    b += "1"
                } else {
                    b += "2"
                }
                a = document.global_save_property_form
            }
        }
        emlakrex.save_property_alerts(emlakrex.property_data.property_id, emlakrex.property_data.address_hash, emlakrex.property_data.property_status, a, emlakrex.property_data.action, b)
    }
};
emlakrex.emlagi_kaydet_ve_uyariyi_goster = function (property_id, address_hash, property_status, action, _callback) {
    if (!_emlakrex_logged_in) {
        emlakrex.property_data.property_id = property_id;
        emlakrex.property_data.address_hash = address_hash;
        emlakrex.property_data.property_status = property_status;
        emlakrex.property_data.action = action;
        emlakrex.property_data._callback = _callback;
        if (action == "save_favorite") {
            show_login(null, "global_save_property_form", true)
        } else {
            show_login(null, "global_email_alerts_form", true)
        }
        return false
    }
    var mutex_name = "save_property_alerts";
    if (!is_mutex_free(mutex_name)) {
        return false
    }
    if (typeof(action) == "undefined") {
        action = "save_favorite"
    }
    var callback = {
        success: function (o) {
            release_mutex(mutex_name);
            if (o.responseText == "-1") {
                return
            }
            if (o.responseText == "1") {
                toggle_icon(property_id, true, 1, property_status);
                return
            }
            if (typeof(_callback) == "function") {
                _callback(o)
            }
            eval("var popup_content = " + o.responseText);
            var show_popup = function () {
                var cfg = {
                    id: "property_alerts",
                    width: "410px",
                    close: true,
                    cache_endpoint: false,
                    use_cancel_link: true,
                    destroy_on_cancel: true
                };
                var popup = new emlakrex.Popup(cfg);
                popup.setHeader(popup_content.header);
                popup.setBody(popup_content.body);
                popup.show()
            };
            if (!YAHOO.widget.Panel) {
                YUI.use("container", show_popup)
            } else {
                show_popup()
            }
            if (typeof(popup_content) != "undefined") {
                if (typeof(popup_content.saved) != "undefined" && popup_content.saved == true) {
                    toggle_icon(property_id, true, 1, property_status)
                }
            }
        },
        failure: function (o) {
            release_mutex(mutex_name)
        }
    };
    set_mutex(mutex_name, 1);
    YUI.u.Connect.asyncRequest("POST", site_root + "Sorgu/q_save_listing/?prpty_id=" + property_id + "&property_status=" + property_status + "&action=" + action, callback)
};
emlakrex.track_email_alert_signup = function (b) {
    var a = "";
    if (typeof(s) != "undefined" && typeof(s.pageName) != "undefined") {
        if (s.pageName.match("details") != null) {
            a += "Details_"
        } else {
            if (s.pageName.match("results") != null) {
                a += "Results_"
            }
        }
    }
    if (typeof(b) != "undefined") {
        a += b
    }
  //  _pageTracker(a)
};
emlakrex.save_property_alerts = function (property_id, address_hash, property_status, form, action, tracking_code, callback) {
    var mutex_name = "save_property_alerts";
    if (!is_mutex_free(mutex_name)) {
        return false
    }
    if (_emlakrex_logged_in == 0 || typeof(form) == "undefined") {
        return false
    }
    var status_opt_in = 0;
    var comps_alert = 0;
    var save_property = 0;
    if (typeof(form.status_alert_opt_in) != "undefined" && (form.status_alert_opt_in.value == 1 || form.status_alert_opt_in.checked)) {
        status_opt_in = 1
    }
    if (typeof(form.comps_alert) != "undefined" && (form.comps_alert.value == 1 || form.comps_alert.checked)) {
        comps_alert = 1
    }
    if (typeof(form.save_property) != "undefined" && form.save_property.value == 1) {
        save_property = 1
    }
    var page_url = site_root + "Sorgu/q_save_listing/?action=" + action + "&prpty_id=" + property_id + "&property_status=" + property_status + "&status_opt_in=" + status_opt_in + "&comps_alert=" + comps_alert + "&save_property=" + save_property;
    if (typeof(callback) != "function") {
        var callback = {
            success: function (o) {
                release_mutex(mutex_name);
                emlakrex.track_email_alert_signup(tracking_code);
                if (o.responseText == "1" || o.responeText == "-1") {
                    return
                }
                eval("var popup_content = " + o.responseText);
                if (typeof(popup_content) != "undefined") {
                    if (typeof(popup_content.saved) != "undefined" && popup_content.saved == true) {
                        toggle_icon(property_id, true, 1, property_status)
                    }
                }
            },
            failure: function (o) {
                release_mutex(mutex_name)
            }
        }
    }
    set_mutex(mutex_name, 1);
    YUI.u.Connect.asyncRequest("POST", page_url, callback)
};
emlakrex.email_opt_in = function (b, c, e, f) {
    var a = "status_alerts_opt_in";
    if (!is_mutex_free("status_alerts_opt_in")) {
        return false
    }
    if (c == 1 || c == "on" || c === true) {
        c = "1"
    } else {
        if (c == 0 || c == "off" || c === false) {
            c = "0"
        } else {
            return false
        }
    }
    if (typeof(f) != "function") {
        var f = {
            success: function (h) {
                var g = h.responseText;
                release_mutex(a)
            },
            failure: function (h) {
                var g = h.responseText;
                release_mutex(a)
            }
        }
    }
    set_mutex(a, 1);
    YUI.u.Connect.asyncRequest("POST", site_root + "Sorgu/q_email_opt_in/?type=" + encodeURIComponent(b) + "&action=" + c + "&frequency=" + encodeURIComponent(e), f);
    return true
};

function UserPropertyNote() {}
UserPropertyNote.default_property_note = "e.g. great neighborhood within walking distance of parks, shops, and transit";
UserPropertyNote.editable_note_id = "upn_editable_note";
UserPropertyNote.main_container = "upn_container";
UserPropertyNote.feedback_container_id = "upn_feedback_container";
UserPropertyNote.feedback_message_id = "upn_feedback_message";
UserPropertyNote.inline_container_id = "upn_inline_container";
UserPropertyNote.inline_note_id = "upn_inline_note";
UserPropertyNote.max_note_length = 1500;
UserPropertyNote.process_note = 0;
UserPropertyNote.property_id = 0;
UserPropertyNote.property_type = "Satılık";
UserPropertyNote.show = function (a, b) {
    if (typeof(a) != "undefined") {
        this.property_id = a
    } else {
        if (typeof(_DETAILS_PROPERTY_ID) != "undefined") {
            this.property_id = _DETAILS_PROPERTY_ID
        }
    }
    if (typeof(b) != "undefined") {
        this.property_type = b
    } else {
        if (typeof(_PROPERTY_TYPE) != "undefined") {
            this.property_type = _PROPERTY_TYPE
        }
    }
    if (_emlakrex_logged_in) {
        this.edit()
    } else {
        show_login(null, "login_upn", true)
    }
};
UserPropertyNote.post_login_callback = function () {
    if (this.process_note == 1) {
        this.edit()
    }
};
UserPropertyNote.show_custom_callback = function () {
    this.process_note = 1;
    if (_emlakrex_logged_in) {
        var a = YUI.getId("login_upn_container");
        if (a) {
            a.style.display = "none"
        }
    }
};
UserPropertyNote.reset_login_callback = function () {
    this.process_note = 0
};
UserPropertyNote.delete_note = function (b, c) {
    if (typeof(b) != "undefined") {
        this.property_id = b
    } else {
        if (typeof(_DETAILS_PROPERTY_ID) != "undefined") {
            this.property_id = _DETAILS_PROPERTY_ID
        }
    }
    if (typeof(c) != "undefined") {
        this.property_type = c
    } else {
        if (typeof(_PROPERTY_TYPE) != "undefined") {
            this.property_type = _PROPERTY_TYPE
        }
    }
    var e = YUI.getId(this.editable_note_id);
    var a = 0;
    if (e) {
        a = this.q_user_property_note("delete", e, this.property_id, this.property_type)
    }
};
UserPropertyNote.clear = function () {
    var a = YUI.getId(this.editable_note_id);
    a.value = ""
};
UserPropertyNote.edit = function () {
    var b = YUI.getId(this.editable_note_id);
    var a = 0;
    if (b) {
        this.reset_container();
        a = this.q_user_property_note("get", b, this.property_id, this.property_type);
        pos_menuyu_goster(null, "user_note_popup", true)
    }
};
UserPropertyNote.show_inline_note = function () {
    var b = YUI.getId(this.editable_note_id);
    if (b) {
        var a = this.q_user_property_note("get", b, this.property_id, this.property_type)
    }
};
UserPropertyNote.save = function () {
    var b = YUI.getId(this.editable_note_id);
    var a = 0;
    if (b) {
        a = this.q_user_property_note("save", b, this.property_id, this.property_type)
    }
};
UserPropertyNote.reset_container = function () {
    var c = YUI.getId(this.feedback_container_id);
    var b = YUI.getId(this.main_container);
    var a = YUI.getId(this.feedback_message_id);
    this.clear();
    if (!c || !b || !a) {
        return
    }
    b.style.display = "block";
    a.innerHTML = "";
    c.style.display = "none"
};
UserPropertyNote.show_feedback = function (e, k, c) {
    if (typeof(c) == "undefined") {
        var c = this.property_id
    } else {
        this.property_id = c
    }
    var b = YUI.getId(this.feedback_container_id);
    var g = YUI.getId(this.main_container);
    var j = YUI.getId(this.feedback_message_id);
    var h = YUI.getId(this.inline_container_id + this.property_id);
    var f = YUI.getId(this.inline_note_id + this.property_id);
    if (!b || !g || !j) {
        return
    }
    if (e == "save") {
        var a = "Notunuz kaydedildi.";
        g.style.display = "none";
        if (typeof(k) != "undefined" && k.note) {
            if (h || f) {
                f.innerHTML = k.note;
                emlakrex.unhide(h, "block")
            } else {
                a = "<b>Notunuz kaydedildi.</b><br /><br />";
                if (typeof(this.property_id) != "undefined") {
                    a += 'You can view your saved notes on the <a  style="color: #0054A6;" href="' + site_root + "property/" + this.property_id + '">property details</a> page.'
                }
            }
        }
        j.innerHTML = a;
        emlakrex.unhide(b, "block")
    } else {
        if (e == "delete") {
            g.style.display = "none";
            j.innerHTML = "Your message has been deleted.";
            b.style.display = "block";
            if (typeof(k) != "undefined" && k.code && k.code == 1) {
                f.innerHTML = "";
                h.style.display = "none"
            }
            pos_menuyu_goster(null, "user_note_popup", true)
        }
    }
};
UserPropertyNote.q_user_property_note = function (action, note_text_element, property_id, property_type) {
    if (!action || !note_text_element || !property_id || !property_type) {
        return false
    }
    var note_text = trim(note_text_element.value);
    var inline_container = YUI.getId(this.inline_container_id + property_id);
    var inline_note_element = YUI.getId(this.inline_note_id + property_id);
    if (action == "save" && note_text.length > this.max_note_length) {
        alert("Your note is longer than the allowed limit of " + this.max_note_length + " characters.  Please reduce the length of your note.");
        return false
    }
    if (action == "save" && note_text.length < 1) {
        alert("You cannot save an empty note.");
        return false
    }
    var result;
    var ajax = new QAjax();
    ajax.set_script_info({
        script: "Sorgu/q_details_property_note/",
        method: "post",
        output: "text"
    });
    ajax.set_value("action", action);
    ajax.set_value("pid", property_id);
    ajax.set_value("ptype", property_type);
    ajax.set_value("note", note_text);
    var parent_object = this;
    ajax.set_callback(function (text) {
        var not_logged_in = YUI.getId("user_property_note_not_logged_in");
        var logged_in = YUI.getId("user_property_note_logged_in");
        eval("result=" + text);
        if (result.code) {
            if (result.code == -1) {
                parent_object.show()
            } else {
                if (result.code == 1) {
                    if (action == "delete") {
                        note_text_element.value = "";
                        parent_object.show_feedback(action, result, property_id)
                    } else {
                        if (action == "save") {
                            note_text_element.value = result.note;
                            parent_object.show_feedback(action, result, property_id);
                            if (note_text_element) {
                                note_text_element.value = result.note
                            }
                            DOMUtils.hide_selects_by_el("user_note_popup")
                        } else {
                            if (action == "get") {
                                if (note_text_element) {
                                    note_text_element.value = result.note
                                }
                                if (inline_container && inline_note_element) {
                                    inline_note_element.innerHTML = result.note;
                                    inline_container.style.display = "block"
                                }
                            }
                        }
                    }
                } else {}
            }
        }
    });
    ajax.go()
};

function q_update_carousel(el, dir, prop_type, search_url, blocked_pid, track_code, carousel_type, profile_user_id) {
    if (typeof(search_url) == "undefined" || !search_url || typeof(prop_type) == "undefined" || !prop_type) {
        return false
    }
    var carousel_window = YUI.getId(el);
    if (!carousel_window) {
        return false
    }
    var previous_page_num_el = YUI.getId(carousel_window.id + "_previous_page_num"),
        next_page_num_el = YUI.getId(carousel_window.id + "_next_page_num");
    if (!previous_page_num_el || !next_page_num_el) {
        return false
    }
    var previous_btn = YUI.getId(carousel_window.id + "_previous"),
        next_btn = YUI.getId(carousel_window.id + "_next");
    if (dir == -1) {
        var page_requested = parseInt(previous_page_num_el.innerHTML);
        if (!page_requested) {
            if (previous_btn) {
                YUI.u.Dom.addClass(previous_btn, "carousel_first_btn_disabled")
            }
            return false
        }
    } else {
        var page_requested = parseInt(next_page_num_el.innerHTML);
        if (!page_requested) {
            if (next_btn) {
                YUI.u.Dom.addClass(next_btn, "carousel_btn_disabled")
            }
            return false
        }
    }
    set_opac(carousel_window, 30);
    var ajax = new QAjax();
    ajax.set_value("lpr", page_requested);
    ajax.set_value("surl", search_url);
    ajax.set_value("bpid", blocked_pid);
    ajax.set_value("ppid", (typeof(_DETAILS_PROPERTY_ID) != "undefined") ? _DETAILS_PROPERTY_ID : -1);
    ajax.set_value("propt", prop_type);
    ajax.set_value("track_code", track_code);
    if (typeof(carousel_type) != "undefined" && carousel_type != "") {
        ajax.set_value("carousel_type", carousel_type)
    }
    if (typeof(profile_user_id) != "undefined" && profile_user_id != "") {
        ajax.set_value("uid", profile_user_id)
    }
    ajax.set_script_info({
        script: "Sorgu/q_get_carousel_items/",
        method: "get",
        output: "text"
    });
    ajax.set_callback(function (response) {
        var paging_string_el = YUI.getId(carousel_window.id + "_carousel_header_right");
        if (typeof(response) == "undefined" || !response) {
            if (dir == -1) {
                YUI.u.Dom.addClass(previous_btn, "carousel_first_btn_disabled")
            } else {
                YUI.u.Dom.addClass(next_btn, "carousel_btn_disabled")
            }
            if (carousel_window) {
                carousel_window.innerHTML = "There are no more properties to display."
            }
            set_opac(carousel_window, 100);
            return false
        }
        eval("var data = " + response);
        if (typeof(data.new_html_items) == "undefined" || !data.new_html_items || typeof(data.l_previous_page_num) == "undefined" || typeof(data.l_next_page_num) == "undefined") {
            return false
        }
        carousel_window.innerHTML = data.new_html_items;
        previous_page_num_el.innerHTML = data.l_previous_page_num;
        next_page_num_el.innerHTML = data.l_next_page_num;
        if (previous_btn) {
            if (!data.l_previous_page_num) {
                YUI.u.Dom.addClass(previous_btn, "carousel_first_btn_disabled")
            } else {
                YUI.u.Dom.removeClass(previous_btn, "carousel_first_btn_disabled")
            }
        }
        if (next_btn) {
            if (!data.l_next_page_num) {
                YUI.u.Dom.addClass(next_btn, "carousel_btn_disabled")
            } else {
                YUI.u.Dom.removeClass(next_btn, "carousel_btn_disabled")
            }
        }
        if (paging_string_el) {
            paging_string_el.innerHTML = data.paging_string
        }
        set_opac(carousel_window, 100)
    });
    ajax.go()
}
function q_update_new_carousel(el, dir, prop_type, search_url, blocked_pid, track_code, carousel_type, profile_user_id, carousel_tab, page) {
    var debugAlert = false;
    if (typeof(search_url) == "undefined" || !search_url || typeof(prop_type) == "undefined" || !prop_type) {
        return false
    }
    if (debugAlert === true) {
        emlakrex.log("THROUGH 1")
    }
    if (typeof(carousel_tab) == "undefined" || !carousel_tab) {
        carousel_tab = "my_search"
    }
    var carousel_window = YUI.getId(el);
    if (!carousel_window) {
        return false
    }
    var previous_page_num_el = YUI.getId(carousel_window.id + "_previous_page_num"),
        next_page_num_el = YUI.getId(carousel_window.id + "_next_page_num");
    if (!previous_page_num_el || !next_page_num_el) {
        return false
    }
    if (debugAlert === true) {
        emlakrex.log("THROUGH 3")
    }
    var previous_btn = YUI.getId(carousel_window.id + "_previous"),
        next_btn = YUI.getId(carousel_window.id + "_next");
    var prevInt = parseInt(previous_page_num_el.innerHTML);
    var nextInt = parseInt(next_page_num_el.innerHTML);
    if (dir == -1) {
        var page_requested = prevInt;
        if (debugAlert === true) {
            emlakrex.log("PREV: " + prevInt)
        }
        if (!page_requested) {
            if (previous_btn) {
                YUI.u.Dom.addClass(previous_btn, "carousel_first_btn_disabled")
            }
            if (debugAlert === true) {
                emlakrex.log("NO PAGE REQUESTED - PREV")
            }
        }
    } else {
        var page_requested = nextInt;
        if (debugAlert === true) {
            emlakrex.log("NEXT: " + prevInt)
        }
        if (!page_requested) {
            if (next_btn) {
                YUI.u.Dom.addClass(next_btn, "carousel_btn_disabled")
            }
            if (debugAlert === true) {
                emlakrex.log("NO PAGE REQUESTED - NEXT")
            }
        }
    }
    if (debugAlert === true) {
        emlakrex.log("THROUGH 4")
    }
    if (typeof(page) != "undefined" && page) {
        page_requested = page
    }
    if ("" + page_requested == "NaN") {
        return
    }
    var ajax = new QAjax();
    ajax.set_value("lpr", page_requested);
    ajax.set_value("surl", search_url);
    ajax.set_value("bpid", blocked_pid);
    ajax.set_value("ppid", (typeof(_DETAILS_PROPERTY_ID) != "undefined") ? _DETAILS_PROPERTY_ID : -1);
    ajax.set_value("propt", prop_type);
    ajax.set_value("track_code", track_code);
    ajax.set_value("carousel_tab", carousel_tab);
    ajax.set_value("c", the_city);
    ajax.set_value("s", the_state_code);
    if (typeof(carousel_type) != "undefined" && carousel_type != "") {
        if (carousel_type == "large") {
            ajax.set_value("row_num", 20)
        }
        ajax.set_value("carousel_type", carousel_type)
    }
    if (typeof(profile_user_id) != "undefined" && profile_user_id != "") {
        ajax.set_value("uid", profile_user_id)
    }
    ajax.set_script_info({
        script: "Sorgu/q_get_carousel_items/",
        method: "get",
        output: "text"
    });
    ajax.set_callback(function (response) {
        if (typeof(response) == "undefined" || !response) {
            return false
        }
        eval("var data = " + response);
        if (typeof(data.new_html_items) == "undefined" || !data.new_html_items || typeof(data.l_previous_page_num) == "undefined" || typeof(data.l_next_page_num) == "undefined") {
            return false
        }
        if (previous_btn) {
            if (!data.l_previous_page_num) {
                YUI.u.Dom.addClass(previous_btn, "carousel_first_btn_disabled")
            } else {
                YUI.u.Dom.removeClass(previous_btn, "carousel_first_btn_disabled")
            }
        }
        if (next_btn) {
            if (!data.l_next_page_num) {
                YUI.u.Dom.addClass(next_btn, "carousel_btn_disabled")
            } else {
                YUI.u.Dom.removeClass(next_btn, "carousel_btn_disabled")
            }
        }
        if (carousel_tab && typeof(data.carousel_count) != "undefined" && typeof(data.carousel_url) != "undefined") {
            if (typeof(large_carousel_tab_summary[carousel_tab]) == "undefined") {
                large_carousel_tab_summary[carousel_tab] = {}
            }
            large_carousel_tab_summary[carousel_tab]["count"] = data.carousel_count;
            large_carousel_tab_summary[carousel_tab]["url"] = data.carousel_url
        }
        update_carousel_summary(carousel_tab);
        var current_tab = YUI.getId(carousel_window.id + "_tab").innerHTML;
        if (current_tab != data.carousel_tab) {
            var oLI = YUI.get("#emlakrex_property_carousel_width ol")[0];
            clone_carousel_data(carousel_window.id, current_tab);
            oLI.innerHTML = "";
            previous_page_num_el.innerHTML = "";
            next_page_num_el.innerHTML = 2;
            var cacheIndex = YUI.getId(carousel_tab + "_index");
            var scrollIndex = 0;
            if (cacheIndex) {
                scrollIndex = parseInt(cacheIndex.innerHTML)
            }
            carousel.scrollTo(scrollIndex)
        } else {
            if ("" + prevInt == "NaN") {
                previous_page_num_el.innerHTML = 1
            } else {
                previous_page_num_el.innerHTML = prevInt + 1
            }
            next_page_num_el.innerHTML = nextInt + 1
        }
        eval(data.new_html_items);
        YUI.getId(carousel_window.id + "_tab").innerHTML = data.carousel_tab;
        var c = YUI.u.Dom.getChildren(YUI.get("#emlakrex_property_carousel_width ol")[0]);
        for (i = 0; i < c.length; i++) {
            c[i].id = "yui-gen" + (i + 2)
        }
        if (c.length > 5) {
            YUI.u.Dom.removeClass(YUI.get(".yui-carousel-next-button")[0], "yui-carousel-next-button-disabled")
        }
        set_opac(YUI.get("#emlakrex_property_carousel_width ol")[0], 100)
    });
    ajax.go()
}
function clone_carousel_data(t, f) {
    var a = false;
    var m = f + "_html";
    var k = YUI.get("#emlakrex_property_carousel_width ol")[0];
    var l = k.cloneNode(true);
    l.id = m;
    var p = 0;
    var r = YUI.get("#emlakrex_property_carousel ol.yui-carousel-element")[0].getElementsByTagName("li");
    for (i = 0; i < r.length; i++) {
        if (r[i].getAttribute("tabindex", 2) == 0) {
            p = i;
            YUI.u.Dom.addClass(r[i], "yui-carousel-item-selected")
        } else {
            YUI.u.Dom.removeClass(r[i], "yui-carousel-item-selected")
        }
    }
    if (YUI.getId(m) && YUI.getId(f + "_prev") && YUI.getId(f + "_next")) {
        YUI.getId(m).innerHTML = l.innerHTML;
        var b = parseInt(YUI.getId(f + "_prev").innerHTML);
        var h = parseInt(YUI.getId(f + "_next").innerHTML);
        if ("" + b == "NaN") {
            YUI.getId(f + "_prev").innerHTML = ""
        } else {
            YUI.getId(f + "_prev").innerHTML = b + 1
        }
        if ("" + h == "NaN") {
            YUI.getId(f + "_next").innerHTML = b + 2
        } else {
            YUI.getId(f + "_next").innerHTML = h + 1
        }
        YUI.getId(f + "_index").innerHTML = p
    } else {
        YUI.u.Dom.insertAfter(l, k);
        var j = YUI.getId(t + "_next_page_num").cloneNode(true);
        j.id = f + "_next";
        YUI.u.Dom.insertAfter(j, k);
        var e = YUI.getId(t + "_previous_page_num").cloneNode(true);
        e.id = f + "_prev";
        YUI.u.Dom.insertAfter(e, k);
        var g = YUI.getId(t + "_index");
        var q = g.cloneNode(true);
        q.id = f + "_index";
        q.innerHTML = p;
        YUI.u.Dom.insertAfter(q, k)
    }
    YUI.u.Dom.addClass(m, "gone");
    var n = YUI.u.Dom.getChildren(YUI.get("#emlakrex_property_carousel_width ol.yui-carousel-element.gone")[0]);
    for (i = 0; i < n.length; i++) {
        n[i].id = "";
        YUI.u.Dom.removeClass(r[i], "yui-carousel-item-selected")
    }
    var n = YUI.u.Dom.getChildren(YUI.get("#emlakrex_property_carousel_width ol.yui-carousel-element")[0]);
    for (i = 0; i < n.length; i++) {
        n[i].id = "yui-gen" + (i + 2)
    }
}
function build_property_map_url(g, a, e, j) {
    if (typeof(T_MAP) == "undefined" || typeof(T_MAP.utils) == "undefined") {
        return
    }
    var b = T_MAP.utils.getMapType();
    var c = site_root + "nearby/";
    if (typeof(j) != "undefined" && j == true) {
        if (b == "G_STREET_TYPE") {
            b = "G_MAP_TYPE"
        }
        c += "poi/"
    }
    if (typeof(_IS_FORECLOSURE) != "undefined" && _IS_FORECLOSURE == 1) {
        c += "foreclosure/"
    } else {
        if (typeof(_PROPERTY_TYPE) != "undefined" && _PROPERTY_TYPE == "isyeri") {
            var h = the_state.replace(/\W+/g, "_");
            var f = the_city.replace(/\W+/g, "_");
            c += "isyeri/" + h + "/" + f + "/"
        }else  if (typeof(_PROPERTY_TYPE) != "undefined" && _PROPERTY_TYPE == "arsa") {
            var h = the_state.replace(/\W+/g, "_");
            var f = the_city.replace(/\W+/g, "_");
            c += "arsa/" + h + "/" + f + "/"
        } else {
            if (typeof(_PROPERTY_URL_TYPE) != "undefined" && (_PROPERTY_URL_TYPE == "rental" || _PROPERTY_URL_TYPE == "classified")) {
                c += _PROPERTY_URL_TYPE + "/"
            }
        }
    }
    T_MAP.setMapSizing();
    c += "z-" + T_MAP.map.getZoom() + "/";
    c += "t-" + b + "/";
    c += T_MAP.map.getCenter().toUrlValue() + "/" + a + "-" + e;
    g.href = "http://" + window.location.host + c;
    return c
}
function share_this_page(g, j, h, c) {
    if (typeof(j) == "undefined" || !j) {
        var f = encodeURIComponent(document.title)
    } else {
        var f = encodeURIComponent(j)
    }
    if (typeof(c) == "undefined" || !c) {
        var b = encodeURIComponent(location.href)
    } else {
        var b = encodeURIComponent(c)
    }
    var a = "Share_This|";
    switch (g) {
    case "send_emlakrex":
       // oa_track_ql_click(a + "SendEmlakRex");
        if (typeof(h) == "undefined" || !h) {
            var h = window.event
        }
        build_email_page_url(h, b, "Send this page to a friend!");
        break;
    case "facebook":
        //oa_track_ql_click(a + "Facebook");
        window.open("http://www.facebook.com/sharer.php?u=" + b + "&t=" + f, "shareemlakrex", "toolbar=0,status=0,width=626,height=436");
        break;
    case "facebook_link":
      //  oa_track_ql_click("Share_Link|Facebook");
        window.open("http://www.facebook.com/sharer.php?u=" + b + "&t=" + f, "shareemlakrex", "toolbar=0,status=0,width=626,height=436");
        break;
    case "google_bkmk":
       // oa_track_ql_click(a + "GoogleBookmark");
        window.open("http://www.google.com/bookmarks/mark?op=edit&bkmk=" + b + "&title=" + f, "shareemlakrex");
        break;
    case "myspace":
      //  oa_track_ql_click(a + "MySpace");
        window.open("http://www.myspace.com/index.cfm?fuseaction=postto&u=" + b + "&t=" + f, "shareemlakrex");
        break;
    case "technorati":
      //  oa_track_ql_click(a + "Technorati");
        window.open("http://technorati.com/faves?add=" + b, "shareemlakrex");
        break;
    case "digg":
       // oa_track_ql_click(a + "Digg");
        window.open("http://digg.com/submit?phase=2&url=" + b + "&title=" + f, "shareemlakrex");
        break;
    case "yahoo_bkmk":
     //   oa_track_ql_click(a + "YahooBookmark");
        window.open("http://us.bookmarks.yahoo.com/admin/savebm?adminAction=Add&selectall=on&url=" + b + "&title=" + f, "shareemlakrex");
        break;
    case "delicious":
       // oa_track_ql_click(a + "Delicious");
        window.open("http://del.icio.us/post?url=" + b + "&title=" + f, "shareemlakrex");
        break;
    case "stumble":
       // oa_track_ql_click(a + "StumbleUpon");
        window.open("http://www.stumbleupon.com/submit?url=" + b + "&title=" + f, "shareemlakrex");
        break;
    case "friendfeed":
       // oa_track_ql_click(a + "FriendFeed");
        window.open("http://friendfeed.com/?url=" + b + "&title=" + f, "shareemlakrex");
        break;
    case "twitter":
       // oa_track_ql_click(a + "Twitter");
        window.open("http://twitter.com/home?status=" + b, "shareemlakrex");
        break;
    default:
       // oa_track_ql_click(a + "error:" + g);
        break
    }
    return false
}
function toggle_property_additional_description() {
    var b = YUI.getId("property_additional_description");
    var c = YUI.getId("show_less_description_link");
    var a = YUI.getId("show_more_description_link");
    if (b) {
        if (b.style.display != "inline") {
            c.style.display = "block";
            a.style.display = "none";
            b.style.display = "inline"
        } else {
            c.style.display = "none";
            a.style.display = "inline";
            b.style.display = "none"
        }
    }
}
function validate_comment_form(e) {
    var a = ["error_questionCaptcha", "error_post_comment"];
    var c = trim(e.post_comment.value);
    var b = "";
    if (YUI.getId("error_summary")) {
        YUI.getId("error_summary").innerHTML = "";
        YUI.getId("error_summary").className = ""
    }
    for (i in a) {
        error_field = a[i];
        if (YUI.getId(error_field)) {
            YUI.getId(error_field).innerHTML = "";
            YUI.getId(error_field).className = ""
        }
    }
    var g = [];
    var f = (typeof(e.captcha) != "undefined");
    if (f) {
        b = e.captcha.value
    }
    if (f && b == "") {
        g.push("error_questionCaptcha")
    }
    if (c == "") {
        g.push("error_post_comment")
    }
    for (i in g) {
        error_field = g[i];
        if (YUI.getId(error_field)) {
            if (error_field == "error_questionCaptcha") {
                YUI.getId(error_field).innerHTML = "Please enter the correct text in the input box."
            } else {
                if (error_field == "error_post_comment") {
                    YUI.getId(error_field).innerHTML = "Please enter a comment."
                }
            }
            YUI.getId(error_field).className = "qa_error"
        }
    }
    if (g.length > 0) {
        if (YUI.getId("error_summary")) {
            YUI.getId("error_summary").innerHTML = "";
            YUI.getId("error_summary").appendChild($$("span", _QA_ERROR_LABELS.error_summary));
            YUI.getId("error_summary").className = "qa_error_summary"
        }
        return false
    } else {
        return true
    }
}
var _QA_DEFAULT_FIELDS = {};
var _QA_ERROR_FIELD_MAP = {};
var _qa_errors = new Queue(10);

function validate_ask_form(k, e) {
    if (e != true) {
        k.submit.value = "Lütfen bekleyiniz...";
        k.submit.disabled = true
    }
    var c = trim(k.questionTitle.value);
    if (c.toLowerCase() == _QA_DEFAULT_FIELDS.questionTitle.toLowerCase()) {
        c = ""
    }
    var m = trim(k.questionBody.value);
    if (m.toLowerCase() == _QA_DEFAULT_FIELDS.questionBody.toLowerCase()) {
        m = ""
    }
    var g = "";
    var p = trim(k.questionLocation.value);
    var n = (typeof(k.questionCaptcha) != "undefined");
    if (n) {
        g = k.questionCaptcha.value
    }
    var f = parseInt(k.categoryId.value);
    clear_ask_error_display();
    _qa_errors.clear();
    var l = new Array();
    if (c == "") {
        _qa_errors.add("question");
        l.push("question_none")
    } else {
        if (c.length < 5) {
            _qa_errors.add("question_too_short");
            l.push("question_short")
        } else {
            if (c.length > 150) {
                _qa_errors.add("question_too_long");
                l.push("question_long")
            }
        }
    }
    if (m != "") {
        if (m.length < 5) {
            _qa_errors.add("body_too_short");
            l.push("question_body_short")
        } else {
            if (m.length > 1000) {
                _qa_errors.add("body_too_long");
                l.push("question_body_long")
            }
        }
    }
    if (!f) {
        _qa_errors.add("category");
        l.push("question_category")
    }
    if (n && g == "") {
        _qa_errors.add("no_captcha");
        l.push("question_captcha")
    }
    if (!_qa_errors.is_empty()) {
        build_ask_error_display();
        var a = get_ask_error_summary_dom();
        var j = 0,
            h = 0;
        if (a && !_QA_ERROR_FIELD_MAP.no_error_summary_scroll) {
            var b = findPos(a);
            if (b && b.x && b.y) {
                j = b.x;
                h = b.y - 100
            }
            window.scroll(j, h)
        }
        if (e != true) {
            k.submit.value = "SUBMIT";
            k.submit.disabled = false
        }
        //process_qa_omni_errors(l);
        return false
    }
    if (m == "(isteye bağlı)") {
        k.questionBody.value = ""
    }
   /* if (k.questionEmail.checked || (k.questionEmail.type === "hidden" && k.questionEmail.value === "1")) {
        _pageTracker("/answer")
    }*/
    return true
}
function submit_voices_form(f, b) {
    var e, c, a;
    if (!f) {
        return
    } else {
        e = YUI.getId(f)
    }
    if (!e) {
        return
    }
    if (f == "ask_question_form") {
        a = validate_ask_form(e, true)
    } else {
        if (f == "answer_question_form") {
            a = validate_answer_form(e, true)
        } else {
            if (f == "post_comment_form") {
                a = validate_comment_form(e, true)
            }
        }
    }
    if (a) {
        if (b === true) {
            e.submit_preview.value = "1"
        } else {
            e.submit_preview.value = ""
        }
        if (_emlakrex_logged_in) {        
            e.submit()
        } else {
            if (handle_voices_reg_form(e)) {
                e.submit()
            }
        }
    }
}
function hide_voices_reg_form() {
    var b = YUI.getId("qa_registration");
    var a = YUI.getId("qa_login");
    if (b) {
        b.style.display = "none"
    }
    if (a) {
        a.style.display = "none"
    }
}
function populate_voices_p_containers() {
    if (typeof(populate_p_container) != "undefined" && !YUI.getId("p_container_child")) {
        populate_p_container()
    }
    if (typeof(populate_p_container2) != "undefined" && !YUI.getId("p_container_child2")) {
        populate_p_container2()
    }
}
function handle_voices_reg_form(h) {
    populate_voices_p_containers();
    var g = YUI.getId("qa_registration");
    var e = YUI.getId("qa_login");
    var l = false;
    if (!g && !e) {
        return false
    }
    var j = new Array();
    if ((YUI.u.Dom.getStyle(g, "display") == "block" && !YUI.u.Dom.hasClass(g, "hidden")) || (YUI.u.Dom.getStyle(g, "display") != "none" && !YUI.u.Dom.hasClass(g, "hidden"))) {
        if (validate_register(h, "_ie6whee", true)) {
            l = true
        }
    } else {
        if (YUI.u.Dom.getStyle(e, "display") == "block" && !YUI.u.Dom.hasClass(g, "hidden") || (YUI.u.Dom.getStyle(e, "display") != "none" && !YUI.u.Dom.hasClass(e, "hidden"))) {
            if (validate_login(h, "_ie6whee", true)) {
                l = true
            }
        } else {
            var c, k;
            if (h.id == "ask_question_form") {
                if (YUI.getId("questionLocationId").value && trim(YUI.getId("questionLocation").value).toLowerCase() != zsbdef.toLowerCase()) {
                    c = YUI.getId("questionLocation").value;
                    k = YUI.getId("questionLocationId").value
                } else {
                    if (user_loc_from_ip) {
                        c = user_loc_from_ip;
                        k = user_loc_from_ip
                    }
                }
                if (c && k) {
                    YUI.getId("location_field_ie6whee").value = c;
                    YUI.getId("autocomplete_location_ie6whee").value = k
                }
                var b = YUI.getId("categoryId").value;
                var f;
                if (b == 37) {
                    f = "Alıcıyım"
                } else {
                    if (b == 38) {
                        f = "Satıcıyım"
                    } else {
                        if (b == 53) {
                            f = "Alıcıyım"
                        } else {
                            if (b == 42) {
                                f = "Emlak Uzmanı"
                            }
                        }
                    }
                }
                if (f) {
                    YUI.getId("user_status_field_ie6whee").value = f;
                    if (f == "Emlak Uzmanı") {
                        block("register_form_pro_status_ie6whee")
                    } else {
                        hide("register_form_pro_status_ie6whee")
                    }
                }
            }
            block("qa_registration");
            l = false;
            j.push("question_login")
        }
    }
   /* for (var a in j) {
        _pageTracker(_QA_OMNI_ERRORS[j[a]])
    }*/
    return l
}
function get_ask_error_summary_dom() {
    var a = (_QA_ERROR_FIELD_MAP.error_summary) ? _QA_ERROR_FIELD_MAP.error_summary : "error_summary";
    return YUI.getId(a)
}
function build_ask_error_display() {
    var b;
    var a = get_ask_error_summary_dom();
    if (a) {
        a.innerHTML = "";
        a.appendChild($$("span", _QA_ERROR_LABELS.error_summary));
        a.className = "qa_error_summary"
    }
    _qa_errors.it_start();
    while (b = _qa_errors.it_next_element()) {
        if (typeof(_QA_ERROR_FIELD_MAP[b]) != "undefined" && YUI.getId(_QA_ERROR_FIELD_MAP[b])) {
            YUI.getId(_QA_ERROR_FIELD_MAP[b]).innerHTML = _QA_ERROR_LABELS[b];
            YUI.getId(_QA_ERROR_FIELD_MAP[b]).className = "qa_error"
        }
    }
}
function clear_ask_error_display() {
    var a = get_ask_error_summary_dom();
    if (a) {
        a.innerHTML = "";
        a.className = ""
    }
    for (var b in _QA_ERROR_FIELD_MAP) {
        if (YUI.getId(_QA_ERROR_FIELD_MAP[b])) {
            YUI.getId(_QA_ERROR_FIELD_MAP[b]).innerHTML = "";
            YUI.getId(_QA_ERROR_FIELD_MAP[b]).className = ""
        }
    }
}
function create_ajax_feedback(c, b) {
    if (YUI.getId("ajax_feedback")) {
        remove_ajax_feedback()
    }
    if (b) {
        var a = $$("span", c, "ajax_feedback");
        YUI.u.Dom.addClass(a, "ajax_feedback");
        b.appendChild(a)
    }
}
function remove_ajax_feedback() {
    kill("ajax_feedback")
}
var _QA_ASK_SUCCESS_OMNI_CODE;

function submit_ask_question_form(form_id, success_msg_id, submit_button, omni_code) {
    var ask_form = YUI.getId(form_id);
    if (ask_form) {
        var ask_submit = YUI.getId(submit_button);
        if (ask_submit) {
            ask_submit.setAttribute("disabled", "true")
        }
        create_ajax_feedback("Saving...", ask_submit.parentNode);
        var ajax = new QAjax();
        ajax.set_from_form(ask_form);
        ajax.set_script_info({
            script: "q_ask_question.php",
            method: "post",
            output: "text"
        });
        ajax.set_callback(function (text) {
            if (ask_submit) {
                ask_submit.disabled = false
            }
            remove_ajax_feedback();
            eval("result=" + text);
            if (result.errors) {
                var error_summary = get_ask_error_summary_dom();
                if (error_summary) {
                    error_summary.innerHTML = "";
                    error_summary.appendChild($$("span", result.errors.message));
                    error_summary.className = "qa_error_summary"
                }
            } else {
                if (result.success) {
                    clear_ask_error_display();
                    var msg_id = (success_msg_id) ? success_msg_id : "ask_open_form_msg";
                    var msg = YUI.getId(msg_id);
                    msg.innerHTML = result.success.message;
                    YUI.u.Dom.removeClass(msg, "hidden");
                    YUI.u.Dom.addClass(ask_form, "hidden");
                    kill("ask_question_popup_from_contact_agent");
                    if (is_IE6() && form_id == "ask_question_form_TB") {
                        var my_pop = YUI.getId("ask_question_toolbox_popup");
                        DOMUtils.hide_selects_by_el(my_pop)
                    }
                    if (_QA_ASK_SUCCESS_OMNI_CODE) {
                        omni_code = _QA_ASK_SUCCESS_OMNI_CODE
                    }
                    var event_tracking = (omni_code) ? omni_code : "V100011";
                   // _pageTracker(result.success.question_id, event_tracking);
                    _QA_DEFAULT_FIELDS.omni_code = null
                }
            }
        });
        ajax.go()
    }
}
function init_ask_question_form(e, b, h, f, c, g) {
    var a = YUI.getId(e);
    YUI.u.Event.on(a, "submit", function (j) {
        if (b) {
            b.call()
        }
        YUI.u.Event.stopEvent(j);
        if (e != "ask_question_form_RQ" && !validate_ask_form(a, true)) {
            return false
        }
        if (!_emlakrex_logged_in) {
            show_login(j, f, false, findPos(a));
            YUI.u.Event.stopEvent(j);
            return false
        }
        submit_ask_question_form(e, h, c, g)
    })
}
function open_form_submit_ask_question_form() {
    submit_ask_question_form("ask_question_form", "ask_open_form_msg", "ask_prop_question_submit", "V100011")
}
function toolbox_submit_ask_question_toolbox_form() {
    pos_menuyu_goster({}, "ask_question_toolbox_popup");
    submit_ask_question_form("ask_question_form_TB", "ask_toolbox_form_msg", "ask_prop_question_submit_TB", "V100012")
}
function inline_submit_ask_question_recent_form() {
    submit_ask_question_form("ask_question_form_RQ", "ask_question_form_RQ_msg", "ask_question_form_RQ_btn")
}
function join_find_a_pro_success() {
    YUI.u.Dom.addClass("join_dir_logged_out", "hidden");
    YUI.u.Dom.removeClass("join_dir_logged_in", "hidden")
}
function toolbox_ask_question(a, b) {
    if (typeof b != "undefined" && b === true) {
        YUI.u.Dom.removeClass("ask_question_popup_from_contact_agent", "hidden")
    } else {
        YUI.u.Dom.addClass("ask_question_popup_from_contact_agent", "hidden")
    }
    pos_menuyu_goster(a, "ask_question_toolbox_popup");
    if (a) {
        YUI.u.Event.stopEvent(a)
    }
    return false
}
function ask_property_question_button(a) {
    _QA_ASK_SUCCESS_OMNI_CODE = "V100000";
    pos_menuyu_goster(a, "ask_question_toolbox_popup");
    YUI.u.Event.stopEvent(a);
    return false
}
function set_ie_table_hover(e) {
    if (!is_IE()) {
        return
    }
    var c = YUI.getId(e);
    if (c.tagName != "TABLE") {
        return
    }
    if (c) {
        var a = c.getElementsByTagName("tr");
        if (!a) {
            return
        }
        for (var b = 0; b < a.length; b++) {
            if (!YUI.u.Dom.hasClass(a[b], "table_hover_content_row")) {
                continue
            }
            a[b].onmouseover = function () {
                YUI.u.Dom.addClass(this, "row_hover_highlight")
            };
            a[b].onmouseout = function () {
                YUI.u.Dom.removeClass(this, "row_hover_highlight")
            }
        }
    }
}
function unformat_price(a, c) {
    if (typeof(a) == "undefined" || !a) {
        return ""
    }
    a = a.split(",").join("");
    if (a.indexOf("$") == 0) {
        a = a.substr(1, a.length)
    }
    var b = parseFloat(a);
    regex = /[kK]/;
    if (regex.test(a)) {
        a = b * 1000
    }
    regex = /[mM]/;
    if (regex.test(a)) {
        a = b * 1000000
    }
    a = parseInt(a);
    if (!c) {
        if (a < 1000) {
            a = a * 1000
        }
    }
    return a
}
emlakrex.show_static_popup = function (e, b, f, a) {
    if (typeof(a) == "undefined") {
        var a = true
    }
    if (typeof(f) == "undefined") {
        var f = "470px"
    }
    if (typeof(b) != "string") {
        var b = ""
    }
    var c = function () {
        var g = {
            width: f,
            close: true,
            classname: e,
            id: e,
            cache_endpoint: a
        };
        var j = new emlakrex.Popup(g);
        var h = "";
        if (e == "share_this_popup") {
            h = "html_id=ajax_share_this_popup&url=" + document.location.href
        }
        j.setContentSource("Sorgu/q_show_simple_popup/?popup_name=" + e + "&popup_header=" + b + "&" + h);
        j.show()
    };
    if (!YAHOO.widget.Panel) {
        YUI.use("container", c)
    } else {
        c()
    }
};
emlakrex.show_community_contact_form = function (a, b, e) {
    var c = function () {
        var g = "";
        if (typeof(e) != undefined) {
            g = "&floorplan_id=" + e
        }
        var f = {
            width: "420px",
            close: true,
            classname: "community_contact",
            id: "community_contact_show",
            cache_endpoint: false
        };
        var h = new emlakrex.Popup(f);
        h.setContentSource("q_show_contact_rental_community_form.php?property_id=" + a + "&state_code=" + b + g);
        h.show()
    };
    if (!YAHOO.widget.Panel) {
        YUI.use("container", c)
    } else {
        c()
    }
};
emlakrex.send_community_contact_form = function (b) {
    var c = YUI.getId(b);
    if (!c) {
        return
    }
    var a = function () {
        var e = {
            width: "420px",
            close: true,
            classname: "community_contact",
            id: "community_contact_send",
            cache_endpoint: false
        };
        var k = new emlakrex.Popup(e);
        var g = "q_contact_rental_community.php";
        var j = false;
        if (c.site_name && c.site_name.value == "ForRent.com") {
            g = "q_contact_forrent.php"
        }
        for (var h = 0; h < c.elements.length; h++) {
            if (c.elements[h].name && c.elements[h].value) {
                if (c.elements[h].name == "msg") {
                    var f = encodeURIComponent(c.elements[h].value)
                } else {
                    var f = c.elements[h].value
                }
                g += (!j ? "?" : "&") + c.elements[h].name + "=" + f;
                if (!j) {
                    j = true
                }
            }
        }
        destroy_popup("community_contact_show");
        k.setContentSource(g);
        k.show();
       // _pageTracker(b)
    };
    if (!YAHOO.widget.Panel) {
        YUI.use("container", a)
    } else {
        a()
    }
};
emlakrex.toggle_floorplan_rows = function (j, g, b) {
    var f = YUI.getId(j);
    if (!f) {
        return
    }
    var g = YUI.getId(g);
    if (!g) {
        return
    }
    var a = f.tBodies[0].getElementsByTagName("tr");
    var c = true;
    for (i = 0; i < a.length; i++) {
        if (i < b) {
            continue
        }
        try {
            if (YUI.u.Dom.hasClass(a[i], "gone")) {
                YUI.u.Dom.removeClass(a[i], "gone")
            } else {
                c = false;
                YUI.u.Dom.addClass(a[i], "gone")
            }
        } catch (h) {}
    }
    if (c) {
        g.innerHTML = "[-] Daha az"
    } else {
        g.innerHTML = "[+] Daha fazla"
    }
};
emlakrex.show_pdp_popup = function (e) {
    if (typeof(_DETAILS_PROPERTY_HASH) == "string") {
        var c = _DETAILS_PROPERTY_HASH
    }
    if (typeof(_PROPERTY_TYPE) == "string") {
        var a = _PROPERTY_TYPE
    }
    if (!c || !a) {
        return false
    }
    if (typeof(popup_header) != "string") {
        switch (e) {
        case "ask_question_toolbox_popup":
            popup_header = "Ask a question about this property";
            popup_width = "470px";
            cache_popup = true;
            break;
        case "pdp_edit_popup":
            popup_header = "Emlak Detaylarını Düzenle";
            popup_width = "600px";
            cache_popup = false;
            break
        }
    }
    var b = function () {
        var f = {
            width: popup_width,
            close: true,
            classname: e,
            id: "yui_" + e,
            cache_endpoint: cache_popup
        };
        var g = new emlakrex.Popup(f);
        g.setContentSource("q_show_pdp_popup.php?property_hash=" + c + "&property_type=" + a + "&popup_name=" + e + "&popup_header=" + popup_header);
        g.show()
    };
    if (!YAHOO.widget.Panel) {
        YUI.use("container", b)
    } else {
        b()
    }
};

function show_foreclosure_contact_popup() {
    var c = (typeof(_IS_FORECLOSURE) != "undefined" && _IS_FORECLOSURE == 1) ? true : false;
    var b = (typeof(_DETAILS_PROPERTY_HASH) == "string") ? _DETAILS_PROPERTY_HASH : false;
    if (c && b) {
        var a = function () {
            var e = {
                width: "470px",
                close: true,
                classname: "contact_user_form_popup",
                id: "contact_foreclosure_popup",
                cache_endpoint: true
            };
            var f = new emlakrex.Popup(e);
            f.setContentSource("q_foreclosure_contact_form.php?property_hash=" + b);
            f.show()
        };
        if (!YAHOO.widget.Panel) {
            YUI.use("container", a)
        } else {
            a()
        }
    }
}
emlakrex.show_my_searches = function () {
    var a = function () {
        var b = {
            width: "410px",
            close: true,
            classname: "my_searches_popup",
            id: "my_searches_popup",
            cache_endpoint: false,
            use_cancel_link: true
        };
        var c = new emlakrex.Popup(b);
        c.setContentSource("Sorgu/q_load_my_searches/?" + Math.random());
        YAHOO.util.Dom.getXY("bar");
        c.show()
    };
    if (!YAHOO.widget.Panel) {
        YUI.use("container", a)
    } else {
        a()
    }
};
emlakrex.show_send_to_friend_popup = function (c, f, a, g) {
    if (typeof(g) == "undefined") {
        g = ""
    }
    var b = (g != "" ? true : false);
    if (c && f && a) {
        var e = function () {
            var h = {
                width: "470px",
                close: true,
                classname: "contact_user_form_popup",
                id: "contact_send_to_friend_popup",
                cache_endpoint: false,
                use_cancel_link: true
            };
            var j = new emlakrex.Popup(h);
            j.setContentSource("email_page_property.php?get_form=1&propertyId=" + c + "&lt=" + f + "&state=" + a + (b ? "&is_rental_community=1" : ""));
            j.show()
        };
        if (!YAHOO.widget.Panel) {
            YUI.use("container", e)
        } else {
            e()
        }
    }
};

function show_contact_agent_popup(c) {
    var a = this.getAttribute("property_id");
    if (a) {
        YUI.u.Event.stopEvent(c);
        var b = function () {
            var e = {
                width: "350px",
                close: true,
                classname: "contact_user_form_popup",
                id: "yui_contact_agent_popup",
                cache_endpoint: true
            };
            var f = new emlakrex.Popup(e);
            f.setContentSource("q_property_contact_user_form.php?propertyId=" + a);
            f.show()
        };
        if (!YAHOO.widget.Panel) {
            YUI.use("container", b)
        } else {
            b()
        }
    }
}
function keyword_keypress_filter(b) {
    var f;
    var c;
    var a;
    if (window.event) {
        f = b.keyCode
    } else {
        if (b.which) {
            f = b.which
        }
    }
    c = String.fromCharCode(f);
    a = /[/?#&']/;
    rtn = !a.test(c);
    return rtn
}
function str_replace(f, e, c) {
    var a = "";
    var b = 0;
    for (i = c.indexOf(f); i > -1; i = c.indexOf(f, i)) {
        a += c.substring(b, i);
        a += e;
        i += f.length;
        b = i
    }
    return a + c.substring(b, c.length)
}
function lb_expand_div(b) {
    var a = YUI.getId("lb_expand_div_" + b);
    if (!a) {
        return
    }
    if (YUI.u.Dom.hasClass(a, "expanded")) {
        toggle_class(a, "collapsed", "expanded")
    } else {
        toggle_class(a, "expanded", "collapsed")
    }
}
function toggle_pdp_expand(c, e) {
    var b = c.id + "_img";
    var a = YUI.getId(c.id + "_txt");
    if (YUI.u.Dom.hasClass(b, "arrow_tab_opened_right")) {
        YUI.u.Dom.removeClass(b, "arrow_tab_opened_right");
        YUI.u.Dom.addClass(b, "arrow_tab_closed_right");
        if (a) {
            a.innerHTML = "Collapse"
        }
        unhide(e)
    } else {
        YUI.u.Dom.removeClass(b, "arrow_tab_closed_right");
        YUI.u.Dom.addClass(b, "arrow_tab_opened_right");
        if (a) {
            a.innerHTML = "Expand"
        }
        hide(e)
    }
}
function toggle_tab_display(e, a, c) {
    for (var b in e) {
        if (e[b] != a) {
            add_class(e[b] + c, "gone");
            add_class(e[b] + "_link", "pseudolink");
            remove_class(e[b] + "_link", "blackcolortxtlink")
        } else {
            remove_class(e[b] + c, "gone");
            add_class(e[b] + "_link", "blackcolortxtlink");
            remove_class(e[b] + "_link", "pseudolink")
        }
    }
}
function q_post_browser(type, post_id, cat_id, header) {
    var ajax = new QAjax();
    ajax.set_script_info({
        script: "q_post_browser.php",
        method: "get",
        output: "text"
    });
    ajax.set_value("ct", type);
    ajax.set_value("cid", post_id);
    ajax.set_value("catid", cat_id);
    ajax.set_value("h", header);
    ajax.set_callback(function (output) {
        eval("var o=" + output);
        if (o.success) {
            var elem = YUI.getId("post_browser_wrapper");
            if (elem) {
                elem.innerHTML = o.message
            }
        } else {}
    });
    ajax.go()
}
emlakrex.show_inbox_promo = function () {
    var b = "Sorgu/q_my_listings_popups/?pop=inbox_promo";
    var a = function () {
        var c = {
            width: "420px",
            close: true,
            classname: "inbox_promo",
            id: "inbox_promo_success_popup",
            cache_endpoint: false
        };
        var e = new emlakrex.Popup(c);
        e.setContentSource(b);
        e.show()
    };
    if (!YAHOO.widget.Panel) {
        YUI.use("container", a)
    } else {
        a()
    }
};

function get_targeting_variables(a) {
    return _AD_TARGETING[a]
}
function submit_foreclosure_contact_form(j) {
    var l, a;
    if (j.uid) {
        l = trim(j.uid.value)
    }
    if (j.from_where) {
        a = trim(j.from_where.value)
    }
    var c = trim(j.lead_user_email.value);
    if (!c || !is_valid_email(c)) {
        alert("Lütfen geçerli bir e-posta adresi giriniz");
        return false
    }
    var m = j.email_msg.value;
    if (!m) {
        alert("Please enter a message.");
        return false
    }
    var f = j.pid.value;
    var g = j.lead_user_name.value;
    var b = j.lead_user_phone.value;
    if (!is_valid_phone(b)) {
        alert("Please enter a valid phone number.");
        return false
    }
    var k = DOMUtils.get_value(j.address);
    var e = new Date();
    var h = new QAjax();
    h.set_from_form(j);
    h.set_script_info({
        script: "Sorgu/q_foreclosure_inquiry/",
        method: "post",
        output: "text"
    });
    h.set_callback(function (n) {
        var p;
        switch (n) {
        case "1":
            show_generic_popup("Tebrikler! ", "Teşekkürler, e-posta başarıyla gönderildi. An agent will contact you in the next 48 hours.");
           // _pageTracker("/ForeclosurePropertyLead", "");
            break;
        case "-1":
        default:
            show_generic_popup("Error", "Üzgünüz &#8212 e-postayı gönderirken hata oluştu.");
            break
        }
    });
    h.go()
}
emlakrex.namespace("Popup");
emlakrex._popup_panel_cache = {};
emlakrex._popup_panel_endpoint_cache = {};

function hide_popup(a) {
    if (!emlakrex._popup_panel_cache) {
        return
    }
    if (a == "login_box") {
        return
    }
    if (emlakrex._popup_panel_cache[a]) {
        emlakrex._popup_panel_cache[a].hide()
    }
}
function destroy_popup(a) {
    if (!emlakrex._popup_panel_cache) {
        return
    }
    if (emlakrex._popup_panel_cache[a]) {
        emlakrex._popup_panel_cache[a].hide();
        emlakrex._popup_panel_cache[a].destroy();
        delete(emlakrex._popup_panel_cache[a])
    }
    if (a == "login_box") {
        _emlakrex_lf = null
    }
    login_reset()
}
function hide_all_open_popups() {
    if (!emlakrex._popup_panel_cache) {
        return
    }
    for (var a in emlakrex._popup_panel_cache) {
        if (a == "login_box") {
            destroy_popup(a)
        } else {
            emlakrex._popup_panel_cache[a].hide()
        }
    }
}
emlakrex.show_lead_indicator = function (a) {
    YUI.ready(function () {
        var b = YUI.get("a[class~=my_leads_unread_indicator]");
        if (b != null && typeof(b.length) != "undefined" && b.length == 0) {
            return
        }
        a = a || false;
        if (a || ((typeof(_is_real_estate_pro) != "undefined") && _is_real_estate_pro == 1)) {
            var e = function (f) {
                if (f != null && f != "" && f != "0") {
                    YUI.iterate("a[class~=my_leads_unread_indicator]", function (g) {
                        var h = '<span class="my_leads_underline">' + g.innerHTML + '</span> <span class="my_leads_spacer"> </span><span title="Unread messages" class="my_leads_unread_count">' + f + "</span>";
                        g.innerHTML = h
                    })
                }
            };
            var c = new QAjax();
            c.set_script_info({
                script: "Sorgu/q_lead_inbox_method/",
                method: "get"
            });
            c.set_value("method", "get_unread_message_count");
            c.set_value("args", "{}");
            c.set_callback(e);
            c.go()
        }
    })
};
emlakrex.show_lead_indicator(false);
emlakrex.report_listing = {
    start: function (a, e, c) {
        var b = function () {
            var g, f = {
                width: "375px",
                close: true,
                classname: "pdp_report_listing_popup",
                id: "pdp_report_listing_popup",
                cache_endpoint: false,
                use_cancel_link: true,
                destroy_on_cancel: true,
                generated_on_click: true
            };
            g = new emlakrex.Popup(f);
            g.setContentSource("Sorgu/flag_incorrect_property/?start");
            g.show()
        };
        if (!YAHOO.widget.Panel) {
            YUI.use("container", b)
        } else {
            b()
        }
    },
    dispute_owner_edits: function () {
        var g = "dispute_owner_edits",
            f = false,
            c = YUI.getId("flag_type"),
            e = YUI.get("#flag_type option");
        for (var b = e.length - 1; b >= 0; b--) {
            if (e[b].value == g) {
                f = true
            } else {
                e[b].style.display = "none"
            }
        }
        if (!f) {
            var a = document.createElement("option");
            a.value = g;
            a.appendChild(document.createTextNode("Dispute owner's edits"));
            c.appendChild(a)
        }
        emlakrex.report_listing.open_report_error_popup("Other", g, "Dispute owner's edits");
        YUI.getId("flag_email").parentNode.parentNode.getElementsByTagName("span")[0].style.display = "none"
    },
    open_report_error_popup: function (f, b, a) {
        var c, e;
        DOMUtils.fill_element("error_box_popup_header", "Listeleme hatası bildir");
        pos_menuyu_goster(null, "error_box");
        if (b) {
            c = YUI.get("#flag_type");
            e = YUI.get("#flag_type option");
            for (i = 0; i < e.length; i++) {
                if (e[i].value === b) {
                    e[i].selected = true;
                    c.selectedIndex = i;
                    emlakrex.report_listing.error_type_change(c);
                    break
                }
            }
        }
        if (a) {
            YUI.getId("error_box_popup_header").innerHTML = a
        } else {
            YUI.getId("error_box_popup_header").innerHTML = "Listeleme hatası bildir"
        }
        if (f && YUI.getId("user_type")) {
            YUI.getId("user_type").value = f
        }
    },
    personality_chosen: function (e) {
        var b, f, a, c;
        a = YUI.get("input[name='what_am_i']");
        for (b = 0; b < a.length; b++) {
            if (a[b].checked) {
                f = a[b].value;
                break
            }
        }
        if (f) {
            if (f === "other") {
                emlakrex.report_listing.open_report_error_popup("Other", "incorrect_property_details")
            } else {
                if (f === "owner") {
                    if (!_emlakrex_logged_in) {
                        destroy_popup("pdp_report_listing_popup");
                        show_login(null, "login", true);
                        emlakrex.callbacks.login.push(function () {
                            emlakrex.report_listing.open_report_error_popup("Owner", "incorrect_property_details")
                        })
                    } else {
                        emlakrex.report_listing.open_report_error_popup("Owner", "incorrect_property_details")
                    }
                } else {
                    if (f === "agent") {
                        if (typeof(_LISTINGS_MANAGEMENT_FLAG_EDIT_URL) != "undefined") {
                            window.location.href = site_root + _LISTINGS_MANAGEMENT_FLAG_EDIT_URL
                        } else {
                            emlakrex.report_listing.open_report_error_popup("Emlak Uzmanı", "incorrect_property_details")
                        }
                    }
                }
            }
        } else {
            alert("Birini Seçin your role")
        }
    },
    error_type_change: function (h) {
        var a = h.selectedIndex,
            b = YUI.getId("property_detail_fields"),
            c = YUI.getId("property_remove_this_listing"),
            e = YUI.getId("property_dispute_edits"),
            g = YUI.getId("property_detail_price"),
            f = YUI.getId("flag_remove");
        g.value = "";
        if (h.length !== 5) {
            if (a === 1 || a === 3) {
                b && hide("property_detail_fields");
                c && unhide("property_remove_this_listing", "block");
                if (f) {
                    f.checked = false
                }
            } else {
                if (a === 2 || a === 6) {
                    b && unhide("property_detail_fields", "block");
                    c && hide("property_remove_this_listing");
                    if (f) {
                        f.checked = false
                    }
                } else {
                    if (a === 9) {
                        b && hide("property_detail_fields");
                        e && unhide("property_dispute_edits", "block")
                    } else {
                        b && hide("property_detail_fields");
                        c && hide("property_remove_this_listing");
                        if (f) {
                            f.checked = false
                        }
                    }
                }
            }
        } else {
            if (a === 1 || a === 2) {
                b && hide("property_detail_fields");
                c && unhide("property_remove_this_listing", "block");
                if (f) {
                    f.checked = false
                }
            } else {
                b && hide("property_detail_fields");
                c && hide("property_remove_this_listing");
                if (f) {
                    f.checked = false
                }
            }
        }
    },
    send: function () {
        var k = YUI.getId("error_box_status_msg"),
            g = YUI.getId("flag_type"),
            r, t = YUI.getId("flag_details"),
            e = YUI.getId("property_detail_price"),
            l = trim(YUI.getId("flag_email").value),
            u = [],
            m, p = "",
            f = YUI.getId("flag_type").selectedIndex,
            j, c, b, q, a;
        if (!g) {
            return
        }
        r = {
            property_detail_type: null,
            property_detail_listing_type: null,
            property_detail_price: "Emlak Fiyatı",
            property_detail_beds: "Yatak odası sayısı",
            property_detail_baths: "Banyo sayısı",
            property_detail_sqft: "M2 si",
            property_detail_lot_size: "Arsa Büyüklüğü",
            property_detail_year_built: "Emlak Yapım Yılı"
        };
        if (g.selectedIndex === 0) {
            alert("Lütfen hata türünü seçiniz.");
            g.focus();
            return false
        }
        if (l !== "" && !is_valid_email(l)) {
            bad_email_alert();
            YUI.getId("flag_email").focus();
            return false
        }
        var m = {
            s: (new Date()).valueOf() + "",
            flag_type: YUI.getId("flag_type").options[YUI.getId("flag_type").selectedIndex].value,
            email: YUI.getId("flag_email").value,
            message: YUI.getId("flag_details").value,
            propertyId: YUI.getId("flag_property_id").value,
            propertyHash: YUI.getId("property_hash").value,
            propertyStateCode: YUI.getId("property_state_code").value,
            propertyStatus: YUI.getId("property_status").value,
            siteId: YUI.getId("flag_site_id").value,
            uid: YUI.getId("user_id").value,
            uname: YUI.getId("user_name").value,
            property_data: YUI.getId("property_data").value,
            istp: YUI.getId("istp") ? YUI.getId("istp").value : 0
        };
        if (YUI.getId("flag_remove").checked) {
            m.remove = "1"
        }
        if (YUI.getId("user_type") && YUI.getId("user_type").value) {
            m.utype = YUI.getId("user_type").value
        }
        if (e && e.value != "") {
            var h = parseFloat(e.value.replace(/\,/g, ""));
            var n = 250;
            if (e.value < n) {
                alert(" Listeleme fiyatı çok düşük. Minimum 250 TL.");
                e.focus();
                return false
            }
        }
        if (f === 2 || f === 6) {
            for (c in r) {
                if (r.hasOwnProperty(c) && typeof(c) === "string") {
                    b = c + "_org";
                    if (YUI.getId(c) && YUI.getId(b)) {
                        q = trim(YUI.getId(c).value);
                        a = trim(YUI.getId(b).value);
                        if (r[c]) {
                            if (q !== "" && isNaN(parseFloat(q))) {
                                u.push(r[c] + " Numara olmak zorunda");
                                continue
                            } else {
                                a = a.replace(/[,]/g, "").replace(/[.]/g, "_").replace(/[\/]/g, "__");
                                q = q.replace(/[,]/g, "").replace(/[.]/g, "_").replace(/[\/]/g, "__")
                            }
                        }
                        if (a !== q) {
                            m[b] = a;
                            m[c] = q
                        }
                    }
                }
            }
        } else {
            if (f === 9) {
                if (l === "" || !is_valid_email(l)) {
                    u.push("E-Posta adresiniz gerekli")
                }
            }
        }
        if (u.length > 0) {
            alert("Lütfen bu hataları düzeltip yeniden deneyin.\n" + u.join("\n"));
            return false
        }
        hide("error_box_content");
        k.innerHTML = "Lütfen bekleyiniz...";
        unhide("error_box_status");
        for (j in m) {
            if (m.hasOwnProperty(j)) {
                p += j + "=" + encodeURIComponent(trim(m[j])) + "&"
            }
        }
        YAHOO.util.Connect.asyncRequest("POST", site_root + "Sorgu/flag_incorrect_property/", {
            success: function (B) {
                var w = YUI.getId("error_box_popup_header"),
                    A = YUI.getId("flag_remove"),
                    E = YUI.getId("error_box_status_msg"),
                    D = YUI.getId("flag_type"),
                    v = YUI.getId("flag_details"),
                    C = YUI.getId("flag_remove"),
                    z;
                if (E) {
                    if (parseInt(B.responseText.replace(/\D+/, ""), 10) === 1) {
                       E.innerHTML = "Teşekkürler." + (m.flag_type === "dispute_owner_edits" ? "dispute" : "listing error") + " sını " + qpn_NAMES.site_possessive + ' in dikkatine sunduğunuz için çok teşekkür ederiz.<div class="padt10">EmlakREX departmanları bukonu hakkında bilgilendirildi. Bu hatanın kontrol edilmesi için lütfen bize <strong>24-48 saat</strong> arası zaman verin.</div>'                        
                    } else {
                        E.innerHTML = "Teşekkürler, geribildirim uygun departmana gönderildi."
                    }
                }
                if (w) {
                    w.innerHTML = "Tebrikler! "
                }
                YUI.getId("property_detail_fields") && hide("property_detail_fields");
                YUI.getId("property_remove_this_listing") && hide("property_remove_this_listing");
                if (A) {
                    A.checked = false
                }
                if (D) {
                    D.selectedIndex = 0
                }
                if (v) {
                    v.value = ""
                }
                if (C) {
                    C.checked = false
                }
                for (z in r) {
                    if (r.hasOwnProperty(z) && typeof(z) === "string" && YUI.getId(z)) {
                        YUI.getId(z).value = ""
                    }
                }
            }
        }, p);
        DOMUtils.hide_selects_by_el("error_box")
    },
    close: function () {
        clear_element("error_box_status_msg");
        hide("error_box_status");
        toggle_menu("", "error_box", 0);
        unhide("error_box_content");
        unhide("nomap")
    }
};
(function () {
    emlakrex.Popup = function (user_cfg) {
        this.id = (user_cfg && typeof user_cfg.id != "undefined") ? user_cfg.id : YUI.u.Dom.generateId();
        this.container_id = this.id + "_c";
        var bVisible = false;
        var bDestroyed = false;
        var default_cfg = {
            zIndex: 1001,
            visible: false,
            fixedcenter: "contained",
            width: "310px",
            constraintoviewport: false,
            underlay: "none",
            close: false,
            cache_endpoint: false,
            fixed_pointer: false,
            classname: false,
            use_cancel_link: false,
            destroy_on_cancel: false,
            omni_code_cancel: false,
            generated_on_click: true,
            http_method: "POST"
        };
        if (typeof(on_pos_menu_event) != "undefined") {
            on_pos_menu_event.subscribe(function () {
                this.hide()
            }, this, true)
        }
        if (typeof(hide_menu_event) != "undefined") {
            hide_menu_event.subscribe(function () {
                this.hide()
            }, this, true)
        }
        this.cfg = default_cfg;
        for (var c in user_cfg) {
            this.cfg[c] = user_cfg[c]
        }
        if (!emlakrex._popup_panel_cache[this.id]) {
            YUI.u.Dom.addClass(document.body, "yui-skin-sam");
            this.P = new YAHOO.widget.Panel(this.id, this.cfg);
            this.P.setHeader("");
            this.P.setBody("");
            this.P.setFooter("");
            this.P.render(document.body);
            emlakrex._popup_panel_cache[this.id] = this;
            YUI.u.Dom.addClass(this.id, "emlakrex_popup");
            if (this.cfg.classname) {
                YUI.u.Dom.addClass(this.id, this.cfg.classname)
            }
            var container = YUI.getId(this.container_id);
            YUI.u.Dom.addClass(container, "emlakrex_popup_c");
            var top_side = '<div class="popup_shadow tm">&nbsp;</div><div class="popup_shadow tl">&nbsp;</div><div class="popup_shadow tr">&nbsp;</div>';
            container.appendChild(mkEl("div", top_side, "top_side", "clearfix"));
            var down_low = '<div class="popup_shadow tm">&nbsp;</div><div class="popup_shadow tl">&nbsp;</div><div class="popup_shadow tr">&nbsp;</div>';
            container.appendChild(mkEl("div", down_low, "down_low", "clearfix"))
        } else {
            this.P = emlakrex._popup_panel_cache[this.id].P;
            this.P.cfg.applyConfig(this.cfg)
        }
        this.setContentSource = function (endpoint, postdata) {
            this.endpoint = endpoint;
            this.postdata = postdata
        };
        this.setEndpointContent = function (content) {
            var header = (content.header) ? content.header : "";
            var body = (content.body) ? content.body : "";
            var footer = (content.footer) ? content.footer : "";
            this.setHeader(header);
            this.setBody(body);
            this.setFooter(footer);
            if (content.callback) {
                eval(content.callback)
            }
            if (this.cfg.setEndpointContentCallback) {
                this.cfg.setEndpointContentCallback()
            }
            this.position()
        };
        this.fetchContent = function () {
            if (this.ajax && YUI.u.Connect.isCallInProgress(this.ajax)) {
                YUI.u.Connect.abort(this.ajax, function () {})
            }
            if (this.cfg.cache_endpoint && emlakrex._popup_panel_endpoint_cache[this.endpoint]) {
                this.setEndpointContent(emlakrex._popup_panel_endpoint_cache[this.endpoint]);
                return true
            }
            var endpoint = this.endpoint;
            var url = site_root + this.endpoint;
            var callback = {
                argument: {
                    popup: this,
                    endpoint: endpoint
                },
                success: function (o) {
                    var popup = o.argument.popup;
                    var endpoint = o.argument.endpoint;
                    if (o.responseText) {
                        eval("var popup_content = " + o.responseText);
                        if (popup.cfg.cache_endpoint) {
                            emlakrex._popup_panel_endpoint_cache[endpoint] = popup_content
                        }
                        popup.setEndpointContent(popup_content)
                    } else {
                        popup.P.setHeader("Error");
                        popup.P.setBody("Sorry there was an error loading.");
                        popup.P.setFooter("")
                    }
                },
                failure: function (o) {
                    popup = o.argument;
                    popup.P.setHeader("Error");
                    popup.P.setBody("Sorry there was an error loading.");
                    popup.P.setFooter("")
                }
            };
            this.ajax = YUI.u.Connect.asyncRequest(this.cfg.http_method, url, callback, this.postdata)
        };
        this.toString = function () {
            return "emlakrex.popup id=" + this.id
        };
        this.setPoint = function (point) {
            this.cfg.point = point
        };
        this.setBody = function (body) {
            if (this.P) {
                this.P.setBody(body)
            }
            if (this.cfg.use_cancel_link) {
                this.initCancelLinks()
            }
        };
        this.initCancelLinks = function () {
            if (this.cfg.use_cancel_link) {
                var me = this;
                var cancel_links = YUI.u.Dom.getElementsByClassName("container-close", "a", this.container_id);
                cancel_links = cancel_links.concat(YUI.u.Dom.getElementsByClassName("popup_cancel_link", "a", this.container_id));
                cancel_links = cancel_links.concat(YUI.u.Dom.getElementsByClassName("popup_close", "a", this.container_id));
                for (var i in cancel_links) {
                    YUI.u.Event.removeListener(cancel_links[i], "click");
                    YUI.u.Event.on(cancel_links[i], "click", function (e) {
                        YUI.u.Event.removeListener(cancel_links[i], "click");
                        YUI.u.Event.stopEvent(e);
                       /* if (me.cfg.omni_code_cancel) {
                            oa_track_ql_click(me.cfg.omni_code_cancel + "|Cancel")
                        }*/
                        if (me.id == "login_box") {
                            login_reset()
                        }
                        if (me.cfg.destroy_on_cancel) {
                            me.destroy()
                        } else {
                            me.hide()
                        }
                    })
                }
            }
        };
        this.setHeader = function (header) {
            if (this.P) {
                this.P.setHeader(header)
            }
        };
        this.setFooter = function (footer) {
            if (this.P) {
                this.P.setFooter(footer)
            }
        };
        this.visible = function () {
            return this.bVisible
        };
        this.show = function () {
            var show_me = true;
            if (emlakrex._popup_panel_cache && this.cfg.generated_on_click) {
                for (var p_id in emlakrex._popup_panel_cache) {
                    if (p_id == "login_box") {
                        continue
                    }
                    if (p_id != this.id) {
                        var p = emlakrex._popup_panel_cache[p_id];
                        if (p.P.cfg.getProperty("visible") === true && p.cfg.generated_on_click) {
                            show_me = false
                        } else {
                            emlakrex._popup_panel_cache[p_id].hide()
                        }
                    }
                }
            }
            if (!show_me) {
                if (this.cfg.destroy_on_cancel) {
                    this.destroy()
                }
                return false
            }
            if (this.P) {
                this.bVisible = true;
                if (this.endpoint) {
                    this.P.setBody('<div class="ajax_feedback mar10">Yükleniyor...</div>');
                    this.fetchContent();
                    this.position();
                    this.P.show()
                } else {
                    this.position();
                    this.P.show()
                }
            }
            return true
        };
        this.hide = function () {
            if (this.P) {
                this.bVisible = false;
                if (this.ajax && YUI.u.Connect.isCallInProgress(this.ajax)) {
                    YUI.u.Connect.abort(this.ajax, function () {})
                }
                return this.P.hide()
            }
        };
        this.unhide = function () {
            if (this.P) {
                this.bVisible = true;
                return this.P.show()
            }
        };
        this.destroy = function () {
            if (this.P) {
                this.hide();
                if (this.id == "login_box") {
                    _emlakrex_lf = null
                }
                this.bDestroyed = true;
                var ret = this.P.destroy();
                delete(emlakrex._popup_panel_cache[this.id]);
                return ret
            }
        };
        this.getPointer = function () {
            if (!this.ptr) {
                this.ptr = YUI.getId("helpPointer")
            }
            if (!this.ptr) {
                var oPtr = document.createElement("DIV");
                oPtr.setAttribute("id", "helpPointer");
                YUI.getId(this.id).appendChild(oPtr);
                this.ptr = oPtr
            }
            return this.ptr
        };
        this.position = function () {
            if (!this.cfg.point || !YUI.getId(this.cfg.point)) {
                this.P.center()
            } else {
                this.ptr_w = 14;
                this.ptr_t = 24;
                this.to = this.cfg.point;
                this.toElt = YUI.getId(this.to);
                var x = YUI.u.Dom.getX(this.to);
                var y = YUI.u.Dom.getY(this.to);
                var w = this.toElt.offsetWidth;
                var h = this.toElt.offsetHeight;
                this.ptr = this.getPointer();
                this.elt = YUI.getId(this.id + "_c");
                this.ptr.className = "";
                if (this.cfg.fixed_pointer == "left" || (!this.cfg.fixed_pointer && (x + w + this.elt.offsetWidth < YUI.u.Dom.getViewportWidth()))) {
                    var posX = x + w + this.ptr_w;
                    YUI.u.Dom.addClass(this.ptr, "ptr-l");
                    var posY = y;
                    posY += (this.toElt.offsetHeight / 2);
                    posY -= (this.elt.offsetHeight / 2);
                    posY += this.ptr_w;
                    YUI.u.Dom.addClass(this.ptr, "ptr-lc");
                    this.P.cfg.setProperty("xy", [posX, posY])
                } else {
                    if (this.cfg.fixed_pointer == "right" || (!this.cfg.fixed_pointer && (this.elt.offsetWidth + this.ptr_w < x))) {
                        var posX = x - this.elt.offsetWidth - this.ptr_w;
                        YUI.u.Dom.addClass(this.ptr, "ptr-r");
                        var posY = y;
                        posY += (this.toElt.offsetHeight / 2);
                        posY -= (this.elt.offsetHeight / 2);
                        posY += this.ptr_w;
                        YUI.u.Dom.addClass(this.ptr, "ptr-rc");
                        this.P.cfg.setProperty("xy", [posX, posY])
                    } else {
                        if (this.cfg.fixed_pointer == "bottom" || (!this.cfg.fixed_pointer && (this.elt.offsetHeight + this.ptr_w < y))) {
                            var posX = x - this.ptr_w;
                            var posY = y - this.elt.offsetHeight - this.ptr_w;
                            this.P.cfg.setProperty("xy", [posX, posY]);
                            YUI.u.Dom.addClass(this.ptr, "ptr-b")
                        } else {
                            var posX = x - this.ptr_w;
                            var posY = y + h + this.ptr_w;
                            this.P.cfg.setProperty("xy", [posX, posY]);
                            YUI.u.Dom.addClass(this.ptr, "ptr-t")
                        }
                    }
                }
            }
        }
    }
})();
if (typeof deconcept == "undefined") {
    var deconcept = new Object()
}
if (typeof deconcept.util == "undefined") {
    deconcept.util = new Object()
}
if (typeof deconcept.SWFObjectUtil == "undefined") {
    deconcept.SWFObjectUtil = new Object()
}
deconcept.SWFObject = function (p, b, r, f, l, m, j, g, e, n) {
    if (!document.getElementById) {
        return
    }
    this.DETECT_KEY = n ? n : "detectflash";
    this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
    this.params = new Object();
    this.variables = new Object();
    this.attributes = new Array();
    if (p) {
        this.setAttribute("swf", p)
    }
    if (b) {
        this.setAttribute("id", b)
    }
    if (r) {
        this.setAttribute("width", r)
    }
    if (f) {
        this.setAttribute("height", f)
    }
    if (l) {
        this.setAttribute("version", new deconcept.PlayerVersion(l.toString().split(".")))
    }
    this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
    if (!window.opera && document.all && this.installedVer.major > 7) {
        deconcept.SWFObject.doPrepUnload = true
    }
    if (m) {
        this.addParam("bgcolor", m)
    }
    var a = j ? j : "high";
    this.addParam("quality", a);
    this.setAttribute("useExpressInstall", false);
    this.setAttribute("doExpressInstall", false);
    var k = (g) ? g : window.location;
    this.setAttribute("xiRedirectUrl", k);
    this.setAttribute("redirectUrl", "");
    if (e) {
        this.setAttribute("redirectUrl", e)
    }
};
deconcept.SWFObject.prototype = {
    useExpressInstall: function (a) {
        this.xiSWFPath = !a ? "expressinstall.swf" : a;
        this.setAttribute("useExpressInstall", true)
    },
    setAttribute: function (a, b) {
        this.attributes[a] = b
    },
    getAttribute: function (a) {
        return this.attributes[a]
    },
    addParam: function (b, a) {
        this.params[b] = a
    },
    getParams: function () {
        return this.params
    },
    addVariable: function (b, a) {
        this.variables[b] = a
    },
    getVariable: function (a) {
        return this.variables[a]
    },
    getVariables: function () {
        return this.variables
    },
    getVariablePairs: function () {
        var c = new Array();
        var b;
        var a = this.getVariables();
        for (b in a) {
            c[c.length] = b + "=" + a[b]
        }
        return c
    },
    getSWFHTML: function () {
        var b = "";
        if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "PlugIn");
                this.setAttribute("swf", this.xiSWFPath)
            }
            b = '<embed type="application/x-shockwave-flash" src="' + this.getAttribute("swf") + '" width="' + this.getAttribute("width") + '" height="' + this.getAttribute("height") + '" style="' + this.getAttribute("style") + '"';
            b += ' id="' + this.getAttribute("id") + '" name="' + this.getAttribute("id") + '" ';
            var g = this.getParams();
            for (var f in g) {
                b += [f] + '="' + g[f] + '" '
            }
            var e = this.getVariablePairs().join("&");
            if (e.length > 0) {
                b += 'flashvars="' + e + '"'
            }
            b += "/>"
        } else {
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "ActiveX");
                this.setAttribute("swf", this.xiSWFPath)
            }
            b = '<object id="' + this.getAttribute("id") + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.getAttribute("width") + '" height="' + this.getAttribute("height") + '" style="' + this.getAttribute("style") + '">';
            b += '<param name="movie" value="' + this.getAttribute("swf") + '" />';
            var c = this.getParams();
            for (var f in c) {
                b += '<param name="' + f + '" value="' + c[f] + '" />'
            }
            var a = this.getVariablePairs().join("&");
            if (a.length > 0) {
                b += '<param name="flashvars" value="' + a + '" />'
            }
            b += "</object>"
        }
        return b
    },
    write: function (b) {
        if (this.getAttribute("useExpressInstall")) {
            var a = new deconcept.PlayerVersion([6, 0, 65]);
            if (this.installedVer.versionIsValid(a) && !this.installedVer.versionIsValid(this.getAttribute("version"))) {
                this.setAttribute("doExpressInstall", true);
                this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl")));
                document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                this.addVariable("MMdoctitle", document.title)
            }
        }
        if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) {
            var c = (typeof b == "string") ? document.getElementById(b) : b;
            c.innerHTML = this.getSWFHTML();
            return true
        } else {
            if (this.getAttribute("redirectUrl") != "") {
                document.location.replace(this.getAttribute("redirectUrl"))
            }
        }
        return false
    }
};
deconcept.SWFObjectUtil.getPlayerVersion = function () {
    var g = new deconcept.PlayerVersion([0, 0, 0]);
    if (navigator.plugins && navigator.mimeTypes.length) {
        var a = navigator.plugins["Shockwave Flash"];
        if (a && a.description) {
            g = new deconcept.PlayerVersion(a.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."))
        }
    } else {
        if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {
            var b = 1;
            var c = 3;
            while (b) {
                try {
                    c++;
                    b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + c);
                    g = new deconcept.PlayerVersion([c, 0, 0])
                } catch (f) {
                    b = null
                }
            }
        } else {
            try {
                var b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")
            } catch (f) {
                try {
                    var b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                    g = new deconcept.PlayerVersion([6, 0, 21]);
                    b.AllowScriptAccess = "always"
                } catch (f) {
                    if (g.major == 6) {
                        return g
                    }
                }
                try {
                    b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash")
                } catch (f) {}
            }
            if (b != null) {
                g = new deconcept.PlayerVersion(b.GetVariable("$version").split(" ")[1].split(","))
            }
        }
    }
    return g
};
deconcept.PlayerVersion = function (a) {
    this.major = a[0] != null ? parseInt(a[0]) : 0;
    this.minor = a[1] != null ? parseInt(a[1]) : 0;
    this.rev = a[2] != null ? parseInt(a[2]) : 0
};
deconcept.PlayerVersion.prototype.versionIsValid = function (a) {
    if (this.major < a.major) {
        return false
    }
    if (this.major > a.major) {
        return true
    }
    if (this.minor < a.minor) {
        return false
    }
    if (this.minor > a.minor) {
        return true
    }
    if (this.rev < a.rev) {
        return false
    }
    return true
};
deconcept.util = {
    getRequestParameter: function (c) {
        var e = document.location.search || document.location.hash;
        if (c == null) {
            return e
        }
        if (e) {
            var b = e.substring(1).split("&");
            for (var a = 0; a < b.length; a++) {
                if (b[a].substring(0, b[a].indexOf("=")) == c) {
                    return b[a].substring((b[a].indexOf("=") + 1))
                }
            }
        }
        return ""
    }
};
deconcept.SWFObjectUtil.cleanupSWFs = function () {
    var b = document.getElementsByTagName("OBJECT");
    for (var c = b.length - 1; c >= 0; c--) {
        b[c].style.display = "none";
        for (var a in b[c]) {
            if (typeof b[c][a] == "function") {
                b[c][a] = function () {}
            }
        }
    }
};
if (deconcept.SWFObject.doPrepUnload) {
    if (!deconcept.unloadSet) {
        deconcept.SWFObjectUtil.prepUnload = function () {
            __flash_unloadHandler = function () {};
            __flash_savedUnloadHandler = function () {};
            window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs)
        };
        window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
        deconcept.unloadSet = true
    }
}
if (!document.getElementById && document.all) {
    document.getElementById = function (a) {
        return document.all[a]
    }
}
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject;
var SWFObject = deconcept.SWFObject;
