function onEnter( evt, field,seshid,fieldid2) 
{
	var keyCode = null;
	if( evt.which ) 
	{
		keyCode = evt.which;
	} 
	else if( evt.keyCode ) 
	{
		keyCode = evt.keyCode;
	}
	if( 13 == keyCode ) 
	{
		if (field.value)
		{
			if (field.value.length > 5)
			{
				ajax_validate(field.value, field.id,seshid,fieldid2);
				Set_Value(fieldid2 + '_Save','');
				//Focus(fieldid2);
				return false;
			}
		}
	}
	return true;
}


function disableEnterKey()
{
//alert("keycode " + window.event.keyCode + "'");
if (window.event.keyCode == 13) window.event.keyCode = 0;
}
function entsub(event,ourform) {
  	if (event && event.which == 13)
	{
//	 	alert("key code '" + event.which + "'");
		return false;
	}
}

function handleClick(num)
{
	var elevalue;
	var Element;
	var elename;
	var badfields;
	var delivfound = "N";
	var postcodefound = "N";
	var propertyfound = "N";
	var delivery_postcodefound = "N";
	var delivery_propertyfound = "N";
	var outMessage;
	var Form = document.myForm;
	var BadFields = "" ;
	var i; 

	if ( num == 0 )
	{
		Form.ACTION.value = "recalc";
		for ( i = 0; i < Form.length; i++ )
		{
			Element = Form.elements[i];
			elename= Element.name
			elevalue= Element.value
		//		alert(elename + " " + elevalue);
			if (elename == "Non_UK" && elevalue > 0 && Element.checked)
			{
				postcodefound = "Y";
				propertyfound = "Y";
			}
			if (elename == "logged_in" && elevalue  == "TRUE")
			{
				postcodefound = "Y";
				propertyfound = "Y";
			}
			if (elename == "Billing_Postcode" && elevalue.length >= 4 & elevalue.substring(0,5) != "Error")
			{
				postcodefound = "Y";
			}
			if (elename == "Billing_PostKey" && selectval(Element) != "")
			{
				//alert(elename + ":" + selectval(Element))
				propertyfound = "Y";
			}
			if (elename == "Billing_PostKey_Save" && elevalue != "")
			{
				propertyfound = "Y";
			}
			if (elename == "Delivery_Postcode" && elevalue.length >= 4  & elevalue.substring(0,5) != "Error")
			{
				delivery_postcodefound = "Y";
			}
			if (elename == "Delivery_PostKey" && selectval(Element) != "")
			{
				delivery_propertyfound = "Y";
			}
			if (elename == "Delivery_PostKey_Save" && elevalue != "")
			{
				delivery_propertyfound = "Y";
			}
		}
				
		if (postcodefound == "Y" && propertyfound == "N")
		//	if (postcodefound == "N")
		{
			BadFields += " - Billing address 1\n";
		}
		if (delivery_postcodefound == "Y" && delivery_propertyfound == "N")
		//	if (delivery_postcodefound == "Y" )
		{
			BadFields += " - Delivery address\n";
		}
		if ( BadFields )
		{
			outMessage = 'We are unable to proceed as the following\n';
			outMessage += "required fields have not been completed:\n\n";
			outMessage += BadFields;

			alert(outMessage);
			return false;
		}
	}
	else if ( num == 1 )
	{
		for ( i = 0; i < Form.length; i++ )
		{
			Element = Form.elements[i];
			elename= Element.name
			elevalue= Element.value
			//alert(elename)
			//alert (elename.indexOf('-del=1'))
			if (elename == "Non_UK" && elevalue > 0 && Element.checked)
			{
				postcodefound = "Y";
				propertyfound = "Y";
			}
			if (elename == "logged_in" && elevalue  == "TRUE")
			{
				postcodefound = "Y";
				propertyfound = "Y";
			}
			if (elename == "Billing_Postcode" && elevalue.length >= 4 & elevalue.substring(0,5) != "Error")
			{
				postcodefound = "Y";
			}
			if (elename == "Billing_PostKey" && selectval(Element) != "")
			{
				propertyfound = "Y";
			}
			if (elename == "Billing_PostKey_Save" && elevalue != "")
			{
				propertyfound = "Y";
			}
			if (elename == "Delivery_Postcode" && elevalue.length >= 4  & elevalue.substring(0,5) != "Error")
			{
				delivery_postcodefound = "Y";
			}
			if (elename == "Delivery_PostKey" && selectval(Element) != "")
			{
				delivery_propertyfound = "Y";
			}
			if (elename == "Delivery_PostKey_Save" && elevalue != "")
			{
				delivery_propertyfound = "Y";
			}
			
		}
		if (postcodefound == "Y" && propertyfound == "N")
//		if (postcodefound == "Y" )
		{
			BadFields += " - Billing address 2\n";
		}
		if (postcodefound == "N")
		{
			BadFields += " - UK Postcode and address or address outside the UK\n";
		}
		if (delivery_postcodefound == "Y" && delivery_propertyfound == "N")
		{
			BadFields += " - Delivery address\n";
		}
		if ( BadFields )
		{
			outMessage = 'We are unable to proceed as the following\n';
			outMessage += "required fields have not been completed:\n\n";
			outMessage += BadFields;
	
			alert(outMessage);
			return false;
		}
		
		Form.target = "_top";
		Form.action = Form.securebasket.value
		Form.ACTION.value = "mailorder";
	}
	else if ( num == 10 )
	{

		for ( i = 0; i < Form.length; i++ )
		{
			Element = Form.elements[i];
			elename= Element.name
			elevalue= Element.value
			//alert(elename)
			//alert (elename.indexOf('-del=1'))
			if (elename.indexOf('del_option') > -1 && 
				((elevalue > 0 && Element.checked) ||
				(elevalue == "free" || elevalue == "-1")))
			{
				//alert(elename)
				//alert (elevalue)
				delivfound = "Y";
			}
			if (elename == "Non_UK" && elevalue > 0 && Element.checked)
			{
				postcodefound = "Y";
				propertyfound = "Y";
			}
			if (elename == "logged_in" && elevalue  == "TRUE")
			{
				postcodefound = "Y";
				propertyfound = "Y";
			}
			if (elename == "Billing_Postcode" && elevalue.length >= 4 & elevalue.substring(0,5) != "Error")
			{
				postcodefound = "Y";
			}
			if (elename == "Billing_PostKey" && selectval(Element) != "")
			{
				propertyfound = "Y";
			}
			if (elename == "Billing_PostKey_Save" && elevalue != "")
			{
				propertyfound = "Y";
			}
			if (elename == "Delivery_Postcode" && elevalue.length >= 4 & elevalue.substring(0,5) != "Error")
			{
				delivery_postcodefound = "Y";
			}
			if (elename == "Delivery_PostKey" && selectval(Element) != "")
			{
				delivery_propertyfound = "Y";
			}
			if (elename == "Delivery_PostKey_Save" && elevalue != "")
			{
				delivery_propertyfound = "Y";
			}
			
		}
		if (postcodefound == "Y" && propertyfound == "N")
//			if (postcodefound == "Y" )
		{
			BadFields += " - Billing address 3\n";
		}
		if (postcodefound == "N")
		{
			BadFields += " - UK Postcode and address, or address outside the UK\n";
		}
		if (delivery_postcodefound == "Y" && delivery_propertyfound == "N")
		{
			BadFields += " - Delivery address\n";
		}
		if (delivfound == "N")
		{
			BadFields += " - Delivery Option\n";
		}
		if ( BadFields )
		{
			outMessage = 'We are unable to proceed as the following\n';
			outMessage += "required fields have not been completed:\n\n";
			outMessage += BadFields;
	
			alert(outMessage);
			return false;
		}
		
		//Form.target = "_top";
		//Form.action= Form.securebasket.value
		Form.ACTION.value = "mailorder";
		
	}
	else
	{
		Form.ACTION.value = "clear";
	}
	Form.submit();
}



