function validateContinue(opt)
{
	trimFields();
	//Login Detail Validation
	if(opt == 'add')
	{
		if(obj.email.value == "" && !chkEmail(obj.email.value))
		{
			alert("Please enter a valid Login Email.\nIt can be either your Shipping or Billing email or any other.");
			obj.email.focus();
			obj.email.select();
			return;
		}
	}
	if(obj.password.value == "")
	{
		alert("Please enter your Password.");
		obj.password.focus();
		return;
	}
	if(obj.conf_password.value == "")
	{
		alert("Please Confirm the Password.");
		obj.conf_password.focus();
		return;
	}
	if(obj.password.value != obj.conf_password.value)
	{
		alert("The Password and Confirm Password do not match!\nPlease enter again and ensure both are same.");
		obj.conf_password.focus();
		obj.conf_password.select();
		return;
	}

	//Billing Address Validation
	if(obj.b_first_name.value == "")
	{
		alert("Please enter your First Name in Billing Information.");
		obj.b_first_name.focus();
		return;
	}
	if(obj.b_last_name.value == "")
	{
		alert("Please enter your Last Name in Billing Information.");
		obj.b_last_name.focus();
		return;
	}
	if(obj.b_address.value == "")
	{
		alert("Please enter the Address in Billing Information.");
		obj.b_address.focus();
		return;
	}
	if(obj.b_city.value == "")
	{
		alert("Please enter the City in Billing Information.");
		obj.b_city.focus();
		return;
	}
	if(obj.b_state.selectedIndex == 0 || obj.b_state.selectedIndex == 52)
	{
		alert("Please select a US or Canada State in Billing Information.");
		obj.b_state.focus();
		return;
	}
	if(obj.b_country.selectedIndex == 0)
	{
		alert("Please select a Country in Billing Information.");
		obj.b_country.focus();
		return;
	}
	if(obj.b_zip.value == "")
	{
		alert("Please enter the Zip in Billing Information.");
		obj.b_zip.focus();
		return;
	}
	if(obj.b_phone.value == "")
	{
		alert("Please enter the Phone Number in Billing Information.");
		obj.b_phone.focus();
		return;
	}
	if(obj.b_email.value == "")
	{
		alert("Please enter the Email in Billing Information.");
		obj.b_email.focus();
		return;
	}
	if(!chkEmail(obj.b_email.value))
	{
		alert("Please enter a valid Email Address in Billing Information.");
		obj.b_email.focus();
		obj.b_email.select();
		return;
	}

	//Shipping Address Validation
	if(obj.s_first_name.value == "")
	{
		alert("Please enter your First Name in Shipping Information.");
		obj.s_first_name.focus();
		return;
	}
	if(obj.s_last_name.value == "")
	{
		alert("Please enter your Last Name in Shipping Information.");
		obj.s_last_name.focus();
		return;
	}
	if(obj.s_address.value == "")
	{
		alert("Please enter the Address in Shipping Information.");
		obj.s_address.focus();
		return;
	}
	if(obj.s_city.value == "")
	{
		alert("Please enter the City in Shipping Information.");
		obj.s_city.focus();
		return;
	}
	if(obj.s_state.selectedIndex == 0 || obj.s_state.selectedIndex == 52)
	{
		alert("Please select a US or Canada State in Shipping Information.");
		obj.s_state.focus();
		return;
	}
	if(obj.s_country.selectedIndex == 0)
	{
		alert("Please select a Country in Shipping Information.");
		obj.s_country.focus();
		return;
	}
	if(obj.s_zip.value == "")
	{
		alert("Please enter the Zip in Shipping Information.");
		obj.s_zip.focus();
		return;
	}
	if(obj.s_phone.value == "")
	{
		alert("Please enter the Phone Number in Shipping Information.");
		obj.s_phone.focus();
		return;
	}
	if(obj.s_email.value == "")
	{
		alert("Please enter the Email in Shipping Information.");
		obj.s_email.focus();
		return;
	}
	if(!chkEmail(obj.s_email.value))
	{
		alert("Please enter a valid Email Address in Shipping Information.");
		obj.s_email.focus();
		obj.s_email.select();
		return;
	}
	if(opt == 'add')
	{
		if(obj.captcha.value == '')
		{
			alert("Please enter the security code");
			obj.captcha.focus();
			return;
		}
	}
	obj.action = 'new_customer_login.php?opt='+opt;
	obj.submit();
}

function fillBillTo(chk)
{
	if(chk.checked)
	{
		//============copy Shipping Address into Billing Address fields============
		obj.s_first_name.value = obj.b_first_name.value;
		obj.s_last_name.value = obj.b_last_name.value;
		obj.s_company_name.value = obj.b_company_name.value;
		obj.s_address.value = obj.b_address.value;
		obj.s_city.value = obj.b_city.value;
		obj.s_state.selectedIndex = obj.b_state.selectedIndex;
		obj.s_country.selectedIndex = obj.b_country.selectedIndex;
		obj.s_zip.value = obj.b_zip.value;
		obj.s_phone.value = obj.b_phone.value;
		obj.s_fax.value = obj.b_fax.value;
		obj.s_email.value = obj.b_email.value;
	}
	else
	{
		//============erase the fields============
		obj.s_first_name.value = '';
		obj.s_last_name.value = '';
		obj.s_company_name.value = '';
		obj.s_address.value = '';
		obj.s_city.value = '';
		obj.s_state.selectedIndex = 0;
		obj.s_country.selectedIndex = 0;
		obj.s_zip.value = '';
		obj.s_phone.value = '';
		obj.s_fax.value = '';
		obj.s_email.value = '';
	}
}

