﻿function DisableButtonAfterClickWithSubmit(button) {
    //hide the button  to prevent doubleclick
    button.style.display = "none";
    setTimeout("ShowButtonAfterTimeOut(" + button + ")", 4000);
    document.forms[0].submit();
} 

function DisableButtonAfterClick(button) {
    //hide the button  to prevent doubleclick
    button.style.display = "none";
    //var postback = document.getElementById('btnPostBack')
    //postback.click();
    //document.forms[0].submit();
}

function DisableButtonAfterClickById(buttonID) {
    //hide the button  to prevent doubleclick
    var button = document.getElementById(buttonID);
    button.style.display = "none";
    setTimeout("ShowButtonAfterTimeOut(" + button + ")", 4000);
    document.forms[0].submit();
}




function ShowButtonAfterTimeOut(button)
{
    button.style.display = "";
}
var HeaderScript = "<style type='text/css' media='print'>#btnPrint{diplay: none; }</style>";

var PrintScript = "<div style='width: 100%; text-align: right; padding-right: 20px;'><A id='btnPrint' HREF='javascript:window.print()' title='Click here to print this page.'>Print Page</A></div>"
function PrintPopup() {

    var controlToPrint = document.getElementById("printMe").innerHTML;
    win2 = window.open("");  //open blank window and write to it
    win2.document.open();  //open document stream
    win2.document.write(HeaderScript + PrintScript + controlToPrint);
    win2.document.close();
}


function numbersonly(myfield, e, dec) {
    var key;
    var keychar;

    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.which;
    else
        return true;
    keychar = String.fromCharCode(key);

    // control keys
    if ((key == null) || (key == 0) || (key == 8) ||
    (key == 9) || (key == 13) || (key == 27))
        return true;

    // numbers
    else if ((("0123456789").indexOf(keychar) > -1))
        return true;


    // decimal point jump
    else if (dec && (keychar == ".")) {
        myfield.form.elements[dec].focus();
        return true;
    }
    else
        return false;
}