
var validForm = true;
		
		function validateForm()
		{	
			validForm = true;
			msg = "";
			
			if (isEmpty(document.getElementById('tbEmail').value))
			{
				validForm = false;
				msg += "Please enter Email Address.\n";
			}
			else if (!isValidEmail(document.getElementById('tbEmail').value))
			{
				validForm = false;
				msg += "Please enter a valid Email Address.\n";
			}
			
			if (isEmpty(document.getElementById('tbZipCode').value))
			{
				validForm = false;
				msg += "Please enter a valid Zip Code.\n";
			}
			else if (!isValidNumber(document.getElementById('tbZipCode').value, 6))
	        {
		        validForm = false;
		        msg += "Please enter a 5 digit number for zip code.\n";
	        }
	        if (isEmpty(document.getElementById('tbQty').value))
			{
				validForm = false;
				msg += "Please enter a quantity.\n";
			}
	        if (!isNumber(document.getElementById('tbQty').value))
			{
				validForm = false;
				msg += "Please enter a valid Number.\n";
			}
		
			if (validForm)
		    return true;
		
	        alert(msg);
	        return false;
				
			
			
		}
		function trim(str)
		{
			return str.replace(/^\s*|\s*$/g,"");
		}
		
		function isValidNumber(value, length)
        {
        		
	        if (length != 0 && value.length != length)
		        return false;
        		
	        return true;
        }
        
        function isNumber(val)
        {
            if (isNaN(val))
            {
                return false;
            }
            else
            {
                return true;
            } 
        }

        
        
		function isEmpty(value)
		{
			return (trim(value).length == 0);
		}
		
		function isValidEmail(value)
		{
			return trim(value).search(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i) >= 0;
		}
		
		function isCheckBoxCheck(field,message) {
	       for (i = 0; i < field.length; i++) {
	          if (field[i].checked)
	             return true;
           }
           alert(message);
           return false;	   
		}
		
		function isValidNumber(field,message) {
		   if ( isNaN(field.value)) {
		      field.value="";
		      alert(message);
		   }
		}