function validate_basket(Form)
{
	Form.Submit.disabled = true;
	var Element;
	var elename;
	var i;
	var BadFields = "";
	var outMessage = "";
	var ccnumber = "";
	var cctype = "";
	var ccsecno = "";
	var ccissueno = "";
	var email = "";
	var email2 = "";
	var hire = "";
	var trade = "";
	var startmonth;
	var startyear;
	var expiremonth;
	var expireyear;
	var password1 = "";
	var password2 = "";
	var how_heard_select =  selectval(Form.How_heard_Select);
	var how_heard_other = how_heard_select.indexOf('please specify'); 
	var how_heard = "";
	var del_inst = "";


	for ( i = 0; i < Form.length; i++ )
	{
		Element = Form.elements[i];

		if (Element.name == 'Hire')
		{
			hire = Element.value;
		}
		if (Element.name == 'Trade')
		{
			trade = Element.value;
		}
		if (Element.name == 'Card_Type')
		{
			cctype = selectval(Element)
			//alert(cctype);
		}
		if (Element.name == 'Card_Number')
		{
			ccnumber = Element.value;
		}
		if (Element.name == 'Issue_Number')
		{
			ccissueno = Element.value;
		}
		if (Element.name == 'Security_Code')
		{
			ccsecno = Element.value;
		}
		if (Element.name == 'Card_Startyear'  )
		{
			startyear = Element.value;
		}	
		if (Element.name == 'Card_Startmonth'  )
		{
			startmonth = Element.value;
		}	
		if (Element.name == 'Card_Expireyear'  )
		{
			expireyear = Element.value;
		}	
		if (Element.name == 'Card_Expiremonth'  )
		{
			expiremonth = Element.value;
		}	
		if (Element.name == 'Email')
		{
			email = Element.value;
		}
		if (Element.name == 'Email2')
		{
			email2 = Element.value;
		}
		if (Element.name == 'password1')
		{
			password1 = Element.value;
		}
		if (Element.name == 'password2')
		{
			password2 = Element.value;
		}
		if (Element.name == 'How_heard')
		{
			how_heard = Element.value;
		}
		if (Element.name == 'Delivery_Instructions')
		{
			del_inst = Element.value;
		}

	}
	if (how_heard == "" && how_heard_other > 0)
	{
		BadFields += "- " + "How did you hear about us?"	 + "\n";
	}
	if (ccnumber != '' && cctype == "Switch" && (startyear == "" && startmonth == "" && ccissueno == ""))
	{
		BadFields += "- " + "Card Start Date or Issue number"	 + "\n";
	}

	if (ccnumber == '' && hire == '' && trade == '' && password1 == '')
	{
		for ( i = 0; i < Form.length; i++ )
	  	{
			Element = Form.elements[i];
		
			if ( 
				 Element.name == 'Forename'    ||
				 Element.name == 'Surname' ||
				 Element.name == 'Contact' ||
				 Element.name == 'Email'  ||
				 Element.name == 'Email2'  )
			{
				if ( Element.value == ""  ||
			 		Element.value == " "  )
					{
					if ( Element.name == 'Contact' )
					{
							BadFields += "- " + Element.name + " Phone No.\n";
					}
					else
					{
							BadFields += "- " + Element.name + "\n";
					}
			 	}
			}
		}
	}
	else
	{
		for ( i = 0; i < Form.length; i++ )
		{
			Element = Form.elements[i];
		
			if ( 
				 Element.name == 'Forename'     ||
				 Element.name == 'Surname'     ||
				 Element.name == 'Contact'    ||
				 Element.name == 'Address1'   ||
				 Element.name == 'Town'		||
				 Element.name == 'PostalCode' ||
				 Element.name == 'Country'    ||
				 Element.name == 'Card_Type'    ||
				 Element.name == 'Card_Name'    ||
				 Element.name == 'Card_Expiremonth'    ||
				 Element.name == 'Card_Expireyear'    ||
				 Element.name == 'Security_Code'    ||
				 Element.name == 'Delivery_Instructions'    ||
				 Element.name == 'Delivery_Select'    ||
				 Element.name == 'Car'    ||
				 Element.name == 'Tyres'    ||
				 Element.name == 'Email'  ||
				 Element.name == 'Email2'  )
			{
				if ( Element.value == ""  ||
			 		Element.value == " "  )
					{
					elename = Element.name;
					if ( elename == 'Address1' )
					{
						elename = "Address"
					}
					if ( elename == 'Contact' )
					{
						elename = "Contact Phone No."
					}
					if ( elename == 'Card_Startmonth' )
					{
						elename = "Valid from month"
					}
					if ( elename == 'Card_Startyear' )
					{
						elename = "Valid from year"
					}
					if ( elename == 'Card_Expiremonth' )
					{
						elename = "Valid to month"
					}
					if ( elename == 'Card_Expireyear' )
					{
						elename = "Valid to year"
					}
					if ( elename == 'Delivery_Select' )
					{
						elename = "Standard Delivery Instructions"
					}
					if ( elename == 'How_heard' )
					{
						elename = "How did you hear about us"
					}

					BadFields += "- " + elename + "\n";
				}
			}
		}
	}
	if ( BadFields )
	{
		outMessage = 'We are unable to proceed as the following\n';
		outMessage += "required fields have not been completed:\n";
		outMessage += BadFields;

		alert(outMessage);
		Form.Submit.disabled = false;
		return false;
	}
	if (ccnumber != '')
	{
		//reg = new RegExp(/ /g);
		//ccnumber = ccnumber.replace(reg,"");
		if (ccnumber.length > 19 || !LuhnCheck(ccnumber))
		{
			outMessage = 'We are unable to proceed as the following\n';
			outMessage += "fields have not been completed correctly:\n";
			outMessage += "Credit/ debit card number (must be up to 19 digits with no spaces)";
		
			alert(outMessage);
			Form.Submit.disabled = false;
			return false;

		}
	}
	if (ccsecno != '')
	{
		if (ccsecno.length != 3 && ccsecno.length != 4) 
		{
			outMessage = 'We are unable to proceed as the following\n';
			outMessage += "fields have not been completed correctly:\n";
			outMessage += "Security Code (must be 3 or 4 digits)";
		
			alert(outMessage);
			Form.Submit.disabled = false;
			return false;

		}
	}
	
	email = email.toLowerCase();
	if (!isEmailAddressValid(email))
	{
		outMessage = 'We are unable to proceed as your email address:\n';
		outMessage += email + '\n';
		outMessage += "appears to be invalid.\n";

		alert(outMessage);
		Form.Submit.disabled = false;
		return false;
	}
	
	email2 = email2.toLowerCase();
	if(email != email2)
	{
		outMessage = 'We are unable to proceed as your email addresses\n';
		outMessage += "appear to mismatch.\n";
		
		alert(outMessage);
		Form.Submit.disabled = false;
		return false;
	}
	
	if (password1 != '' || password2 != '')
	{
		if (password1.length < 6 || password2.length < 6)
		{
			outMessage = 'We are unable to proceed as the following\n';
			outMessage += "fields have not been completed correctly:\n";
			outMessage += "New password (must be 6 or more characters)";
		
			alert(outMessage);
			Form.Submit.disabled = false;
			return false;

		}
		if (password1 != password2)
		{
			outMessage = 'We are unable to proceed as the following\n';
			outMessage += "fields have not been completed correctly:\n";
			outMessage += "New password (must be the same as confirmation password)";
		
			alert(outMessage);
			Form.Submit.disabled = false;
			return false;

		}
	}

	//alert ("ok");
	Form.Submit.disabled = true;
	Form.Back.disabled = true;
	Form.Reset.disabled = true;
	Form.submit();
	alert("What happens next?\nYou'll see a confirmation page including your online order number.  We'll also send you an e-mail confirmation, although some customers will find that their spam filters block these e-mails. But if you don't receive the immediate confirmation page then we haven't received your order, so you'll need to order again.  Don't worry - we won't charge your card before we're ready to send the goods.");
	return true;
}




