function validateForm() 
	{
		username=document.getElementById("txtUser").value;
		user=username.replace(/^\s+|\s+/,"");
		
		password=document.getElementById("txtPass").value;
		pass=password.replace(/^\s+|\s+/,"");
				
		if(user==""){
		alert("Please enter your username.");
		document.getElementById("txtUser").focus();
		return false;
		}
		
		/*var check=isValidEmail(username);
		
		if(check=="Invalid Email Address."){
		alert(check);
		document.getElementById("txtUser").focus();
		return false;
		}*/
	
		if(pass==""){
		alert("Please enter your password.");
		document.getElementById("txtPass").focus();
		return false;
		}
		
	}

function validateRegistration(){
			fname1=document.getElementById("firstName").value;
			fname=fname1.replace(/^\s+|\s+/,"");
			
			/*lname1=document.getElementById("lastName").value;
			lname=lname1.replace(/^\s+|\s+/,"");*/
			uname1=document.getElementById("username").value;
			uname=uname1.replace(/^\s+|\s+/,"");
			
			returnText3=document.getElementById("userEmail").value;
			returnTextFinal3=returnText3.replace(/^\s+|\s+/,"");
			
			pass21=document.getElementById("txtConPass").value;
			pass22=pass21.replace(/^\s+|\s+/,"");
			
			pass11=document.getElementById("txtPass").value;
			pass12=pass11.replace(/^\s+|\s+/,"");
			
			if(returnTextFinal3==""){
			alert("Please enter your email address."); 
			document.getElementById("userEmail").focus();
			return false;
			}
			var check=isValidEmail(returnTextFinal3);
			
			if(check=="Invalid Email Address."){
			alert(check);
			document.getElementById("userEmail").focus();
			return false;
			}
			if(fname==""){
			alert("Please enter your first name.");
			document.getElementById("firstName").focus();
			return false;
			}
			/*if(lname==""){
			alert("Please enter your last name.");
			document.getElementById("lastName").focus();
			return false;
			}*/
			if(pass12==""){
			alert("Please enter your password.");
			document.getElementById("txtPass").focus();
			return false;
			}
			if(pass21==""){
			alert("Please enter your confirmation password.");
			document.getElementById("txtConPass").focus();
			return false;
			}
			if(document.getElementById("txtConPass").value!=document.getElementById("txtPass").value){
			alert("Your passwords do not match.");
			document.getElementById("txtConPass").focus();
			return false;
			}
			if(pass12.length<6)
			{
			alert("Your passwords must contain at least 6 characters.");
			}
			
			checkpostal("txtPass");
			
			    if(document.getElementById("terms").checked==true){
				 var state=1;
				}
				if(state==1)
				 return true;
				else{
				 alert("You need to agree to our terms to continue further.");
				 return false;
			    }
			}
			
			function checkpostal(id){
				var pattern=/\w\d[!;,:-.]/ //regular expression defining a 5 digit number
				if (document.getElementById(id).value.search(pattern)==-1) //if match failed
				alert("Your passwords must contain at least one digit and a punctuation character.")
				}

			 function isValidEmail(strEmail) {
				
				var msg;
				var i;
				var len=strEmail.length;
				if(strEmail=="") {
						msg="";
				} else {
					if((strEmail.charAt(0)=="@") || (strEmail.charAt(0)==".")) {
						msg="Invalid Email Address.";
					} else {
				//	checking the number of the @ and dots in the email add	
						var countAt=0;
						var countDot=0;
						for (i=0; i<len; i++) {
							if(strEmail.charAt(i)=="@") {
								countAt=countAt+1;
							}	
							if(strEmail.charAt(i)==".") {
								countDot=countDot+1;
							}
						} //end of for (i=0; i<strEmail.length; i++) {...	
						if((countAt!=1) || (countDot<1)) {
							msg="Invalid Email Address.";
						} else {
					//	checking the position of the @ with respect to the dot 
							var posDot=0;
							var posAt=0;
							posDot=strEmail.lastIndexOf(".");
							posAt=strEmail.indexOf("@");
							if((posAt>posDot) || (posDot==(posAt+1))) {
								msg="Invalid Email Address.";
							} else {
						//	checking the dot position and the @ postion at the end
								if((strEmail.charAt(len)=="@") || (strEmail.charAt(len)==".")) {
									msg="Invalid Email Address.";
								} else {
									/* 	checking for the invalid characters
									 if(ereg('[^A-Za-z0-9_]', strEmail)) {
								msg="Only letters, numbers and underscores(_).";		*/
									msg = "";
								} //end of if((strEmail.charAt(len)=="@") || (strEmail.charAt(len)==".")) {...
							} //end of if((posAt>posDot) || (posDot==(posDot+1))) {...
						} //end of if((countAt!=1) ||(countDot<1)) {...		
					} //end  if((strEmail.charAt(i)=="@") || (strEmail.charAt(i)==".")) {...
				} //end of if(strEmail=="") {...
				return msg;	
			}//end function		
	