function chk_register(){
var illegalChars_Comm= /[\(\)\<\>\,\;\:\\\/\"\[\]^$@%*&()!]/ // for other sections
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]^$@% ' '*&()!]/
var f=document.register;


if(f.username.value==""){
	alert("Please enter your Username.");
	f.username.focus();
	return false;
	}	

var uname=f.username.value;
if (uname.match(illegalChars)) {
   alert("The Unsername can not contain illegal characters.\n");
	f.username.focus();
	return false;
}
if(f.passowrd.value==""){
	alert("Please enter passowrd.");
	f.passowrd.focus();
	return false;
	}
	
	if ((f.passowrd.value.length < 6) || (f.passowrd.value.length > 10)){
	mesg = "You have entered a password that is only " + f.passowrd.value.length + " character(s) \n"
	mesg = mesg + "Valid entries are between 6 and 10 characters.\n"
	mesg = mesg + "Please verify your input and submit again."
	alert(mesg);
	f.passowrd.focus();
	return false;
	}	

if(f.passowrd.value!=f.cnpassword.value){
	alert("Password and Confirm password is not same.");
	f.cnpassword.focus();
	return false;
}

  /*===========================================================================*/	
if(f.email.value==""){
	alert("Please enter your E-mail.");
	f.email.focus();
	return false;
	}
	
		if(f.email.value!=""){
		if(IsEmailValid(f.email)==false)
		{
			alert('Please enter a valid e-mail address!');
			f.email.focus();
			return false;
		}
	}
	/*===========================================================================*/	
	var first_name=f.fname.value;
	if(f.fname.value==""){
	alert("Please enter your first name.");
	f.fname.focus();
	return false;
	}	
	if(first_name!=""){
	if (first_name.match(illegalChars_Comm))
	 {
	   alert("The first name can not contain illegal characters.\n");
		f.fname.focus();
		return false;
	 }
	}
	
	/*===========================================================================*/	
	
	var last_name=f.lname.value;
	if(last_name!=""){
	if (last_name.match(illegalChars_Comm))
	 {
	   alert("The last name can not contain illegal characters.\n");
		f.lname.focus();
		return false;
	 }
	}
	
	/*===========================================================================*/
	
	
	var age=f.age.value;
	if(age!=""){
	if (age.match(illegalChars_Comm))
	 {
	   alert("The age can not contain illegal characters.\n");
		f.age.focus();
		return false;
	 }
	}
	
	
	
	
	/*===========================================================================*/	
	if(f.agree.checked==false){
	alert("Please Check term and condition");
	f.agree.focus();
	return false;
	}	
}


//function to check email vallid
function IsEmailValid(ElemName)
{
				var EmailOk  = true
				var Temp     = ElemName;
				var AtSym    = Temp.value.indexOf('@')
				var Period   = Temp.value.lastIndexOf('.')
				var Space    = Temp.value.indexOf(' ')
				var Length   = Temp.value.length - 1   // Array is from 0 to length-1
					if ((AtSym < 1) ||                     // '@' cannot be in first position

					    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
					    (Period == Length ) ||             // Must be atleast one valid char after '.'
					    (Space  != -1))                    // No empty spaces permitted
						   {
						      EmailOk = false
						      //alert('Please enter a valid e-mail address!')
						      //Temp.focus()
						      return false
						   }
					//return EmailOk
}
//end of email function

//function for upload photo
function vallidate_photo()
{
	var f=document.frm_upload;

if(f.member_photo_th.value==""){
	alert("Please select photo.");
	f.member_photo_th.focus();
	return false;
	}	
}
/* function for update profile*/
function vallidate_profile()
{
var illegalChars_Comm= /[\(\)\<\>\,\;\:\\\/\"\[\]^$@%*&()!]/ // for other sections
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]^$@% ' '*&()!]/
var f=document.editprofile;

