
function closeorredirect(elementid,url){if(document.getElementById(elementid).className=='SubNavGroupCurrent'){document.getElementById(elementid).className='SubNavGroup';}else{document.location.href=url;}}
function featuredbrandsrollover(divid,strimg){if(strimg==2){newimg="url('/images/Buttons/Blue_02.jpg')";}
if(strimg==1){newimg="url('/images/Buttons/Blue_01.jpg')";}
document.getElementById(divid).style.backgroundImage=newimg;}
function showHideDiv(divid){if(document.getElementById(divid)){if(document.getElementById(divid).style.display==""){document.getElementById(divid).style.display="none";}else{document.getElementById(divid).style.display="";}}}
function getBrowserWidth(){var viewportwidth;var viewportheight;if(typeof window.innerWidth!='undefined'){viewportwidth=window.innerWidth,viewportheight=window.innerHeight}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){viewportwidth=document.documentElement.clientWidth,viewportheight=document.documentElement.clientHeight}else{viewportwidth=document.getElementsByTagName('body')[0].clientWidth,viewportheight=document.getElementsByTagName('body')[0].clientHeight}
return viewportwidth;}
function adjustLayers(){var browserWidth;var browserCenter;var menusLeft
browserWidth=getBrowserWidth();browserCenter=Math.round(browserWidth/2);menusLeft=browserCenter-490
if(menusLeft<0){menusLeft=0;}
x=document.getElementById("head_menu")
x.style.paddingLeft=menusLeft+"px";x.style.visibility='visible';x=document.getElementById("shop_form")
x.style.paddingLeft=menusLeft+"px";x.style.visibility='visible';if(x=document.getElementById("body_list")){var productWidth
var productRow
var productLeft
productWidth=browserWidth-368;if(productWidth>1044){productRow=6;}else if(productWidth>870){productRow=5;}else if(productWidth>696){productRow=4;}else{productRow=3;}
productLeft=Math.round((productWidth-(productRow*174))/2);productLeft=String(productLeft-12);if(productLeft<0){productLeft=0;}
x.style.paddingLeft=productLeft+"px";x.style.visibility='visible';}}
function loadMap(){if(GBrowserIsCompatible()){function createMarker(point,number){var marker=new GMarker(point);GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml("<b>Boundary Bathrooms</b><br />Ainsworth and Dent House<br />Regent Street<br />Colne<br />Lancashire<br />BB8 8LD");});return marker;}
var map=new GMap2(document.getElementById("map"));map.setCenter(new GLatLng(53.85013,-2.19563),13);map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl());map.setMapType(G_MAP_TYPE);var point=new GLatLng(53.85013,-2.19563);map.addOverlay(createMarker(point,1));}}
function focusContact(){document.contactus_form.contact_name.focus();}
function trimStr(str){while(str.charAt(0)==(" ")){str=str.substring(1);}
while(str.charAt(str.length-1)==" "){str=str.substring(0,str.length-1);}
return str;}
function checkemailaddress(inputbox){var teststring
teststring=inputbox.toString()
if(inputbox==""){return 1002}
if(teststring.length<=6){return 1002}
var illegalchrs=new Array("*","£","$","!")
var counter
for(counter=0;counter<=illegalchrs.length;counter++){if(teststring.indexOf(illegalchrs[counter])!=-1){return 1002}}
var atpositionback=teststring.lastIndexOf("@")
var dotpositionback=teststring.lastIndexOf(".")
var atpositionfront=teststring.indexOf("@")
if(atpositionback==-1){return 1002}
if(dotpositionback==-1){return 1002}
if(atpositionfront!=atpositionback){return 1002}
if(atpositionback>dotpositionback){return 1002}
return 0}
function checkContact(){if(trimStr(contactus_form.contact_name.value)==""){alert("Please provide your name");contactus_form.contact_name.focus();contactus_form.contact_name.select();return false;}
if(trimStr(contactus_form.contact_email.value)==""){alert("Please provide your email");contactus_form.contact_email.focus();contactus_form.contact_email.select();return false;}
if(checkemailaddress(contactus_form.contact_email.value)!=0){alert("Please provide a valid email");contactus_form.contact_email.focus();contactus_form.contact_email.select();return false;}
if(trimStr(contactus_form.contact_phone.value)==""){alert("Please provide your telephone number");contactus_form.contact_phone.focus();contactus_form.contact_phone.select();return false;}
return true;}
function makeRequest(script_src,script_qry,element_id){var http_request=false;var url=script_src;url=url+"?"+script_qry;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/xml');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Giving up :( Cannot create an XMLHTTP instance');return false;}
http_request.onreadystatechange=function(){showResult(http_request,element_id);};http_request.open('GET',url,true);http_request.send(null);}
function showResult(http_request,element_id){if(http_request.readyState==4){if(http_request.status==200){x=document.getElementById(element_id);x.innerHTML='';x.innerHTML=http_request.responseText;}else{x=document.getElementById(element_id);x.innerHTML='';x.innerHTML='Operation Failed';}}}
function clearResult(element_id){x=document.getElementById(element_id);x.innerHTML='';}
function getCatBrandMenu(cat_id){if(cat_id==undefined)
{cat_id=document.field_search.searchCatTypeID.value;}
var script_src="/bb-ajax.asp";var element_id="brandSelect";var script_qry="menu=brand_cattype&id="+cat_id;makeRequest(script_src,script_qry,element_id);var element_id="rangeSelect";var script_qry="menu=range&id=0"
makeRequest(script_src,script_qry,element_id);}
function getSubBrandMenu(){var script_src="/bb-ajax.asp";var element_id="brandSelect";var script_qry=""
if(document.field_search.searchSubTypeID.value=="")
{script_qry="menu=brand_cattype&id="+document.field_search.searchCatTypeID.value;}else{script_qry="menu=brand_subtype&id="+document.field_search.searchSubTypeID.value;}
makeRequest(script_src,script_qry,element_id);var element_id="rangeSelect";var script_qry="menu=range&id=0";makeRequest(script_src,script_qry,element_id);}
function getSubTypeMenu(row_id){if(row_id==0){var script_src="/bb-ajax.asp";var element_id="subTypeSelect";var script_qry="menu=subType&id="+document.field_search.searchCatTypeID.value+"&row="+row_id;getCatBrandMenu(document.field_search.searchCatTypeID.value);}else{var script_src="/bb-ajax.asp";var element_id="subTypeSelect";if(row_id==2){var script_qry="menu=subType&id="+document.RTEDemo.catTypeID.value+"&row="+row_id;}else{var script_qry="menu=subType&id="+document.field_search.catTypeID.value+"&row="+row_id;}}
makeRequest(script_src,script_qry,element_id);}
function getRangeMenu(row_id){if(row_id==0){var element_id="rangeSelect";var script_src="/bb-ajax.asp";var script_qry="menu=range&id="+document.field_search.searchBrandID.value+"&row="+row_id+"&cat="+document.field_search.searchCatTypeID.value+"&sub="+document.field_search.searchSubTypeID.value;}else{var element_id="rangeSelect";var script_src="bb-ajax.asp";if(row_id==2){var script_qry="menu=range&id="+document.RTEDemo.brandID.value+"&row="+row_id;}else{var script_qry="menu=range&id="+document.field_search.brandID.value+"&row="+row_id;}}
makeRequest(script_src,script_qry,element_id);}
function updateQty(inputid){var whichField="wq"+inputid;if(isNaN(document.getElementById(whichField).value)){document.getElementById(whichField).value="1";}
document.location.href="/e-cart.asp?action=update_item&id="+inputid+"&uQty="+document.getElementById(whichField).value;}
function removeItem(id){document.location.href="/e-cart.asp?action=remove_item&id="+id;}
function add_product_to_basket_check(itmCode,itmName,itmPrice,itmRetail,itmShippingCode,itmStandardDelivery,itmProductCode,intShippingSupplemental,intHasLinkedOptions){var thisField="";var tmpArray;var AdditionalItemsCounter=document.getElementById("AdditionalItemsCounter").value;var notCheckedCountAddtional=0;var checkedCountAddtional=0;var allOptionsCounter=0;var notCheckedCountOption=0;var checkedCountOption=0;if(AdditionalItemsCounter>0)
{for(i=0;i<AdditionalItemsCounter;i++)
{tmpField="AdditionalItem_"+i;if(eval("document.forms.product_detail_form."+tmpField+".length")==undefined)
{if(eval("document.forms.product_detail_form."+tmpField).checked==true)
{checkedCountAddtional++;}}
for(n=0;n<eval("document.forms.product_detail_form."+tmpField+".length");n++)
{if(eval("document.forms.product_detail_form."+tmpField+"[n]").checked==true)
{checkedCountAddtional++;}}}}
if(document.getElementById("allOptionsCounter")!=null)
{allOptionsCounter=document.getElementById("allOptionsCounter").value;if(document.getElementById("option_0_0")!=null)
{for(i=0;i<allOptionsCounter;i++)
{tmpField="option_"+i;for(n=0;n<eval("document.forms.product_detail_form."+tmpField+".length");n++)
{if(eval("document.forms.product_detail_form."+tmpField+"[n]").checked==true)
{checkedCountOption++;}}}}}
if(checkedCountAddtional<AdditionalItemsCounter)
{alert("Please select required product options");}else if(checkedCountOption<allOptionsCounter){alert("Please select required product options");}
else
{if(trimStr(document.getElementById("productQty").value)==""||isNaN(document.getElementById("productQty").value)||document.getElementById("productQty").value=="0"){document.getElementById("productQty").style.backgroundColor="#FF0000";alert("Please enter quantity required -- numbers only");document.getElementById("productQty").focus();}else{var itmQty=document.getElementById("productQty").value;var itmOptionCount=0;var itmOptions=document.getElementById("itemOptionsString").value;document.getElementById("productQty").style.backgroundColor="#66C2FF";var additionalItemsOrderString=document.getElementById("AdditionalItemsOrderString").value;var intHasLinkedOptions=intHasLinkedOptions;if(intHasLinkedOptions=="1")
{var aiCount=document.getElementById("AdditionalItemsCounter").value;var foundCount=0;var tmpfield
for(i=0;i<aiCount;i++)
{tmpfield="AdditionalItem_"+i;for(n=0;n<document.getElementsByName(tmpfield).length;n++)
{if(document.getElementsByName(tmpfield)[n].checked)
{foundCount=1;}}}
if(foundCount==0)
{alert("Please select one option");}else{if(additionalItemsOrderString==""){document.location.href="/e-cart.asp?action=add_item&itemstring=$"+itmCode+"^"+itmName+"^"+itmQty+"^"+itmPrice+"^"+itmRetail+"^"+itmOptions+"^"+itmShippingCode+"^"+itmStandardDelivery+"^"+itmProductCode+"^"+intShippingSupplemental;}else{document.location.href="/e-cart.asp?action=add_multi-item&itemstring=$"+itmCode+"^"+itmName+"^"+itmQty+"^"+itmPrice+"^"+itmRetail+"^"+itmOptions+"^"+itmShippingCode+"^"+itmStandardDelivery+"^"+itmProductCode+"^"+intShippingSupplemental+"&additionalitemstring="+additionalItemsOrderString;}}}else{if(additionalItemsOrderString==""){document.location.href="/e-cart.asp?action=add_item&itemstring=$"+itmCode+"^"+itmName+"^"+itmQty+"^"+itmPrice+"^"+itmRetail+"^"+itmOptions+"^"+itmShippingCode+"^"+itmStandardDelivery+"^"+itmProductCode+"^"+intShippingSupplemental;}else{document.location.href="/e-cart.asp?action=add_multi-item&itemstring=$"+itmCode+"^"+itmName+"^"+itmQty+"^"+itmPrice+"^"+itmRetail+"^"+itmOptions+"^"+itmShippingCode+"^"+itmStandardDelivery+"^"+itmProductCode+"^"+intShippingSupplemental+"&additionalitemstring="+additionalItemsOrderString;}}}}}
function createAdditionalItemString(itmCode,itmName,itmPrice,itmRetail,itmShippingCode,itmStandardDelivery,itmProductCode,intShippingSupplemental,radioCount){var itmQty=1;var itmOptions=itmProductCode;var additionalItemsOrderString=document.getElementById("AdditionalItemsOrderString").value;var newItemToAdd=itmCode+"^"+itmName+"^"+itmQty+"^"+itmPrice+"^"+itmRetail+"^"+itmOptions+"^"+itmShippingCode+"^"+itmStandardDelivery+"^"+itmProductCode+"^"+intShippingSupplemental;var AdditionalItemsCounter=document.getElementById("AdditionalItemsCounter").value;var AdditionalItemsDefaultString=document.getElementById("AdditionalItemsDefaultString").value;if(additionalItemsOrderString.indexOf(newItemToAdd)>=0)
{}else{var AdditionalItemsTmpArray=new Array(AdditionalItemsCounter+1);var AdditionalItemsTmpArray2=new Array(AdditionalItemsCounter+1);AdditionalItemsTmpArray2=additionalItemsOrderString.split("$");AdditionalItemsTmpArray[radioCount]=newItemToAdd;additionalItemsOrderString="";var additionalItemsOrderValue=0.00;var additionalItemsRetailValue=0.00;var tmpField="";var thisField="";var tmpArray;for(i=0;i<AdditionalItemsCounter;i++)
{tmpField="AdditionalItem_"+i;if(eval("document.forms.product_detail_form."+tmpField+".length")==undefined)
{if(eval("document.forms.product_detail_form."+tmpField).checked==true)
{thisField=eval("document.forms.product_detail_form."+tmpField+".value");tmpArray=thisField.split("||");itmRetail=tmpArray[2];itmPrice=tmpArray[3];additionalItemsOrderValue+=Number(itmPrice);additionalItemsRetailValue+=Number(itmRetail);additionalItemsOrderString+="$"+tmpArray[0]+"^"+tmpArray[1]+"^1^"+itmPrice+"^"+itmRetail+"^^"+itmShippingCode+"^"+itmStandardDelivery+"^"+itmProductCode+"^"+intShippingSupplemental;}}else{for(n=0;n<eval("document.forms.product_detail_form."+tmpField+".length");n++)
{if(eval("document.forms.product_detail_form."+tmpField+"[n]").checked==true)
{thisField=eval("document.forms.product_detail_form."+tmpField+"[n].value");tmpArray=thisField.split("||");itmRetail=tmpArray[2];itmPrice=tmpArray[3];additionalItemsOrderValue+=Number(itmPrice);additionalItemsRetailValue+=Number(itmRetail);additionalItemsOrderString+="$"+tmpArray[0]+"^"+tmpArray[1]+"^1^"+itmPrice+"^"+itmRetail+"^^"+itmShippingCode+"^"+itmStandardDelivery+"^"+tmpArray[0]+"^"+intShippingSupplemental;}}}}
document.getElementById("AdditionalItemsOrderString").value=additionalItemsOrderString;document.getElementById("AdditionalItemsOrderValue").value=roundEmTo2(additionalItemsOrderValue);document.getElementById("AdditionalItemsRetailValue").value=roundEmTo2(additionalItemsRetailValue);var productTotalPrice=Number(document.getElementById("ProductPrice").value.replace(",",""));productTotalPrice=roundEmTo2(productTotalPrice);var productTotalPriceRetail=Number(document.getElementById("ProductPriceRetail").value.replace(",",""))
productTotalPriceRetail=roundEmTo2(productTotalPriceRetail);var optionPrice=(Number(additionalItemsOrderValue)*1.175);var optionRetail=(Number(additionalItemsRetailValue)*1.175);var displayItemRRPCost=(Number(productTotalPriceRetail)+Number(optionRetail))
displayItemRRPCost=roundEmTo2(displayItemRRPCost);var displayItemUnitCost=(Number(productTotalPrice)+Number(optionPrice))
displayItemUnitCost=roundEmTo2(displayItemUnitCost);if(document.getElementById("ItemUnitCost").innerHTML.toLowerCase()!="£ <b>call for prices</b>")
{document.getElementById("ItemUnitCost").innerHTML="£ "+displayItemUnitCost;}else{document.getElementById("ItemUnitCost").innerHTML="&pound; <b>Call for Prices</b>";}
document.getElementById("ItemRRPCost").innerHTML="£ "+displayItemRRPCost;}}
function removeAdditionalItemString(itmCode,itmName,itmPrice,itmRetail,itmShippingCode,itmStandardDelivery,itmProductCode,intShippingSupplemental){var itmQty=1;var itmOptions=""
var additionalItemsToRemove="$"+itmCode+"^"+itmName+"^"+itmQty+"^"+itmPrice+"^"+itmRetail+"^"+itmOptions+"^"+itmShippingCode+"^"+itmStandardDelivery+"^"+itmProductCode+"^"+intShippingSupplemental;var additionalItemsOrderString=document.getElementById("AdditionalItemsOrderString").value
var positionadditionalItemsToRemove=additionalItemsOrderString.indexOf(additionalItemsToRemove)
if(positionadditionalItemsToRemove==-1){}else{additionalItemsOrderString=additionalItemsOrderString.replace(additionalItemsToRemove,"");var additionalItemsOrderValue=document.getElementById("AdditionalItemsOrderValue").value
additionalItemsOrderValue=(Number(additionalItemsOrderValue)-Number(itmPrice))
var additionalItemsRetailValue=document.getElementById("AdditionalItemsRetailValue").value
additionalItemsRetailValue=(Number(additionalItemsRetailValue)-Number(itmRetail))
document.getElementById("AdditionalItemsOrderString").value=additionalItemsOrderString;document.getElementById("AdditionalItemsOrderValue").value=roundEmTo2(additionalItemsOrderValue);document.getElementById("AdditionalItemsRetailValue").value=roundEmTo2(additionalItemsRetailValue);var optionPrice=(Number(additionalItemsOrderValue)*1.175);var optionRetail=(Number(additionalItemsRetailValue)*1.175);var productTotalPrice=Number(document.getElementById("ProductPrice").value.replace(",",""));productTotalPrice=roundEmTo2(productTotalPrice);var productTotalPriceRetail=Number(document.getElementById("ProductPriceRetail").value.replace(",",""))
productTotalPriceRetail=roundEmTo2(productTotalPriceRetail);var displayItemUnitCost=(Number(productTotalPrice)+Number(optionPrice))
displayItemUnitCost=roundEmTo2(displayItemUnitCost);var displayItemRRPCost=(Number(productTotalPriceRetail)+Number(optionRetail))
displayItemRRPCost=roundEmTo2(displayItemRRPCost);if(document.getElementById("ItemUnitCost").innerHTML.toLowerCase()!="£ <b>call for prices</b>")
{document.getElementById("ItemUnitCost").innerHTML="£ "+displayItemUnitCost;}else{document.getElementById("ItemUnitCost").innerHTML="&pound; <b>Call for Prices</b>";}
document.getElementById("ItemRRPCost").innerHTML="£ "+displayItemRRPCost;}}
function remove2AdditionalItemString(radioCount){var AdditionalItemsCounter=document.getElementById("AdditionalItemsCounter").value;var additionalItemsOrderString=document.getElementById("AdditionalItemsOrderString").value;var AdditionalItemsTmpArray=new Array(AdditionalItemsCounter+1);var additionalIndividualItemsArray;var individualUnitPrice=0.00;var individualRetailPrice=0.00;AdditionalItemsTmpArray=additionalItemsOrderString.split("$");additionalItemsOrderString="";radioCount++;var additionalItemsOrderValue=0.00;var additionalItemsRetailValue=0.00;for(i=1;i<=AdditionalItemsCounter;i++)
{individualUnitPrice=0.00;individualRetailPrice=0.00;if(i==radioCount)
{additionalItemsOrderString+="$";individualUnitPrice=0.00;individualRetailPrice=0.00;}else{if(AdditionalItemsTmpArray[i]==undefined){additionalItemsOrderString="";individualUnitPrice=0.00;individualRetailPrice=0.00;}else{additionalItemsOrderString+="$"+AdditionalItemsTmpArray[i];additionalIndividualItemsArray=AdditionalItemsTmpArray[i].split("^");individualUnitPrice=additionalIndividualItemsArray[2];individualRetailPrice=additionalIndividualItemsArray[3];}}
if(individualUnitPrice==undefined)
{individualUnitPrice=0.00;individualRetailPrice=0.00;}
additionalItemsOrderValue=Number(additionalItemsOrderValue)+Number(individualUnitPrice);additionalItemsRetailValue=Number(additionalItemsRetailValue)+Number(individualRetailPrice);document.getElementById("AdditionalItemsOrderString").value=additionalItemsOrderString;document.getElementById("AdditionalItemsOrderValue").value=roundEmTo2(additionalItemsOrderValue);document.getElementById("AdditionalItemsRetailValue").value=roundEmTo2(additionalItemsRetailValue);var optionPrice=(Number(additionalItemsOrderValue)*1.175);var optionRetail=(Number(additionalItemsRetailValue)*1.175);var productTotalPrice=Number(document.getElementById("ProductPrice").value.replace(",",""));productTotalPrice=roundEmTo2(productTotalPrice);var productTotalPriceRetail=Number(document.getElementById("ProductPriceRetail").value.replace(",",""))
productTotalPriceRetail=roundEmTo2(productTotalPriceRetail);var displayItemUnitCost=(Number(productTotalPrice)+Number(optionPrice))
displayItemUnitCost=roundEmTo2(displayItemUnitCost);var displayItemRRPCost=(Number(productTotalPriceRetail)+Number(optionRetail))
displayItemRRPCost=roundEmTo2(displayItemRRPCost);if(document.getElementById("ItemUnitCost").innerHTML.toLowerCase()!="£ <b>call for prices</b>")
{document.getElementById("ItemUnitCost").innerHTML="£ "+displayItemUnitCost;}else{document.getElementById("ItemUnitCost").innerHTML="&pound; <b>Call for Prices</b>";}
document.getElementById("ItemRRPCost").innerHTML="£ "+displayItemRRPCost;}}
function createItemString(){var optionCount=document.getElementById("allOptionsCounter").value;var itmOptions="";var productTotalPrice=document.getElementById("ProductInitialPrice").value.replace(",","");var productTotalPriceRetail=document.getElementById("ProductInitialPriceRetail").value.replace(",","");var optionArray="";var optionPrice=0.00;var optionRetail=0.00;var thisOption="";var additionalItemsOrderValue=document.getElementById("AdditionalItemsOrderValue").value
var additionalItemsRetailValue=document.getElementById("AdditionalItemsRetailValue").value
if(Number(productTotalPrice)>0){for(o=0;o<optionCount;o++){var optionsLength=document.getElementsByName("option_"+o).length;for(l=0;l<optionsLength;l++){if(eval("document.forms.product_detail_form.option_"+o+"_"+l).checked==true){optionArray=eval("document.forms.product_detail_form.option_"+o+"_"+l).value.split("||");optionId=optionArray[0];optionName=optionArray[1];optionRetail=optionArray[2]*1.175;if(optionArray[0]!=""&&optionArray[1]!=""){itmOptions=itmOptions+"¬"+eval("document.forms.product_detail_form.option_"+o+"_"+l).value;productTotalPrice=Number(productTotalPrice)+Number(optionRetail);productTotalPriceRetail=Number(productTotalPriceRetail)+Number(optionRetail);}}}}
productTotalPrice=roundEmTo2(productTotalPrice);productTotalPriceRetail=roundEmTo2(productTotalPriceRetail);var displayItemUnitCost=Number(productTotalPrice)+(Number(additionalItemsOrderValue*1.175));displayItemUnitCost=roundEmTo2(displayItemUnitCost);var displayItemRRPCost=Number(productTotalPriceRetail)+(Number(additionalItemsRetailValue*1.175));displayItemRRPCost=roundEmTo2(displayItemRRPCost);if(document.getElementById("ItemUnitCost").innerHTML.toLowerCase()!="£ <b>call for prices</b>"&&document.getElementById("ItemUnitCost").innerHTML.toLowerCase()!="&pound; <b>call for prices</b>")
{document.getElementById("ItemUnitCost").innerHTML="£ "+displayItemUnitCost;}else{document.getElementById("ItemUnitCost").innerHTML="&pound; <b>Call for Prices</b>";}
document.getElementById("ItemRRPCost").innerHTML="£ "+displayItemRRPCost;document.getElementById("itemOptionsString").value=itmOptions;document.getElementById("ProductPrice").value=productTotalPrice;}else{for(o=0;o<=optionCount;o++){var optionsLength=document.getElementsByName("option_"+o).length;for(l=0;l<optionsLength;l++){if(eval("document.forms.product_detail_form.option_"+o+"["+l+"]").checked==true){optionArray=document.getElementsByName("option_"+o)[l].value.split("||");optionId=optionArray[0];optionName=optionArray[1];optionRetail=optionArray[2]*1.175;if(optionArray[0]!=""&&optionArray[1]!=""){itmOptions=itmOptions+"¬"+document.getElementsByName("option_"+o)[l].value;productTotalPriceRetail=Number(productTotalPriceRetail)+Number(optionRetail)}}}}
document.getElementById("ItemRRPCost").innerHTML="£ "+productTotalPriceRetail;document.getElementById("itemOptionsString").value=itmOptions;}}
function getQueryVariable(variable){var query=window.location.search.substring(1);var vars=query.split("&");for(var i=0;i<vars.length;i++){var pair=vars[i].split("=");if(pair[0]==variable){return pair[1];}}}
function refine_product(variantCount){var variable="pgt";var query=window.location.search.substring(1);if(query!="")
{query=query.replace("&utm_source=google&utm_medium=sfeed&utm_campaign=bb","");}
if(query!="")
{query=query.replace("utm_source=google&utm_medium=sfeed&utm_campaign=bb","");}
var vars=query.split("&");var variantString="";var v=0;var availQS=query;if(query=="")
{query="productid="+document.getElementById("ProductInitialProductId").value;query+="&productgroupid="+document.getElementById("ProductInitialProductGroupId").value;}
if(query.indexOf("CatTypeName")<0)
{query+="&CatTypeName="+document.getElementById("CanonicalCatName").value;query+="&SubTypeName="+document.getElementById("CanonicalSubTypeName").value;}
for(o=0;o<=variantCount;o++){var variantOptionsLength=document.getElementsByName("variant_"+o).length;for(v=0;v<variantOptionsLength;v++){if(eval("document.forms.product_detail_form.variant_"+o+"["+v+"]").checked==true){variantString+=eval("document.forms.product_detail_form.variant_"+o+"["+v+"]").value;if(o<variantCount){variantString+="^";}}}}
if(variantString!=""){var foundPairMatch=0;for(var i=0;i<vars.length;i++){var pair=vars[i].split("=");if(pair[0]==variable){foundPairMatch=1;document.location.href="/product-detail-new.asp?"+query.replace(pair[1],variantString);}}
if(foundPairMatch==0){document.location.href="/product-detail-new.asp?"+query+"&pgt="+variantString;}}}
function roundEmTo2(original){var result=Math.round(original*100)/100
var thisResult=result.toString();var roundEmArray=thisResult.split(".");if(roundEmArray.length==2)
{var strDecimals=roundEmArray[1];if(strDecimals.length==1)
{thisResult=roundEmArray[0]+"."+roundEmArray[1]+"0";}
else
{thisResult=roundEmArray[0]+"."+roundEmArray[1];}}
else
{thisResult=thisResult+".00";}
return thisResult;}
function tomoney(n){n=Math.round(n*100)/100;if(n.toFixed){return n.toFixed(2);}else{return~~n+'.'+String(Math.round((n?n:1)*100)).slice(-2);}}
function dnt(){return;}
function moneyFormat(textObj){var newValue=textObj;var decAmount="";var dolAmount="";var decFlag=false;var aChar="";for(i=0;i<newValue.length;i++){aChar=newValue.substring(i,i+1);if(aChar>="0"&&aChar<="9"){if(decFlag){decAmount=""+decAmount+aChar;}else{dolAmount=""+dolAmount+aChar;}}
if(aChar=="."){if(decFlag){dolAmount="";break;}
decFlag=true;}}
if(dolAmount==""){dolAmount="0";}
if(dolAmount.length>1){while(dolAmount.length>1&&dolAmount.substring(0,1)=="0"){dolAmount=dolAmount.substring(1,dolAmount.length);}}
if(decAmount.length>2){if(decAmount.substring(2,3)>"4"){decAmount=parseInt(decAmount.substring(0,2))+1;if(decAmount<10){decAmount="0"+decAmount;}else{decAmount=""+decAmount;}}else{decAmount=decAmount.substring(0,2);}
if(decAmount==100){decAmount="00";dolAmount=parseInt(dolAmount)+1;}}
if(decAmount.length==1){decAmount=decAmount+"0";}
if(decAmount.length==0){decAmount=decAmount+"00";}
if(newValue.substring(0,1)!='-'||(dolAmount=="0"&&decAmount=="00")){return dolAmount+"."+decAmount;}else{return dolAmount+"."+decAmount;}}
function checkForm(fieldString)
{if(fieldString!="")
{var dottedLine="---------------------------------------\n";var alertMessage=dottedLine;alertMessage+=" Please complete the following information\n";alertMessage+=dottedLine;var originalAlert=alertMessage;var fieldArray=fieldString.split("^");var firstFieldToFocus="";var strInvalid=" ";for(f=0;f<fieldArray.length;f++)
{if(fieldArray[f]=="Billing_Address")
{if(document.getElementById(fieldArray[f]).innerText==""||document.getElementById(fieldArray[f]).value=="")
{alertMessage+="\n ** "+fieldArray[f].replace("_"," ");if(firstFieldToFocus=="")
{firstFieldToFocus=fieldArray[f];}}}else{if(document.getElementById(fieldArray[f]).value==""||document.getElementById(fieldArray[f]).value==fieldArray[f])
{alertMessage+="\n ** "+fieldArray[f].replace("_"," ");if(firstFieldToFocus=="")
{firstFieldToFocus=fieldArray[f];}}}}
if(document.getElementById("Billing_Postcode")!=null)
{if(document.getElementById("Billing_Postcode").value!="")
{if(document.getElementById("Billing_Postcode").value.indexOf(strInvalid)==-1)
{alertMessage+="\n ** Postcode - full postcode required including spaces ie: BB8 8LD";if(firstFieldToFocus=="")
{firstFieldToFocus="Billing_Postcode";}}}}
if(document.getElementById("CustomerDeliveryPostcode")!=null)
{if(document.getElementById("CustomerDeliveryPostcode").value!="")
{if(document.getElementById("CustomerDeliveryAddress").value=="")
{alertMessage+="\n ** Delivery Address";if(firstFieldToFocus=="")
{firstFieldToFocus="CustomerDeliveryAddress";}}}}
if(alertMessage!=originalAlert)
{alertMessage+="\n\n"+dottedLine;alert(alertMessage);setFocus(firstFieldToFocus);return false;}
if(document.getElementById("CreateOrxderButton2")!=null)
{window.scrollTo(0,0);document.getElementById('ProcessingCenter').className='ShowMe';document.getElementById('ProcessingDisabledLayer').className='ShowMe';for(i=0;i<=5000;i++){}}}else{return false;}}
function setFocus(elementId)
{var elementExists=document.getElementById(elementId);if(elementExists!=null)
{document.getElementById(elementId).focus();}}
function processing(){window.scrollTo(0,0);document.getElementById('ProcessingCenter').className='ShowMe';document.getElementById('ProcessingDisabledLayer').className='ShowMe';}
var newWindow1=null;var newWindow2=null;var newWindow3=null;var newWindow4=null;var newWindow5=null;function imageZoom(Item){URL="/Product-Zoom.asp?Product="+Item
if(!newWindow1||newWindow1.closed){newWindow1=window.open(URL,"subwin1","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow1.focus();}else{newWindow1.close();newWindow1=window.open(URL,"subwin1","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow1.focus();}}
function emailAFriend(ProductName,ProductID){URL="/EmailAFriend.asp?ProductID="+ProductID+"&ProductName="+ProductName
if(!newWindow2||newWindow2.closed){newWindow2=window.open(URL,"subwin2","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow2.focus();}else{newWindow2.close();newWindow2=window.open(URL,"subwin2","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow2.focus();}}
function technicalInfo(ProductName,ProductID){URL="/Product-TechnicalInfo.asp?ProductID="+ProductID+"&ProductName="+ProductName
if(!newWindow3||newWindow3.closed){newWindow3=window.open(URL,"subwin3","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow3.focus();}else{newWindow3.close();newWindow3=window.open(URL,"subwin3","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow3.focus();}}
function testimonials(ProductName,ProductID,CatID,SubTypeID,BrandID,RangeID){URL="/Product-Testimonials.asp?ProductID="+ProductID+"&ProductName="+ProductName+"&CatID="+CatID+"&SubTypeID= "+SubTypeID+"&BrandID="+BrandID+"&RangeID="+RangeID
if(!newWindow4||newWindow4.closed){newWindow4=window.open(URL,"subwin4","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow4.focus();}else{newWindow4.close();newWindow4=window.open(URL,"subwin4","height=600,width=500,toolbars=no,status=no,scrollbars=no");newWindow4.focus();}}
function WhatCustomersBought(ProductName,ProductID){URL="/Product-Bought.asp?ProductID="+ProductID+"&ProductName="+ProductName
if(!newWindow5||newWindow5.closed){newWindow5=window.open(URL,"subwin5","height=600,width=560,toolbars=no,status=no,scrollbars=yes");newWindow5.focus();}else{newWindow5.close();newWindow5=window.open(URL,"subwin5","height=600,width=560,toolbars=no,status=no,scrollbars=yes");newWindow5.focus();}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}