﻿// İlan Listeleme mouseover
function show(o) {
    o.getElementsByTagName("span")[0].style.display = "block";
    o.className = "over";
}
function hide(o) {
    o.getElementsByTagName("span")[0].style.display = "none";
    o.className = "";
}

var cifexp = new RegExp("[A-Za-z0-9]");
function cif_keypress(obj) {
    if (!cifexp.test(String.fromCharCode(event.keyCode))) {
        event.returnValue = false;
    }
}
function doBlink() {
    var blink = document.all.tags("BLINK")
    for (var i = 0; i < blink.length; i++)
        blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
}

function startBlink() {
    if (document.all)
        setInterval("doBlink()", 700)
}
startBlink();


function FbtDeleteConfirmation(sMessage) {
    if (CheckBoxIDs != null) {
        var bConfirm = false;
        for (var i = 0; i < CheckBoxIDs.length; i++) {
            var cb = document.getElementById(CheckBoxIDs[i]);
            if (cb != null) {
                if (cb.checked) {
                    bConfirm = true;
                    break;
                }
            }
        }

        if (bConfirm) {
            return confirm(sMessage);
        }
        else
            return true;
    }
    else {
        return true;
    }
}

function ChangeCheckBoxState(id, checkState) {
    var cb = document.getElementById(id);
    if (cb != null)
        cb.checked = checkState;
}

function ChangeAllCheckBoxStates(checkState) {
    if (CheckBoxIDs != null) {
        for (var i = 0; i < CheckBoxIDs.length; i++)
            ChangeCheckBoxState(CheckBoxIDs[i], checkState);
    }
}

function ChangeHeaderAsNeeded() {
    if (CheckBoxIDs != null) {
        for (var i = 1; i < CheckBoxIDs.length; i++) {
            var cb = document.getElementById(CheckBoxIDs[i]);
            if (cb != null) {
                if (!cb.checked) {
                    ChangeCheckBoxState(CheckBoxIDs[0], false);
                    return;
                }
            }
        }
        ChangeCheckBoxState(CheckBoxIDs[0], true);
    }
}

function ChangeChecked(thisis) {
    for (var i = 0; i < CheckBoxIDs.length; i++)
        ChangeCheckBoxState(CheckBoxIDs[i], false);

    thisis.checked = true;
}

function SelectOneRadioButton(rdo, gridName) {
    all = document.getElementsByTagName("input");
    for (i = 0; i < all.length; i++) {
        if (all[i].type == "radio") {
            var count = all[i].id.indexOf(gridName + '__ctl');
            if (count != -1) {
                all[i].checked = false;
            }
        }
    }

    rdo.checked = true; /* Finally making the clicked radio button CHECKED */
}

function SetUniqueRadioButton(nameregex, current) {
    re = new RegExp(nameregex);
    for (i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i]
        if (elm.type == 'radio') {
            if (re.test(elm.name)) {
                elm.checked = false;
            }
        }
    }
    current.checked = true;
}

function overTab(o) {
    o.className = "tab_selected tab_over";
}

function outTab(o, t) {
    if (t)
        o.className = "tab_selected";
    else
        o.className = "tab";
}

/*
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} 

function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{ 
c_start=c_start + c_name.length+1; 
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
} 
}
return "";
}
*/

function Scripts_GetObject(obj) {
    var theObj;
    if (document.all) {
        if (typeof obj == "string") {
            return document.all(obj);
        }
        else {
            return obj.style;
        }
    }

    if (document.getElementById) {
        if (typeof obj == "string") {
            return document.getElementById(obj);
        }
        else {
            return obj.style;
        }
    }
    return null;
}

function Scripts_TimeoutMessage(diaWidth, diaHeight) {
    var vReturnValue;
    if (diaWidth == null || diaWidth == "") diaHeight = "520";
    if (diaHeight == null || diaHeight == "") diaHeight = "300";
    vReturnValue = window.showModalDialog("/Ssl/BasePages/pgTimeoutPopup.aspx", "", "dialogHeight: " + diaHeight + "px; dialogWidth: " + diaWidth + "px; dialogTop: px; dialogLeft: px; center: Yes; edge: Raised; help: No; resizable: No; status: No;");
    if (vReturnValue != null && vReturnValue == true) {
        window.location.reload(true);
        return vReturnValue
    }
    else {
        window.location = "/Ssl/BasePages/pgExit.aspx";
        return false;
    }
}