if(f.fname.value==""){
	alert("Please enter First Name.");
	f.fname.focus();
	return false;
	}	

var uname=f.fname.value;
if (uname.match(illegalChars)) {
   alert("The first Name can not contain illegal characters.\n");
	f.fname.focus();
	return false;
}

if(f.lname.value==""){
	alert("Please enter Last Name.");
	f.lname.focus();
	return false;
	}	

var uname1=f.lname.value;
if (uname1.match(illegalChars)) {
   alert("The Last Name can not contain illegal characters.\n");
	f.lname.focus();
	return false;
}
if(f.aboutme.value==""){
	alert("Please enter About us.");
	f.aboutme.focus();
	return false;
	}	


}
//function for add gallery photo
//function for upload photo
function vallidate_gallryphoto()
{
	var f=document.frm_galleryupload;
if(f.phototitle.value==""){
	alert("Please Enter Photo Title.");
	f.phototitle.focus();
	return false;
	}	
if(f.member_photo_th.value==""){
	alert("Please select photo.");
	f.member_photo_th.focus();
	return false;
	}	
	
}

function validate_contactus()
{
	if(document.contactform.firstname.value==""){
	alert("Please Enter The Name ...!");
	document.contactform.firstname.focus();
	return false;
	}
	if(document.contactform.phone.value==""){
	alert("Please Enter The Phone ...!");
	document.contactform.phone.focus();
	return false;
	}
	if(document.contactform.phone.value==""){
	alert("Please Enter The Phone ...!");
	document.contactform.phone.focus();
	return false;
	}
	if(document.contactform.Email.value!=""){
		if(document.contactform.Email.value.indexOf("@")==-1 ||
			document.contactform.Email.value.indexOf(".")==-1 ||
			document.contactform.Email.value.indexOf("")==-1 ||
			document.contactform.Email.value.length < 6)
		{
			alert("Sorry, the e-Mail Address is not valid.");
			document.contactform.Email.focus();
			return false;		
		}
	}
	else
	{
		alert("Please enter e-Mail Address.");
		document.contactform.Email.focus();
		return false;	
	}
	   
	if(document.contactform.message.value==""){
	alert("Enter The Message ...!");
	document.contactform.message.focus();
	return false;
	}
}

function validate_forgotpassword()
{
	if(document.forgotpass_form.emailaddress.value=="")
	{
		alert("Please Enter Email Address");
		document.forgotpass_form.emailaddress.focus();
		return false;
	}
}

function chknewslatter()
{
	
	
	if(document.frm_login.member_email.value==""){
	alert("Please enter your E-mail.");
	document.frm_login.member_email.focus();
	return false;
	}
	
		if(document.frm_login.member_email.value!=""){
		if(IsEmailValid(document.frm_login.member_email)==false)
		{
			alert('Please enter a valid e-mail address!');
			document.frm_login.member_email.focus();
			return false;
		}
	}
	if(document.frm_login.fname.value=="")
	{
		alert("Please Enter First name");
		document.frm_login.fname.focus();
		return false;
	}
	if(document.frm_login.lname.value=="")
	{
		alert("Please Enter Last Name");
		document.frm_login.lname.focus();
		return false;
	}
}
function chk_comments()
{
var illegalChars_Comm= /[\(\)\<\>\/\"\[\]^$@%*&()!]/ // for other sections
var illegalChars= /[\(\)\<\>\\\/\"\[\]^$@%*&()!]/
var f=document.frm_comments;


if(f.comments_description.value==""){
	alert("Please enter comment.");
	f.comments_description.focus();
	return false;
	}	

var uname=f.comments_description.value;
if (uname.match(illegalChars)) {
   alert("The comment can not contain illegal characters.\n");
	f.comments_description.focus();
	return false;
}
	
}

function validatesearch()
{
	var f=document.frmsearch;
	if(f.keyword.value=="")
	{
		alert("Please enter search keyword");
		return false;
	}
	
	
}
