function stopError() {
  return true;
}

window.onerror = stopError;

			function recalcPrice(productID) {
				var content;
				eval("thisPrice = baseprice"+productID+";");
				eval("thisPriceExTax = basepriceExTax"+productID+";");
				eval("thisPriceIncTax = basepriceIncTax"+productID+";");
				eval("thisPriceTax = basepriceTax"+productID+";");
				eval("thisOOPrice = oobaseprice"+productID+";");
				eval("thisOOPriceExTax = oobasepriceExTax"+productID+";");
				eval("thisOOPriceIncTax = oobasepriceIncTax"+productID+";");
				eval("thisOOPriceTax = oobasepriceTax"+productID+";");
				currentValues = new Array(efcount);
				if (doesFormElementExist("productForm"+productID,"qty"+productID)) {
					qty = getFormElementValue("productForm"+productID,"qty"+productID);
				} else {
					qty = 1;
				}
				for (f = 0; f < efcount; f++) {
					currentValues[extrafields[f]] = "";

					elementExists = doesFormElementExist("productForm"+productID,extrafields[f]);
					fieldtype = getFormElementType("productForm"+productID,extrafields[f]);
					if (extrafieldstype[f] == "CHECKBOXES") {
						elementExists = doesFormElementExist("productForm"+productID,extrafields[f]+"1");
						fieldtype = getFormElementType("productForm"+productID,extrafields[f]+"1");
					}
					if (extrafieldstype[f] == "RADIOBUTTONS") {
						elementExists = doesFormElementExist("productForm"+productID,extrafields[f]);
						elem = getFormElement("productForm"+productID,extrafields[f]);
						if (elem.length > 0) {
							elementExists = true;
							fieldtype = "radio";
						} else {
							elementExists = false;
						}
					}

					if (elementExists) {
						if (fieldtype=="select-one") {
							currentValues[extrafields[f]] = getFormElementValue("productForm"+productID,extrafields[f]);
						}
						if (fieldtype=="checkbox") {
							content = "";
							thisOne = 1;
							result = getFormElement("productForm"+productID,extrafields[f]+thisOne);
							while (result) {
								if (result.checked == true) {
									if (content != "") {
										content = content+";";
									}
									content = content + result.value;
								}
								thisOne++;
								result = getFormElement("productForm"+productID,extrafields[f]+thisOne);
							}
							currentValues[extrafields[f]] = content;
						}
						if (fieldtype=="radio") {
							buttons = getFormElement("productForm"+productID,extrafields[f]);
							radlength = buttons.length;
							for (g = 0; g < radlength; g++) {
								thisoption = buttons[g].checked;
								if (thisoption) {
									currentValues[extrafields[f]] = buttons[g].value;
								}
							}
						}
					}
				}
				eval ("arraylength = p"+productID+".length;");
				eval ("advArray = p"+productID+";");
				for (f = 0; f <  arraylength; f++) {		
					applicable = false;
					doesExist = false;
					for (var h in advArray[f]) {
						if (h == "qtyfrom") {
							doesExist = true;
						}
					}
					if (doesExist) {
						if (parseInt(advArray[f]["qtyfrom"]) != -1 && parseInt(advArray[f]["qtyto"]) != -1 && parseInt(advArray[f]["qtyto"]) != 0) {
							//quantity is applicable here
							if (parseInt(qty) >= parseInt(advArray[f]["qtyfrom"]) && parseInt(qty) <= parseInt(advArray[f]["qtyto"])) {
								applicable = true;
							}
						} else {
							applicable = true;
						}
					} else {
						applicable = true;
					}
					thisapplic = true;
					foundMatches = 0;
					for (g = 0; g < efcount; g++) {
						doesExist = false;
						for (var h in advArray[f]) {
							if (h == extrafields[g]) {
								doesExist = true;
							}
						}
						if (doesExist) {
							if (advArray[f][extrafields[g]] != "" && advArray[f][extrafields[g]] != "0") {
								splitCheck = advArray[f][extrafields[g]].split(";");
								splitapplic = false;
								for (k = 0; k < splitCheck.length; k++) {
									splitValues = currentValues[extrafields[g]].split(";");
									for (l = 0; l < splitValues.length; l++) {
										if ((splitCheck[k] == splitValues[l] && splitCheck[k] != "" && splitValues[l] != "")) {
											splitapplic = true;
											if (extrafieldstype[g] == "CHECKBOXES") {
												foundMatches = foundMatches + 1;
											}
										}
									}
								}
								if (splitapplic == true && thisapplic == true) {
									thisapplic = true;
								} else {
									thisapplic = false;
								}
							}
						}
					}
					if (thisapplic == true && applicable == true) {
						applicable = true;
					} else {
						applicable = false;
					}
					if (applicable == true) {
						//new base price
						if (foundMatches == 0) { foundMatches =1; }
						npPercentage = 0;
						npPrice = 0;
						npPriceExTax = 0;
						npPriceIncTax = 0;
						npPriceTax = 0;
						for (var h in advArray[f]) {
							if (h == "percentage") {
								npPercentage = eval(advArray[f]["percentage"]);
							}
							if (h == "price") {
								npPrice = eval(advArray[f]["price"]);
							}
							if (h == "priceExTax") {
								npPriceExTax = eval(advArray[f]["priceExTax"]);
							}
							if (h == "priceIncTax") {
								npPriceIncTax = eval(advArray[f]["priceIncTax"]);
							}
							if (h == "priceTax") {
								npPriceTax = eval(advArray[f]["priceTax"]);
							}
						}

						if (parseInt(advArray[f]["priceType"]) == 0) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								thisPrice = thisPrice + (thisPrice  * (npPercentage/100));
								thisPriceExTax = thisPriceExTax + (thisPriceExTax  * (npPercentage/100));
								thisPriceIncTax = thisPriceIncTax + (thisPriceIncTax  * (npPercentage/100));
								thisPriceTax = thisPriceTax + (thisPriceTax  * (npPercentage/100));
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								thisPrice = thisPrice - (thisPrice  * (Math.abs(npPercentage)/100));
								thisPriceExTax = thisPriceExTax - (thisPriceExTax  * (Math.abs(npPercentage)/100));
								thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax  * (Math.abs(npPercentage)/100));
								thisPriceTax = thisPriceTax - (thisPriceTax  * (Math.abs(npPercentage)/100));
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								thisPrice = npPrice;
								thisPriceExTax = npPriceExTax;
								thisPriceIncTax = npPriceIncTax;
								thisPriceTax = npPriceTax;
							}
						}
						if (parseInt(advArray[f]["priceType"]) == 1) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice + (thisPrice  * (npPercentage/100));
									thisPriceExTax = thisPriceExTax + (thisPriceExTax  * (npPercentage/100));
									thisPriceIncTax = thisPriceIncTax + (thisPriceIncTax  * (npPercentage/100));
									thisPriceTax = thisPriceTax + (thisPriceTax  * (npPercentage/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - (thisPrice  * (Math.abs(npPercentage)/100));
									thisPriceExTax = thisPriceExTax - (thisPriceExTax  * (Math.abs(npPercentage)/100));
									thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax  * (Math.abs(npPercentage)/100));
									thisPriceTax = thisPriceTax - (thisPriceTax  * (Math.abs(npPercentage)/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice + npPrice;
									thisPriceExTax = thisPriceExTax + npPriceExTax;
									thisPriceIncTax = thisPriceIncTax + npPriceIncTax;
									thisPriceTax = thisPriceTax + npPriceTax;
								}
							}
						}	
						if (parseInt(advArray[f]["priceType"]) == 2) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - (thisPrice * (npPercentage/100));
									thisPriceExTax = thisPriceExTax - (thisPriceExTax * (npPercentage/100));
									thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax * (npPercentage/100));
									thisPriceTax = thisPriceTax - (thisPriceTax * (npPercentage/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - (thisPrice * (Math.abs(npPercentage)/100));
									thisPriceExTax = thisPriceExTax - (thisPriceExTax * (Math.abs(npPercentage)/100));
									thisPriceIncTax = thisPriceIncTax - (thisPriceIncTax * (Math.abs(npPercentage)/100));
									thisPriceTax = thisPriceTax - (thisPriceTax * (Math.abs(npPercentage)/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisPrice = thisPrice - npPrice;
									thisPriceExTax = thisPriceExTax - npPriceExTax;
									thisPriceIncTax = thisPriceIncTax - npPriceIncTax;
									thisPriceTax = thisPriceTax - npPriceTax;
								}
							}
						}	
						if (parseInt(advArray[f]["priceType"]) == 4) {
							if (parseFloat(advArray[f]["percentage"]) > 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisOOPrice = thisOOPrice - (thisOOPrice * (npPercentage/100));
									thisOOPriceExTax = thisOOPriceExTax - (thisOOPriceExTax * (npPercentage/100));
									thisOOPriceIncTax = thisOOPriceIncTax - (thisOOPriceIncTax * (npPercentage/100));
									thisOOPriceTax = thisOOPriceTax - (thisOOPriceTax * (npPercentage/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) < 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisOOPrice = thisOOPrice - (thisPrice * (Math.abs(npPercentage)/100));
									thisOOPriceExTax = thisOOPriceExTax - (thisOOPriceExTax * (Math.abs(npPercentage)/100));
									thisOOPriceIncTax = thisOOPriceIncTax - (thisOOPriceIncTax * (Math.abs(npPercentage)/100));
									thisOOPriceTax = thisOOPriceTax - (thisOOPriceTax * (Math.abs(npPercentage)/100));
								}
							}
							if (parseFloat(advArray[f]["percentage"]) == 0) {
								for (m = 1; m <= foundMatches; m++) {
									thisOOPrice = npPrice;
									thisOOPriceExTax = npPriceExTax;
									thisOOPriceIncTax = npPriceIncTax;
									thisOOPriceTax = npPriceTax;
								}
							}
						}																
					}							
				}
				displayPrice = presentValue(thisPrice,cDP,cPreT,cMidT,cPostT);
				changeContent("priceSpan"+productID,"priceLayer"+productID,displayPrice);
				displayPrice = presentValue(thisPriceExTax,cDP,cPreT,cMidT,cPostT);
				changeContent("priceExTaxSpan"+productID,"priceExTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisPriceIncTax,cDP,cPreT,cMidT,cPostT);
				changeContent("priceIncTaxSpan"+productID,"priceIncTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisPriceTax,cDP,cPreT,cMidT,cPostT);
				changeContent("priceTaxSpan"+productID,"priceTaxLayer"+productID,displayPrice);
				
				displayPrice = presentValue(thisOOPrice,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceSpan"+productID,"oopriceLayer"+productID,displayPrice);
				displayPrice = presentValue(thisOOPriceExTax,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceExTaxSpan"+productID,"oopriceExTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisOOPriceIncTax,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceIncTaxSpan"+productID,"oopriceIncTaxLayer"+productID,displayPrice);
				displayPrice = presentValue(thisOOPriceTax,cDP,cPreT,cMidT,cPostT);
				changeContent("oopriceTaxSpan"+productID,"oopriceTaxLayer"+productID,displayPrice);
			}
			
			isNS4 = (document.layers) ? true : false;
			isIE4 = (document.all && !document.getElementById) ? true : false;
			isIE5 = (document.all && document.getElementById) ? true : false;
			isNS6 = (!document.all && document.getElementById) ? true : false;
			
function changeContent(theDiv,theLayer,newText) {
	
	newText = htmlentities(newText);
	if (isNS4){
	   elm = document.layers[theLayer];
	   elm.document.open();
       elm.document.write(newText);
       elm.document.close();

	}
	else if (isIE4) {
	   elm = document.all[theDiv];
	   elm.innerText = newText;
	}
	else if (isIE5) {
	   elm = document.getElementById(theDiv);
		if (elm) {
	   		elm.innerText = newText;
	   	}
	}
	else if (isNS6) {
		var elmw = document.getElementById(theDiv);
    	if (elmw) {
    		elmw.childNodes[0].nodeValue = newText;
    	}	
	}
}			

    function presentValue(value,dp,pt,mt,at) {
        if(value<=0.9999) {
            newPounds='0';
        } else {
            newPounds=parseInt(value);
        }
        dec='1';
        for (var i=1; i<=dp;i++) {
            dec=dec+'0';
        }
        if (value>0) {
            newPence=Math.round((eval(value)+.000008 - newPounds)*(eval(dec)));
        } else {
            newPence=0;
        }
        compstring='9';
        for (var i=1; i <=dp-1;i++) {
            if (eval(newPence) <= eval(compstring)) newPence='0'+newPence;
            compstring=compstring+'9';
        }
        if (dp>0) {
            if (newPence==eval(dec)) { newPounds++; newPence='00'; }
            newString=pt+newPounds+mt+newPence+at;
        } else {
            newString=pt+newPounds+at;
        }
        return (newString);
    }

	function doesFormElementExist(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return true;
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return true;
			}
		}
		return false;
	}

	function getFormElementValue(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return theForm.elements[elementName].value;
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return document.forms[formName].elements[elementName].value;
			}
		}
		return "";
	}

	function getFormElementType(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return theForm.elements[elementName].type;
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return document.forms[formName].elements[elementName].type;
			}
		}
		return "";
	}

	function getFormElement(formName,elementName) {
		if (document.getElementById(formName)) {
			theForm = document.getElementById(formName);
			if (theForm.elements[elementName]) {
				return theForm.elements[elementName];
			}
		}
		if (document.forms[formName]) {
			if (document.forms[formName].elements[elementName]) {
				return document.forms[formName].elements[elementName];
			}
		}
		return "";
	}

	function jss_openWindow(url) {
		window.open(url,"JSSWindow","height=400,width=500,resizable=1,scrollbars=1");
	}
	
	
