﻿function ValueYaz(TextBoxID, ValueString) {

    document.getElementById(TextBoxID).value = ValueString;
}

function ValueYazCoklu(TextBoxID1, ValueString1, TextBoxID2, ValueString2, TextBoxID3, ValueString3, TextBoxID4, ValueString4, TextBoxID5, ValueString5) {

    if (TextBoxID1 != "")
        document.getElementById(TextBoxID1).value = ValueString1;

    if (TextBoxID2 != "")
        document.getElementById(TextBoxID2).value = ValueString2;

    if (TextBoxID3 != "")
        document.getElementById(TextBoxID3).value = ValueString3;

    if (TextBoxID4 != "")
        document.getElementById(TextBoxID4).value = ValueString4;

    if (TextBoxID5 != "")
        document.getElementById(TextBoxID5).value = ValueString5;
}

function ValueYazCokluONY(TextBoxID1, ValueString1, TextBoxID2, ValueString2, TextBoxID3, ValueString3, TextBoxID4, ValueString4, TextBoxID5, ValueString5, UyariString) {

    if (confirm(UyariString)) {
        if (TextBoxID1 != "")
            document.getElementById(TextBoxID1).value = ValueString1;

        if (TextBoxID2 != "")
            document.getElementById(TextBoxID2).value = ValueString2;

        if (TextBoxID3 != "")
            document.getElementById(TextBoxID3).value = ValueString3;

        if (TextBoxID4 != "")
            document.getElementById(TextBoxID4).value = ValueString4;

        if (TextBoxID5 != "")
            document.getElementById(TextBoxID5).value = ValueString5;
    }
    else {
        document.getElementById(TextBoxID1).value = "0";
    }
}

function ValueYazOnayli(TextBoxID, ValueString, UyariString) {

    if (confirm(UyariString)) {
        document.getElementById(TextBoxID).value = ValueString;
    }
    else {
        document.getElementById(TextBoxID).value = "0";
    }
}

function CokluSec(id, control, checked) {
    if (checked == true) {
        document.getElementById(control).value = document.getElementById(control).value + ";" + id;
    }
    else if (checked == false) {
        document.getElementById(control).value = document.getElementById(control).value.replace(";" + id, "");
    }
}



function yazdir(okprinting) {

    var pg = document.getElementById(okprinting);

    var sprint = window.open('', '', 'toolbar=0,scrollbars=0,width=650');

    sprint.document.write("<body bottommargin='0' leftmargin='0' rightmargin='0' topmargin='0' style='font-family: Verdana;font-size: 10pt;'>");

    sprint.document.write(pg.innerHTML);
    sprint.document.close();
    sprint.focus();
    sprint.print();
    sprint.close();
    pg.INNERHTML = "";

}

function GridOnMouseOver(nedir) {
    self.MouseOverOldColor = nedir.style.backgroundColor; nedir.style.backgroundColor = '#FEDBCD';
}

function GridOnMouseOut(nedir) {
    nedir.style.backgroundColor = self.MouseOverOldColor;
}

//        //Seçim yapamasın
//        function disableselect(e) {
//            return false
//        }

//        function reEnable() {
//            return true
//        }

//        //if IE4+
//        document.onselectstart = new Function("return false")

//        //if NS6
//        if (window.sidebar) {
//            document.onmousedown = disableselect
//            document.onclick = reEnable
//        }




//        var isnn, isie
//        if (navigator.appName == 'Microsoft Internet Explorer') //check the browser
//        { isie = true }

//        if (navigator.appName == 'Netscape')
//        { isnn = true }

//        function right(e) //to trap right click button 
//        {
//            if (isnn && (e.which == 3 || e.which == 2))
//                return false;
//            else if (isie && (event.button == 2 || event.button == 3)) {
//                alert("Sorry, you do not have permission to right click on this page.");
//                return false;
//            }
//            return true;
//        }

//        function key(k) {
//            if (isie) {
//                
//                if (event.keyCode == 17 || event.keyCode == 18 || event.keyCode == 93) {
//                    alert("Sorry, you do not have permission to press this key.")
//                    return false;
//                }
//            }

//            if (isnn) {
//                alert("Sorry, you do not have permission to press this key.")
//                return false;
//            }
//        }

//        if (document.layers) window.captureEvents(Event.KEYPRESS);
//        if (document.layers) window.captureEvents(Event.MOUSEDOWN);
//        if (document.layers) window.captureEvents(Event.MOUSEUP);
//        document.onkeydown = key;
//        document.onmousedown = right;
//        document.onmouseup = right;
//        window.document.layers = right;

//        function AccessClipboardData() {
//            try {
//                window.clipboardData.setData('text', "No print data");
//            } catch (err) {
//                // txt = "There was an error on this page.\n\n";
//                // txt += "Error description: " + err.description + "\n\n";
//                // txt += "Click OK to continue.\n\n";
//                //  alert(txt);
//            }

//        }

//setInterval("AccessClipboardData()", 300);


/* Modified to support Opera */
function bookmarksite(title, url) {
    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, "");
    else if (window.opera && window.print) { // opera
        var elem = document.createElement('a');
        elem.setAttribute('href', url);
        elem.setAttribute('title', title);
        elem.setAttribute('rel', 'sidebar');
        elem.click();
    }
    else if (document.all)// ie
        window.external.AddFavorite(url, title);
}


function focusNext(kendisi, controladi, oncekicontroladi, oncekigec, focus, len) {

    if (event.keyCode == 8 || event.keyCode == 46) {
        if (document.getElementById(kendisi.id).value.length <= 0 && oncekigec == 1) {

            document.getElementById(oncekicontroladi).focus();
            document.getElementById(oncekicontroladi).value = document.getElementById(oncekicontroladi).value;
        }
        return;
    }

    if (document.getElementById(kendisi.id).value.length >= len && focus == 1) {
        document.getElementById(controladi).focus();
    }

}
