
  

         function load()
         {
             
		//---
            //bind enter event to all input boxes
            //---
            
            //get all inputs that are inputs
            els = $("body").find("input");
            
            //loop through inputs and bind event
            for(var i = 0; i < els.length; i++)
            {
                $(els[i]).bind("keydown", 
                        function(e)
                        {
                            checkInputForEnterKey($(this), e);
                        }
                    );
            }
            
            //Binding the click event to the submit button.
            elSubmit = $("body").find("[validate=true]");
            $(elSubmit).bind("click", 
                    function(e)
                    {
                        CheckValidation();
                    }
                );
         }   
         
         
         function checkInputForEnterKey(el, e)
         {
            if($.browser.msie)
            {
                if(e.keyCode == 13)
                {
                    e.preventDefault();
                    CheckValidation();
                    
                }
            }
         }
         
         function CheckValidation()
          {

           
		els = $("body").find("[required=true]");
            for (var i=0; i < els.length; i++)
            {
                var elsName = $(els[i]).attr("name"); 
                var elsFriendlyName = $(els[i]).attr("friendlyname"); 
                if(elsFriendlyName == undefined)
                {
                    elsFriendlyName = elsName;
                }
                
                var elsValue = $(els[i]).get(0).value;
			    if(elsValue.length == 0)
                {
				    alert("Please Enter " + elsFriendlyName);
				    
				    $(els[i]).get(0).focus();
				    return false;
                } 
               
            }
          
            $("form").get(0).submit();
          }