function CheckNumeric()
{
    // Get ASCII value of key that user pressed
    var key = window.event.keyCode;
    // Was key that was pressed a numeric character (0-9)?
    if ( (key > 47 && key < 58) || key==46 || key==45 )
        return; // if so, do nothing
    else
        window.event.returnValue = null; // otherwise,
	                                   // discard character
}

function CheckNumericWithRange()
{
    // Get ASCII value of key that user pressed
    var key = window.event.keyCode;
    // Was key that was pressed a numeric character (0-9)?
    if ( (key > 47 && key < 58) || key==46 || key==45 || key==60 || key==61 || key==62)
        return; // if so, do nothing
    else
        window.event.returnValue = null; // otherwise,
	                                   // discard character
}

function CheckPosInteger()
{
    // Get ASCII value of key that user pressed
    var key = window.event.keyCode;

    // Is key that is pressed a positive integer (0-9)?
    if ( (key > 47 && key < 58) )
    return; // if so, do nothing
    else
    window.event.returnValue = null; // otherwise,
	                               // discard character
}

function CheckPosDouble()
{
    // Get ASCII value of key that user pressed
    var key = window.event.keyCode;
    // Was key that was pressed a numeric character (0-9)?
    if ( (key > 47 && key < 58) || key==46)
        return; // if so, do nothing
    else
        window.event.returnValue = null; // otherwise,
	                                   // discard character
}

function TextRemaining(maxLength,elementId) {
    var key = window.event.keyCode;
    var element = window.document.getElementById(elementId) ;
    if (element.innerText.length==maxLength) {
        //Except Del/Backspace/Left/Up/Down/Right buttons
        if (key==8 || key==46 || key==37 || key==38 || key==39 || key==40) {
            return;
        } else {
            window.event.returnValue=null;
        }
    } else if (element.innerText.length>maxLength) {
        //element.innerText="This field is limited to "+ maxLength +" characters...";
        element.innerText=element.innerText.substring(0, maxLength);
    }
}

function HighLightRow(tableId) {
    var table=document.getElementById(tableId);
    if (table!=null) {
        var tr;
        for (i=0;i<table.childNodes.length;i++) {
            tbody=table.childNodes[i];
            if (tbody.nodeName=="TBODY") {
                for (j=0; j<tbody.childNodes.length; j++) {
                    tr=tbody.childNodes[j];
                    if (tr.nodeName=="TR" && tr.className!="GridViewHeader" && tr.className!="") {
                        tr.onmouseover=function() {
                            this.className+=" GridViewHighLightRow";
                        }
                        if (i%2==0) {
                            tr.onmouseout=function() {
                                this.className=this.className.replace(" GridViewHighLightRow", " GridViewRow");
                            }
                        } else {
                            tr.onmouseout=function() {
                                this.className=this.className.replace(" GridViewHighLightRow", " GridViewAlternatingRow");
                            }
                        }
                    }
                }
            }
        }
    }
}

function CopyCode(textBoxId) {
    var textbox=document.getElementById(textBoxId);
    if (textbox!=null) {
        var Copied=textbox.createTextRange();
        Copied.execCommand("RemoveFormat");
        Copied.execCommand("Copy");
    }
}

function OnMouseOverOut(imgId,imgPath)
{
    var image=document.getElementById(imgId);
	image.src = imgPath;
}