// Ported from Recipe 3.9 in Secure Programming Cookbook for C and C++ by
// John Viega and Matt Messier (O'Reilly 2003)

var rfc822_specials = "()<>@,;L\\\"[]";

function isEmailAddressValid(str)
{
	
	var c, count, domain;
	var quot = '"';
	var backslash = "\\";

	for (c = 0;  c < str.length;  c++)
	{
		if (str.charAt(c) == ' ') continue;

		if (str.charAt(c) == quot &&
			(!c || str.charAt(c - 1) == "." || str.charCharAt(c - 1) == quot))
		{
			while (++c < str.length)
			{
				if (str.charAt(c) == quot) break;
				if (str.charAt(c) == backslash && (str.charAt(++c) == ' ')) continue;
				if (str.charCodeAt(c) <= 32 || str.charCodeAt(c) >= 127)
					return false;
			}
			if (c++ >= str.length) return false;
			if (str.charAt(c) == "@") break;
			if (str.charAt(c) != ".") return false;
			continue;
		}
		if (str.charAt(c) == "@") break;
		if (str.charCodeAt(c) <= 32 || str.charCodeAt(c) >= 127) return false;
		if (rfc822_specials.indexOf(str.charAt(c)) != -1) return false;
	}
	if (!c || str.charAt(c - 1) == ".") return false;

	if ((domain = ++c) >= str.length) return false;
	count = 0;
	do
	{
		if (str.charAt(c) == ' ') continue;

		if (str.charAt(c) == ".")
		{
			if (c == domain || str.charAt(c - 1) == ".") return false;
			count++;
		}
		if (str.charCodeAt(c) <= 32 || str.charCodeAt(c) >= 127) return false;
		if (rfc822_specials.indexOf(str.charAt(c)) != -1) return false;
	} while (++c < str.length);

	return (count >= 1 ? true : false);
}