//MC/
function get_html_translation_table (table, quote_style) {
    // Returns the internal translation table used by htmlspecialchars and htmlentities  
    // 
    // version: 1004.1212
    // discuss at: http://phpjs.org/functions/get_html_translation_table
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // +   bugfixed by: Alex
    // +   bugfixed by: Marco
    // +   bugfixed by: madipta
    // +   improved by: KELAN
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Frank Forte
    // +   bugfixed by: T.Wild
    // +      input by: Ratheous
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js, meaning the constants are not
    // %          note: real constants, but strings instead. Integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, hash_map = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
 
    useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
 
    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
        throw new Error("Table: "+useTable+' not supported');
        // return false;
    }
 
    entities['38'] = '&amp;';
    if (useTable === 'HTML_ENTITIES') {
        entities['160'] = '&nbsp;';
        entities['161'] = '&iexcl;';
        entities['162'] = '&cent;';
        entities['163'] = '&pound;';
        entities['164'] = '&curren;';
        entities['165'] = '&yen;';
        entities['166'] = '&brvbar;';
        entities['167'] = '&sect;';
        entities['168'] = '&uml;';
        entities['169'] = '&copy;';
        entities['170'] = '&ordf;';
        entities['171'] = '&laquo;';
        entities['172'] = '&not;';
        entities['173'] = '&shy;';
        entities['174'] = '&reg;';
        entities['175'] = '&macr;';
        entities['176'] = '&deg;';
        entities['177'] = '&plusmn;';
        entities['178'] = '&sup2;';
        entities['179'] = '&sup3;';
        entities['180'] = '&acute;';
        entities['181'] = '&micro;';
        entities['182'] = '&para;';
        entities['183'] = '&middot;';
        entities['184'] = '&cedil;';
        entities['185'] = '&sup1;';
        entities['186'] = '&ordm;';
        entities['187'] = '&raquo;';
        entities['188'] = '&frac14;';
        entities['189'] = '&frac12;';
        entities['190'] = '&frac34;';
        entities['191'] = '&iquest;';
        entities['192'] = '&Agrave;';
        entities['193'] = '&Aacute;';
        entities['194'] = '&Acirc;';
        entities['195'] = '&Atilde;';
        entities['196'] = '&Auml;';
        entities['197'] = '&Aring;';
        entities['198'] = '&AElig;';
        entities['199'] = '&Ccedil;';
        entities['200'] = '&Egrave;';
        entities['201'] = '&Eacute;';
        entities['202'] = '&Ecirc;';
        entities['203'] = '&Euml;';
        entities['204'] = '&Igrave;';
        entities['205'] = '&Iacute;';
        entities['206'] = '&Icirc;';
        entities['207'] = '&Iuml;';
        entities['208'] = '&ETH;';
        entities['209'] = '&Ntilde;';
        entities['210'] = '&Ograve;';
        entities['211'] = '&Oacute;';
        entities['212'] = '&Ocirc;';
        entities['213'] = '&Otilde;';
        entities['214'] = '&Ouml;';
        entities['215'] = '&times;';
        entities['216'] = '&Oslash;';
        entities['217'] = '&Ugrave;';
        entities['218'] = '&Uacute;';
        entities['219'] = '&Ucirc;';
        entities['220'] = '&Uuml;';
        entities['221'] = '&Yacute;';
        entities['222'] = '&THORN;';
        entities['223'] = '&szlig;';
        entities['224'] = '&agrave;';
        entities['225'] = '&aacute;';
        entities['226'] = '&acirc;';
        entities['227'] = '&atilde;';
        entities['228'] = '&auml;';
        entities['229'] = '&aring;';
        entities['230'] = '&aelig;';
        entities['231'] = '&ccedil;';
        entities['232'] = '&egrave;';
        entities['233'] = '&eacute;';
        entities['234'] = '&ecirc;';
        entities['235'] = '&euml;';
        entities['236'] = '&igrave;';
        entities['237'] = '&iacute;';
        entities['238'] = '&icirc;';
        entities['239'] = '&iuml;';
        entities['240'] = '&eth;';
        entities['241'] = '&ntilde;';
        entities['242'] = '&ograve;';
        entities['243'] = '&oacute;';
        entities['244'] = '&ocirc;';
        entities['245'] = '&otilde;';
        entities['246'] = '&ouml;';
        entities['247'] = '&divide;';
        entities['248'] = '&oslash;';
        entities['249'] = '&ugrave;';
        entities['250'] = '&uacute;';
        entities['251'] = '&ucirc;';
        entities['252'] = '&uuml;';
        entities['253'] = '&yacute;';
        entities['254'] = '&thorn;';
        entities['255'] = '&yuml;';
    }
 
    if (useQuoteStyle !== 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
    if (useQuoteStyle === 'ENT_QUOTES') {
        entities['39'] = '&#39;';
    }
    entities['60'] = '&lt;';
    entities['62'] = '&gt;';
 
 
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal);
        hash_map[symbol] = entities[decimal];
    }
    
    return hash_map;
}
//MC/
function htmlentities (string, quote_style) {
    // Convert all applicable characters to HTML entities  
    // 
    // version: 1004.1212
    // discuss at: http://phpjs.org/functions/htmlentities
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Ratheous
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');
    // *     returns 1: 'Kevin &amp; van Zonneveld'
    // *     example 2: htmlentities("foo'bar","ENT_QUOTES");
    // *     returns 2: 'foo&#039;bar'
    var hash_map = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    hash_map["'"] = '&#039;';
    for (symbol in hash_map) {
        entity = hash_map[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}