// JavaScript Document

function trim(str)
{
	
	return str.replace(/^\s*|\s(?=\s)|\s*$/g,"");
	
}


function chk()
{
	
	
	/*if(trim(document.frm_gen.username.value)=='')
	{
		showDialog('Warning','Please enter username','warning');		
		return false;
	}
	
	if(trim(document.frm_gen.first_name.value)=='')
	{
		showDialog('Warning','Please enter first name','warning');		
		return false;
	}
	
	
	
	else if(trim(document.frm_gen.last_name.value)=='')
	{
		showDialog('Warning','Please enter lastname','warning');
		document.frm_gen.last_name.focus();
		return false;
	}*/
	
	if(trim(document.frm_gen.email.value)=='')
	{
		showDialog('Warning','Please enter email addresss','warning');
		document.frm_gen.email.focus();
		return false;
	}
	else if((/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/).exec(document.frm_gen.email.value)==null)
	{
		showDialog('Warning','Invalid email address format.','warning');		
		document.frm_gen.email.value="";
		
		return false;
	}
	
	
	
	
	/*else if(trim(document.frm_gen.con_email.value)=='')
	{
		showDialog('Warning','Please enter confirm email address','warning');
		document.frm_gen.con_email.focus();
		return false;
	}
	
	else if(trim(document.frm_gen.con_email.value)!=trim(document.frm_gen.email.value))
	{
		showDialog('Warning','Email and confirm email address does not match','warning');
		document.frm_gen.con_email.value="";
		return false;
	}*/
	
	else if(trim(document.frm_gen.password.value)=='')
	{
		showDialog('Warning','Please enter password','warning');
		document.frm_gen.password.focus();
		return false;
	}
	
	else if(trim(document.frm_gen.public_url.value)=='')
	{
		showDialog('Warning','Please enter Public Profile URL','warning');
		document.frm_gen.public_url.focus();
		return false;
	}
	/*else if(trim(document.frm_gen.conpassword.value)=='')
	{
		showDialog('Warning','Please enter confirm password','warning');
		document.frm_gen.conpassword.focus();
		return false;
	}
	
	else if(trim(document.frm_gen.conpassword.value)!=trim(document.frm_gen.password.value))
	{
		showDialog('Warning','Password and confirm password does not match','warning');
		return false;
	}
	
	else if(trim(document.frm_gen.mem_dob.value)=='')
	{
		showDialog('Warning','Please select date of birth','warning');
		return false;
	}*/
	else if(document.frm_gen.formYear.value=='0' || document.frm_gen.formMonth.value=='0' || document.frm_gen.formDate.value=='0' )
	{
		showDialog('Warning','Please select Date of Birth','warning');
		return false;
	}	
	else if(trim(document.frm_gen.country.value)=='0')
	{
		showDialog('Warning','Please select country','warning');
		return false;
	}
	
	else if(trim(document.frm_gen.country.value)=='0' || trim(document.frm_gen.country.value)=='1' || trim(document.frm_gen.country.value)=='2')
		{
			
		
				 if(trim(document.frm_gen.province.value)=='0')
				{
					showDialog('Warning','Please select the province','warning');
					return false;
				}
				
				else if(trim(document.frm_gen.city.value)=='0')
				{
					showDialog('Warning','Please select the city','warning');
					return false;
				}
				
				//else if(trim(document.frm_gen.city.value)=='0')
				//{
					//showDialog('Warning','Please select the city','warning');
					//return false;
				//}
				
				else if(document.frm_gen.termagree.checked=="")
					{
						showDialog('Warning','Please select the privacy policy condition','warning');
						return false;
					}
		 document.frm_gen.submit();
	      return true;
					
		}
					
		
		
	
	
else if(document.frm_gen.termagree.checked=="")
	{
		showDialog('Warning','Please select the privacy policy condition','warning');
		return false;
	}
	
	
	
	document.frm_gen.submit();
	return true;
}

function chk_edit()
{
	//alert("*****************");
	/*if(trim(document.frm_gen.username.value)=='')
	{
		showDialog('Warning','Please enter username','warning');
		document.frm_gen.username.focus();
		return false;
	}
	
	else if(trim(document.frm_gen.first_name.value)=='')
	{
		showDialog('Warning','Please enter firstname','warning');
		document.frm_gen.first_name.focus();
		return false;
	}
	
	else if(trim(document.frm_gen.last_name.value)=='')
	{
		showDialog('Warning','Please enter lastname','warning');
		document.frm_gen.last_name.focus();
		return false;
	}*/
	
	if(trim(document.frm_gen.email.value)=='')
	{
		showDialog('Warning','Please enter email addresss','warning');
		document.frm_gen.email.focus();
		return false;
	}
	else if((/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/).exec(document.frm_gen.email.value)==null)
	{
		showDialog('Warning','Invalid email address format.','warning');		
		document.frm_gen.email.value="";
		
		return false;
	}
	
	
	
	
	/*else if(trim(document.frm_gen.con_email.value)=='')
	{
		showDialog('Warning','Please enter confirm email address','warning');
		document.frm_gen.con_email.focus();
		return false;
	}
	
	else if(trim(document.frm_gen.con_email.value)!=trim(document.frm_gen.email.value))
	{
		showDialog('Warning','Email and confirm email address does not match','warning');
		document.frm_gen.con_email.value="";
		return false;
	}*/
	
	/*else if(trim(document.frm_gen.password.value)=='')
	{
		showDialog('Warning','Please enter password','warning');
		document.frm_gen.password.focus();
		return false;
	}*/
	/*else if(trim(document.frm_gen.conpassword.value)=='')
	{
		showDialog('Warning','Please enter confirm password','warning');
		document.frm_gen.conpassword.focus();
		return false;
	}
	
	else if(trim(document.frm_gen.conpassword.value)!=trim(document.frm_gen.password.value))
	{
		showDialog('Warning','Password and confirm password does not match','warning');
		return false;
	}*/
	
	else if(trim(document.frm_gen.country.value)=='')
	{
		showDialog('Warning','Please select country','warning');
		return false;
	}
	
	else if(trim(document.frm_gen.province.value)=='')
	{
		showDialog('Warning','Please select the province','warning');
		return false;
	}
	
	else if(trim(document.frm_gen.city.value)=='')
	{
		showDialog('Warning','Please select the city','warning');
		return false;
	}
	
	return true;
}


