﻿// JScript File
function emailAdresiKontrol() {

    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= '0' && ch <= '9') && !(ch >= 'a' && ch <= 'z') && (ch != '@') && (ch != '-') && (ch != '_') && (ch != '.')) {
        event.returnValue = 0;
    }
    else return true;
}
function WebAdresiKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= '0' && ch <= '9') && !(ch >= 'a' && ch <= 'z') && (ch != '-') && (ch != '.') && (ch != '/')) {
        event.returnValue = 0;
    }
    else return true;
}
function NSKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= '0' && ch <= '9') && (ch != '.')) {
        event.returnValue = 0;
    }
    else return true;
}
function numericKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= '0' && ch <= '9')) {
        event.returnValue = 0;
    }
    else return true;
}

function DomainRegisterCompany(idRD,idTB) {

    if (document.getElementById(idRD).value == '0')
        numericKontrol();
    else
        numericKontrolTR(document.getElementById(idTB).value);
 }

function numericKontrolTR(str) {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= '0' && ch <= '9') && (str.toString().length > 10)) {
        event.returnValue = 0;
    }
    else return true;
}
function decnumericKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= '0' && ch <= '9') && (ch != ',')) {
        event.returnValue = 0;
    }
    else return true;
}
function alphanumericTRKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    //alert(ch);
    if (!(ch >= '0' && ch <= '9') && !(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z') && (ch != ' ') && (ch != 'ğ')
    && (ch != 'Ğ') && (ch != 'ü') && (ch != 'Ü') && (ch != 'ş') && (ch != 'Ş') && (ch != 'ı')
    && (ch != 'İ') && (ch != 'ö') && (ch != 'Ö') && (ch != 'ç') && (ch != 'Ç')) {
        event.returnValue = 0;
    }
    else return true;
}
function alphanumericEngKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z') && (ch != ' ')) {
        event.returnValue = 0;
    }
    else return true;
}

function alphanumericEngCompanyKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z') && (ch != ' ') && (ch != '-') && (ch != '_') && (ch != '.') && (ch != '/') && !(ch >= '0' && ch <= '9') && (ch != ':')) {
        event.returnValue = 0;
    }
    else return true;
}

function ZipKontrol() {
    key = window.event.keyCode;
    ch = String.fromCharCode(key);
    if (!(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z') && (ch != '-') && !(ch >= '0' && ch <= '9')) {
        event.returnValue = 0;
    }
    else return true;
}

// JScript File
function AnyChecked(tldcount, controlName) {
    var obj, flag;
    flag = false;
    for (i = 0; i < tldcount; i++) {
        obj = document.getElementById(controlName + i);
        if (obj.checked == true) {
            flag = true;
            break;
        }
    }
    return flag;
}
function IsChecked(obj) {
    if (obj.checked == true)
        return true;
    else
        return false;
}
function IsEmpty(obj) {
    if (obj.value == '')
        return true;
    else
        return false;
}

function XMLHTTP_Olustur() {
    var retval = null;
    try {
        retval = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e) {
        try {
            retval = new ActiveXObject("Microsoft.XMLHTTP")
        }
        catch (oc) {
            retval = null
        }
    }
    if (!retval && typeof XMLHttpRequest != "undefined") {
        retval = new XMLHttpRequest()
    }
    return retval
}
function call_async_request(lbl, url) {

    var xmlHttpNesnesi = XMLHTTP_Olustur();

    if (xmlHttpNesnesi) {
        xmlHttpNesnesi.open("GET", url, true);

        xmlHttpNesnesi.onreadystatechange = function() {
            if (xmlHttpNesnesi.readyState == 4) {
                document.all[lbl].innerHTML = xmlHttpNesnesi.responseText;
            }
        }
			;
        xmlHttpNesnesi.send();
    }
}

function PencereAc(isim) {
    window.open(isim, 'yeniPencere', 'toolbar=no,resizable=yes,scrollbars=yes,left=0,top=0,width=800,height=625');
}

function setCheckboxBasket(tableName, obj) {

    var flag = false;
    this.tabs = document.getElementById(tableName).getElementsByTagName("input");
    if (obj.checked == true)
        flag = true;

    for (var i = 0; i < this.tabs.length; i++) {
        this.tabs[i].checked = flag;
    }
}

function acKapa(obj) {
    var temp = $get(obj);
    if (temp.style.display == 'block')
        temp.style.display = 'none';
    else
        temp.style.display = 'block';
}

function acKapaMesaj(obj, etkileyen, msg1, msg2) {
    var temp = $get(obj);
    var tempEtkileyen = $get(etkileyen);
    if (temp.style.display == 'block') {
        temp.style.display = 'none';
        tempEtkileyen.Text = msg1;
    }
    else {
        temp.style.display = 'block';
        tempEtkileyen.Text = msg2;
    }
}
