function checkemail(em)
 {
	if(em == '' || em.indexOf('@',0) == -1) return(true);
	if(em.length < 4 || em.indexOf('.',0) == -1) return(true);
	n=em.indexOf('.')
	if(em.length <= n+1) return(true);
}

function trim(string) 
{
	return string.replace(/^\s+|\s+$/g,"");
}

function redirection1()
{
	id = document.formx.brand_id.options[document.formx.brand_id.selectedIndex].value;
	window.location.href = "cigarette_details.php?brand_id="+id;
}

function redirection2()
{
	id = document.formy.brand_id.options[document.formy.brand_id.selectedIndex].value;
	window.location.href = "cigarette_details.php?brand_id="+id;
}

function redirection3()
{
	id = document.formz.brand_id.options[document.formz.brand_id.selectedIndex].value;
	window.location.href = "cigarette_details.php?brand_id="+id;
}

function check_frmlogin()
{
	if(trim(document.form_login.email.value) == "" || checkemail(trim(document.form_login.email.value)) == true)
	{
		alert("Please enter the email address.");
		document.form_login.email.value = "";
		document.form_login.email.focus();
		return false;
	}
	
	if(trim(document.form_login.password.value) == "")
	{
		alert("Please enter the password.");
		document.form_login.password.value = "";
		document.form_login.password.focus();
		return false;
	}
	
	return true;
}

function check_frmpass()
{
	if(trim(document.form_pass.email.value) == "" || checkemail(trim(document.form_pass.email.value)) == true)
	{
		alert("Please enter the email address.");
		document.form_pass.email.value = "";
		document.form_pass.email.focus();
		return false;
	}
	
	return true;
}