function LenControl(Object, maxLength, txtsayac) {
    /*Gelen multiline kontrolün istenen uzunluğa kadar yazılabilmesini sağlar*/
    objectValue = Object.value;
    objectValueLength = objectValue.length;
    if (objectValueLength > maxLength) Object.value = objectValue.substring(0, maxLength);
    document.all(txtsayac).value = (maxLength - Object.value.length);
    Object.focus();
}
function CheckPage(maxCount, txtTool) {
    var PageNumber;
    var Check;
    if (document.all(txtTool).disabled == true)
        return false;

    PageNumber = document.all(txtTool).value;
    Check = false;
    if (PageNumber == '') {
        alert('1 ile ' + maxCount + ' arasında bir sayı girmelisiniz!');
        document.all(txtTool).focus();
        Check = true;
    }
    if (PageNumber < 1 && Check == false) {
        alert('1 ile ' + maxCount + ' arasında bir sayı girmelisiniz!');
        document.all(txtTool).focus();
        Check = true;
    }
    if (PageNumber > maxCount && Check == false) {
        alert('1 ile ' + maxCount + ' arasında bir sayı girmelisiniz!');
        document.all(txtTool).focus();
        Check = true;
    }
    if (Check == true) return false;
    else return true;

}

function checkKey(key) {//Sayfada entera basılınca hangi butonun aktiflenceğini belirler.
    var Btn = null;
    Btn = document.all('LBtnGoToPage');
    if (key == 13) {
        if (Btn != null)
            document.all('LBtnGoToPage').focus();
    }
}

function gundoldur() {
    var g_yil = document.forms[0].txtyil.value;
    var g_ay = document.forms[0].dday.options[document.forms[0].dday.selectedIndex].value;

    var gun = document.forms[0].ddgun.options[document.forms[0].ddgun.selectedIndex].value;
    if (g_ay == "01" || g_ay == "03" || g_ay == "05" || g_ay == "07" || g_ay == "08" || g_ay == "10" || g_ay == "12")
        g_ay = 31;
    else if (g_ay == "04" || g_ay == "06" || g_ay == "09" || g_ay == "11")
        g_ay = 30;
    else if (g_yil % 4 == 0)
        g_ay = 29;
    else
        g_ay = 28;

    document.forms[0].ddgun.options.length = 0;

    for (i = 1; i <= g_ay; i++) {

        var neway = document.createElement("OPTION")
        if (i < 10) {
            neway.text = '0' + i;
            neway.value = '0' + i;
        }
        else {
            neway.text = i;
            neway.value = i;
        }

        if (navigator.appName != "Netscape") {
            document.forms[0].ddgun.options.add(neway)
        }
        if (navigator.appName == "Netscape") {
            a = document.forms[0].ddgun.options.length
            document.forms[0].ddgun.options.length = a + 1
            document.forms[0].ddgun.options[a] = neway
        }
    }

    document.forms[0].elements['ddgun'].selectedIndex = document.forms[0].ddgun.options.length - 1;
    //document.forms[0].ddgun.selectedIndex = document.forms[0].ddgun.options.length-1;
    document.forms[0].ddgun.options[document.forms[0].ddgun.options.length - 1].selected = true;
    if (document.forms[0].ddgun.options.length > gun) {
        document.forms[0].ddgun.value = gun;
    }

}
function onlyCurrency(key) {
    if (key == 44)//, ise yes
        event.returnValue = true;
    else if (key == 46)//. ise no
        event.returnValue = false;
    else if (key < 45 || key > 57) //sayı dışı ise no
        event.returnValue = false;
}