function LuhnCheck(str) 
{
  var result = true;

  var sum = 0; 
  var mul = 1; 
  var strLen = str.length;
  var i;
  for (i = 0; i < strLen; i++) 
  {
    var digit = str.substring(strLen-i-1,strLen-i);
    var tproduct = parseInt(digit ,10)*mul;
    if (tproduct >= 10)
      sum += (tproduct % 10) + 1;
    else
      sum += tproduct;
    if (mul == 1)
      mul++;
    else
      mul--;
  }
  if ((sum % 10) != 0)
    result = false;
    
  return result;
}

function selectval(Sel)
{
return Sel.options[Sel.selectedIndex].value;
}
function DoLogin(Form)
{
	if (Form.loginemail.value == "" ||
		Form.password.value == "")
	{
		outMessage = 'We are unable to proceed as the following\n';
		outMessage += "fields have not been completed correctly:\n";
		outMessage += "Email address and password (must be entered)";
	
		alert(outMessage);
		return false;
	}

		Form.ACTION.value = "login";
		//Form.action.value = "login";
	Form.submit();
	return true;

}
function Set_Existing_Customer (Sel)
{
var opt = Sel.options[Sel.selectedIndex].value;
if (opt.indexOf('existing customer') > -1)
{
	document.form1.Ordered_before.value = "Yes";
}
}

