﻿// JScript File

 /*************************************************
        Validates that only alpha-numeric characters and spaces are entered
        **************************************************/
        function NumericKeyPress(passedEvent)
        {
            //only alpha-numeric characters are allowed - first character must not be a number
            var objEvent = (passedEvent==null)? window.event: passedEvent;//for mozilla compatibility
            var keyCode = (navigator.appName == "Netscape")? objEvent.which: objEvent.keyCode;
        	
            if(keyCode < 30)
	            return;
            if((keyCode>=48 && keyCode<59))
	            return true;
            else 
	            return false;
        	
        }
            
        /*************************************************
        Validates that only alpha-numeric characters are entered
        **************************************************/
        function AlphaNumericKeypress(passedEvent)
        {
	        //only alpha-numeric characters are allowed - first character must not be a number
	        var objEvent = (passedEvent==null)? window.event: passedEvent;//for mozilla compatibility
	        var keyCode = (navigator.appName == "Netscape")? objEvent.which: objEvent.keyCode;
        	
            if((keyCode >= 97 && keyCode <=122) || (keyCode >= 65 && keyCode <=90) || (keyCode == 8))
		        return true;
	        else 
		        return false;
        	
        }

/***************************************************************************************************
SendAJAXRequest:  Use this function to send AJAX requests to a predefined server side ASHX handler
functionName - The name of server side function to be called - this function is actually some server side code block that returns data
queryString - querystring to be sent to server side function 
callBackFunction - 
	the client side function that will be called when data comes from server side;  Get data in XML format from http.responseXML or in text 
	format from http.responseText, depending upon the way you are returning data from your server side block

	Put the following status check in your client side function
			if (http.readyState != 4 || http.status != 200 )
				return;


***************************************************************************************************/
var http = null;//HTTP object
function SendAJAXRequest(functionName, queryString, callBackFunction)
{
    //alert(callBackFunction);
    if(navigator.appName != "Netscape")
		http = new ActiveXObject("Microsoft.xmlhttp");
	else
		http = new XMLHttpRequest();
	
	var root = window.location.pathname.split("/")[1];	
	var strAjaxPath = strAppPath+"AJAXFunctions.ashx?Function="+functionName+"&"+queryString;
	//http.open("GET", "/"+root+"/AJAXFunctions.ashx?Function="+functionName+"&"+queryString, true); 
	http.open("GET", strAjaxPath, true); 
	http.onreadystatechange = callBackFunction;
	http.send(null);	
}