BWS=function(){};BWS.settings={};BWS.states=[];BWS.Init=function(){try{new BWS.Menu(document.getElementById("nav"),"mouseover")}catch(b){}try{var c=new BWS.Menu(document.getElementById("left-nav").firstChild,"click",false);c.SetSelected("current")}catch(b){}try{NG.addEventListener(NG.getElementsByClassName(document.body,"rsa")[0],"click",function(){document.location.href=BWS.settings.RSAURL})}catch(b){}try{NG.addEventListener(document.getElementById("postcode").getElementsByTagName("img")[0],"click",function(){BWS.OpenStorefinder(document.getElementById("locator").value)})}catch(b){}try{NG.addEventListener(NG.getElementsByClassName(document.getElementById("window"),"button-close")[0],"click",function(){document.location.href=BWS.settings.HomeURL})}catch(b){}try{var a=new BWS.Search("search")}catch(b){}};BWS.OpenStorefinder=function(c){var a=new NGUrl(BWS.settings.LocatorURL);var b=c.replace(/\./gi,"");if(!isNaN(c)&&(c%1==0)){a.addArgument("postcode",c,true)}else{if(this.states.indexOf(b.toUpperCase())>-1){a.addArgument("state",b,true)}else{a.addArgument("suburb",c,true)}}NG.popup(a.toString(),{scrollbars:"no",width:700,height:550,position:"windowcentre"})};BWS.Menu=function(f,h,e){this.node=f;this.mode=h;this.selected=null;if(e!=false){var d=this.node.getElementsByTagName("ul");for(var c=0;c<d.length;c++){var g=new BWS.Menu(d[c],h,false);d[c].bwsMenu=g}}var b=this;var a=this.node.getElementsByTagName("li");for(var c=0;c<a.length;c++){if(a[c].parentNode==this.node){NG.addEventListener(a[c],this.mode,function(i){b.Select(this);NG.stopPropagation(i)})}}NG.addEventListener(this.node,this.mode,function(i){NG.stopPropagation(i)});if(this.mode=="mouseover"){NG.addEventListener(document.body,this.mode,function(i){b.Unselect()})}};BWS.Menu.prototype.SetSelected=function(c){var b=NG.getElementsByClassName(this.node,c)[0];this.Select(b);for(var a=0;a<b.children.length;a++){if(b.children[a].bwsMenu!=null){b.children[a].bwsMenu.SetSelected(c)}}};BWS.Menu.prototype.Select=function(a){if(this.selected!=a){if(this.selected){NG.delClass(this.selected,"selected")}this.selected=a;NG.addClass(this.selected,"selected")}};BWS.Menu.prototype.Unselect=function(){if(this.selected){NG.delClass(this.selected,"selected")}this.selected=null};BWS.ButtonGroup=function(b,c){if(isStr(b)){b=document.getElementById(b)}this.form=b;if(c){var a=document.createElement("span");a.innerHTML='<input type="hidden" name="'+c+'" id="'+c+'" />';this.form.appendChild(a);this.field=a.lastChild}else{this.field=null}this.buttons=[]};BWS.ButtonGroup.prototype.Add=function(b){if(isStr(b)){b=document.getElementById(b)}if(b){var a=this;NG.addEventListener(b,"click",function(){a.Select(b)});this.buttons.push(b)}};BWS.ButtonGroup.prototype.Select=function(a){if(isStr(a)){a=document.getElementById(a)}if(this.selected!=null){NG.delClass(this.selected,"button-select")}this.selected=a;NG.addClass(a,"button-select");if(this.field){this.field.value=(a.alt?a.alt:a.title)}};BWS.StateSelector=function(b){var a=this;this.id=b;this.root=document.getElementById("state-selector-"+this.id);this.map=document.getElementById("state-selector-imagemap");this.hover=null;this.selected=null;NG.addEventListener(this.root,"mouseover",function(c){NG.stopPropagation(c)});NG.addEventListener(this.map,"mouseover",function(c){NG.stopPropagation(c)});NG.addEventListener(document,"mouseover",function(c){a.Hover(a.selected)})};BWS.StateSelector.prototype.Add=function(a,e,g){var c=this;var f=document.getElementById("state-selector-"+(g?g+"-":"")+"imagemap-"+a);var d=NG.getElementsByClassName(this.root,"state-selector-"+a)[0];NG.addEventListener(f,"mouseover",function(h){c.Hover(d)});NG.addEventListener(d,"click",function(){c.Select(a,true)});if(e){for(var b=0;b<e.length;b++){this.Add(a,null,e[b])}}};BWS.StateSelector.prototype.Hover=function(a){if(this.hover==a){return}if(this.hover!=null){NG.delClass(this.hover,"state-selector-state-hover")}this.hover=a;if(this.hover!=null){NG.addClass(this.hover,"state-selector-state-hover")}};BWS.StateSelector.prototype.Select=function(b,d){var c=NG.getElementsByClassName(this.root,"state-selector-"+b)[0];this.Hover(c);this.selected=c;if(d){var a=NGUrl.thisRequest();a.addArgument("op","setstate",true);a.addArgument("bwsstate",b,true);a.redirect()}};BWS.Search=function(a){BWS.ButtonGroup.apply(this,[a]);this.Add("search-tab-store");this.Add("search-tab-site");this.Select("search-tab-store");NG.addEventListener(NG.getElementsByClassName(this.form,"button-stores")[0],"click",function(){BWS.OpenStorefinder(document.getElementById("search-store").value)});NG.addEventListener(NG.getElementsByClassName(this.form,"button-site")[0],"click",function(){var b=new NGUrl(BWS.settings.SearchResultsURL);b.addArgument("Query",document.getElementById("search-site").value,true);b.redirect()})};BWS.Search.prototype=new BWS.ButtonGroup();BWS.Search.prototype.Add=function(a){BWS.ButtonGroup.prototype.Add.apply(this,[a]);var c=document.getElementById(a).getElementsByTagName("input");for(var b=0;b<c.length;b++){c[b].focusText=c[b].value;NG.addEventListener(c[b],"focus",function(){if(this.value==this.focusText){this.value=""}});NG.addEventListener(c[b],"blur",function(){if(this.value==""){this.value=this.focusText}})}};BWS.AddMeta=function(){var a=!NG.hasClass(document.getElementById("page"),"noads");if(typeof NGCMSLoader!="undefined"){var b=NGCMSLoader._start;NGCMSLoader._start=function(){var c=NGCMS.load;NGCMS.load=function(d){c(d);NG.addEventListener(NGCMS.getSideNode(),"load",function(){var f=NGCMS.getSideNode().contentWindow.document;var e=f.getElementById("meta-form");var g=f.createElement("div");g.innerHTML='<b>Tiles</b><br /><label><input type="checkbox" name="BWSShowAds" /> Show</label>';e.appendChild(g);g.getElementsByTagName("input")[0].checked=a})};b()}}};BWS.Ratings=function(d){if(isStr(d)){var d=document.getElementById(d)}this.root=d;this.root.BWSRatings=this;this.ratings={};this.current=0;this.init=false;var b=this;var c=NG.getElementsByClassName(this.root,"slot");for(var a=0;a<c.length;a++){NG.addEventListener(c[a],"click",function(){b.Select(this)})}};BWS.Ratings.Init=function(a){if(typeof a=="undefined"){setTimeout("BWS.Ratings.Init(true);",1000);return}else{var c=NG.getElementsByClassName(document,"bwsratings");for(var b=0;b<c.length;b++){if(!c[b].BWSRatings.init){c[b].BWSRatings.Init()}}}};BWS.Ratings.prototype.Init=function(){var a=NG.getElementsByClassName(this.root,"slot-0")[0];this.init=true;if(a.BWSRating){this.Select(a)}else{setTimeout("BWS.Ratings.Init();",1000)}};BWS.Ratings.prototype.Add=function(a){this.ratings[a.id]=a;if(this.current<5){this.Set(this.current,a.id)}this.current++};BWS.Ratings.prototype.Select=function(a){if(isInt(a)){a=BWS.ratings[a].slot}if(a.BWSRating){this.Set(0,a.BWSRating,true)}else{var b=a.className.match(/slot-([0-9]+)/)[1];this.Set(b,NG.getElementsByClassName(this.root,"slot-0")[0].BWSRating);this.Clear(0)}};BWS.Ratings.prototype.Set=function(g,f,e){var b=this;var d=NG.getElementsByClassName(this.root,"slot-"+g)[0];var c=this.ratings[f];if(!this.init){setTimeout(function(){b.Set(g,f,e)},1000);return}if(!c){return}switch(d.tagName){case"OBJECT":if(isFunc(d.Change)){d.Change(c.ProductMedia,c.LargeMedia,c.Staff,c.Product,c.Header,c.Body)}break;default:d.style.backgroundImage="url("+c.FramedMedia+")";var a=d.getElementsByTagName("img")[0];if(a){a.src=c.SmallProductMedia;a.style.display="inline"}break}if(e&&d.BWSRating){this.Set(c.slot,d.BWSRating)}else{if(c.slot){this.Clear(c.slot)}}d.BWSRating=f;this.ratings[f].slot=g};BWS.Ratings.prototype.Clear=function(c){var b=NG.getElementsByClassName(this.root,"slot-"+c)[0];switch(b.tagName){case"OBJECT":b.Change("","","","","","");break;default:b.style.backgroundImage="none";var a=b.getElementsByTagName("img")[0];if(a){a.style.display="none"}break}b.BWSRating=null};BWS.Specials=function(){};BWS.Specials.Init=function(d,a){var c=d.getElementsByTagName("span");for(var b=0;b<c.length;b++){if(NG.hasClass(c[b],"button-download")){NG.addEventListener(c[b],"click",function(){window.location=a})}if(NG.hasClass(c[b],"button-friend")){NG.addEventListener(c[b],"click",function(){new NG.SendToFriends("",1);BWS.SendToFriends()})}if(NG.hasClass(c[b],"button-contents")){NG.addEventListener(c[b],"click",function(){tmp.TOC()})}}};BWS.SendToFriends=function(){var j=document.getElementById("ngcms-region-main");var b=j.style.visibility;var f=j.style.display;var k=document.getElementsByTagName("input");for(var c=0;c<k.length;c++){var g=k[c];if(g.value=="Send"&&g.type=="submit"){NG.addEventListener(g,"click",function(){j.style.visibility=b;j.style.display=f})}}var h=document.getElementsByTagName("div");for(var c=0;c<h.length;c++){var a=h[c];if(NG.hasClass(a,"close")&&a.innerHTML=="X"){NG.addEventListener(a,"click",function(){j.style.visibility=b;j.style.display=f})}try{this.node.appendChild(this.toc)}catch(d){}}j.style.visibility="hidden";j.style.display="none"};BWS.Character=function(b){this.id=b.id;this.media=b.Media;this.width=b.Width;this.height=b.Height;var a=this;setTimeout(function(){a.Start()},(b.Delay||b.delay)*1000)};BWS.Character.Mute=function(a){document.cookie="bws.character.mute="+(a||a=="true")};BWS.Character.IsMute=function(){var c=document.cookie.split(";");for(var b=0;b<c.length;b++){var a=c[b].split("=");if(a[0].replace(" ","")=="bws.character.mute"){return(a[1]||a[1]=="true")}}return false};BWS.Character.FinishAll=function(){var b=NG.getElementsByClassName(document.body,"bwscharacter");for(var a=0;a<b.length;a++){b[a].BWSCharacter.Finish()}};BWS.Character.prototype.Start=function(){this.node=document.createElement("div");this.node.BWSCharacter=this;this.node.id="bwscharacter-"+this.id;NG.addClass(this.node,"bwscharacter");document.getElementById("page").appendChild(this.node);swfobject.embedSWF(this.media,this.node.id,this.width,this.height,"8","/js/expressInstall.swf",{},{wmode:"transparent",loop:"false"},{"class":"bwscharacter",style:"width:"+this.width+"px; height:"+this.height+"px;"});document.getElementById(this.node.id).BWSCharacter=this};BWS.Character.prototype.Finish=function(){var a=document.getElementById(this.node.id);a.style.display="none";a.parent.removeChild(a)};CharacterFinished=function(){return BWS.Character.FinishAll()};IsMute=function(){return BWS.Character.IsMute()};Mute=function(a){return BWS.Character.Mute(a)};