<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
			return (false);
		}
	} 
	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
			return (-1);		
		} 
	}
}

function IsCardnumber(sText) 
	{
	var ValidChars = "0123456789 ";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) 
		{
		Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1) 
			{
			IsNumber = false;
			}
		}
		return IsNumber;
	}

function s1() 
	{
	if(!check_email(document.checkoutfm.email.value)) 
		{
		alert('Please enter a valid e-mail address');
		document.checkoutfm.email.focus();
		document.checkoutfm.email.style.backgroundColor='#DD00DD';
		return false;
		}
		else 
			{
			return true;
			}
	}

function s3() 
	{
	if(document.checkoutfm.firstname.value=='') 
		{
		alert('Please enter your first name');
		document.checkoutfm.firstname.focus();
		document.checkoutfm.firstname.style.backgroundColor='#DD00DD';
		return false;
		} 
		else 
			{
			if(document.checkoutfm.lastname.value=='') 
				{
				alert('Please enter your last name');
				document.checkoutfm.lastname.focus();
				document.checkoutfm.lastname.style.backgroundColor='#DD00DD';
				return false;
				} 
				else 
					{
					if(document.checkoutfm.address1.value=='') 
						{
						alert('Please enter the first line of your address');
						document.checkoutfm.address1.focus();
						document.checkoutfm.address1.style.backgroundColor='#DD00DD';
						return false;
						} 
						else 
							{
							if(document.checkoutfm.city.value=='') 
								{
								alert('Please enter a town or city');
								document.checkoutfm.city.focus();
								document.checkoutfm.city.style.backgroundColor='#DD00DD';
								return false;
								} 
								else 
									{
									if(document.checkoutfm.postcode.value=='') 
										{
										alert('Please enter a postcode');
										document.checkoutfm.postcode.focus();
										document.checkoutfm.postcode.style.backgroundColor='#DD00DD';
										return false;
										} 
										else 
											{
											if(document.checkoutfm.country.value!='UK' && document.checkoutfm.phone.value=='') 
												{
												alert('Please enter a contact phone number');
												document.checkoutfm.phone.focus();
												document.checkoutfm.phone.style.backgroundColor='#DD00DD';
												return false;
												} 
												else 
													{
													if(!document.checkoutfm.cardholder[0].checked && !document.checkoutfm.cardholder[1].checked) 
														{
														alert('Please tell us if this is also the cardholder\'s address.');
														document.checkoutfm.cardholder[0].focus();
														return false;
														} 
														else 
															{
															return true;
															}
													}
											}
									}
							}
					}
			}
	}


function s3a() 
	{
	if(document.checkoutfm.s_firstname.value=='') 
		{
		alert('Please enter your first name');
		document.checkoutfm.s_firstname.focus();
		document.checkoutfm.s_firstname.style.backgroundColor='#DD00DD';
		return false;
		} 
		else 
			{
			if(document.checkoutfm.s_lastname.value=='') 
				{
				alert('Please enter your last name');
				document.checkoutfm.s_lastname.focus();
				document.checkoutfm.s_firstname.style.backgroundColor='#DD00DD';
				return false;
				} 
				else 
					{
					if(document.checkoutfm.s_address1.value=='') 
						{
						alert('Please enter the first line of your address');
						document.checkoutfm.s_address1.focus();
						document.checkoutfm.s_address1.style.backgroundColor='#DD00DD';
						return false;
						} 
						else 
							{
							if(document.checkoutfm.s_city.value=='') 
								{
								alert('Please enter a town or city');
								document.checkoutfm.s_city.focus();
								document.checkoutfm.s_city.style.backgroundColor='#DD00DD';
								return false;
								} 
								else 
									{
									if(document.checkoutfm.s_postcode.value=='') 
										{
										alert('Please enter a postcode');
										document.checkoutfm.s_postcode.focus();
										document.checkoutfm.s_postcode.style.backgroundColor='#DD00DD';
										return false;
										} 
										else 
											{
											return true;
											}
									}
							}
					}
			}
	}

function s4() 
	{
	if (document.checkoutfm.card_name.value=='') 
		{
		alert('Please enter the card holder\'s name');
		document.checkoutfm.card_name.style.backgroundColor='#DD00DD';
		document.checkoutfm.card_name.focus();
		return false;
		} 
		else 
			{
			if (document.checkoutfm.card_number.value=='' || !IsCardnumber(document.checkoutfm.card_number.value)) 
				{
				alert('Please enter the card number');
				document.checkoutfm.card_number.style.backgroundColor='#DD00DD';
				document.checkoutfm.card_number.focus();
				return false;
				} 
				else 
					{
					if(document.checkoutfm.cv2.value=='') 
						{
						alert('Please enter the 3-digit security code from the reverse of your card');
						document.checkoutfm.cv2.style.backgroundColor='#DD00DD';
						document.checkoutfm.cv2.focus();
						return false;
						} 
						else 
							{
							if (document.checkoutfm.card_type.value == 'Switch' || document.checkoutfm.card_type.value == 'Solo') 
								{
								if (document.checkoutfm.card_issue.value=='' || !IsNumeric(document.checkoutfm.card_issue.value)) 
									{
									alert('Please supply an issue number. If your card has no issue number, please enter 0');
									document.checkoutfm.card_issue.style.backgroundColor='#DD00DD';
									document.checkoutfm.card_issue.focus();
									return false;
									} 
									else 
										{
										document.checkoutfm.finito.value='Please Wait...';
										document.checkoutfm.finito.disabled=true;
										return true;
										}
								} 
								else 
									{
									document.checkoutfm.finito.value='Please Wait...';
									document.checkoutfm.finito.disabled=true;
									return true;
									}
							}
					}
			}
	}

function s5() 
	{
	document.checkoutfm.finito.value='Please Wait...';
	document.checkoutfm.finito.disabled=true;
	return true;
	}

function UpdateQty(item)
	{
	itemId = item.name;
	newQty = item.options[item.selectedIndex].text;

	document.location.href = 'cart.php?action=update_item&id='+itemId+'&qty='+newQty;
	}