function deletefrombasket(prodref)
{
//var Form = document.myForm;
document.getElementById(prodref).value=0;
handleClick(0);
}

function Focus(id)
{
document.getElementById(id).focus();
}

function Non_UK_Click()
{
var cb = document.getElementById("Non_UK").checked;
if (cb == true)
{
	alert("checked");
	Clear_Postcodes();

}

}


function Postcode_Missing_Click()
{
var cb = document.getElementById("Postcode_Missing").checked;
if (cb == true)
{
	alert("checked");
	Clear_Postcodes();


}
}
function Clear_Postcodes()
{
var bp = document.getElementById("Billing_Postcode");
bp.value = "";
var dp = document.getElementById("Delivery_Postcode");
dp.value = "";
select_ID = "Billing_PostKey";
Clear_Property_Selector(true,false);
select_ID = "Delivery_PostKey";
Clear_Property_Selector(true,false);
Set_Value("Billing_PostKey_Save","");
Set_Value("Delivery_PostKey_Save","");

var message = document.getElementById("Billing_PostcodeResponse");
message.innerHTML = ""
var message = document.getElementById("Delivery_PostcodeResponse");
message.innerHTML = ""

ajax_validate("", "Billing_Postcode","","")
ajax_validate("", "Delivery_Postcode","","")

}


