/*--------------------------------------------------
BASE-1.0.0 contains CONFIG, UTIL, UKISA.FLASH, UKISA.WIDGET.MULTIMAP, FORM, BASE, POLYCELL.SHOPPINGLIST
Generated: 2/6/2010
--------------------------------------------------*/
var UKISA={Config:{},l10n:{},widget:{}};UKISA.Config={REGION:"EIE",CODE:"POL",SITE:"Polycell",domLoad:function(){var a=new UKISA.Polycell.ShoppingList();UKISA.util.clearDefault("search");if(document.body.id==="home-page"){UKISA.Polycell.Page.home();UKISA.Polycell.Page.tooltips()}if(document.body.id==="product-page"){a.attach()}if(document.body.id==="category-page"){UKISA.Polycell.CategoryAccordian.init()}if(document.body.id==="visual-guide-page"){UKISA.Polycell.CategoryAccordian.visual()}if(document.body.id==="guide-page"){UKISA.Polycell.Guide.init();a.multiAttach()}(function(){var c,h,k,e,f,d,g,i,b;c=YAHOO.util.Dom;h=YAHOO.util.Event;b=YAHOO.env.ua.ie;i=0;d=178;f=53;g=11;resize=function(){k=c.getDocumentHeight();e=YAHOO.util.Dom.getViewportHeight();i=e-d-f-g;if(i>0){c.setStyle("body","min-height",i+"px");if(b>=6&&b<7){c.setStyle("body","height",i+"px")}}};h.addListener(window,"resize",resize);resize()})()},contentLoad:function(){}};UKISA.l10n[UKISA.Config.SITE]={};var UKISA=UKISA||{util:{}};UKISA.util={pngFix:function(a){if(typeof DD_belatedPNG!=="undefined"){DD_belatedPNG.fix(a)}else{alert("Missing PNG handler")}},print:function(){if(window.print){window.print()}return false},nthChild:function(c,d){for(var b=0,a=c.length;b<a;b++){if((b+1)%d==0){YAHOO.util.Dom.addClass(c[b],"nth-child")}else{YAHOO.util.Dom.removeClass(c[b],"nth-child")}}},clearDefault:function(){var c=function(e){if(!e){return}var d=e.value;e.onfocus=function(){var f=d;if(this.value===d){this.value=""}};e.onblur=function(){var f=d;if(this.value===""||this.value===d){this.value=f}}};for(var b=0,a=arguments.length;b<a;b++){c(document.getElementById(arguments[b]))}},parentNode:function(a){var c=(typeof a=="string")?document.getElementById(a):a;var b=null;if(c&&c.parentNode){while(c.parentNode.nodeType!=1){c=c.parentNode;b=c}return(!b)?c.parentNode:b}},trim:function(a){return a.replace(/^\s+|\s+$/g,"")},getScrollXY:function(){var b=0,a=0;if(typeof(window.pageYOffset)==="number"){a=window.pageYOffset;b=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){a=document.body.scrollTop;b=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){a=document.documentElement.scrollTop;b=document.documentElement.scrollLeft}}}return[b,a]}};UKISA.Flash={_baseUrl:"/web/media/flash/",_supportedVersion:"8.0.0",_flashVersion:null,_defaultVars:{},_defaultParams:{quality:"high",pluginspage:"http://www.macromedia.com/go/getflashplayer",wmode:"transparent"},embed:function(c,e,d,a,f,g,b){if(c.toLowerCase().indexOf(".flv")!==-1){return this.embedVideo(c,e,d,a,f,g,b)}else{return this.embedMovie(c,e,d,a,f,g,b)}},embedMovie:function(d,f,e,b,g,h,c){var a,g,h;a=c||this._supportedVersion;fVars=g||this._defaultVars;fParams=h||this.defaultParams;if(typeof swfobject!=="undefined"){swfobject.embedSWF(this._baseUrl+d,f,e,b,this._supportedVersion,null,fVars,fParams)}else{alert("Missing Flash handler script")}},embedVideo:function(d,f,e,b,g,h,c){var a,b,e,g,h;a=c||this._supportedVersion;b=b||400;e=e||400;fVars=g||{MM_ComponentVersion:"1",skinName:"/web/media/flash/Halo_Skin_3",streamName:"/web/media/movies/"+d.substring(0,d.indexOf(".")),autoPlay:"false",autoRewind:true};fParams=h||{quality:"high",scale:"noscale",pluginspage:"http://www.macromedia.com/go/getflashplayer",wmode:"transparent"};if(typeof swfobject!=="undefined"){swfobject.embedSWF("/web/media/flash/flv_player.swf",f,e,b,a,null,fVars,fParams)}else{alert("Missing Flash handler script")}},remove:function(a){swfobject.removeSWF(a)}};var UKISA=UKISA||{};UKISA.widget=UKISA.widget||{};UKISA.widget.MultiMap={_viewer:null,_country:"GB",reload:function(d,c,b){var a=this;var e=function(i,l,f,g){var k,m,h;m=a._viewer.getCurrentPosition();h=new MMIcon("/web/media/images/global/location.png");h.iconSize=new MMDimensions(32,32);h.iconAnchor=new MMPoint(16,16);a._viewer.createMarker(m,{label:b,icon:h});k=new MMPanZoomWidget();a._viewer.addWidget(k)};var d=document.getElementById(d);if(d){this._viewer=new MultimapViewer(d);this._viewer.addEventHandler("endGeocode",e)}this._viewer.drawAndPositionMap(new MMLocation(new MMAddress({postal_code:c,country_code:this._country})))},load:function(d,c,b){var a=this;var e=function(i,l,f,g){var k,m,h;m=a._viewer.getCurrentPosition();h=new MMIcon("/web/media/images/global/location.png");h.iconSize=new MMDimensions(32,32);h.iconAnchor=new MMPoint(16,16);a._viewer.createMarker(m,{label:b,icon:h});k=new MMPanZoomWidget();a._viewer.addWidget(k)};var d=document.getElementById(d);if(!this._viewer||d){this._viewer=new MultimapViewer(d);this._viewer.addEventHandler("endGeocode",e)}this._viewer.drawAndPositionMap(new MMLocation(new MMAddress({postal_code:c,country_code:this._country})))}};function highlightField(a){a.focus();if(a.select){a.select()}}function fieldError(a,b){if(a){highlightField(a)}alert(b);return false}function hasNumbers(b){var a=new RegExp("[0-9]");return a.test(b)}function isRadiogroupChecked(a){for(var b=0;b<a.length;b++){if(a[b].checked){return true}}return false}function isNumeric(b){var a=parseFloat(b);return(!isNaN(a)||b=="")}function isInteger(b){var a=parseInt(b);return(b.indexOf(".")<0&&(!isNaN(a)||b==""))}function isPhoneNumber(b){var a=new RegExp("^[0-9 ]*$");return a.test(b)}function inRange(b,a,c){if(isNaN(b)){b=0}return(b>=a&&b<=c)}function isAlpha(b){var a=new RegExp("[^A-Za-z]");return !a.test(b)}function isAlphaAndNumeric(b){var a=new RegExp("[^A-Za-z0-9]");return !a.test(b)}function trimSpaces(a){return a.replace(/\s+/g,"")}function trimOutsideSpaces(a){return a.replace(/^\s+|\s+$/g,"")}function isValidSequence(c,b){var a=new RegExp("[^"+b+"]");return !a.test(c)}function isEmail(b){b=trimOutsideSpaces(b.toLowerCase());var a=new RegExp(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(2([0-4]\d|5[0-5])|1?\d{1,2})(\.(2([0-4]\d|5[0-5])|1?\d{1,2})){3} \])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);return a.test(b)}function isValueSelected(a){return(a.options[a.selectedIndex].value!="")}function validatePostCode(c,b,a){if(((b)&&b.options[b.options.selectedIndex].value!="United Kingdom")){return true}var e=trimSpaces(c.value.toUpperCase());if(e.length==0){return fieldError(c,"Please enter a postcode.")}if(!isAlphaAndNumeric(e)){return fieldError(c,"Please enter a valid UK postcode (containing both letters and numbers).")}var d=(a&&a==true)?new RegExp("^[A-Z]{1,2}([0-9]{1,2}|[0-9][A-Z])($|[0-9][ABD-HJLNP-UW-Z]{2}$)"):new RegExp("^[A-Z]{1,2}([0-9]{1,2}|[0-9][A-Z])[0-9][ABD-HJLNP-UW-Z]{2}$");if(!d.test(e)&&!document.layers){return fieldError(c,"Please enter a valid UK postcode.")}else{return true}}function getDays(c,a){var b=new Array(31,28,31,30,31,30,31,31,30,31,30,31);b[1]=(a%4==0&&a%100!=0||a%400==0)?b[1]+1:b[1];return b[c-1]}function validateDateOfBirth(h,e,g){var d=trimSpaces(h.value);var i=trimSpaces(e.value);var b=trimSpaces(g.value);var f=new Date();if(d.length==0||i.length==0||b.length==0){return fieldError(h,"Please complete your full date of birth.")}if(!(isNumeric(b)&&inRange(parseInt(b),1849,f.getFullYear()))){return fieldError(g,"Please give a valid year.  It may not be before 1849 or after the present year.")}if(!(isNumeric(i)&&inRange(parseInt(i),1,12))){return fieldError(e,"Please give a valid month (1 - 12).")}var a=getDays(parseInt(i),parseInt(b));if(!(isNumeric(d)&&inRange(parseInt(d),1,a))){return fieldError(h,"Please give a valid day.")}var c=new Date(parseInt(b),parseInt(i)-1,parseInt(d));if(c>=f){return fieldError(h,"Please give a date of birth that is not in the future.")}return true}(function(){UKISA.l10n.get=function(a){var b=UKISA.l10n[UKISA.Config.SITE][a][UKISA.Config.REGION];return(b!=="undefined")?b:null};YAHOO.util.Event.onDOMReady(UKISA.Config.domLoad);YAHOO.util.Event.onContentReady(UKISA.Config.contentLoad);UKISA[UKISA.Config.SITE]={}})();UKISA.Polycell.Page={home:function(){if(document.all&&document.getElementById){var a=document.getElementById("product-selector");if(!a){return}a.onmouseover=function(){this.className="hover"};a.onmouseout=function(){this.className=""}}},player:function(a){var b;b={MM_ComponentVersion:"1",skinName:"/web/media/flash/Clear_Skin_1",streamName:"/web/media/movies/"+a.substring(0,a.indexOf(".")),autoPlay:"true",autoRewind:true};UKISA.Flash.embed(a,"featured-player-static",272,153,b);return false},tooltips:function(){var b,a,c;b=document.getElementById("guide-finder");if(!b){return}b=b.getElementsByTagName("ul");if(!b){return}b=b[0];a=b.getElementsByTagName("a");c=new YAHOO.widget.Tooltip("video-tooltip",{context:a,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.2},width:218,zIndex:150});c.setHeader("");c.setFooter("");c.contextMouseOverEvent.subscribe(function(f,d){var e=d[0];if(e&&e.id==="B3"){return false}else{return true}});c.contextTriggerEvent.subscribe(function(f,d){var e=d[0];this.cfg.setProperty("text",e.title)});c.moveTo=function(d,e){this.cfg.setProperty("xy",[d-43,e-this.element.offsetHeight])}}};UKISA.Polycell.Guide={init:function(){var a=new YAHOO.dulux.co.uk.Widgets.Bookmarker();this.related();this.equalise()},related:function(){var b,e,c,a,d;b=document.getElementById("related-articles");if(!b){return}e=b.getElementsByTagName("a");d=document.createElement("span");d.className="direct";for(c=0,a=e.length;c<a;c++){e[c].appendChild(d.cloneNode(false))}},equalise:function(){var a,e,c,g,h,f,k;var a=document.getElementById("guide-shopping-list");if(!a){return}list=a.getElementsByTagName("ul");if(!a&&!a.length){return}a=list[0];e=a.getElementsByTagName("li");c=4;g=0;h=0;f=[];for(var d=0,b=e.length;d<b;d++){k=e[d];f.push(k);h=k.offsetHeight;if(h>g){g=h}if(f.length===c){for(j=0,jx=f.length;j<jx;j++){f[j].style.height=g+"px"}f=[];g=0}if(d+1===e.length){for(j=0,jx=f.length;j<jx;j++){f[j].style.height=g+"px"}}}}};UKISA.Polycell.CategoryAccordian={init:function(){var f=document.getElementById("category-list");if(!f){return}var e=f.getElementsByTagName("div");for(var d=0,a=e.length;d<a;d++){var g=e[d].className;if(g.indexOf("parent-category-content")!==-1||g.indexOf("child-category-content")!==-1){if(g.indexOf("active")===-1){e[d].style.display="none"}else{container=YAHOO.util.Dom.getPreviousSibling(e[d]);container.className="active"}}}var c=f.getElementsByTagName("h2");for(var d=0,a=c.length;d<a;d++){c[d].onclick=function(){var l=f.getElementsByTagName("div");var n=(this.nextSibling.nodeType!==1)?this.nextSibling.nextSibling:this.nextSibling;var m=n.style.display;for(var k=0,h=l.length;k<h;k++){if(l[k].className==="parent-category-content"){l[k].style.display="none"}}for(var k=0,h=c.length;k<h;k++){c[k].className=""}if(m==="block"){n.style.display="none";this.className=""}else{n.style.display="block";this.className="active"}return false}}var b=f.getElementsByTagName("h3");for(var d=0,a=b.length;d<a;d++){b[d].onclick=function(){var l=f.getElementsByTagName("div");var n=(this.nextSibling.nodeType!==1)?this.nextSibling.nextSibling:this.nextSibling;var m=n.style.display;for(var k=0,h=l.length;k<h;k++){if(l[k].className==="child-category-content"){l[k].style.display="none"}}for(var k=0,h=b.length;k<h;k++){b[k].className=""}if(m==="block"){n.style.display="none";this.className=""}else{n.style.display="block";UKISA.Polycell.CategoryAccordian.equalise(n);this.className="active"}return false}}},visual:function(){var f=document.getElementById("visual-guide-list");if(!f){return}var e=f.getElementsByTagName("div");for(var d=0,b=e.length;d<b;d++){var g,a;g=e[d].className;if(g.indexOf("parent-category-content")!==-1||g.indexOf("child-category-content")!==-1){if(g.indexOf("active")===-1){e[d].style.display="none"}else{a=YAHOO.util.Dom.getPreviousSibling(e[d]);a.className="active"}}}var c=f.getElementsByTagName("h2");for(var d=0,b=c.length;d<b;d++){c[d].onclick=function(){var l=f.getElementsByTagName("div");var n=(this.nextSibling.nodeType!==1)?this.nextSibling.nextSibling:this.nextSibling;var m=n.style.display;for(var k=0,h=l.length;k<h;k++){if(l[k].className=="parent-category-content"){l[k].style.display="none"}}for(var k=0,h=c.length;k<h;k++){c[k].className=""}if(m==="block"){n.style.display="none";this.className=""}else{n.style.display="block";this.className="active"}return false}}},equalise:function(e){var a,f,c,h,k,g;var a=e.getElementsByTagName("ul");if(!a&&!a.length){return}a=a[0];f=a.getElementsByTagName("li");c=4;h=0;k=0;g=[];for(var d=0,b=f.length;d<b;d++){var l=f[d];if(l.className.indexOf("product")!==-1){g.push(l);k=l.offsetHeight;if(k>h){h=k}if(g.length===c){for(j=0,jx=g.length;j<jx;j++){g[j].style.height=h+"px"}g=[];h=0}}if(d+1==f.length){for(j=0,jx=g.length;j<jx;j++){g[j].style.height=h+"px"}}}}};UKISA.Polycell.Stockist={canvas:null,search:function(f){var h,g,c,d,b,a;if(document.body.id!=="stockist-search-page"){return true}a=function(e){var k=e.value.toUpperCase().replace(/ /g,"");var i=new RegExp("[0-9]");if(i.test(k)){return true}var i=new RegExp("^[A-Z]{1,2}([0-9]{1,2}|[0-9][A-Z])[0-9][ABD-HJLNP-UW-Z]{2}$");if(!i.test(k)){return false}else{return true}};d=f.pc;if(a(d)){return true}b=document.getElementById("stockist-search-error");if(d&&d.value.length===0){if(!b){b=document.createElement("p");b.id="stockist-search-error";b.className="error";b.innerHTML="Please enter a postcode or location";f.insertBefore(b,f.getElementsByTagName("fieldset")[0])}return false}else{if(b){f.removeChild(b)}}if(!this.canvas){this.canvas=document.createElement("div");document.getElementById("content").appendChild(this.canvas)}this.canvas.innerHTML='<p class="ajax-loader">Please wait</p>';c=this.canvas;h={success:function(e){c.innerHTML=e.responseText},failure:function(e){c.innerHTML='<p class="error">Sorry, there is a problem and we apologise for any inconvenience caused. Please try again.</p>'},timeout:8000};YAHOO.util.Connect.setForm(f);g=YAHOO.util.Connect.asyncRequest("POST",f.getAttribute("action")+"?ajax=true",h);YAHOO.util.Event.preventDefault(f);return false},result:function(){var b,a,c;b=document.getElementById("stockist-results");if(!b){return}a=b.getElementsByTagName("li");for(c=0,ix=a.length;c<ix;c++){YAHOO.util.Event.addListener(a[c],"click",function(f){var d=this.getElementsByTagName("a");YAHOO.util.Event.preventDefault(f);if(d&&d.length){UKISA.Polycell.Stockist.map(d[0])}return false})}},map:function(c){var f,d,b,a;if(!this.canvas){this.canvas=document.getElementById("stockist-content");if(!this.canvas){this.canvas=document.createElement("div");this.canvas.id="stockist-content";a=document.getElementById("content");a.appendChild(this.canvas)}}this.canvas.innerHTML='<p class="ajax-loader">Please wait</p>';b=this.canvas;f={success:function(p){var k,h,g,e,m,n,l;b.innerHTML=p.responseText;k=decodeURI(c.getAttribute("href"));h=k.match(/pc=([a-zA-Z0-9 ]*)/);g=RegExp.$1;m=c.getElementsByTagName("span");if(m&&m.length){e=m[0].innerHTML}else{e="Polycell stockist"}n=document.getElementById("stockist-results").getElementsByTagName("li");for(l=0,ix=n.length;l<ix;l++){YAHOO.util.Dom.removeClass(n[l],"active")}n=UKISA.util.parentNode(UKISA.util.parentNode(UKISA.util.parentNode(c)));YAHOO.util.Dom.addClass(n,"active");UKISA.widget.MultiMap.reload("stockist-map",g.replace(/ /g,""),e.replace(/&amp;/g,"&"))},failure:function(e){b.innerHTML='<p class="error">Sorry, there is a problem and we apologise for any inconvenience caused. Please try again.</p>'},timeout:8000};d=YAHOO.util.Connect.asyncRequest("GET",c.getAttribute("href").replace("store","accountRef")+"&ajax=true",f);return false}};UKISA.Polycell.ShoppingList=function(){this.init()};UKISA.Polycell.ShoppingList.prototype={init:function(){this.config={offsetY:12,startY:114,minWidth:700,duration:0.5};this.note={anim:null};this.tab={anim:null,state:true};var b=document.getElementById("notebook-tab");if(b){var a=this;YAHOO.util.Event.addListener(b,"click",this.toggle,null,this);this.tab.anim=new YAHOO.util.Anim("notebook-body");this.tab.anim.duration=0.3;this.tab.anim.method=YAHOO.util.Easing.easeOut;this.tab.anim.onComplete.subscribe(function(){a.tab.state=!a.tab.state})}this.move();YAHOO.util.Event.addListener(window,"scroll",this.move,null,this);YAHOO.util.Event.addListener(window,"resize",this.resize)},toggle:function(){var b=(this.tab.state)?169:0;var a=(this.tab.state)?0:169;this.tab.anim.attributes.width={from:b,to:a};this.tab.anim.animate()},move:function(b){var c,a;if(UKISA.util.getScrollXY()[1]<114){a=new YAHOO.util.Anim("notebook",{top:{to:100}},0.5,YAHOO.util.Easing.backOut).animate()}else{a=new YAHOO.util.Anim("notebook",{top:{to:UKISA.util.getScrollXY()[1]+14}},0.5,YAHOO.util.Easing.backOut).animate()}},resize:function(a){},attach:function(){var a=document.getElementById("add-shopping-list");if(a){YAHOO.util.Event.addListener(a,"submit",this.add,null,this)}},add:function(d){var h,g,f,b,a,c;a=document.getElementById("notebook-content");if(!a){return}b=document.getElementById("add-shopping-list");c=document.getElementById("add-shopping-list-add");c.src=c.src.replace("shopping_list_add.gif","shopping_list_loading.gif");h={success:function(i){var e;e=document.getElementById("add-shopping-list-error");if(e){e.parentNode.removeChild(e)}a.innerHTML=i.responseText;c.src=c.src.replace("shopping_list_loading.gif","shopping_list_success.gif");c.disabled=true},failure:function(i){var e;e=document.getElementById("add-shopping-list-error");if(e){e.parentNode.removeChild(e)}e=document.createElement("p");e.id="add-shopping-list-error";e.className="error";e.innerHTML="Sorry, this could not be added to your shopping list.";b.appendChild(e);c.src=c.src.replace("shopping_list_loading.gif","shopping_list_add.gif")},timeout:8000};f="colour="+encodeURIComponent(b.colour.value);f+="&listaction="+encodeURIComponent(b.listaction.value);f+="&product="+encodeURIComponent(b.product.value);f+="&successURL="+encodeURIComponent("/includes/mini_shopping_list.jsp");g=YAHOO.util.Connect.asyncRequest("POST",b.getAttribute("action")+"?ajax=true",h,f);YAHOO.util.Event.preventDefault(d);return false},multiAttach:function(){var a,b;a=document.getElementById("guide-shopping-list");forms=a.getElementsByTagName("form");for(b=0,ix=forms.length;b<ix;b++){YAHOO.util.Event.addListener(forms[b],"submit",this.multiAdd,null,this)}},multiAdd:function(k){var b,l,d,f,a,c,m,g,h;c=document.getElementById("notebook-content");if(!c){return}a=(window.event)?k.srcElement:k.target;h=a.getElementsByTagName("input");for(g=0,ix=h.length;g<ix;g++){if(h[g].getAttribute("type")==="image"){m=h[g];break}}m.src=m.src.replace("shopping_list_add_multi.gif","shopping_list_multi_loading.gif");m.src=m.src.replace("shopping_list_guide_add.gif","shopping_list_guide_loading.gif");l={success:function(i){var e;e=document.getElementById("add-shopping-list-error");if(e){e.parentNode.removeChild(e)}c.innerHTML=i.responseText;m.src=m.src.replace("shopping_list_multi_loading.gif","shopping_list_multi_success.gif");m.src=m.src.replace("shopping_list_guide_loading.gif","shopping_list_guide_success.gif");m.disabled=true},failure:function(n){var i,e;i=document.getElementById("add-shopping-list-error");if(i){i.parentNode.removeChild(i)}i=document.createElement("p");i.id="add-shopping-list-error";i.className="error";i.innerHTML="Sorry, this could not be added to your shopping list.";if(document.body.id==="guide-page"){e=document.getElementById("add-shopping-list");e.appendChild(i)}else{a.appendChild(i)}m.src=m.src.replace("shopping_list_multi_loading.gif","shopping_list_add_multi.gif");m.src=m.src.replace("shopping_list_loading.gif","shopping_list_add_multi.gif");m.src=m.src.replace("shopping_list_guide_loading.gif","shopping_list_guide_add.gif")},timeout:8000};f="colour="+encodeURIComponent(a.colour.value);f+="&listaction="+encodeURIComponent(a.listaction.value);f+="&successURL="+encodeURIComponent("/includes/mini_shopping_list.jsp");if(a.product){f+="&product="+encodeURIComponent(a.product.value)}if(a.products){f+="&products="+encodeURIComponent(a.products.value)}d=YAHOO.util.Connect.asyncRequest("POST",a.getAttribute("action")+"?ajax=true",l,f);YAHOO.util.Event.preventDefault(k);return false}};
