   	/************************* Library Functions **************************/
    /* This function checks email validation */
    function isEmail(email) 
    {
        //if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
        if(/^[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]+$/.test(email)) 
        {
            return (true);
        }
        return (false);
    }
    
    /*This function checks undefined anfd null objects */
    function isDigit(str)
    {
       regExInvalidChars = /[^a-zA-Z][-]+/;
       if (regExInvalidChars.test(str))
       { 
         return false;
       }
       else
       {
	       return true;
	   }
    }
    
    function isPhoneNumber(phoneNo)
    {
       regExInvalidChars = /[^0-9][-]/;       
       if (regExInvalidChars.test(phoneNo))
       { 
             return false;
       }
                
       return true;
    }
    
    
    function validateObject(str)
    {
        if(str != null && str != 'null' && str!=undefined && str!='undefined')
        {
            return true;
        }
        else
        {
            return false;
        }
    }
   
    function isInteger(s)
	{   var i;
	    for (i = 0; i < s.length; i++)
	    {   
	        // Check that current character is number.
	        var c = s.charAt(i);
	        if (((c < "0") || (c > "9"))) return false;
	    }
	    // All characters are numbers.
	    return true;
	}

// Addded by Sushil
function checkText(field, event)
{	
	var isNN = (navigator.appName.indexOf("Netscape")!=-1);
	var asciCode = event.which;	
	var KeyTyped = (isNN) ? String.fromCharCode(event.which) : String.fromCharCode(event.keyCode);   
	var lCode = KeyTyped.charCodeAt(0);
	//alert("lCode : "+lCode);

//	alert("asciCode : "+ asciCode +"\n KeyTyped : "+KeyTyped);
    if (
			(lCode >= 97 && lCode <= 122)	|| 
			(lCode >= 65 && lCode <= 90)||		
			(lCode >= 0 && lCode<=32) 			
		)
	{
		return true;
	} 
	else
	{
		return false;
	}
 }
 function trimText(id)
 {
		var text = id.value;
		if(text != null && text != "")
		{
				while(text.charAt(0)==' ')
					text=text.substring(1,text.length )
				while(text.charAt(text.length-1)==' ')
					text=text.substring(0,text.length-1)
				if(text.charAt(0)==' ')
					text=text.substring(1,text.length )
				if(text.charAt(text.length-1)==' ')
					text=text.substring(0,text.length-1)
		}
   id.value = text;
  }
	