function TBC_Delivery_Click(del)
{
	var cb = del.checked;
	if (cb == true)
	{
		del.checked = confirm("! You've selected a delivery option with a TBC cost. This is intended for deliveries outside the GB mainland. We'll have to contact you to confirm the delivery charge.\nPlease confirm that delivery is to an address outside the GB mainland.");
		non_uk = document.getElementById("Non_UK");
		non_uk.checked = del.checked;
	}
}

function TBC_del()
{
	var aryClassElements = getElementsByClassName('TBC_del', document.body);
	var tbc = aryClassElements[0];
	
	var non_uk = document.getElementById("Non_UK");
	if(tbc)
	{
		tbc.checked = non_uk.checked;
	}
		//alert('checked');
		
		//if(confirm("! As your address as not listed above we've selected a delivery option with a TBC cost. This is intended for deliveries outside the GB mainland. We'll have to contact you to confirm the delivery charge."))
		//{
		//}
}

function getElementsByClassName( strClassName, obj ) {
    var ar = arguments[2] || new Array();
    var re = new RegExp("\\b" + strClassName + "\\b", "g");

    if ( re.test(obj.className) ) {
        ar.push( obj );
    }
    for ( var i = 0; i < obj.childNodes.length; i++ )
        getElementsByClassName( strClassName, obj.childNodes[i], ar );
    
    return ar;
}


function deletebillingaddress()
{
var bp = document.getElementById("Billing_Postcode");
bp.value = "";
select_ID = "Billing_PostKey";
Clear_Property_Selector(true,true);
Set_Value("Billing_PostKey_Save","");

ajax_validate("", "Billing_Postcode","","")
ajax_validate("", "Billing_PostKey","","")
var message = document.getElementById("Billing_PostcodeResponse");
message.innerHTML = "&nbsp;"


}

function copyBillingAddress()
{
	var bp = document.getElementById("Billing_Postcode"); //input
	var bps = document.getElementById("Billing_PostKey_Save"); //hidden
	var bpsdd = document.getElementById("Billing_PostKey"); //dropdown
	var bpr = document.getElementById("Billing_PostcodeResponse"); //response text
	
	var dp = document.getElementById("Delivery_Postcode");
	var dps = document.getElementById("Delivery_PostKey_Save");
	var dpsdd = document.getElementById("Delivery_PostKey"); //dropdown
	var dpr = document.getElementById("Delivery_PostcodeResponse"); //response text
	
	
	
	if(bp.value == "" && bps.value == "")
	{
		alert("Please enter a billing postcode");
		return false;
	}
	else
	{
		dp.value = bp.value;
		dps.value = bps.value;
		dpsdd.disabled = false;
		dpsdd.innerHTML = bpsdd.innerHTML;
		dpr.innerHTML = bpr.innerHTML;
		dpsdd.selectedIndex = bpsdd.selectedIndex;
		
		return true;
	}
}


function deletedeliveryaddress()
{
var dp = document.getElementById("Delivery_Postcode");
dp.value = "";
select_ID = "Delivery_PostKey";
Clear_Property_Selector(true,true);
Set_Value("Delivery_PostKey_Save","");

ajax_validate("", "Delivery_Postcode","","")
ajax_validate("", "Delivery_PostKey","","")
var message = document.getElementById("Delivery_PostcodeResponse");
message.innerHTML = "&nbsp;"


}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();




function Update_Order_Total(price, ttl)
{
	var ele;
	var new_ttl;
	
	ele = document.getElementById('ttl_inc_del');
	
	if(ele)
	{
		if(price == "TBC")
		{
			new_ttl = ttl;
		}
		else
		{
			new_ttl = parseFloat(ttl) + parseFloat(price);
			new_ttl = new_ttl.toFixed(2);
		}
		
		ele.innerHTML = "&pound;"+new_ttl; 
	}
}


