/* Copyright 2010 Crushpad */var CP={};Object.extend(CP,{init:function(){},debugCheck:function(){return(CP.Constants.Force.Debug||document.body.className.match(/(^|\s)debug($|\s)/)?true:false);},log:function(){var args=CP.toArray(arguments);if(CP.debugCheck()){if(!CP.Constants.Force.GhettoConsole&&typeof console!='undefined'&&typeof console.log=='function'){console.log.apply(console,args);}else{if(!CP.Globals.console){CP.Globals.console=$(document.createElement('textarea'));CP.Globals.console.writeAttribute('readonly','readonly');CP.Globals.console.writeAttribute('id','console-interface');$(document.body).appendChild(CP.Globals.console);}
CP.Globals.console.setValue(CP.Globals.console.getValue()+args.join('\n')+'\n');}}},toArray:function(iterable){var arrayed=[];for(var i=0;i<iterable.length;i++){arrayed.push(iterable[i]);};return arrayed;},timeAgo:function(s_ago){var rounded=s_ago;var human_ago='';if(rounded<=1)
{human_ago='1 sec ago';return human_ago;}
if(rounded<60)
{human_ago=rounded+' sec ago';return human_ago;}
var m_ago=s_ago/60;rounded=Math.round(m_ago);if(rounded<=1)
{human_ago='1 min ago';return human_ago;}
if(rounded<60)
{human_ago=rounded+' min ago';return human_ago;}
var h_ago=m_ago/60;rounded=Math.round(h_ago);if(rounded<=1)
{human_ago='1 hour ago';return human_ago;}
if(rounded<24)
{human_ago=rounded+' hours ago';return human_ago;}
var d_ago=h_ago/24;rounded=Math.round(d_ago);if(rounded<=1)
{human_ago='1 day ago';return human_ago;}
if(rounded<365)
{human_ago=rounded+' days ago';return human_ago;}
var y_ago=d_ago/365;rounded=Math.round(y_ago);if(rounded<=1)
{human_ago='1 year ago';return human_ago;}
human_ago=rounded+' years ago';return human_ago;},timeToGo:function(delta){var obj={"day":0,"hour":0,"minute":0,"second":0}
if(delta<=0){return obj;}
var days;var hrs;var rem;var mins;days=Math.abs(delta/86400);rem=Math.abs(delta%86400);if(days<1){days=0;};hrs=Math.abs(rem/3600);rem=Math.abs(rem%3600);if(hrs<1){hrs=0;}
mins=rem/60;if(mins<1){mins=0;}
secs=rem%60;obj.day=Math.floor(days);obj.hour=Math.floor(hrs);obj.minute=Math.floor(mins);obj.second=Math.floor(secs);return obj;},openPopup:function(url,height,width){newwindow=window.open(url,'name','height = '+height+',width = '+width);if(window.focus){newwindow.focus()}
return false;},Constants:{Force:{Debug:'0'=='1',GhettoConsole:false},URL:{MagentoBase:'http://store.brixr.com'}},Globals:{console:false}});Event.observe(document,'dom:loaded',CP.init);var CP;if(Object.isUndefined(CP.Utility)){CP.Utility={postToWindow:function(url,target,data){var form=$(document.createElement('form'));form.target=target;form.action=url;form.method='post';form.acceptCharset='UTF-8';form.enctype='multipart/form-data';form.hide();$H(data).each(function(pair){var field=document.createElement('input');field.type='hidden';field.name=pair.key;field.value=pair.value;form.appendChild(field);});document.body.appendChild(form);form.submit();FB.yield(form.remove.bind(form));},getViewportDims:function(){var viewportwidth;var viewportheight;if(typeof window.innerWidth!='undefined'){viewportwidth=window.innerWidth,viewportheight=window.innerHeight}else{viewportwidth=document.documentElement.clientWidth,viewportheight=document.documentElement.clientHeight}
return[viewportheight,viewportwidth];},changeDocumentStyles:function(styleobj){var body=$$('body').first();if(!body){return false;}
var html=$$('html').first();if(!html){return false;}
$H(styleobj).each(function(pair){body.style[pair.key]=pair.value;html.style[pair.key]=pair.value;})
return true;},needsIECSS:function(){/*@cc_on
     return true;
   @*/return false;},needsIE6CSS:function(){/*@cc_on
    /*@if ( @_jscript_version <= 5.6 || @_jscript_version == 5.7 )
     return true && !window.XMLHttpRequest;
    @else @*/return false;/*@end
   @*/},needsIE7CSS:function(){/*@cc_on
    /*@if ( @_jscript_version > 5.6 && @_jscript_version < 5.8)
     return true && window.XMLHttpRequest;
    @else @*/return false;/*@end
   @*/},needsIEPNGFilter:function(){/*@cc_on
    /*@if ((@_jscript_version >= 5.5 && @_jscript_version <= 5.6) || @_jscript_version == 5.7)
     return true && !window.XMLHttpRequest;
    @else @*/return false;/*@end
   @*/},version:function(){return'1.0';},currentQueryString:function(){var qs=window.location.search.substr(1);var params={};qs.split('&').each(function(param){var split_params=param.split('=');params[split_params[0]]=split_params[1];});return params;},currentFragment:function(){var hash;if(typeof window.location.hash!='undefined'){hash=window.location.hash;}else{hash=window.location.href;}
var frag_pos=hash.indexOf('#');if(frag_pos==-1){return hash;}
return hash.substr(frag_pos+1);},loadScript:function(url,callback,sentinel){var load_check,script=$(document.createElement('script'));script.charset='utf-8';script.type='text/javascript';script.src=url;document.body.appendChild(script);if(typeof callback=='function'&&typeof sentinel!='undefined'){load_check=setInterval(function(){try{if(typeof window[sentinel]!='undefined'){clearInterval(load_check);callback.defer(script);}}catch(e){CP.log(e);}},50);};},LinkedList:function(){var that=this;var head=null;var num_objects=0;function push(){for(var i=arguments.length-1;i>=0;i--){if(typeof arguments[i]=='undefined'){throw"Pushing undefined value"}
head={o:arguments[i],n:head};num_objects++;};return that;};this.push=push;function pop(){if(!head){throw"Poping empty list";}
var obj=head.o;head=head.n;num_objects--;return obj;};this.pop=pop;function remove(obj){var walk=head;var last=null;while(walk){if(walk.o===obj){if(last===null){head=walk.n;}else{last.n=walk.n;}
delete walk;num_objects--;break;}else{last=walk;walk=walk.n;}}
return that;};this.remove=remove;function reverse(){var tail=null,next,walk=head;while(walk){tail=walk;walk=walk.n;}
walk=head;while(walk&&walk!=tail){next=tail.n;tail.n=walk;walk=walk.n;tail.n.n=next;}
head=tail;return that;};this.reverse=reverse;function empty(){var walk=head,last;while(walk){last=walk;walk=walk.n;last.n=null;delete last;num_objects--;}
head=null;return that;};this.empty=empty;function filter(callback){var walk=head;var last=null;while(walk){if(callback(walk.o)){if(last===null){head=walk.n;delete walk;walk=head;}else{last.n=walk.n;delete walk;walk=last.n;}
num_objects--;}else{last=walk;walk=walk.n;}}
return that;};this.filter=filter;function length(){return num_objects;};this.length=length;function string(){var walk=head;var str='<@LinkedList: ';while(walk){str+=walk.o.toString();walk=walk.n;if(walk){str+=', ';}}
return str+'>';};this.string=string;this.toString=string;function contains(obj){var walk=head;while(walk){if(walk.o===obj){return true;}
walk=walk.n;}
return false;};this.contains=contains;for(var i=arguments.length-1;i>=0;i--){push(arguments[i]);};},EventRegistry:function(){var event_queue_next_id=0;var queues={};function objToId(obj){try{if(typeof obj[CP.Utility.Constants.EventRegistryMagicKey]!='undefined'){return obj[CP.Utility.Constants.EventRegistryMagicKey];}
return false;}catch(e){return false;}};function initQueue(obj){var id=objToId(obj);if(id===false){id=obj[CP.Utility.Constants.EventRegistryMagicKey]=event_queue_next_id++;}
if(!queues[id]){queues[id]={};}
return true;};this.initQueue=initQueue;function addEvent(obj,event,callback,single_shot){var id=objToId(obj);if(id===false||!queues[id]||typeof callback!='function'){return false;}
if(!queues[id][event]){queues[id][event]=new CP.Utility.LinkedList();}
queues[id][event].push({'callback':callback,'single_shot':single_shot==true});return true;};this.addEvent=addEvent;function removeEvent(obj,event,callback){var id=objToId(obj);if(id===false||!queues[id]||typeof callback!='function'){return false;}
if(queues[id][event]){queues[id][event].filter(function(o){return o.callback===callback;});}
return true;};this.removeEvent=removeEvent;function fireEvent(obj,event,synchronous){var id=objToId(obj);if(id===false||!queues[id]){return false;}
if(queues[id][event]){var args=$A(arguments).slice(3);queues[id][event].filter(function(o){if(synchronous){o.callback.apply(o,args);}else{Function.defer.apply(o.callback,args);}
return o.single_shot;});}
return true;};this.fireEvent=fireEvent;function removeEvents(obj,event){var id=objToId(obj);if(id===false||!queues[id]){return false;}
if(queues[id][event]){queues[id][event].empty();}
return true;};this.removeEvents=removeEvents;},EventHandler:function(element,event,callback,one_shot){function callCallback(e){callback(e);if(one_shot){clear();}};function register(){Event.observe(element,event,callCallback);};this.register=register;function clear(){Event.stopObserving(element,event,callCallback);};this.clear=clear;function fire(){callCallback();};this.fire=fire;},Constants:{Debug:true,DebugParam:'__debug',EventRegistryMagicKey:'__EventRegistryId'}};CP.Utility.EventRegistry=new CP.Utility.EventRegistry();(function(){var params=CP.Utility.currentQueryString();if(params[CP.Utility.Constants.DebugParam]=='false'){CP.Utility.Constants.Debug=false;}else if(params[CP.Utility.Constants.DebugParam]=='true'){CP.Utility.Constants.Debug=true;}})();Element.addMethods({removeChildren:function(element){element=$(element);for(var i=element.childNodes.length-1;i>=0;i--){element.removeChild(element.childNodes[i]);};return element;}});Object.extend(String.prototype,{toDOM:function(){var div=$(document.createElement('div'));div.update(this);return div.down();}});};if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return"";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;var CP;if(Object.isUndefined(CP.Utility.ModalOverlay)){CP.Utility.ModalOverlay={init:function(){if(Object.isElement(this.overlay)){return;};CP.Utility.EventRegistry.initQueue(this);this.overlay=$(document.createElement('div'));this.overlay.id='modal-overlay';this.overlay_contents=$(document.createElement('div'));this.overlay_contents.id='modal-overlay-contents';this.overlay.hide();this.overlay_contents.hide();this.event_handlers=[];var body=$$('body').first();body.appendChild(this.overlay);body.appendChild(this.overlay_contents);Event.observe(this.overlay,'click',this.closeEvent.bindAsEventListener(this));}.bind(CP.Utility.ModalOverlay),open:function(contents,actions){if(this.isOpen()){this.changeContents(contents,actions);return;}
if(self.pageYOffset){this.yPos=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){this.yPos=document.documentElement.scrollTop;}else if(document.body){this.yPos=document.body.scrollTop;}
if(CP.Utility.needsIE6CSS()||CP.Utility.needsIE7CSS()){CP.Utility.changeDocumentStyles({height:'100%'});$$('select').each(function(element){element.style.visibility='hidden';});this.overlay.style.height=document.body.clientHeight/13+'em';}
window.scrollTo(0,0);this.overlay.show();this.changeContents(contents,actions);CP.Utility.EventRegistry.fireEvent(this,'open',false);this.overlay_contents.show();}.bind(CP.Utility.ModalOverlay),close:function(){if(!this.isOpen()){return;}
window.scrollTo(0,this.yPos);if(CP.Utility.needsIE6CSS()||CP.Utility.needsIE7CSS()){CP.Utility.changeDocumentStyles({height:'auto'});$$('select').each(function(element){element.style.visibility='visible';});this.overlay.style.height='auto';}
this.overlay.hide();this.overlay_contents.hide();while(this.event_handlers.length>0){var eh=this.event_handlers.pop();eh.clear();delete eh;}
CP.Utility.EventRegistry.fireEvent(this,'close',false);}.bind(CP.Utility.ModalOverlay),closeEvent:function(event){event.stop();this.close();}.bind(CP.Utility.ModalOverlay),changeContents:function(contents,actions){if(Object.isElement(contents)){this.changeContents([contents],actions);}else{CP.Utility.EventRegistry.fireEvent(this,'before-change-contents',true);while(this.event_handlers.length>0){var eh=this.event_handlers.pop();eh.clear();delete eh;}
if(Object.isArray(contents)){this.overlay_contents.removeChildren();contents.each(function(ele){this.overlay_contents.appendChild(ele);}.bind(this));}else{this.overlay_contents.removeChildren();this.overlay_contents.update(contents);}
if(!Object.isArray(actions)){actions=[];}
actions.push({selector:'a[rel=close]',event:'click',callback:this.closeEvent.bind(this)});actions.each(function(action){if(typeof action.event_handler!='undefined'){this.event_handlers.push(action.event_handler);}else{this.overlay_contents.select(action.selector).each(function(ele){var eh=new CP.Utility.EventHandler(ele,action.event,action.callback);eh.register();this.event_handlers.push(eh);}.bind(this));}}.bind(this));if(CP.Utility.needsIE6CSS()||CP.Utility.needsIE7CSS()){$(this.overlay_contents).select('select').each(function(element){element.style.visibility='visible';});}
CP.Utility.EventRegistry.fireEvent(this,'after-change-contents',false);}}.bind(CP.Utility.ModalOverlay),isOpen:function(){return this.overlay.visible();}.bind(CP.Utility.ModalOverlay),dispatcher:function(){var fragment=CP.Utility.currentFragment();if(this.fragment!=fragment){this.fragment=fragment;CP.Utility.EventRegistry.fireEvent(this,'change-location',false,fragment);}}.bind(CP.Utility.ModalOverlay),addEventHandlers:function(ehs){ehs.each(function(eh){this.event_handlers.push(eh);}.bind(this));}.bind(CP.Utility.ModalOverlay)};document.observe('dom:loaded',function(){CP.Utility.ModalOverlay.init();setInterval(CP.Utility.ModalOverlay.dispatcher.bind(CP.Utility.ModalOverlay),50);});}
var CP;if(Object.isUndefined(CP.Utility.CarouselManager)){CP.Utility.CarouselManager={carousels:[],init:function(){CP.Utility.EventRegistry.initQueue(this);$$('.carousel').each(CP.Utility.CarouselManager.create);},create:function(root){var carousel=new CP.Utility.CarouselManager.Carousel(root);CP.Utility.CarouselManager.carousels.push(carousel);CP.Utility.EventRegistry.fireEvent(this,'new-carousel',false,carousel);},findById:function(id){for(var i=CP.Utility.CarouselManager.carousels.length-1;i>=0;i--){if(CP.Utility.CarouselManager.carousels[i].getId()==id){return CP.Utility.CarouselManager.carousels[i];};};},Carousel:Class.create({initialize:function(root,options){var that=this;var attributes={offset:0,delta:1,duration:500,'control-location':null};var panes=[];var current_pane=null;var list=root.select('ul').first();function redraw(){var initial_offset=0;for(var i=0;i<current_pane.position;i++){initial_offset+=parseInt(panes[i].element.getStyle('width'));};if((-1*initial_offset)!=parseInt(list.getStyle('left'))){if(typeof Fx!='undefined'){var fx=new Fx.Style(list,'left',{duration:attributes.duration});fx.custom(parseInt(list.getStyle('left')),(-1*initial_offset));}else{list.setStyle({left:(-1*initial_offset)+'px'});};};};function gotoPane(pane_index){if(pane_index>=panes.length||pane_index<0){return;};current_pane=panes[pane_index];redraw();CP.Utility.EventRegistry.fireEvent(that,'goto-pane',false,that);}
this.gotoPane=gotoPane;function currentPane(){return current_pane;};this.currentPane=currentPane;function nextCallback(event){event.stopPropagation();event.preventDefault();next();};function next(){if(current_pane.position+attributes.delta>=panes.length){current_pane=panes[0];}else{current_pane=panes[current_pane.position+attributes.delta];};redraw();CP.Utility.EventRegistry.fireEvent(that,'next-pane',false,that);};this.next=next;function prevCallback(event){event.stopPropagation();event.preventDefault();prev();};function prev(){if(current_pane.position==0){current_pane=panes[panes.length-attributes.delta];}else if(current_pane.position-attributes.delta<0){current_pane=panes[0];}else{current_pane=panes[current_pane.position-attributes.delta];};redraw();CP.Utility.EventRegistry.fireEvent(that,'previous-pane',false,that);};this.prev=prev;this.previous=prev;function getId(){if(root.id!=''){return root.id;};};this.getId=getId;function toString(){var str='<@Carousel panes='+panes.length+' current-pane='+(currentPane().position+1);var id=getId();if(typeof id!='undefined'){str=str+' id='+id;};$H(attributes).each(function(attribute){str=str+' '+attribute.key+'='+attribute.value;});return str+'>';};this.toString=toString;CP.Utility.EventRegistry.initQueue(this);if(root.hasAttribute('carousel-offset')){attributes.offset=root.getAttribute('carousel-offset');};if(root.hasAttribute('carousel-delta')){attributes.delta=root.getAttribute('carousel-delta');};if(root.hasAttribute('carousel-duration')){attributes.duration=root.getAttribute('carousel-duration');};if(root.hasAttribute('carousel-control-location')){attributes['control-location']=root.getAttribute('carousel-control-location');};if(typeof options!='undefined'){if(typeof options.offset!='undefined'){attributes.offset=options.offset;};if(typeof options.delta!='undefined'){attributes.delta=options.delta;};if(typeof options.duration!='undefined'){attributes.duration=options.duration;};if(typeof options['control-location']!='undefined'){attributes['control-location']=options['control-location'];};};attributes.offset=parseInt(attributes.offset);attributes.delta=parseInt(attributes.delta);attributes.duration=parseInt(attributes.duration);var items=root.select('li');for(var i=0;i<items.length;i++){panes.push({width:parseInt(items[i].getStyle('width')),element:items[i],position:i});};if(attributes.delta>panes.length){attributes.delta=panes.length;};var width=0;for(var i=0;i<items.length;i++){panes[i].element.setStyle({position:'absolute',top:'0px',left:width+'px'});width+=parseInt(panes[i].element.getStyle('width'));};if(list.getStyle('left')===null){list.setStyle({left:'0px'});};current_pane=panes[attributes.offset];redraw();root.select('a[rel=next-pane]').each(function(element){Event.observe(element,'click',nextCallback);});root.select('a[rel=previous-pane]').each(function(element){Event.observe(element,'click',prevCallback);});if(attributes['control-location']!=null){$$(attributes['control-location']+' a[rel=next-pane]').each(function(element){Event.observe(element,'click',nextCallback);});$$(attributes['control-location']+' a[rel=previous-pane]').each(function(element){Event.observe(element,'click',prevCallback);});};}})};document.observe('dom:loaded',function(){CP.Utility.CarouselManager.init();});};var CP;if(typeof CP.Index=='undefined'){CP.Index={};}
Object.extend(CP.Index,{tabs:[],clicked:false,slideTime:11000,init:function(){CP.Index.tabs=[$('home-carousel-videos-tab'),$('home-carousel-packs-tab'),$('home-carousel-about-tab')];CP.Index.tabs.each(function(tab){Event.observe(tab,'click',function(e){e.stopPropagation();e.preventDefault();CP.Index.activateTab(this);CP.Index.clicked=true;});});setTimeout('CP.Index.autoAdvance()',CP.Index.slideTime);var player=$('open-about-button');if(player){Event.observe(player,'click',function(event){CP.Index.intoVideoModal();event.stop();});};},activateTab:function(tab){CP.Utility.CarouselManager.findById('home-carousel').gotoPane(CP.Index.tabs.indexOf(tab));$$('.dark-tabbed-sb-tabs li').each(function(t){t.removeClassName('selected');});tab.up(1).addClassName('selected');return false;},autoAdvance:function(){if(CP.Index.clicked){return;}
var t=$$('.dark-tabbed-sb-tabs .selected a').first();var i=CP.Index.tabs.indexOf(t)+1;if(i>=CP.Index.tabs.length){i=0;}
CP.Index.activateTab(CP.Index.tabs[i]);setTimeout('CP.Index.autoAdvance()',CP.Index.slideTime);},intoVideoModal:function(){CP.Utility.ModalOverlay.open($('home-about-lightbox').show());}});Event.observe(document,'dom:loaded',CP.Index.init);var CP;if(typeof CP.Cart=='undefined'){CP.Cart={};}
Object.extend(CP.Cart,{init:function(){var cartContainer=$('header-cart-container');var cartCount=$('cart-count');var hasProductBeenPulled=0;if(!cartContainer||!cartCount){return;}
CP.Cart.cartCount=cartCount;CP.Cart.cartContainer=cartContainer.down();CP.Cart.hasProductBeenPulled=hasProductBeenPulled;CP.Cart.productListDomain=CP.Constants.URL.MagentoBase;cartContainer.observe('click',CP.Cart.navigateToCart);$('check-out-btn').down().observe('click',CP.Cart.navigateToCart);},navigateToCart:function(e){try{var cartAnchor=Event.findElement(e,'a');if((CP.TastingRoom.tastingState=='live'||CP.TastingRoom.tastingState=='ondemand')&&(CP.TastingRoom.aVideoIsPlaying==1)){Event.stop(e);window.open(cartAnchor.href,'brixrCartWin');}}catch(e){return true;}},updateCart:function(cartData){if(cartData){CP.log(cartData);CP.Cart.cartCount.update(cartData['total_items']);var subtotal=$('cart-subtotal');if(subtotal){subtotal.update(cartData['subtotal']);}
if(CP.TastingRoom.scriptsToClean.get(cartData['token'])){CP.TastingRoom.scriptsToClean.get(cartData['token']).remove();CP.TastingRoom.scriptsToClean.unset(cartData['token']);if(CP.TastingRoom.scriptsToClean.keys().length==0){CP.Utility.ModalOverlay.changeContents(cartData['output'],[{selector:'#checkout',event:'click',callback:CP.Utility.ModalOverlay.close.bind(CP.Utility.ModalOverlay)}]);};};}},getCartProducts:function(){var body=$(document.body);var cartProducts=$('detailed-cart-products');if(cartProducts==null&&CP.Cart.hasProductBeenPulled==0){var call=$(document.createElement('script'));call.src=CP.Cart.productListDomain;call.charset='utf-8';call.type='text/javascript';call.id='get-product-list';body.appendChild(call);body.removeChild($('get-product-list'));CP.Cart.hasProductBeenPulled=1;}else{if(cartProducts!=null){CP.Cart.hasProductBeenPulled=0;CP.Cart.cartContainer.removeChild($('detailed-cart-products'));}}},showCartProducts:function(cartdata){var total=0;var outter_div=$(document.createElement('div'));outter_div.id='detailed-cart-products';var clr_div=$(document.createElement('div'));clr_div.className='clr';if(cartdata['products'].length!=0){$H(cartdata['products']).each(function(product){var product_item=$(document.createElement('div'));product_item.addClassName('pdetails');var img_div=$(document.createElement('div'));img_div.className='float-left';var product_img=$(document.createElement('img'));product_img.className='pdetails-img';product_img.src=product[1].img;var details_div=$(document.createElement('div'));details_div.className="float-left details-text"
var name_div=$(document.createElement('div'));name_div.className='pdetails-name';var formated_name='';if(product[1].name.length>30){formated_name=product[1].name.truncate(30,'...');}else{formated_name=product[1].name;}
var name_text=$(document.createTextNode(formated_name));var qty_div=$(document.createElement('div'));qty_div.className='pdetails-qty float-left';var qty_text=$(document.createTextNode('Qty: '+product[1].qty));var price_div=$(document.createElement('div'));price_div.className='pdetails-price float-right';var price_text=$(document.createTextNode('Price $'+product[1].price.truncate(5,'')));total+=(product[1].qty*product[1].price);img_div.appendChild(product_img);product_item.appendChild(img_div);name_div.appendChild(name_text);details_div.appendChild(name_div);qty_div.appendChild(qty_text);details_div.appendChild(qty_div);price_div.appendChild(price_text);details_div.appendChild(price_div);details_div.appendChild(clr_div);product_item.appendChild(details_div);outter_div.appendChild(product_item);outter_div.appendChild(clr_div);});}else{var empty_cart=$(document.createElement('div'));empty_cart.id='pdetails-empty';var empty_text=$(document.createTextNode('You have No Products in your cart'));empty_cart.appendChild(empty_text);outter_div.appendChild(empty_cart);}
var total_div=$(document.createElement('div'));total_div.className='float-left';var total_text=$(document.createTextNode('Total: $'+total));total_div.appendChild(total_text);var check_div=$(document.createElement('div'));check_div.className='float-right';var check_out=$(document.createElement('a'));check_out.id='pdetails-checkout';check_out.href=CP.Constants.URL.MagentoBase+'/checkout/cart/';var check_text=$(document.createTextNode('Check Out'));outter_div.appendChild(total_div);check_out.appendChild(check_text);check_div.appendChild(check_out);outter_div.appendChild(check_div);outter_div.appendChild(clr_div);CP.Cart.cartContainer.appendChild(outter_div);}});Event.observe(document,'dom:loaded',CP.Cart.init);