﻿$(document).ready(function(){loadLargeImage();createPopUpProductNew();toggleOpen();hideContextualHelp();toggleContextualHelp();testShowHide();})
function ClearArea()
{document.getElementById('areaFloor').value='';}
function ClearPacks()
{document.getElementById('packsReq').value='';}
function loadLargeImage(){$(".enlargeImage").wrapInner("<a href='#'></a>");$("a",".enlargeImage").bind("click",function(e){var newLargerImage=$("img",this).css("backgroundImage");var newSmallerImage=$(".largeImage").css("backgroundImage");newLargerImage=newLargerImage.replace("h=42","h=400");newLargerImage=newLargerImage.replace("w=42","w=400");newLargerImage=newLargerImage.replace("t=42","t=400");newSmallerImage=newSmallerImage.replace("h=400","h=42");newSmallerImage=newSmallerImage.replace("w=400","w=42");newSmallerImage=newSmallerImage.replace("t=400","t=42");$("img",this).css("backgroundImage",newSmallerImage);$(".largeImage").css("backgroundImage",newLargerImage);$(".enlargeImage").show();return false;});}
function toggleOpen(){var browser="standard";if(jQuery.browser.msie){if(parseInt(jQuery.browser.version)<7)
{browser="non-standard";}}
if($(".open").length>0)
{$(".displayHelp").hide();$(".open").prepend("<a href='#'>Open</a>");}
if($(".close").length>0)
{$(".close").prepend("<a href='#' rel='nofollow, noindex'>Close</a>");}
$(".open").bind("click",function(e){if($(".open").length>0)
{$("a",".open","rel='nofollow, noindex'").text("Close");$(".open")[0].className="close";}
else
{$("a",".close","rel='nofollow, noindex'").text("Open");$(".close")[0].className="open";}
if(jQuery.browser.msie){if(parseInt(jQuery.browser.version)<7)
{$(".displayHelp").toggle();}else
{$(".displayHelp").slideToggle("slow");}}
else{$(".displayHelp").slideToggle("slow");}
return false;});$(".close").bind("click",function(e){if($(".open").length>0)
{$("a",".open","rel='nofollow, noindex'").text("Close");$(".open")[0].className="close";}
else
{$("a",".close","rel='nofollow, noindex'").text("Open");$(".close")[0].className="open";}
if(jQuery.browser.msie){if(parseInt(jQuery.browser.version)<7)
{$(".displayHelp").toggle();}else
{$(".displayHelp").slideToggle("slow");}}
else{$(".displayHelp").slideToggle("slow");}
return false;});}
function toggleContextualHelp(){$(".contextHelp").css({cursor:"pointer"});$(".contextHelp").click(function(e){$(".contextHelpHide").hide();var thisPos=e.pageX+10+"px";var thisContainer=$(this).parents("div.deviceBox")[0];var thisToolTip=$(".contextHelpHide",thisContainer)[0];$(thisToolTip).css({border:"1px solid #b1b6b9",padding:"3px",backgroundColor:"white",width:"200px",position:"absolute",left:thisPos});var thisH2=$("h2",thisContainer)[0];$(thisH2).css({float:"left"});$(".contextHelpHide",thisContainer).show("slow");$(".contextHelpHide",thisContainer).oneTime("20s",function(e){closeInTime();});});$(".contextHelp").mouseout(function(e){$(".contextHelpHide").hide("slow");});}
function closeInTime(){$(".contextHelpHide").hide("slow");}
function hideContextualHelp(){$(".contextHelpHide").hide();}
function issueValidationChange(ddl,rfvID)
{if(ddl.options[ddl.selectedIndex].value=='7'){document.getElementById(rfvID).enabled=true;}else{document.getElementById(rfvID).enabled=false;}}
function printpage(){window.print();}
function differentAddressValidationChange(cb,rfvID1,rfvID2,rfvID3,rfvID4,rfvID5,rfvID6,tb1,tb2,tb3,tb4,tb5,tb6)
{if(cb.checked==1){document.getElementById(rfvID1).enabled=true;document.getElementById(rfvID2).enabled=true;document.getElementById(rfvID3).enabled=true;document.getElementById(rfvID4).enabled=true;document.getElementById(rfvID5).enabled=true;document.getElementById(rfvID6).enabled=true;document.getElementById(tb1).disabled=false;document.getElementById(tb2).disabled=false;document.getElementById(tb3).disabled=false;document.getElementById(tb4).disabled=false;document.getElementById(tb5).disabled=false;document.getElementById(tb6).disabled=false;}else{document.getElementById(rfvID1).enabled=false;document.getElementById(rfvID2).enabled=false;document.getElementById(rfvID3).enabled=false;document.getElementById(rfvID4).enabled=false;document.getElementById(rfvID5).enabled=false;document.getElementById(rfvID6).enabled=false;document.getElementById(tb1).disabled=true;document.getElementById(tb2).disabled=true;document.getElementById(tb3).disabled=true;document.getElementById(tb4).disabled=true;document.getElementById(tb5).disabled=true;document.getElementById(tb6).disabled=true;}}
function deliveryValidationChange(cb,rfvID1,rfvID2,rfvID3,rfvID4,rfvID5,rfvID6,tb1,tb2,tb3,tb4,tb5,tb6)
{if(cb.checked==1){document.getElementById(rfvID1).enabled=false;document.getElementById(rfvID2).enabled=false;document.getElementById(rfvID3).enabled=false;document.getElementById(rfvID4).enabled=false;document.getElementById(rfvID5).enabled=false;document.getElementById(rfvID6).enabled=false;document.getElementById(tb1).disabled=true;document.getElementById(tb2).disabled=true;document.getElementById(tb3).disabled=true;document.getElementById(tb4).disabled=true;document.getElementById(tb5).disabled=true;document.getElementById(tb6).disabled=true;document.getElementById(tb1).value='';document.getElementById(tb2).value='';document.getElementById(tb3).value='';document.getElementById(tb4).value='';document.getElementById(tb5).value='';document.getElementById(tb6).value='';document.getElementById(rfvID1).style.visibility='hidden';document.getElementById(rfvID2).style.visibility='hidden';document.getElementById(rfvID3).style.visibility='hidden';document.getElementById(rfvID4).style.visibility='hidden';document.getElementById(rfvID5).style.visibility='hidden';document.getElementById(rfvID6).style.visibility='hidden';}else{document.getElementById(rfvID1).enabled=true;document.getElementById(rfvID2).enabled=true;document.getElementById(rfvID3).enabled=true;document.getElementById(rfvID4).enabled=true;document.getElementById(rfvID5).enabled=true;document.getElementById(rfvID6).enabled=true;document.getElementById(tb1).disabled=false;document.getElementById(tb2).disabled=false;document.getElementById(tb3).disabled=false;document.getElementById(tb4).disabled=false;document.getElementById(tb5).disabled=false;document.getElementById(tb6).disabled=false;}}
function createPopUpProductNew(){$("#modalswap").css("cursor","pointer");$("#modalswap").mouseover(function(event){;var backgroundImageFor=$("img",this).css("backgroundImage");backgroundImageFor=backgroundImageFor.replace("url(","");backgroundImageFor=backgroundImageFor.replace(")","");backgroundImageFor=backgroundImageFor.replace("h=400","h=690");backgroundImageFor=backgroundImageFor.replace("w=400","w=690");backgroundImageFor=backgroundImageFor.replace("t=400","t=690");var theLink=document.getElementById("modalLink");theLink.setAttribute("href",backgroundImageFor);});}
function testShowHide(){$("#speciesShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all species");}
return false});$("#brandShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all species");}
return false});$("#edgingShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all species");}
return false});$("#styleShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all styles");}
return false});$("#finishcategoryShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all finishes");}
return false});$("#grainShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all grains");}
return false});$("#priceShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all prices");}
return false});$("#pricerangeShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all prices");}
return false});$("#manufacturerShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all brands");}
return false});$("#rangeShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all ranges");}
return false});$("#finishShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all finishes");}
return false});$("#colourvarianceShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all colours");}
return false});$("#typeShowAll").click(function(){parentUL=$(this).parents("ul.iconThumbLarge");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all accessories");}
return false});$("#accessoriesShowAll").click(function(){parentUL=$(this).parents("ul.verThumb");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all accessories");}
return false});$("#adhesiveShowAll").click(function(){parentUL=$(this).parents("div.boxHighlight");if($(".accessoriesBlank",parentUL).length>0){$(".accessoriesBlank",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","accessoriesBlank");$(this).text("Show all adhesives");}
return false});$("#aftercareShowAll").click(function(){parentUL=$(this).parents("div.boxHighlight");if($("table.accessoriesBlank",parentUL).length>0){$(".accessoriesBlank",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","accessoriesBlank");$(this).text("Show all aftercare products");}
return false});$("#decorativeShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all decorative products");}
return false});$("#toolsShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all tools");}
return false});$("#trimsShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all trims");}
return false});$("#underlayShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all underlay");}
return false});$("#featureandmetallicstripsShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all feature metallic strips");}
return false});$("#skirtingandscotiaShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all skirting and scotia");}
return false});$("#suggestedbordersShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all suggested design borders");}
return false});$("#suggesteddesignstripsShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all suggested design strips");}
return false});$("#vinyladhesiveShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all vinyl adhesives");}
return false});$("#woodadhesiveShowAll").click(function(){parentUL=$(this).parents("table.accessoriesblank");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all wood adhesives");}
return false});$("#IndexServerShowAll").click(function(){parentUL=$(this).parents("ul.AdvicePages");if($(".hideLITag",parentUL).length>0){$(".hideLITag",parentUL).attr("class","showLITag");$(this).text("Show most popular advice pages");}else{$(".showLITag",parentUL).attr("class","hideLITag");$(this).text("Show all advice pages");}
return false});}
function toggle(element,link,link1){ele=document.getElementById(element);if(ele.style.display==""||ele.style.display=="block"){ele.style.display="none";document.getElementById(link).innerHTML="Show all "+link;document.getElementById(link1).innerHTML="Show all "+link;}else{ele.style.display="";document.getElementById(link).innerHTML="Close";document.getElementById(link1).innerHTML="Close";}}
function JSSearch(source,eventArgs){window.location=("/results.aspx?Search="+eventArgs.get_text());}
function PacksFromTotalArea(TotalPacks,PackSize,TotalAreaEntered,PackPrice,UOM,DeliveryThreshold,DeliveryCharge,CostText,VAT,CostIncVATText){TotalArea=TotalAreaEntered.value;var HiddenNumberOfPacks=document.getElementById("NumberOfPackPostBackPostBack");var HiddenPackText=document.getElementById("PackPostBack");var HiddenCostText=document.getElementById("CostExVATPostBack");if(IsNumeric(TotalArea)){var factor=1;var UnitToDisplay='m2';if(TotalArea==undefined){TotalArea=TotalAreaEntered;}
if(UOM=='f'){factor=10.764;UnitToDisplay='sq.ft.';}
var AreaCoveredByPacks=parseFloat(PackSize)*parseFloat(Math.ceil((TotalArea/factor)/PackSize));if(HiddenNumberOfPacks!==null){HiddenNumberOfPacks.value=Math.ceil((TotalArea/factor)/PackSize);}
passCostToOpener(Math.ceil((TotalArea/factor)/PackSize),PackPrice,VAT,DeliveryThreshold,DeliveryCharge,CostIncVATText);var NumberOfPacks=document.getElementById(TotalPacks);NumberOfPacks.value=Math.ceil((TotalArea/factor)/PackSize);}
else{alert('Please only enter numbers');HiddenNumberOfPacks.value='';HiddenPackText.value='';HiddenCostText.value='0';}}
function passCostToOpener(Packs,PackPrice,VAT,DeliveryThreshold,DeliveryCharge,CostIncVATText,DeliveryText){var CostExVAT=parseFloat(Packs)*parseFloat(PackPrice);var CostIncVAT=parseFloat(CostExVAT)+(parseFloat(CostExVAT)*(parseFloat(VAT/100)));var CostInfo=document.getElementById(CostIncVATText);var HiddenCostText=document.getElementById("CostExVATPostBack");var HiddenCostPostBack=document.getElementById("CostPostPack");if(HiddenCostText!==null){HiddenCostText.value=CostExVAT;}
CostInfo.innerHTML='<strong>\u00A3'+CurrencyFormatted(CostExVAT)+'</strong>';}
function TotalPacks(TotalArea,PacksRequired,PackCost,PackSize,UOM,DeliveryThreshold,DeliveryCharge,CostText,VAT,CostIncVATText){Packs=PacksRequired.value;var HiddenNumberOfPacks=document.getElementById("NumberOfPackPostBackPostBack");var HiddenPackText=document.getElementById("PackPostBack");var HiddenCostText=document.getElementById("CostExVATPostBack");if(IsNumericPacks(Packs)){var factor=1;UnitToDisplay='m2';if(UOM=='f'){factor=10.764;var UnitToDisplay='sq.ft.';}
HiddenNumberOfPacks.value=Packs;var AreaCovered=document.getElementById(TotalArea);AreaCovered.value=roundNumber(Packs*PackSize*factor,3);passCostToOpener(Packs,PackCost,VAT,DeliveryThreshold,DeliveryCharge,CostIncVATText);}
else{alert('Please only enter whole numbers');HiddenNumberOfPacks.value='';HiddenPackText.value='';HiddenCostText.value='0';}}
function clearCalc()
{var items=clearCalc.arguments.length;for(i=0;i<items;i++)
{document.getElementById(clearCalc.arguments[i]).value='';if(document.getElementById(clearCalc.arguments[i]).innerHTML!="")
{document.getElementById(clearCalc.arguments[i]).innerHTML="";}}}
function checknumber(num){var x=num;var anum=/(^\d+$)|(^\d+\.\d+$)/;if(anum.test(x))
testresult=true
else{testresult=false}
return(testresult)}
function IsNumeric(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 roundNumber(num,dec){var result=Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);return result;}
function CurrencyFormatted(amount){var i=parseFloat(amount);if(isNaN(i)){i=0.00;}
var minus='';if(i<0){minus='-';}
i=Math.abs(i);i=parseInt((i+.005)*100);i=i/100;s=new String(i);if(s.indexOf('.')<0){s+='.00';}
if(s.indexOf('.')==(s.length-2)){s+='0';}
s=minus+s;return s;}
function IsNumericOnly(sText){var HiddenNumberOfPacks=document.getElementById("NumberOfPackPostBackPostBack");var HiddenPackText=document.getElementById("PackPostBack");var HiddenCostText=document.getElementById("CostExVATPostBack");NumberPacks=sText.value;if(IsNumericOnly(NumberPacks)){}
else{alert('Please only enter numbers');HiddenNumberOfPacks.value='';HiddenPackText.value='';HiddenCostText.value='0';}}
function IsNumericPacks(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 sizecalccarpet(unitsf,sf,lengthbox,cost,vat,uom,deliverycutoff){var widthval=document.getElementById(sf);var lengthboxval=document.getElementById(lengthbox);var normalisedCost=cost;b=parseFloat(widthval.value);if(uom=='f'){b=parseFloat(widthval.value)/parseFloat(3.281);normalisedCost=cost/parseFloat(10.764);}
unitsf=parseFloat(unitsf/1000);lengthboxval.value=b/unitsf;if(lengthboxval.value>100)passPacksToOpener(document.forms[0].units.value);passCostToOpenerCarpet(widthval.value,normalisedCost,vat,deliverycutoff);var areapackscover=parseFloat(unitsf)*parseFloat(lengthboxval.value);var waste=((areapackscover-widthval.value)/widthval.value*100);var result=Math.round(waste*100)/100;return;}
function packsOnlyCarpet(length,width,cost,vat,uom,totalareabox){var factor=1;if(uom=='f'){length=parseFloat(length)/parseFloat(3.281);factor=10.764;}
length=parseFloat(length/1000);var widthval=document.getElementById(width);var totalareaboxtext=document.getElementById(totalareabox);var totalarea=parseFloat(length)*parseFloat(widthval.value);var costexvat=parseFloat(totalarea)*parseFloat(cost);var a=0;totalareaboxtext.value=totalarea*factor;document.forms[0].totalcost.value='\u00A3'+CurrencyFormatted(costexvat+a);}
function passCostToOpenerCarpet(Packs,PackPrice,VAT,DeliveryThreshold,DeliveryCharge,CostIncVATText,DeliveryText){var CostExVAT=parseFloat(Packs)*parseFloat(PackPrice);var CostIncVAT=parseFloat(CostExVAT)+(parseFloat(CostExVAT)*(parseFloat(VAT/100)));var CostInfo=document.getElementById(CostIncVATText);var DeliveryInfo=document.getElementById(DeliveryText);var HiddenCostText=document.getElementById("CostEXVATPostBack");var HiddenDeliveryInfo=document.getElementById("DeliveryPostBack");var HiddenCostPostBack=document.getElementById("CostPostPack");if(HiddenCostText!==null){HiddenCostText.value=CostExVAT;}
document.forms[0].totalcost.value='\u00A3'+CurrencyFormatted(CostExVAT);}
function Accessories(quantity,cost,vat,deliverycutoff){var total=parseFloat(quantity)*parseFloat(cost);var vat=parseFloat(total)*parseFloat(vat/100);document.forms[0].totalcost.value=('\u00A3'+CurrencyFormatted(total));}