MooTools.More={version:"1.2.4.4",build:"6f6057dc645fdb7547689183b2311063bd653ddf"};Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a);var d=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=document.id(this.element.getDocument().body);}var c=this.element;if(this.options.wheelStops){this.addEvent("start",function(){c.addEvent("mousewheel",d);},true);this.addEvent("complete",function(){c.removeEvent("mousewheel",d);},true);}},set:function(){var a=Array.flatten(arguments);if(Browser.Engine.gecko){a=[Math.round(a[0]),Math.round(a[1])];}this.element.scrollTo(a[0],a[1]);},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a);});},start:function(c,g){if(!this.check(c,g)){return this;}var e=this.element.getScrollSize(),b=this.element.getScroll(),d={x:c,y:g};for(var f in d){var a=e[f];if($chk(d[f])){d[f]=($type(d[f])=="number")?d[f]:a;}else{d[f]=b[f];}d[f]+=this.options.offset[f];}return this.parent([b.x,b.y],[d.x,d.y]);},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start("right",false);},toBottom:function(){return this.start(false,"bottom");},toElement:function(b){var a=document.id(b).getPosition(this.element);return this.start(a.x,a.y);},scrollIntoView:function(c,e,d){e=e?$splat(e):["x","y"];var h={};c=document.id(c);var f=c.getPosition(this.element);var i=c.getSize();var g=this.element.getScroll();var a=this.element.getSize();var b={x:f.x+i.x,y:f.y+i.y};["x","y"].each(function(j){if(e.contains(j)){if(b[j]>g[j]+a[j]){h[j]=b[j]-a[j];}if(f[j]<g[j]){h[j]=f[j];}}if(h[j]==null){h[j]=g[j];}if(d&&d[j]){h[j]=h[j]+d[j];}},this);if(h.x!=g.x||h.y!=g.y){this.start(h.x,h.y);}return this;},scrollToCenter:function(c,e,d){e=e?$splat(e):["x","y"];c=$(c);var h={},f=c.getPosition(this.element),i=c.getSize(),g=this.element.getScroll(),a=this.element.getSize(),b={x:f.x+i.x,y:f.y+i.y};["x","y"].each(function(j){if(e.contains(j)){h[j]=f[j]-(a[j]-i[j])/2;}if(h[j]==null){h[j]=g[j];}if(d&&d[j]){h[j]=h[j]+d[j];}},this);if(h.x!=g.x||h.y!=g.y){this.start(h.x,h.y);}return this;}});Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",wrapper:false,hideOverflow:true},initialize:function(b,a){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);if(this.open){this.wrapper.setStyle("height","");}if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=document.id(b);this.parent(a);var d=this.element.retrieve("wrapper");var c=this.element.getStyles("margin","position","overflow");if(this.options.hideOverflow){c=$extend(c,{overflow:"hidden"});}if(this.options.wrapper){d=document.id(this.options.wrapper).setStyles(c);}this.wrapper=d||new Element("div",{styles:c}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},set:function(a){this.element.setStyle(this.margin,a[0]);this.wrapper.setStyle(this.layout,a[1]);return this;},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a);});},start:function(b,e){if(!this.check(b,e)){return this;}this[e||this.options.mode]();var d=this.element.getStyle(this.margin).toInt();var c=this.wrapper.getStyle(this.layout).toInt();var a=[[d,c],[0,this.offset]];var g=[[d,c],[-this.offset,0]];var f;switch(b){case"in":f=a;break;case"out":f=g;break;case"toggle":f=(c==0)?a:g;}return this.parent(f[0],f[1]);},slideIn:function(a){return this.start("in",a);},slideOut:function(a){return this.start("out",a);},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(a){this[a||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(a){return this.start("toggle",a);}});Element.Properties.slide={set:function(b){var a=this.retrieve("slide");if(a){a.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},b));},get:function(a){if(a||!this.retrieve("slide")){if(a||!this.retrieve("slide:options")){this.set("slide",a);}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));}return this.retrieve("slide");}};Element.implement({slide:function(d,e){d=d||"toggle";var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[c?"slideOut":"slideIn"](e);this.store("slide:flag",!c);a=true;break;default:b.start(d,e);}if(!a){this.eliminate("slide:flag");}return this;}});var Asset={javascript:function(f,d){d=$extend({onload:$empty,document:document,check:$lambda(true)},d);if(d.onLoad){d.onload=d.onLoad;}var b=new Element("script",{src:f,type:"text/javascript"});var e=d.onload.bind(b),a=d.check,g=d.document;delete d.onload;delete d.check;delete d.document;b.addEvents({load:e,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){e();}}}).set(d);if(Browser.Engine.webkit419){var c=(function(){if(!$try(a)){return;}$clear(c);e();}).periodical(50);}return b.inject(g.head);},css:function(b,a){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:b},a)).inject(document.head);},image:function(c,b){b=$merge({onload:$empty,onabort:$empty,onerror:$empty},b);var d=new Image();var a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var g="on"+e;var f=e.capitalize();if(b["on"+f]){b[g]=b["on"+f];}var h=b[g];delete b[g];d[g]=function(){if(!d){return;}if(!a.parentNode){a.width=d.width;a.height=d.height;}d=d.onload=d.onabort=d.onerror=null;h.delay(1,a,a);a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);}return a.set(b);},images:function(d,c){c=$merge({onComplete:$empty,onProgress:$empty,onError:$empty,properties:{}},c);d=$splat(d);var a=[];var b=0;return new Elements(d.map(function(e){return Asset.image(e,$extend(c.properties,{onload:function(){c.onProgress.call(this,b,d.indexOf(e));b++;if(b==d.length){c.onComplete();}},onerror:function(){c.onError.call(this,b,d.indexOf(e));b++;if(b==d.length){c.onComplete();}}}));}));}};(function(){var a=function(c,b){return(c)?($type(c)=="function"?c(b):b.get(c)):"";};this.Tips=new Class({Implements:[Events,Options],options:{onShow:function(){this.tip.setStyle("display","block");},onHide:function(){this.tip.setStyle("display","none");},title:"title",text:function(b){return b.get("rel")||b.get("href");},showDelay:100,hideDelay:100,className:"tip-wrap",offset:{x:16,y:16},windowPadding:{x:0,y:0},fixed:false},initialize:function(){var b=Array.link(arguments,{options:Object.type,elements:$defined});this.setOptions(b.options);if(b.elements){this.attach(b.elements);}this.container=new Element("div",{"class":"tip"});},toElement:function(){if(this.tip){return this.tip;}return this.tip=new Element("div",{"class":this.options.className,styles:{position:"absolute",top:0,left:0}}).adopt(new Element("div",{"class":"tip-top"}),this.container,new Element("div",{"class":"tip-bottom"})).inject(document.body);},attach:function(b){$$(b).each(function(d){var f=a(this.options.title,d),e=a(this.options.text,d);d.erase("title").store("tip:native",f).retrieve("tip:title",f);d.retrieve("tip:text",e);this.fireEvent("attach",[d]);var c=["enter","leave"];if(!this.options.fixed){c.push("move");}c.each(function(h){var g=d.retrieve("tip:"+h);if(!g){g=this["element"+h.capitalize()].bindWithEvent(this,d);}d.store("tip:"+h,g).addEvent("mouse"+h,g);},this);},this);return this;},detach:function(b){$$(b).each(function(d){["enter","leave","move"].each(function(e){d.removeEvent("mouse"+e,d.retrieve("tip:"+e)).eliminate("tip:"+e);});this.fireEvent("detach",[d]);if(this.options.title=="title"){var c=d.retrieve("tip:native");if(c){d.set("title",c);}}},this);return this;},elementEnter:function(c,b){this.container.empty();["title","text"].each(function(e){var d=b.retrieve("tip:"+e);if(d){this.fill(new Element("div",{"class":"tip-"+e}).inject(this.container),d);}},this);$clear(this.timer);this.timer=(function(){this.show(this,b);this.position((this.options.fixed)?{page:b.getPosition()}:c);}).delay(this.options.showDelay,this);},elementLeave:function(c,b){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this,b);this.fireForParent(c,b);},fireForParent:function(c,b){b=b.getParent();if(!b||b==document.body){return;}if(b.retrieve("tip:enter")){b.fireEvent("mouseenter",c);}else{this.fireForParent(c,b);}},elementMove:function(c,b){this.position(c);},position:function(e){if(!this.tip){document.id(this);}var c=window.getSize(),b=window.getScroll(),f={x:this.tip.offsetWidth,y:this.tip.offsetHeight},d={x:"left",y:"top"},g={};for(var h in d){g[d[h]]=e.page[h]+this.options.offset[h];if((g[d[h]]+f[h]-b[h])>c[h]-this.options.windowPadding[h]){g[d[h]]=e.page[h]-this.options.offset[h]-f[h];}}this.tip.setStyles(g);},fill:function(b,c){if(typeof c=="string"){b.set("html",c);}else{b.adopt(c);}},show:function(b){if(!this.tip){document.id(this);}this.fireEvent("show",[this.tip,b]);},hide:function(b){if(!this.tip){document.id(this);}this.fireEvent("hide",[this.tip,b]);}});})();var srchtxt='Search all products...';var _gaq=_gaq||[];window.addEvent('domready',function(){var srchfm=$('srchfm');var srch=srchfm.getElement('input');if(srch.value.trim()=='')srch.value=srchtxt;srch.addEvents({'focus':function(){if(srch.value==srchtxt)srch.value='';},'blur':function(){if(srch.value.trim()=='')srch.value=srchtxt;}});srchfm.addEvent('submit',function(){if(srch.value.trim()==''||srch.value.trim()==srchtxt)return false;});var ships=$$('div.ships');if(ships.length>0){var shipImg=new Element('span',{'html':'In Stock','title':'Product usually ships within 24 hours','style':'cursor:help','events':{'click':function(){var myDiv=new Element('div',{'styles':{'padding':'5px','text-align':'center'},'html':'This product usually ships within 24 hours of purchase.'});var showError=new pleromaPopup({height:50,width:400,data:myDiv,title:'Product Shipping Information',overlay:true,clickOverlayClose:true});}}});ships.each(function(item){var clone=shipImg.clone().cloneEvents(shipImg).inject(item);});}
var noships=$$('div.noships');if(noships.length>0){var s=new Element('span',{'html':'4-10 Day<br />Shipping','title':'Product usually ships within 4-10 days','style':'cursor:help','events':{'click':function(){var myDiv=new Element('div',{'styles':{'padding':'5px','text-align':'center'},'html':'This product usually ships within 4-10 days.<br /><br />Please <a href="'+base+'contact_us">contact us</a> if you require more detailed information.'});var showError=new pleromaPopup({height:70,width:400,data:myDiv,title:'Product Shipping Information',overlay:true,clickOverlayClose:true});}}});noships.each(function(item){var clone=s.clone().cloneEvents(s).inject(item);});}
var jsWarnings=$$('.jswarning');jsWarnings.each(function(item){item.destroy();});var tbls=$$('table.p');var maxLen=180;tbls.each(function(item){var elid=item.id;var id=elid.replace(/p_/,'');var imglnk=item.getElement('td.pimg').addEvent('click',function(){pinfo(id);});imglnk.set('title','Click for more information');var descrBlock=item.getElement('td.pdescr');var descrElm=descrBlock.getElement('div.descr');var descrTxt=descrElm.innerHTML;if(descrTxt.length>maxLen){descrTxt=descrTxt.substring(0,maxLen);descrTxt=descrTxt.replace(/\w+$/,'');descrTxt+='... ';descrElm.innerHTML=descrTxt;}
lastChars=descrTxt.substring(descrTxt.length-4);if(lastChars=='... ')var moreInfo=new Element('a',{'class':'more','html':'more details','href':'javascript:;',events:({'click':function(){pinfo(id)}})}).inject(descrElm);var h3=descrBlock.getElement('h3');var titlelnk=new Element('span',{'html':h3.get('html'),events:{'click':function(){pinfo(id);}}}).inject(h3.empty());var choiceBlock=item.getElement('td.pchoice');var rrpTitle=item.getElement('div.rrp').set('title','Recommended Retail Price');var spTitle=item.getElement('div.sp');if(spTitle)spTitle.set('title','Special Price');var rprTitle=item.getElement('div.rpr');if(rprTitle)rprTitle.set('title','Your Reseller Price');var atclink=new Element('div',{'class':'atc','title':'Add to Cart',events:({'click':function(){atc(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var atwlink=new Element('div',{'class':'atw','title':'Add to Wishlist',events:({'click':function(){atw(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var pinfolink=new Element('div',{'class':'pinfo','title':'More Details',events:({'click':function(){pinfo(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);});$$('input.submitdisable').addEvent('click',function(el){var myForm=this.getParent('form');if(myForm){this.disabled=true;myForm.submit();}});$('b2').inject($('b1'),'after');new banRol({el1:$('b1'),el2:$('b2')});$$('div.product_holder_small').each(function(item){var elid=item.id;var id=elid.replace(/p_/,'');var imglnk=item.getElement('div.img img');if(imglnk){imglnk.addEvent('click',function(){pinfo(id);});imglnk.setStyle('cursor','pointer');imglnk.set('title','Click for more information');}
var des=item.getElement('p.descr');if(des){var descrTxt=des.get('html');if(descrTxt.length>maxLen){descrTxt=descrTxt.substring(0,maxLen);descrTxt=descrTxt.replace(/\w+$/,'');descrTxt+='... ';des.set('html',descrTxt);}
lastChars=descrTxt.substring(descrTxt.length-4);if(lastChars=='... ')var moreInfo=new Element('a',{'class':'more','html':'more details','href':'javascript:;',events:({'click':function(){pinfo(id)}})}).inject(des);}
var h3=item.getElement('h3 a');var titlelnk=h3.addEvent('click',function(){pinfo(id);return false;});var choiceBlock=item.getElement('div.price');var rrpTitle=item.getElement('div.rrp').set('title','Recommended Retail Price');var spTitle=item.getElement('div.sp');if(spTitle)spTitle.set('title','Special Price');var rprTitle=item.getElement('div.rpr');if(rprTitle)rprTitle.set('title','Your Reseller Price');var atclink=new Element('div',{'class':'atc','title':'Add to Cart',events:({'click':function(){atc(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var atwlink=new Element('div',{'class':'atw','title':'Add to Wishlist',events:({'click':function(){atw(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var pinfolink=new Element('div',{'class':'pinfo','title':'More Details',events:({'click':function(){pinfo(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var eheight=item.getHeight();var img=item.getElement('div.img img');var mar=(eheight-img.getHeight())/2;img.setStyle('margin-top',mar-10+'px');});$$('div.product_holder_large').each(function(item){var elid=item.id;var id=elid.replace(/p_/,'');var choiceBlock=item.getElement('div.price');var rrpTitle=item.getElement('div.rrp').set('title','Recommended Retail Price');var spTitle=item.getElement('div.sp');if(spTitle)spTitle.set('title','Special Price');var rprTitle=item.getElement('div.rpr');if(rprTitle)rprTitle.set('title','Your Reseller Price');var atclink=new Element('div',{'class':'atc','title':'Add to Cart',events:({'click':function(){atc(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var atwlink=new Element('div',{'class':'atw','title':'Add to Wishlist',events:({'click':function(){atw(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var pinfolink=new Element('div',{'class':'pinfo','title':'More Details',events:({'click':function(){pinfo(id);},'mouseover':function(){hl(this);},'mouseout':function(){unhl(this);}})}).inject(choiceBlock);var eheight=item.getHeight();var img=item.getElement('div.img img');var mar=(eheight-img.getHeight())/2;img.setStyle('margin-top',mar-10+'px');});});function loadProducts(){var jsonReq=postJSON(base+'ascripts/slideshow.php','',function(result){var x=new genGal({title:'Top 20',cssclass:'top_20',data:result.t,link:'products/top_20'});var y=new genGal({title:'Newsletter Releases',cssclass:'newsletter_releases',data:result.n,link:'products/newsletter_releases'});var y=new genGal({title:'Featured Products',cssclass:'specials',data:result.f,link:'products/featured_products'});});}
var banRol=new Class({Implements:[Options,Events],options:{el1:false,el1_timer:5000,el2:false,el2_timer:10000},initialize:function(options){this.setOptions(options);if(!this.options.el1||!this.options.el2)return false;this.initBan();},initBan:function(){this.switchView.delay(this.options.el1_timer,this);},switchView:function(){if(this.options.el2.getStyle('display')=='block'){this.options.el2.setStyle('display','none');this.options.el1.setStyle('display','block');this.switchView.delay(this.options.el1_timer,this);}else{this.options.el2.setStyle('display','block');this.options.el1.setStyle('display','none');this.switchView.delay(this.options.el2_timer,this);}}});var genGal=new Class({Implements:[Options,Events],options:{title:'no title',cssclass:'',data:false,curSel:-1,link:false},initialize:function(options){this.setOptions(options);if(this.options.data.length==0)return false;this.initGal();},initGal:function(){var gal=new Element('div',{'class':'gal '+this.options.cssclass});this.h=new Element('h1').inject(gal);this.lnk=new Element('a',{'html':this.options.title,'href':base+this.options.link,'title':'Click to view all '+this.options.title}).inject(this.h);var myTips=new Tips(this.lnk,{'text':''});myTips.addEvent('show',function(tip,hovered){tip.setStyle('opacity','0.7');});this.l=new Element('div',{'class':'l',events:{'click':this.prevImg.bind(this),'mouseover':function(){this.setStyle('opacity',1);},'mouseout':function(){this.setStyle('opacity',0.5);}}}).inject(gal);this.i=new Element('div',{'class':'i','style':''}).inject(gal);this.r=new Element('div',{'class':'r',events:{'click':this.nextImg.bind(this),'mouseover':function(){this.setStyle('opacity',1);},'mouseout':function(){this.setStyle('opacity',0.5);}}}).inject(gal);this.l.setStyle('opacity',0.5);this.r.setStyle('opacity',0.5);this.t=new Element('a',{'class':'title'}).inject(gal);this.a=new Element('div',{'class':'author'}).inject(gal);this.nextImg();gal.inject($('galholder'));},nextImg:function(){var nextEl=this.options.curSel+1;if(this.options.data[nextEl])this.options.curSel=nextEl;else this.options.curSel=0;this.displayImg();},prevImg:function(){var nextEl=this.options.curSel-1;if(this.options.data[nextEl])this.options.curSel=nextEl;else this.options.curSel=this.options.data.length-1;this.displayImg();},displayImg:function(){var mydata=this.options.data[this.options.curSel];if(mydata.i==1)var img=base+'images/products/slide/'+mydata.r+'.jpg';else var img=base+'images/products/no_image.gif';this.i.setStyle('background','url('+img+') center center no-repeat');this.i.removeEvents('click');this.i.addEvent('click',function(){pinfo(mydata.r)});this.t.set('text',mydata.n);this.t.removeEvents('click');this.t.addEvent('click',function(){pinfo(mydata.r)});this.a.set('text',mydata.a);}});var statusMessage=new Class({Implements:[Options,Events],options:{timeout:2500,overlay:true,data:new Element('div')},initialize:function(options){this.setOptions(options);this.popup();window.addEvents({'resize':this.centerItems.bind(this),'scroll':this.centerItems.bind(this)});},popup:function(){if(this.options.overlay){this.overlay=new Element('div').setProperty('id','overlay').injectInside(document.body);this.overlay.setStyles({opacity:'0.3'});this.overlay.setStyles({top:Window.getScrollTop()+'px',left:0,height:Window.getHeight()+'px',width:Window.getWidth()+Window.getScrollLeft()+'px'});}
this.messageBox=new Element('div').setProperty('class','messagebox').injectInside(document.body);var dataType=typeof(this.options.data);if(dataType=='object'){this.options.data.inject(this.messageBox);}
else{this.messageBox.set('html',this.options.data);}
var myWinWidth=Window.getWidth()+Window.getScrollLeft();if(this.messageBox){var marLeft=(myWinWidth/2)-(this.messageBox.getWidth()/2);var topMar=Window.getScrollTop()+(Window.getHeight()/2)-(this.messageBox.getHeight()/2);this.messageBox.setStyles({'left':marLeft+'px','top':topMar+'px'});}
var myChain=new Chain(this);myChain.chain(function(){if(this.options.overlay)this.overlay.fade('out');this.messageBox.fade('out')}.bind(this),function(){if(this.options.overlay)this.overlay.destroy();this.messageBox.destroy();window.removeEvent('resize',this.centerItems.bind(this));window.removeEvent('scroll',this.centerItems.bind(this));}.bind(this));window.setTimeout(function(){myChain.callChain()},this.options.timeout);window.setTimeout(function(){myChain.callChain()},(this.options.timeout+1500));},centerItems:function(){var myWinWidth=Window.getWidth()+Window.getScrollLeft();if(this.overlay)this.overlay.setStyles({top:Window.getScrollTop()+'px',height:Window.getHeight()+'px',width:myWinWidth+'px'});if(this.messageBox){var marLeft=(myWinWidth/2)-(this.messageBox.getWidth()/2);var topMar=Window.getScrollTop()+(Window.getHeight()/2)-(this.messageBox.getHeight()/2);this.messageBox.setStyles({'left':marLeft+'px','top':topMar+'px'});}}});var pleromaPopup=new Class({Implements:[Options,Events],options:{fullscreen:false,overlay:false,clickOverlayClose:false,width:400,height:200,popupTopHeight:30,popupBottomHeight:15,closeButton:true,centerpopup:true,title:false,data:new Element('div')},initialize:function(options){this.setOptions(options);this.drawPopup();},drawPopup:function(){if(this.options.overlay)this.createOverlay();this.popup();window.addEvents({'resize':this.centerItems.bind(this),'scroll':this.centerItems.bind(this)});},createOverlay:function(){this.overlay=new Element('div').setProperty('id','overlay').injectInside(document.body);this.overlay.setStyles({opacity:'0.3'});this.overlay.setStyles({top:Window.getScrollTop()+'px',left:0,height:Window.getHeight()+'px',width:Window.getWidth()+Window.getScrollLeft()+'px'});},positionOverlay:function(){if(this.overlay)
this.overlay.setStyles({top:Window.getScrollTop()+'px',height:Window.getHeight()+'px',width:(Window.getWidth()+Window.getScrollLeft())+'px'});},popup:function(){var popupTopHeight=this.options.popupTopHeight;var popupBottomHeight=this.options.popupBottomHeight;this.infobox=new Element('div').setProperty('class','popupbox').injectInside(document.body);this.infobox.setStyles({'height':this.options.height+28+'px','width':this.options.width+'px'});if(this.options.title){var title=new Element('div',{'class':'dragbar','html':this.options.title}).inject(this.infobox);if(this.options.closeButton){var closeButton=new Element('div',{'class':'closepopup','html':'CLOSE','title':'Click to close',events:({'click':this.destruct.bind(this)})}).inject(title,'top');}}
var myWinWidth=Window.getWidth()+Window.getScrollLeft();if((this.infobox)&&(this.options.centerpopup)){var marLeft=(myWinWidth/2)-(this.infobox.getWidth()/2);var topMar=Window.getScrollTop()+(Window.getHeight()/2)-(this.infobox.getHeight()/2);this.infobox.setStyles({'left':marLeft+'px','top':topMar+'px'});}
var dataType=typeof(this.options.data);if(dataType=='object'){this.options.data.inject(this.infobox);}
else{this.infobox.set('html',this.options.data);}
if(this.options.clickOverlayClose){this.overlay.addEvents({'click':this.destruct.bind(this)});this.overlay.setStyles({'cursor':'pointer'});}},destruct:function(){if(this.overlay)this.overlay.destroy();if(this.infobox)this.infobox.destroy();window.removeEvent('resize',this.centerItems.bind(this));window.removeEvent('scroll',this.centerItems.bind(this));slideshow=true;},centerItems:function(){var myWinWidth=Window.getWidth()+Window.getScrollLeft();if(this.overlay)this.overlay.setStyles({top:Window.getScrollTop()+'px',height:Window.getHeight()+'px',width:myWinWidth+'px'});if((this.infobox)&&(this.options.centerpopup)){var marLeft=(myWinWidth/2)-(this.infobox.getWidth()/2);var topMar=Window.getScrollTop()+(Window.getHeight()/2)-(this.infobox.getHeight()/2);this.infobox.setStyles({'left':marLeft+'px','top':topMar+'px'});}}});function postJSON(myurl,mydata,func){dispAjax();var myRequest=new Request({method:'post',url:myurl,onSuccess:function(response){hideAjax();var result=$try(function(){return myObject=JSON.decode(response);},function(){return false;});if(result){func(result);}
else{errorMsg(response);}},onFailure:function(response){errorMsg('Error retrieving data from '+myurl);}}).send(mydata);}
function dispAjax(){var ajaxLoaderOverlay=new Element('div').setProperty('id','ajaxLoaderOverlay').injectInside(document.body);$('ajaxLoaderOverlay').setStyles({top:Window.getScrollTop()+'px',left:0,height:Window.getHeight()+'px',width:Window.getWidth()+Window.getScrollLeft()+'px'});}
function hideAjax(){if($('ajaxLoaderOverlay'))$('ajaxLoaderOverlay').destroy();}
function errorMsg(msg){var myDiv=new Element('div',{'styles':{'overflow':'auto','height':'300px','padding':'5px'},'html':msg});var showError=new pleromaPopup({height:310,width:730,data:myDiv,title:'Server Error',overlay:true,clickOverlayClose:true});}
function pinfo(item,disabld){var myData=postJSON(base+'ascripts/product_info.php','ref='+item,function(result,disabled){slideshow=false;var table=new Element('table',{'id':'displayProduct'});var tbody=new Element('tbody').inject(table);var myRow=new Element('tr').inject(tbody);var imgtd=new Element('td',{'class':'pimage','html':'<img src="'+base+'images/loading.gif" /> Loading image'}).inject(myRow);if(result.im==0)var showImage='no_image.gif';else showImage=result.ir+'.jpg';var theImage=base+'images/products/large/'+showImage;var myImage=new Asset.image(theImage,{onload:function(){imgtd.empty();myImage.inject(imgtd);var imageHeight=myImage.getHeight();var imageWidth=myImage.getWidth();if((imageHeight>300)||(imageWidth>300)){if(imageWidth>imageHeight){myImage.set('width','300');myImage.set('height',300/imageWidth*imageHeight);}else{myImage.set('height','300');myImage.set('width',300/imageHeight*imageWidth);}}}});var descrTD=new Element('td',{'class':'pdescr'}).inject(myRow);var descr=new Element('div',{'class':'descr'}).inject(descrTD);var code=new Element('h3',{'html':'Code: '+result.ic}).inject(descr);var title=new Element('h1',{'html':result.sn}).inject(descr);var author=new Element('h3',{'html':'Author: '+result.sa}).inject(descr);if(result.pub)
var pub=new Element('h3',{'html':'Publisher: '+result.pub}).inject(descr);if((result.specq)&&(!result.rpr)){if(result.specq==1)var special=new Element('div',{'class':'special','html':'Product on special - only $'+result.specp+' per item'}).inject(descr);else var special=new Element('div',{'class':'special','html':'Product on special - order at least '+result.specq+' of these items and pay only '+result.specp+' per item'}).inject(descr);}
var notes=new Element('div',{'html':result.notes}).inject(descr);var pchoice=new Element('td',{'class':'pchoice'}).inject(myRow);var rrp=new Element('div',{'class':'rrp','title':'Recommended Retail Price','html':result.rrp}).inject(pchoice);if(result.rpr)var rpr=new Element('div',{'class':'rpr','title':'Your Reseller Price','html':result.rpr}).inject(pchoice);else if(result.specp)var specp=new Element('div',{'class':'sp','title':'Special Price','html':result.specp}).inject(pchoice);if(typeof(disabld)=='undefined'){var atcDiag=new Element('div',{'class':'atc','title':'Add to Cart','events':{'click':function(){atc(result.ir)}}}).inject(pchoice);var atwDiag=new Element('div',{'class':'atw','title':'Add to Wishlist','events':{'click':function(){atw(result.ir)}}}).inject(pchoice);}
var showProduct=new pleromaPopup({height:310,width:730,data:table,title:'Product Details',overlay:true,clickOverlayClose:true});_gaq.push(['_trackEvent','Product Click',result.sn]);});}
function createOverlay(){var overlay=new Element('div').setProperty('id','overlay').injectInside(document.body);$('overlay').setStyles({opacity:'0.2'});$('overlay').setStyles({top:Window.getScrollTop()+'px',left:0,height:Window.getHeight()+'px',width:Window.getWidth()+Window.getScrollLeft()+'px'});}
function login(){var holder=new Element('div');var Q=new Element('div',{'styles':{'padding':'10px'},'html':'<b>You need to first log into your account to use this feature.</b><br />'+'<ul><li><a href="'+base+'login">Click here</a> to <b>Log In</b><br /><br /></li><li>or <a href="'+base+'create_account">Click here</a> to create a <b>new account</b></li></ul> '}).inject(holder);var btnholder=new Element('div',{'styles':{'text-align':'center','padding-top':'10px'}}).inject(holder);var cancel=new Element('input',{'type':'button','value':'No thanks','class':'button no','events':{'click':function(){gotoLogin.destruct();}}}).inject(btnholder);var gotoLogin=new pleromaPopup({height:180,width:350,data:holder,overlay:true,closeButton:false,clickOverlayClose:true});}
function logout(url){var agree=confirm('Are you sure you want to log out of this website?');if(agree){location.href=url;}}
function checkbrowser(){if(typeof document.body.style.maxHeight=="undefined"){var IE6Warning='<h3>Did you know that your Internet Explorer is out of date?</h3>';var infoMsg='In order to use this site\'s features such as the shopping cart, we recommend that you upgrade to a newer version or other web browser. A list of the most popular web browsers can be found below. <br />We recommend <b>Mozilla Firefox</b>.';var browsers=[["Firefox 3+","browser_firefox.gif","http:\/\/www.mozilla.com\/firefox\/"],["Internet Explorer 7+","browser_ie.gif","http:\/\/www.microsoft.com\/windows\/Internet-explorer\/default.aspx"],["Chrome 2.0+","browser_chrome.gif","http:\/\/www.google.com\/chrome"],["Opera 9.5+","browser_opera.gif","http:\/\/www.opera.com\/download\/"],["Safari 3+","browser_safari.gif","http:\/\/www.apple.com\/safari\/download\/\""]];var myDiv=new Element('div',{'styles':{'overflow':'auto','height':'300px','padding':'5px'},'html':IE6Warning+'<p>'+infoMsg+'</p>'});browsers.each(function(item){var dlLink=new Element('div',{'class':'dlbrowser','html':'<a href="'+item[2]+'" target="_blank"><img src="'+base+'includes/ie6/'+item[1]+'" /></a><br />'+item[0]}).inject(myDiv);})
var showError=new pleromaPopup({height:260,width:730,data:myDiv,title:'Please Upgrade Your Browser',overlay:true,clickOverlayClose:true});}}
function hl(elm){elm.setStyle('opacity','0.7');}
function unhl(elm){elm.setStyle('opacity','1');}
function showCartImportantInfo(){var myData=postJSON(base+'ascripts/important_info.php','base='+base,function(result){var myDiv=new Element('div',{'styles':{'overflow':'auto','height':'300px','padding':'5px'},'html':result.html});var showProduct=new pleromaPopup({height:310,width:730,data:myDiv,title:'Important Information',overlay:true,clickOverlayClose:true});});}
function mailingList(){var myIframe=new Element('iframe',{'src':'http://www.epostie.co.nz/subscribe/pleroma','style':'border:none;height: 420px;width:600px;'});var showProduct=new pleromaPopup({width:604,height:420,data:myIframe,title:'Sign Up To Our Newsletter',overlay:true,clickOverlayClose:true});}
function atw(code){var myData=postJSON(base+'ascripts/product_info.php','ref='+code,function(result,disabled){var holder=new Element('div');var Q=new Element('div',{'styles':{'padding':'10px'},'html':'Would you like to add "<b>'+result.sn+'</b>" to your wishlist?<br /><span style="color: gray">Adding items to your wishlist '+'means you can remember the products you like, and allows us to contact you if they are on special.</span>'}).inject(holder);var btnholder=new Element('div',{'styles':{'text-align':'center','padding-top':'10px'}}).inject(holder);var conf=new Element('input',{'type':'button','value':'Yes please','class':'button yes','events':{'click':function(){var update=postJSON(base+'ascripts/add_to_wishlist.php','id='+code,function(response){if(response.access=='1'){var message=new statusMessage({data:response.reply});addto.destruct();}else{login();}});}}}).inject(btnholder);var cancel=new Element('input',{'type':'button','value':'No thanks','class':'button no','events':{'click':function(){addto.destruct();}}}).inject(btnholder);var addto=new pleromaPopup({height:150,width:350,data:holder,overlay:true,closeButton:false,clickOverlayClose:true});});}
function atc(code){var myData=postJSON(base+'ascripts/product_info.php','ref='+code,function(result,disabled){var holder=new Element('div');var Q=new Element('div',{'styles':{'padding':'10px 10px 20px 10px'},'html':'Would you like to add "<b>'+result.sn+'</b>" to your shopping cart?</b>'}).inject(holder);if(result.in_wl==1){var insertRow=new Element('div',{'styles':{'padding-left':'46px','padding-bottom':'10px'}}).inject(holder);var myLabel=new Element('label').inject(insertRow);var rfw=new Element('input',{'type':'checkbox','value':'1','name':'rfw','checked':'checked'}).inject(myLabel);myLabel.appendText(" Remove this from my wishlist &");}
var insertRow=new Element('div',{'html':'Quantity: ','styles':{'padding-left':'50px'}}).inject(holder);var qtyinput=new Element('input',{'type':'text','value':'1','styles':{'width':'50px'}}).inject(insertRow);var conf=new Element('input',{'type':'button','value':'Add to Shopping Cart','class':'button yes','events':{'click':function(){var qty=qtyinput.value;var rfwTask=0;if(rfw){var rfwval=rfw.getProperty('checked');if(rfwval)rfwTask=1;}
var update=postJSON(base+'ascripts/add_to_cart.php','id='+code+'&'+'q='+qty+'&'+'rfw='+rfwTask,function(response){if(response.access=='1'){var message=new statusMessage({data:response.reply});addto.destruct();$('cart').setStyle('visibility','visible');}else{login();}});}}}).inject(insertRow);var btnholder=new Element('div',{'styles':{'text-align':'center','padding-top':'20px'}}).inject(holder);var cancel=new Element('input',{'type':'button','value':'No thanks','class':'button no','events':{'click':function(){addto.destruct();}}}).inject(btnholder);var addto=new pleromaPopup({height:160,width:375,data:holder,overlay:true,closeButton:false,clickOverlayClose:true});});}
