
function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/;
var matchArray=emailStr.match(emailPat);
if(emailStr=="")
{ 
	alert("Please enter your Email Address.");
return false;
}
if (matchArray==null) {
 	alert("Email address seems incorrect (check @ and .'s)");
	return false;
}


return true;
}
function validate(){
if(document.accountForm.lookupzact.value=="yes") {

     if (emailCheck(document.accountForm.email.value)==false)
	{
		document.accountForm.email.select();
		document.accountForm.email.focus();
		return false;
	}


if(document.accountForm.fname.value==""){
alert("Please enter your first name");
document.accountForm.fname.focus();
return false;
}
if(document.accountForm.lname.value==""){
alert("Please enter your last name");
document.accountForm.lname.focus();
return false;
}

if(document.accountForm.password.value==""){
alert("Please enter a password");
document.accountForm.password.focus();
return false;
}

if(document.accountForm.password2.value==""){
alert("Please confirm your password");
document.accountForm.password2.focus();
return false;
}

if(document.accountForm.password2.value!=""){

if(document.accountForm.password.value!=document.accountForm.password2.value)
{
alert("Passwords don't match, please check again");
document.accountForm.password2.focus;
return false;
}

}



}
}

function emailCheckz (emailStr) {
var emailPat=/^(.+)@(.+)$/;

var matchArray=emailStr.match(emailPat);
if(emailStr=="")
{ 
	alert("Please enter your Email Address.");
return false;
}
if (matchArray==null) {
 	alert("Email address seems incorrect (check @ and .'s)");
	return false;
}

return true;
}
function validatez(){
if(document.accountForm2.lookupactq.value=="yes") {

     if (emailCheckz(document.accountForm2.email.value)==false)
	{
		document.accountForm2.email.select();
		document.accountForm2.email.focus();
		return false;
	}


if(document.accountForm2.fname.value==""){
alert("Please enter your first name");
document.accountForm2.fname.focus();
return false;
}
if(document.accountForm2.lname.value==""){
alert("Please enter your last name");
document.accountForm2.lname.focus();
return false;
}

if(document.accountForm2.password.value==""){
alert("Please enter a password");
document.accountForm2.password.focus();
return false;
}

if(document.accountForm2.password2.value==""){
alert("Please confirm your password");
document.accountForm2.password2.focus();
return false;
}

if(document.accountForm2.password2.value!=""){

if(document.accountForm2.password.value!=document.accountForm2.password2.value)
{
alert("Passwords don't match, please check again");
document.accountForm2.password2.focus;
return false;
}

}



}
}

function noenter() {
  return !(window.event && window.event.keyCode == 13); }

function tabstate(tabdiv,tabimage)
{

var tablayeron = tabimage+'-on';
var tablayeroff = tabimage+'-off';

hidelayer('tab-mailinglist-on');
hidelayer('tab-coupon-on');
hidelayer('tab-login-on');
showlayer('tab-mailinglist-off');
showlayer('tab-coupon-off');
showlayer('tab-login-off');
hidelayer(tablayeroff);
showlayer(tablayeron);

hidelayer('loginbardiv');
hidelayer('couponbardiv');
hidelayer('mailinglistbardiv');
hidelayer('lostpassbardiv');
showlayer(tabdiv);
}

function setStyleById(i, p, v) {
//  i - element id
//  p - property
//  v - value
	var n = document.getElementById(i);
	n.style[p] = v;
}

function tabstaterestore()
{
	setStyleById('mailinglisttab','background','url(/imgs/tab-mailinglist-off.gif) bottom no-repeat');
	setStyleById('coupontab','background','url(/imgs/tab-coupon-off.gif) bottom no-repeat');
	setStyleById('logintab','background','url(/imgs/tab-login-off.gif) bottom no-repeat');
}

function showlayer(layerid)
{	
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(layerid).style;
		style2.display = "block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[layerid].style;
		style2.display = "block";
	}	
}

function hidelayer(layerid)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(layerid).style;
		style2.display = "none";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[layerid].style;
		style2.display = "none";
	}
}