function karakterkontrol(code) {

    //sadece karakter
    if (code == 199 || code == 214 || code == 220 || code == 231 || code == 246 || code == 252 || code == 286 || code == 287 || code == 304 || code == 305 || code == 350 || code == 351)
        return true;
    if (code < 65)
        if (code != 32)
        return false;
    if (code > 90) {
        if (code < 97)
            return false;
        else if (code > 122)
            return false;
    }
    return true;

}
//*****************************************    
function Checkvirgul(objvl, type) {
    if (type == 1) objvl = objvl.replace(',', '.');
    if (type == 2) objvl = objvl.replace('.', ',');
    return objvl;
}
//****************************************
//*****************************************
function rnd(sayi, yuvarla) {
    var carp = 10;
    for (i = 0; i < yuvarla - 1; i++)
        carp = carp * 10;

    var s = sayi;
    if (yuvarla > 0) s = sayi * carp;

    s = Math.round(s)
    if (yuvarla > 0) s = s / carp;

    return s;
}
function PencereAc(Pagestr, w, h, r, s) {
    window.open(Pagestr, 'Sayfa', 'toolbar=no, resizable=' + r + ', scrollbars=' + s + ',width=' + w + ', height=' + h);
}
function NewWindow(Pagestr, w, h, r, s) {
    window.open(Pagestr, 'Sayfa', 'toolbar=no, resizable=' + r + ', scrollbars=' + s + ',width=' + w + ', height=' + h);
}

function openModulDialog(WhichPage, Title, dialogWidth, dialogHeight) {
    url = WhichPage + '&Title=' + Title;
    returnValue = showModalDialog(url, "window", "dialogHeight: " + dialogHeight + "px; dialogWidth: " + dialogWidth + "px;status:no;help:no;close:no")
}

function NewWindow(mypage, myname, w, h, scroll, r) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable=' + r
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

/* Functions for AJAX */

function LoadPopUpImage(imageurl, pwidth, pheight) {
    document.getElementById('PopUpDiv').innerHTML = "<img src=\"" + imageurl + "\" alt=''>";
    document.getElementById('ctl00_MainContent_PanelPopUp').style.width = pwidth + 20;
    document.getElementById('ctl00_MainContent_PanelPopUp').style.height = pheight + 60;

    //var el = $get('<%=Panel1.ClientID%>'); // Get its position.
    //var newLocation = $common.getLocation(el);

    //var newLocation = new Sys.UI.Point(screen.width / 2) - ((pwidth+20)/2), ((screen.height / 2) - ((pheight+20)/2));
    //var newLocation = new Sys.UI.Point(100,100);
    // Move the Panel to the destination.
    //$common.setLocation(document.getElementById('ctl00_MainContent_PanelPopUp'), newLocation); 


    //document.getElementById('ctl00_MainContent_PanelPopUp').style.position = "absolute";
    //document.getElementById('ctl00_MainContent_PanelPopUp').style.top = "100px";
    //document.getElementById('ctl00_MainContent_PanelPopUp').style.left = (screen.width / 2) - ((pwidth+20)/2);             
    GosterAbi();
}
function LoadPopUpHTML(html) {
    document.getElementById('PopUpDiv').innerHTML = "<span id='ctl00_MainContent_TabContainer2_TabPanel6_lblPollTitle' class='maingray14b'>Sentez Yazılım Ürün Anketi</span><br /><span id='ctl00_MainContent_TabContainer2_TabPanel6_lblPollStatus' class='mainblue2'></span>&nbsp;<br /><div id='ctl00_MainContent_TabContainer2_TabPanel6_UpdatePanel2'><table id='ctl00_MainContent_TabContainer2_TabPanel6_TblPoll' border='0' cellpadding='0' cellspacing='0' style='width: 649px'><tr><td align='left' bgcolor='#dddddd' colspan='6' height='25'><font color='#3366cc'><b>&nbsp;&nbsp; 1.Kullandığınız Sentez ürünü ihtiyaçlarınızı karşılıyor mu? </b></font></td></tr><tr><td align='left' class='text339' height='25' width='121'></td><td height='25'></td><td height='25'></td></tr><tr><td align='right' colspan='5' height='23'> &nbsp;</td></tr><tr><td align='center' colspan='5' height='15'></td></tr><tr><td align='right' colspan='5' style='height: 25px'></td></tr></table>";
    GosterAbi();
}

function LoadPopUpFrame(url, width, height, pwidth, pheight) {
    document.getElementById('<%=PanelPopUp.ClientID%>').style.width = pwidth;
    document.getElementById('<%=PanelPopUp.ClientID%>').style.height = pheight + 20;

    document.getElementById('PopUpDiv').innerHTML = "<iframe height=\"" + height + "px\" width=\"" + width + "px\" src=\"" + url + "\"></iframe>";
    GosterAbi();
}

function GosterAbi() {
    var modalPopupBehaviorCtrl = $find('ModalPopupBehaviorID');
    modalPopupBehaviorCtrl.show();
}


