﻿function fnPureNumeric(evt)
{
var code = evt.which ? evt.which : evt.keyCode;
var checknos=false;
//alert(code);
if ((code >= 48 && code <= 57) || (code==8))
{
checknos = true;
return (checknos);
}
else
{
checknos= false;
evt.which ? evt.which : evt.keyCode=0;
return (checknos);
}
}

//--------------------------------------------

function SelectAllCheckboxes(spanChk)
{
    // Added as ASPX uses SPAN for checkbox

    var oItem = spanChk.children;

    var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];

    xState=theBox.checked;

    elm=theBox.form.elements;

    for(i=0;i<elm.length;i++)

        if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)

        {

            //elm[i].click();

            if(elm[i].checked!=xState)

                elm[i].click();

                //elm[i].checked=xState;

        }

}

function IsMatch(id,x,gridName) 
{
    var pattern = '^' + gridName + '[a-zA-Z0-9._-]';
    var regularExpresssion = new RegExp(pattern);            
    if(id.match(regularExpresssion)) return true; 
    else return false; 
}

function IsCheckBox(chk) 
{ 
    if(chk.type == 'checkbox') return true; 
    else return false;
}


function fnNumericNoDec(evt)
{
	var code = evt.keyCode;
	if ((code >= 48 && code <= 57)  || ( code == 45))
	{ 
		checknos = true;
		return (checknos);
	}
	else
	{
		checknos= false;
		evt.keyCode=0;	
		return (checknos);
	}
}

 function fnNumeric()
	{
		var code = window.event.keyCode;
		if ((code >= 48 && code <= 57)  || ( code == 45) || (code == 46))
		{ 
			//checknos = true;
			return true;
		}
		else
		{
			//checknos= false;
			window.event.keyCode=0;	
			return false;
		}
	}


function checkInt(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57))
    {
       // alert("Please make sure entries are numbers only.");
        return false;
    } 
    //var k= ("f"+i);
    //k.value = k.value + String.fromCharCode(charCode);
    return true;
}
	


