// JavaScript Document
 
// Declaring required variables
// calculate the ASCII code of the given character
function CalcKeyCode(aChar) {
  var character = aChar.substring(0,1);
  var code = aChar.charCodeAt(0);
  return code;
}

function checkNumber(val) {
  var strPass = val.value;
  var strLength = strPass.length;
  var lchar = val.value.charAt((strLength) - 1);
  var cCode = CalcKeyCode(lchar);

  /* Check if the keyed in character is a number
     do you want alphabetic UPPERCASE only ?
     or lower case only just check their respective
     codes and replace the 48 and 57 */

  if (cCode < 48 || cCode > 57 ) {
    var myNumber = val.value.substring(0, (strLength) - 1);
    val.value = myNumber;
  }
  return false;
}

 
//form
 

  	function validatepack() 
		{ 
		 if(document.contact_us.package.value=="")
			{
				window.alert('Choose package');
				document.contact_us.package.focus();
				return false;
			}
		
		    if(document.contact_us.name.value=="")
			{
				window.alert('Enter Name');
				document.contact_us.name.focus();
				return false;
			}
			  if(document.contact_us.email.value=="")
			{
				window.alert('Enter Email');
				document.contact_us.email.focus();
				return false;
			}
			else
			
			 if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.contact_us.email.value ))
			{
		    
			if(document.contact_us.mobile.value=="")
			{
				window.alert('Enter Telephone Number !');
				document.contact_us.mobile.focus();
				return false;
			}
				if(document.contact_us.address.value=="")
			{
				window.alert('Enter address !');
				document.contact_us.address.focus();
				return false;
			}
			 
            	
			return true;
			}
            
			else
			{
 			window.alert("Invalid E-mail Address! Please re-enter.");
			document.contact_us.email.focus();
			return false;
			}
		
		}
	 
 	function validatescript() 
		{ 
		 
		    if(document.contact_us.name.value=="")
			{
				window.alert('Enter Name');
				document.contact_us.name.focus();
				return false;
			}
			  if(document.contact_us.email.value=="")
			{
				window.alert('Enter Email');
				document.contact_us.email.focus();
				return false;
			}
			else
			
			 if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.contact_us.email.value ))
			{
		    
			if(document.contact_us.mobile.value=="")
			{
				window.alert('Enter Telephone Number !');
				document.contact_us.mobile.focus();
				return false;
			}
		 
            	
			return true;
			}
            
			else
			{
 			window.alert("Invalid E-mail Address! Please re-enter.");
			document.contact_us.email.focus();
			return false;
			}
		
		}
