function validate_regform()
{
	var reg=document.frm_Reg;
	if(GenValidation(reg.txt_SurName,"surname.",'','spl')=='')
		return false;
	if(GenValidation(reg.txt_FName,"First Name.",'','spl')=='')
		return false;
	if(GenValidation(reg.txt_Username,"username.",'','')=='')
		return false;
	if(EmailValidation(reg.txt_Username) == "")
		return false;
	if(GenValidation(reg.txt_Password,"password",'','')=='')
	return false;
	if(reg.txt_Password.value.length < 6)
	{
		alert("Password should be atleast six characters.");
		//txt_Password.focus();
		document.getElementById("txt_Password").focus();
		return false;
	}

	var check = /^\w*(?=\w*\d)(?=\w*[a-zA-Z]\w*$)/;

	if(!check.test(reg.txt_Password.value)) { 
   	alert("The password should contain at least one letter and one number and be a minimum of 6 characters.");
	txt_Password.focus();
	document.getElementById("txt_Password").focus();
	return false;
    }

	if(GenValidation(reg.txt_ConPassword,"confirm password.",'','')=='')
		return false;
	if(PassValidation(reg.txt_Password,reg.txt_ConPassword)=='')
		return false;
	if(document.getElementById("drop_sec_ques").selectedIndex==0)
	{
		alert("Please select your security question.");
		document.getElementById("drop_sec_ques").focus();
		return false;
	}
	if(GenValidation(reg.txt_sec_answer,"security answer.",'','')=='')
		return false;
	/*if(reg.txt_address.value=="")
	{
		alert('Please enter your Address.');
		reg.txt_address.focus();
		return false;
	}*/
	if(reg.txt_city.value=="")
	{
		alert('Please enter City.');
		reg.txt_city.focus();
		return false;
	}
	if(alphabetic(reg.txt_city, 'City') == false)
	return false;

	if(reg.slctCountry.value==0)
	{
		alert('Please select a country');
		reg.slctCountry.focus();
		return false;
	}			
	if(getSelectedIndex(reg.rd_gender)== -1)
	{
		alert("Please select gender.");
		return false;
	}
	if(GenValidation(reg.Confirmation_Code,'security code','','')=='')
	{
		return false;
	}
	if(document.getElementById('chkTerms').value=='')
	{
		return false;
	}
    if(reg.chkTerms.checked == false)
	{
		alert("Please accept the terms and conditions.");
		return false;
	}
}
function validate_signin(reg)
{
	if(GenValidation(reg.LoginUsername,"username",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(reg.LoginPassword,"password",'','spl')=='')
	{
		return false;
	}
}
function validate_submit(signfrm)
{
 	if(GenValidation(signfrm.Loginemilid,'email','','') == "")
		return false;
	if(EmailValidation(signfrm.Loginemilid) == "")
	{
		return false;
	}
}
function validate_login(signfrm)
{	
	if(GenValidation(signfrm.LoginUsername,"username",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(signfrm.LoginPassword,"password",'','spl')=='')
	{
		return false;
	}
}
function validate_contactfrm(contactus)
{
	if(GenValidation(contactus.uname,"username",'','spl')=='')
	{
		return false;
	}	
	if(GenValidation(contactus.txt_Email,'email','','') == "")
		return false;
	if(EmailValidation(contactus.txt_Email) == "")
	{
		return false;
	}
	if(GenValidation(contactus.subject,"subject",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(contactus.message,"comments",'','spl')=='')
	{
		return false;
	}
}
function  validate_chgpwd(chg_pwd)
{
	if(GenValidation(chg_pwd.oldpass,"old password",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(chg_pwd.txt_npwd,"New password",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(chg_pwd.txt_cpwd,"confirm password",'','spl')=='')
	{
		return false;
	}
	if(PassValidation(chg_pwd.txt_npwd,chg_pwd.txt_cpwd)=='')
	{
		return false;
	}
}
function validate_updatefrm(frm)
{
	if(GenValidation(frm.surname,"surname",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(frm.first_name,"firstname",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(frm.Email,'email','','') == "")
		return false;
	if(EmailValidation(frm.Email) == "")
	{
		return false;
	}
	if(GenValidation(frm.uname,"username",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(frm.Password,"password",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(frm.cpassword,"confirm password",'','spl')=='')
	{
		return false;
	}
	if(PassValidation(frm.Password,frm.cpassword)=='')
	{
		return false;
	}
	if(document.getElementById('From_Date').value=='')
	{
		alert("Please enter the Date of Birth");
		document.getElementById('From_Date').focus;
		return false;
	}
	if(getSelectedIndex(frm.rd_gender)== -1)
	{
		alert("select gender");
		return false;
	}
}
/////////////////this validation is used to validate CC information in cc_details.php,ord_conf.php
function chkValidationCCDetails()
{
	var frm=document.frm_order;
	if(GenValidation(frm.txt_FN,"first name.",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(frm.txt_SN,"sur name.",'','spl')=='')
	{
		return false;
	}
	if(GenValidation(frm.txt_name,"name on card.",'','spl')=='')
	{
		return false;
	}
	
	if(NumValidation(frm.txt_CCNO, 'credit card number.','','num') == "")
	return false;
	
	if(frm.txt_CCNO.value.length != 16)
			{
				alert("Credit card should be 16 digit");
				frm.txt_CCNO.focus();
				return false;
			} // closing the if - else condtion for if(MessageLen4.length != 0)
	
	
	
	if(NumValidation(frm.txt_CVV, 'CVV number.','','num') == "")
	return false;
	
	if(frm.txt_CVV.value.length != 3)
			{
				alert( "CVV should be 3 digit");
				frm.txt_CVV.focus();
				return false;
			} 
	
	if(frm.slt_mnt.value==0)
	{
		alert('Please select a Month');
		frm.slt_mnt.focus();
		return false;
	}		
	if(frm.slt_yr.value==0)
	{
		alert('Please select a Year');
		frm.slt_yr.focus();
		return false;
	}		
	
}
////////////////////////////////////////
/////////////////////function to check for atleast one item called in cart////////////////
function selectOne(total)
{
	var chk=false;
	for(var i=0;i<total;i++)
	{
		if(document.getElementById('Item_'+i))
		{
			if(document.getElementById('Item_'+i).checked==true)
			chk=true;
		}
	}
	if(chk!=true)
	alert('Please select an item')
	return chk;
}
//////////////////////////////////////////////////////////////////////////////////////
