  var $j = jQuery.noConflict();

function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }




function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}

$j(document).ready(function(){
   
      $j('#appform').bind('change', function() {


		window.location = $j('#appform').val();

   
	  });
   
   
   
   
   
        $j("input[type='submit']").click(function(){
          ok = true;
       
	   
	   
	   //empty
	      $j("input.required").each(function(){
            if(this.value=='') { 
              ok = false;
              $j(this).css("background", "#ff0");
            } else {
              $j(this).css("background", "#fff");
            };                    
          });
		  
		 	  	  
          if(ok==false) {
            alert('Please go back and fill the empty fields in.');
            return false;                    
          };
		 ok = true;  
		   
		//email  
		  	$j("input.required-email").each(function(){
           if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(this.value)){
			   $j(this).css("background", "#fff");   
		   }else{
			  ok = false;
              $j(this).css("background", "#ff0");
		   }
		  });
		  
		 if(ok==false) {
            alert('Please enter a valid email address');
            return false;                    
          };
		 ok = true;  
		  
		  
		  
			//numeric 
		  	$j("input.required-num").each(function(){
           if (IsNumeric(this.value) == false){
					   
			  ok = false;
              $j(this).css("background", "#ff0");  
		   }else{
			  $j(this).css("background", "#fff"); 
		   }
		  });
		  	 if(ok==false) {
            alert('Please enter numbers only');
            return false;                    
          };
		 ok = true;  
		  
	
        });
      });
