  function isWhiteSpace(s) {
		 var whitespace = " \t\n\r" ;
		 var x='';
		 for (i = 0; i < s.length; i++) {
            var c = s.charAt(i);
            if (whitespace.indexOf(c) == -1) 
            {
				x +=c
			}
		}
		return x.length==0
         
    }
    
    function CheckLength(s) {
		 var whitespace = " \t\n\r" ;
		 var x='';
		 for (i = 0; i < s.length; i++) {
            var c = s.charAt(i);
            if (whitespace.indexOf(c) == -1) 
            {
				x +=c
			}
		}
		return x.length ;
         
    }
    
	function checkForEmptyRequiredFields() {
	
		var e=document.getElementById("Email") ;
		var p=document.getElementById("Phone");
		var f=document.getElementById("FirstName") ;
		var l=document.getElementById("Lastname");
		var m='';
		try {
			if (e && p && f && l)  {
				//alert('here');
				if (isWhiteSpace(e.value))  { 
					m+='email address\n' ;
				}else {
					if (! /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e.value)) {  //not the best email validation but 
							 m+='Please check the email that you have entered\n' ;	   //then it is just intended to see
					}																	  //that something is at least enterd according
				}	   			                                                         // to the business unit
				if(isWhiteSpace(p.value)|| CheckLength(p.value) != 10 || !isNumeric(p.value)) {
					m+='Please enter a 10 digit numeric phone number\n';
				}						
				if(isWhiteSpace(f.value)) {
					m+='First name\n';
				}	
				if(isWhiteSpace(l.value)) {
					m+='Last name\n';
				}							
			}
			if (m.length > 0) {
				alert('Please check the following required fields.\n' + m);
				return false;
			}
		}catch(e) {
			alert(e.description); //just let it submit
			return true  ;
		}
		return true ;
	}



 function isNumeric(s) {
	 var Numeric = "1234567890" ;
	 var x='';
	 for (i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (Numeric.indexOf(c) == -1) 
        {
			return false ;
		}
	}
    return true;
 }
 
   function NumericOnly()   {
       try {
            var key;
             if(window.event) {
                  key = window.event.keyCode;     //IE
             } else {
                  key = e.which;     //firefox
             }
             //alert(key);
             if (key!=8 && key!=46) {
                    if (key<48||key>57) {
                        event.keyCode =0 ;
                        return false ;
                    }
             }else {
                return true ;
             }
        }catch(e) {
            //let it continue
            return true ;
        }
   }
   
    function ExcludeMarkup()   {
       try {
            var key;
             if(window.event) {
                  key = window.event.keyCode;     //IE
             } else {
                  key = e.which;     //firefox
             }
             //alert(key);
             if (key!=8 && key!=46) {
                    if (CheckKey(key)) {
                        event.keyCode =0 ;
                        return false ;
                    }
             }else {
                return true ;
             }
        }catch(e) {
            //let it continue
            return true ;
        }
   }
   
   function CheckKey(Code) {
	var arr=new Array() ;
	//alert(Code) ;
	arr[0]=60 ; // <
	arr[1]=62 ; // >
	arr[2]=33 ; //!
	arr[3]=35 ; // #
	arr[4]=58 ; // :
	for (i=0; i<= arr.length-1;i++) {
		if (Code==arr[i]){
			return true;
			break;
		}
	}
   
   }