var ddlevelsmenu={downarrowpointer:["/wcsstore/ConsumerDirectStorefrontAssetStore/images/arrow-down.gif",11,7],rightarrowpointer:["/wcsstore/ConsumerDirectStorefrontAssetStore/images/arrow-right.gif",12,12],hideinterval:200,httpsiframesrc:"/wcsstore/blank.htm",topmenuids:[],topitems:{},subuls:{},topitemsindex:-1,ulindex:-1,hidetimers:{},shimadded:false,getoffset:function(b,a){return(b.offsetParent)?b[a]+this.getoffset(b.offsetParent,a):b[a];},getoffsetof:function(a){a._offsets={left:this.getoffset(a,"offsetLeft"),top:this.getoffset(a,"offsetTop")};},getwindowsize:function(){this.docwidth=window.innerWidth?window.innerWidth-10:this.standardbody.clientWidth-10;this.docheight=window.innerHeight?window.innerHeight-15:this.standardbody.clientHeight-18;},gettopitemsdimensions:function(){for(var a=0;a<this.topmenuids.length;a++){var d=this.topmenuids[a];for(var b=0;b<this.topitems[d].length;b++){var e=this.topitems[d][b];var c=document.getElementById(e.getAttribute("rel"));e._dimensions={w:e.offsetWidth,h:e.offsetHeight,submenuw:c.offsetWidth,submenuh:c.offsetHeight};}}},isContained:function(a,b){var b=window.event||b;var d=b.relatedTarget||((b.type=="mouseover")?b.fromElement:b.toElement);while(d&&d!=a){try{d=d.parentNode;}catch(b){d=a;}}if(d==a){return true;}else{return false;}},addpointer:function(b,d,a){var c=document.createElement("img");c.src=a[0];c.style.width=a[1]+"px";c.style.height=a[2]+"px";c.className=d;b.appendChild(c);},css:function(b,a,c){var d=new RegExp("(^|\\s+)"+a+"($|\\s+)","ig");if(c=="check"){return d.test(b.className);}else{if(c=="remove"){b.className=b.className.replace(d,"");}else{if(c=="add"&&!d.test(b.className)){b.className+=" "+a;}}}},addshimmy:function(b){var c=(!window.opera)?document.createElement("iframe"):document.createElement("div");c.className="ddiframeshim";c.setAttribute("src",location.protocol=="https:"?this.httpsiframesrc:"about:blank");c.setAttribute("frameborder","0");b.appendChild(c);try{c.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";}catch(a){}return c;},positionshim:function(g,c,a,f,e){if(g._istoplevel){var e=window.pageYOffset?window.pageYOffset:this.standardbody.scrollTop;var d=g._offsets.top-e;var b=e+this.docheight-g._offsets.top-g._dimensions.h;if(d>0){this.shimmy.topshim.style.left=f+"px";this.shimmy.topshim.style.top=e+"px";this.shimmy.topshim.style.width="99%";this.shimmy.topshim.style.height=d+"px";}if(b>0){this.shimmy.bottomshim.style.left=f+"px";this.shimmy.bottomshim.style.top=g._offsets.top+g._dimensions.h+"px";this.shimmy.bottomshim.style.width="99%";this.shimmy.bottomshim.style.height=b+"px";}}},hideshim:function(){this.shimmy.topshim.style.width=this.shimmy.bottomshim.style.width=0;this.shimmy.topshim.style.height=this.shimmy.bottomshim.style.height=0;},buildmenu:function(d,f,c,e,a,b){f._master=d;f._pos=e;f._istoplevel=a;if(a){this.addEvent(f,function(g){ddlevelsmenu.hidemenu(ddlevelsmenu.subuls[this._master][parseInt(this._pos)]);},"click");}this.subuls[d][e]=c;f._dimensions={w:f.offsetWidth,h:f.offsetHeight,submenuw:c.offsetWidth,submenuh:c.offsetHeight};this.getoffsetof(f);c.style.left=0;c.style.top=0;c.style.visibility="hidden";this.addEvent(f,function(j){if(!ddlevelsmenu.isContained(this,j)){if(typeof ddlevelsmenu.hidetimers[this._master][parseInt(this._pos)]!="undefined"){clearTimeout(ddlevelsmenu.hidetimers[this._master][parseInt(this._pos)]);}if(this._istoplevel){ddlevelsmenu.css(this,"selected","add");}var h=ddlevelsmenu.subuls[this._master][parseInt(this._pos)];ddlevelsmenu.getoffsetof(f);var l=window.pageXOffset?window.pageXOffset:ddlevelsmenu.standardbody.scrollLeft;var i=window.pageYOffset?window.pageYOffset:ddlevelsmenu.standardbody.scrollTop;var n=this._offsets.left+this._dimensions.submenuw+(this._istoplevel&&b=="topbar"?0:this._dimensions.w);var g=this._offsets.top+this._dimensions.submenuh;var m=(this._istoplevel?this._offsets.left+(b=="sidebar"?this._dimensions.w:0):this._dimensions.w);if(n-l>ddlevelsmenu.docwidth){m+=-this._dimensions.submenuw+(this._istoplevel&&b=="topbar"?this._dimensions.w:-this._dimensions.w);}h.style.left=m+"px";var k=(this._istoplevel?this._offsets.top+(b=="sidebar"?0:this._dimensions.h):this.offsetTop);if(g-i>ddlevelsmenu.docheight){if(this._dimensions.submenuh<this._offsets.top+(b=="sidebar"?this._dimensions.h:0)-i){k+=-this._dimensions.submenuh+(this._istoplevel&&b=="topbar"?-this._dimensions.h:this._dimensions.h);}else{k+=-(this._offsets.top-i)+(this._istoplevel&&b=="topbar"?-this._dimensions.h:0);}}h.style.top=k+"px";ddlevelsmenu.positionshim(this,h,b,l,i);h.style.visibility="visible";}},"mouseover");this.addEvent(f,function(i){if(this._istoplevel){var g=ddlevelsmenu.subuls[this._master][parseInt(this._pos)];if(!ddlevelsmenu.isContained(this,i)&&!ddlevelsmenu.isContained(g,i)){ddlevelsmenu.hidemenu(g);}}else{if(!this._istoplevel&&!ddlevelsmenu.isContained(this,i)){var h=this;ddlevelsmenu.hidetimers[this._master][parseInt(this._pos)]=setTimeout(function(){var j=ddlevelsmenu.subuls[h._master][parseInt(h._pos)];ddlevelsmenu.hidemenu(j);},ddlevelsmenu.hideinterval);}}},"mouseout");},hidemenu:function(a){if(typeof a._pos!="undefined"){this.css(this.topitems[a._master][parseInt(a._pos)],"selected","remove");this.hideshim();}a.style.left=0;a.style.top="-1000px";a.style.visibility="hidden";},addEvent:function(b,c,a){if(b.addEventListener){b.addEventListener(a,c,false);}else{if(b.attachEvent){b.attachEvent("on"+a,function(){return c.call(b,window.event);});}}},init:function(b,e){this.standardbody=(document.compatMode=="CSS1Compat")?document.documentElement:document.body;this.topitemsindex=-1;this.ulindex=-1;this.topmenuids.push(b);this.topitems[b]=[];this.subuls[b]=[];this.hidetimers[b]=[];if(!this.shimadded){this.shimmy={};this.shimmy.topshim=this.addshimmy(document.body);this.shimmy.bottomshim=this.addshimmy(document.body);this.shimadded=true;}var j=document.getElementById(b);var d=j.getElementsByTagName("a");this.getwindowsize();for(var g=0;g<d.length;g++){if(d[g].getAttribute("rel")){this.topitemsindex++;this.ulindex++;var l=d[g];this.topitems[b][this.topitemsindex]=l;var m=document.getElementById(l.getAttribute("rel"));m.style.zIndex=2000;m._master=b;m._pos=this.topitemsindex;this.addEvent(m,function(){ddlevelsmenu.hidemenu(this);},"click");var h=(e=="sidebar")?"rightarrowpointer":"downarrowpointer";this.addpointer(l,h,this[h]);this.buildmenu(b,l,m,this.ulindex,true,e);this.addEvent(m,function(i){if(!ddlevelsmenu.isContained(this,i)&&!ddlevelsmenu.isContained(ddlevelsmenu.topitems[this._master][parseInt(this._pos)],i)){var c=this;ddlevelsmenu.hidetimers[this._master][parseInt(this._pos)]=setTimeout(function(){ddlevelsmenu.hidemenu(c);},ddlevelsmenu.hideinterval);}},"mouseout");var f=m.getElementsByTagName("ul");for(var k=0;k<f.length;k++){this.ulindex++;var a=f[k].parentNode;this.addpointer(a.getElementsByTagName("a")[0],"rightarrowpointer",this.rightarrowpointer);this.buildmenu(b,a,f[k],this.ulindex,false,e);}}}this.addEvent(window,function(){ddlevelsmenu.getwindowsize();ddlevelsmenu.gettopitemsdimensions();},"resize");},setup:function(b,a){this.addEvent(window,function(){ddlevelsmenu.init(b,a);},"load");}};