function validateUser(frm){
		var utype	= frm.utype;
		var fname	= frm.fname;	
		var email	= frm.email;	
		
		var msg		= "";
		var patternEmail='^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+[a-zA-Z0-9]$';
		if(utype.selectedIndex == 0){
			msg += "Please choose user type \n";
		}
		if(fname.value==""){
			msg += "Please enter first name \n";
		}
		
		if(email.value !=""){
			if(!email.value.match(patternEmail)){
				msg +="Enter valid email address";
			}
		}
		
		if(msg != ''){
			alert("Please fill up all the compulsory fields: \n-------------------------- \n" + msg);	
			return false;
		}else{
			return true;
		}
}

function validateLogin(frm,type){
		var username			= frm.username;
		var password			= frm.password;	
		var confirm_password	= frm.confirm_password;	
		var msg		= "";
		if(type == "" || type == null){
			if(username.value==""){
				msg += "Username is a required field \n";
			}
		}
		if(password.value==""){
			msg +="Password is a required field \n";
		}
		if(confirm_password.value==""){
			msg +="Confirm password is a required field \n";
		}
		if(password.value !="" && confirm_password.value != ""){
			if(password.value != confirm_password.value){
				msg +="Password and Confirm password donot match \n";
			}
		}
		if(msg != ''){
			alert("Please fill up all the compulsory fields: \n-------------------------- \n" + msg);	
			return false;
		}else{
			return true;
		}
}

function validateComment(frm){
		var fullName			= frm.fullname;
		var email				= frm.email_address;	
		var comment				= frm.comment;	
		var captcha				= frm.captcha;
		var patternEmail		= '^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+[a-zA-Z0-9]$';
		var msg		= "";
		if(captcha.value == ""){
			msg +="Security code is a required field \n";
		}
		if(fullName.value==""){
			msg +="Name is a required field \n";
		}
		if(email.value==""){
			msg +="Email is a required field \n";
		}
		if(email.value !=""){
			if(!email.value.match(patternEmail)){
				msg +="Enter valid email address \n";
			}
		}
		if(comment.value==""){
			msg +="Comment is a required field \n";
		}
		
		if(msg != ''){
			alert("Please fill up all the compulsory fields: \n---------------------------------- \n" + msg);	
			return false;
		}else{
			return true;
		}
}
function doConfirm(msg){
	if(confirm(msg)){
		return true;	
	}
	else{
		return false;
	}
}

