	function AddYears() {
		var selYear = document.getElementById('year');
		var year = (new Date()).getFullYear();
		
		selYear.options.length = 0;
		
		for(var i=year;i>=1950;i--) {
			var opt = document.createElement('option');
			opt.text = opt.value = i;
			
			selYear.options.add(opt);
		}
	}
	
	function checkAge() {
		var year = parseInt(document.getElementById('year').value);
		var religion = document.getElementById('religion').value;
		
		var theirDate = new Date((year + 21), 1, 1);
		var today = new Date();

		if (religion == 'Y' || ((today.getTime() - theirDate.getTime()) < 0)) {
			document.getElementById('form').style.display = "none";
			document.getElementById('mesg').style.display = "";
		}
		else {
			window.location = "main.html";
		}
		
		return false;
	}
	
	function showForm() {
		document.getElementById('mesg').style.display = "none";
		document.getElementById('form').style.display = "";
		
		return false;
	}

	function removeText(obj, text) {
		if(obj.value == text) {
			obj.value = "";
		}
	}
	
	function setText(obj, text) {
		if(obj.value == "") {
			obj.value = text;
		}
	}

	function submitform()
		{

		var AppForm = document.getElementById('AppForm');
		var MsgError = ""; 

			if(AppForm.txtFirstName.value== "First Name" || AppForm.txtFirstName.value== "")
			{
				MsgError+="Enter your First Name \n"; 
//				AppForm.txtFirstName.className="formred";
			}
//			else
//				AppForm.txtFirstName.className="";
				
				
			if(AppForm.txtLastName.value== "Last Name" || AppForm.txtLastName.value== "")
			{
				MsgError+="Enter your Last Name \n"; 
//				AppForm.txtFirstName.className="formred";
			}
//			else
//				AppForm.txtLastName.className="";				
	
			
			if(AppForm.txtEmail.value== "Email" || AppForm.txtEmail.value=="")
			{	
				MsgError+="Enter your Email \n";
//				AppForm.txtEmail.className="formred";			
			}
			else
			{
				  var re = new RegExp("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$");
				  if (!re.test(AppForm.txtEmail.value)) {
						MsgError+="Your Email format is invalid \n";			
//						AppForm.txtEmail.className="formred";
				  }
//				  else
//				  			AppForm.txtEmail.className="";
			}
			
			if(AppForm.txtComments.value== "Message" || AppForm.txtComments.value== "")
			{
				MsgError+="Enter your Message \n"; 
//				AppForm.txtFirstName.className="formred";
			}
//			else
//				AppForm.txtLastName.className="";
			

			if (MsgError !="")
			{
				alert(MsgError);
			}
			else
			{
				AppForm.submit();
			}

			return false;
		}
