ProductsCarousel=Class.create({options:{mode:'horizontal',showActive:false},initialize:function(carouselContainer,custom_options){Object.extend(this.options,custom_options||{});this.carousel=carouselContainer;this.mode=(this.options.mode=='vertical')?1:0;this.setDimensions();this.centerActive();this.addListeners();this.updateNav();},setDimensions:function(){this.carouselUl=this.carousel.down('ul');this.carouselUlSize=this.carouselUl.childElements().length;this.carouselLi=this.carousel.down('li');if(this.mode){this.carouselLiDimension=this.carouselLi.getHeight()
+parseInt(this.carouselLi.getStyle('marginTop'))
+parseInt(this.carouselLi.getStyle('marginBottom'));this.carouselAreaDimension=this.carousel.down('.view-area').getHeight();}
else{this.carouselLiDimension=this.carouselLi.getWidth()
+parseInt(this.carouselLi.getStyle('marginRight'))
+parseInt(this.carouselLi.getStyle('marginLeft'));this.carouselAreaDimension=this.carousel.down('.view-area').getWidth();}
this.carouselUlDimension=this.carouselLiDimension*this.carouselUlSize;this.prevBtn=this.carousel.down('span.prev-views');this.nextBtn=this.carousel.down('span.next-views');if(this.mode){this.carouselUl.setStyle({height:this.carouselUlDimension+'px'});}
else{this.carouselUl.setStyle({width:this.carouselUlDimension+'px'});}},centerActive:function(){if(this.options.showActive){if(this.carouselUlDimension>this.carouselAreaDimension){var centerOffset=this.carouselLiDimension*Math.floor(this.carouselAreaDimension/(2*this.carouselLiDimension));var currentOffset=this.carousel.down('li.item-active').positionedOffset()[this.mode];var offsetDiff=centerOffset-currentOffset;if(offsetDiff<0){var initialOffset=(offsetDiff>=this.carouselAreaDimension-this.carouselUlDimension)?offsetDiff:(this.carouselAreaDimension-this.carouselUlDimension);if(this.mode)
this.carouselUl.setStyle({top:initialOffset+'px'});else
this.carouselUl.setStyle({left:initialOffset+'px'});}}}},addListeners:function(){this.prevBtn.observe('click',this.movePrev.bindAsEventListener(this));this.nextBtn.observe('click',this.moveNext.bindAsEventListener(this));},movePrev:function(){if(this.prevBtn.hasClassName('prev-active')){var moveX=0,moveY=0;if(this.mode){moveY=this.carouselLiDimension;}
else{moveX=this.carouselLiDimension;}
new Effect.Move(this.carouselUl,{x:moveX,y:moveY,mode:'relative',duration:0.4,queue:{scope:'carousel_scope',limit:1},afterFinish:function(){this.updateNav();}.bind(this)});}},moveNext:function(){if(this.nextBtn.hasClassName('next-active')){var moveX=0,moveY=0;if(this.mode){moveY=-this.carouselLiDimension;}
else{moveX=-this.carouselLiDimension;}
new Effect.Move(this.carouselUl,{x:moveX,y:moveY,mode:'relative',duration:0.4,queue:{scope:'carousel_scope',limit:1},afterFinish:function(){this.updateNav();}.bind(this)});}},updateNav:function(){if(this.carouselUl.positionedOffset()[this.mode]>=0)
this.prevBtn.removeClassName('prev-active');else
this.prevBtn.addClassName('prev-active');if(this.carouselUl.positionedOffset()[this.mode]-10+this.carouselUlDimension<=this.carouselAreaDimension)
this.nextBtn.removeClassName('next-active');else
this.nextBtn.addClassName('next-active');}});;ProductsCarouselAutoScroll=Class.create({options:{mode:'horizontal',showActive:false},initialize:function(carouselContainer,custom_options){Object.extend(this.options,custom_options||{});this.carousel=carouselContainer;this.mode=(this.options.mode=='vertical')?1:0;this.setDimensions();this.addListeners();this.centerActive();this.scroll(4000);},setDimensions:function(){this.carouselUl=this.carousel.down('ul');this.carouselUlSize=this.carouselUl.childElements().length;this.carouselLi=this.carousel.down('li');if(this.mode){this.carouselLiDimension=this.carouselLi.getHeight()
+parseInt(this.carouselLi.getStyle('marginTop'))
+parseInt(this.carouselLi.getStyle('marginBottom'));this.carouselAreaDimension=this.carousel.down('.view-area').getHeight();}
else{this.carouselLiDimension=this.carouselLi.getWidth()
+parseInt(this.carouselLi.getStyle('marginRight'))
+parseInt(this.carouselLi.getStyle('marginLeft'));this.carouselAreaDimension=this.carousel.down('.view-area').getWidth();}
this.carouselUlDimension=this.carouselLiDimension*this.carouselUlSize;this.prevBtn=this.carousel.down('span.prev-views');this.prevBtn.addClassName('prev-active');this.nextBtn=this.carousel.down('span.next-views');this.nextBtn.addClassName('next-active');if(this.mode){this.carouselUl.setStyle({height:this.carouselUlDimension+'px'});}
else{this.carouselUl.setStyle({width:this.carouselUlDimension+'px'});}},centerActive:function(){if(this.options.showActive){if(this.carouselUlDimension>this.carouselAreaDimension){var centerOffset=this.carouselLiDimension*Math.floor(this.carouselAreaDimension/(2*this.carouselLiDimension));var currentOffset=this.carousel.down('li.item-active').positionedOffset()[this.mode];var offsetDiff=centerOffset-currentOffset;if(offsetDiff<0){var initialOffset=(offsetDiff>=this.carouselAreaDimension-this.carouselUlDimension)?offsetDiff:(this.carouselAreaDimension-this.carouselUlDimension);if(this.mode)
this.carouselUl.setStyle({top:initialOffset+'px'});else
this.carouselUl.setStyle({left:initialOffset+'px'});}}}},addListeners:function(){this.prevBtn.observe('click',this.movePrev.bindAsEventListener(this));this.nextBtn.observe('click',this.moveNext.bindAsEventListener(this));},movePrev:function(event){if(!this.carouselUl.hasClassName('processing')){if(event){if(Event.element(event)==this.prevBtn){clearInterval(this.timer);this.timer=null;}}
var carouselElements=this.carouselUl.childElements().length;if(carouselElements>1){var moveX=0,moveY=0;if(this.mode){moveY=this.carouselLiDimension;}
else{moveX=this.carouselLiDimension;}
this.carouselUl.insert({top:this.carouselUl.down('li:last-child')});this.carouselUl.setStyle({left:-this.carouselLiDimension+'px'});new Effect.Move(this.carouselUl,{x:moveX,y:moveY,mode:'relative',duration:0.4,queue:{scope:'carousel_scope',limit:1},beforeStart:function(){this.carouselUl.addClassName("processing");}.bind(this),afterFinish:function(){this.carouselUl.removeClassName("processing");if(event){this.scroll(4000);}}.bind(this)});}}},moveNext:function(event){if(!this.carouselUl.hasClassName('processing')){if(event){if(Event.element(event)==this.nextBtn){clearInterval(this.timer);this.timer=null;}}
var carouselElements=this.carouselUl.childElements().length;if(carouselElements>1){var moveX=0,moveY=0;if(this.mode){moveY=-this.carouselLiDimension;}
else{moveX=-this.carouselLiDimension;}
new Effect.Move(this.carouselUl,{x:moveX,y:moveY,mode:'relative',duration:0.4,queue:{scope:'carousel_scope',limit:1},beforeStart:function(){this.carouselUl.addClassName("processing");}.bind(this),afterFinish:function(){this.carouselUl.insert(this.carouselUl.down('li'));this.carouselUl.setStyle({left:0+'px'});this.carouselUl.removeClassName("processing");if(event){this.scroll(4000);}}.bind(this)});}}},scroll:function(time){this.timer=setInterval(function(){this.moveNext();}.bind(this),time);}});;Event.observe(document,'dom:loaded',function(){nav();})
function nav(){var liElem=$$('#main-nav > ul > li.element');for(var i=0,l=liElem.length;i<l;i++){if(liElem[i].className=='no-drill element'){Event.observe(liElem[i],'mouseover',function(){this.addClassName('active')});Event.observe(liElem[i],'mouseout',function(){this.removeClassName('active')});}else if(liElem[i].className=='no-drill element active'){}else{Event.observe(liElem[i],'mouseover',function(){this.addClassName('over')});Event.observe(liElem[i],'mouseout',function(){this.removeClassName('over')});}}}
function equalizeHeight(pItems){var pHeight=0;for(i=0;i<pItems.length;i++){if(pItems[i].getHeight()>pHeight){pHeight=pItems[i].getHeight();}}
pItems.invoke('setStyle',{height:pHeight+'px'});}
function opener(){document.getElementById('careerForm').show();$("careerSelect").observe('change',function(){if($(this).getValue()!=='0'){console.log(this.getValue());window.open($(this).getValue(),'_blank');}});}
function LayeredNavi(){if($('layered-nav')){var drills=$$('#layered-nav .drilldown').each(function(e){e.setStyle({left:0}).hide();})
document.observe('click',function(event){var element=Event.findElement(event,'table.row');if(!element){drills.each(function(ed){ed.hide().up('td').removeClassName('isopen');})}});$$('#layered-nav td.ne').each(function(list){if(list.select('.drilldown').length==1){Event.observe(list,'click',function(event){if(!Event.element(event).up('td')){var clickedLi=Event.element(event);}else{var clickedLi=Event.element(event).up('td');}
var clickedHref=event.findElement('a');var drillList=clickedLi.down('.drilldown');if(clickedLi||clickedHref){drills.each(function(itemDrill){if(itemDrill.up('td')!==clickedLi){itemDrill.hide().up('td').removeClassName('isopen');}});if(clickedLi.hasClassName('isopen')){console.log('bylo')
if(clickedHref){new Effect.SlideUp(drillList,{duration:0.3,afterFinish:function(effect){clickedLi.removeClassName('isopen');}});}else{new Effect.SlideUp(drillList,{duration:0.3,afterFinish:function(effect){clickedLi.removeClassName('isopen');},queue:{position:'end',scope:'menuxscope'}});}}else{console.log(clickedLi)
new Effect.SlideDown(drillList,{duration:0.3,beforeStart:function(effect){clickedLi.addClassName('isopen');console.log(clickedLi)},queue:{position:'end',scope:'menuxscope'}});}}});}});}};Ajaxify={Request:{count:0,send:function(sUrl,fnAfter,oParams){if(typeof(oParams)=='string'){oParams=oParams.toQueryParams();}
if(!oParams){oParams={ajaxify:true,sanitizeJSON:true};}
else{oParams.ajaxify=true;oParams.sanitizeJSON=true;}
Ajaxify.Event.fire('ajax_request_prepared');Ajaxify.Request.count++;var request=new Ajax.Request(sUrl,{onSuccess:function(response){var oData=response.responseText.evalJSON();if(fnAfter)
fnAfter(oData);if(oData.blocks){for(var i=0,j=oData.blocks.length;i<j;i++){Ajaxify.Update.doUpdate(oData.blocks[i].code,oData.blocks[i].content);}}
Ajaxify.addHandlers();Ajaxify.Event.fire('ajax_request_complete',response);Ajaxify.Request.count--;},parameters:oParams});}},Update:{hDest:new Hash(),add:function(sCode,oDest,oParam){if(!oParam)
oParam={};var oData={'target':oDest,'params':oParam};this.hDest.set(sCode,oData);},doUpdate:function(sCode,oData){var oBlock=this.hDest.get(sCode);if(oBlock){Ajaxify.Event.fire('before_'+sCode+'_update',oBlock.target);if(typeof(oBlock.target)=='string')
oTarget=$$(oBlock.target)[0];else
oTarget=oBlock.target;if(oBlock.params.parse){oData=oBlock.params.parse(oData);}
if(!oBlock.params.mode){oTarget.replace(oData);}
else{switch(oBlock.params.mode){case'top':oTarget.insert({top:oData});break;case'bottom':oTarget.insert({bottom:oData});break;case'after':oTarget.insert({after:oData});break;case'before':oTarget.insert({before:oData});break;case'update':oTarget.update(oData);break;default:var fnCallback=oBlock.params.mode;oTarget.fnCallback(oData);}}}
Ajaxify.Event.fire('after_'+sCode+'_update',oBlock.target);}},Event:{enabled:true,enable:function(){this.enabled=true;},disable:function(){this.enabled=false;},init:function(){this.registred=new Hash();},register:function(sName,fnCallback){if(!this.registred)
this.init();if(!this.registred.get(sName))
this.registred.set(sName,new Array());this.registred.get(sName)[this.registred.get(sName).length]=fnCallback;},fire:function(sName,oParams){if(!this.enabled)
return;if(this.registred.get(sName)){for(var i=0,j=this.registred.get(sName).length;i<j;i++){this.registred.get(sName)[i](oParams);}}}},hHandlers:new Hash,handle:function(sSelector,fnCallback){this.hHandlers.set(sSelector,fnCallback);},Handler:{location:function(oRef){var sOnclick=oRef.getAttribute('onclick');if(!sOnclick)
return;var sHref=sOnclick.substr(13,sOnclick.length-15);oRef.onclick=function(){Ajaxify.Request.send(sHref);return false;}},link:function(oRef){var fnCurrent=oRef.onclick;oRef.onclick=function(){if(fnCurrent)
var answer=fnCurrent();if(answer||answer==undefined){Ajaxify.Request.send(oRef.href);}
return false;}}},__init:function(){this.Event.init();Element.observe(window,'load',function(){Ajaxify.addHandlers(true);});},addHandlers:function(bForce){if(!bForce)
bForce=false;this.hHandlers.each(function(item){var aElements=$$(item.key);for(var i=0,j=aElements.length;i<j;i++){if(aElements[i].hasAttribute('ajaxified')&&!bForce)
continue;item.value(aElements[i]);aElements[i].setAttribute('ajaxified',true);}});}}
Ajaxify.__init();;if(typeof(Control)=='undefined')
Control={};var $proc=function(proc){return typeof(proc)=='function'?proc:function(){return proc};};var $value=function(value){return typeof(value)=='function'?value():value;};Object.Event={extend:function(object){object._objectEventSetup=function(event_name){this._observers=this._observers||{};this._observers[event_name]=this._observers[event_name]||[];};object.observe=function(event_name,observer){if(typeof(event_name)=='string'&&typeof(observer)!='undefined'){this._objectEventSetup(event_name);if(!this._observers[event_name].include(observer))
this._observers[event_name].push(observer);}else
for(var e in event_name)
this.observe(e,event_name[e]);};object.stopObserving=function(event_name,observer){this._objectEventSetup(event_name);if(event_name&&observer)
this._observers[event_name]=this._observers[event_name].without(observer);else if(event_name)
this._observers[event_name]=[];else
this._observers={};};object.observeOnce=function(event_name,outer_observer){var inner_observer=function(){outer_observer.apply(this,arguments);this.stopObserving(event_name,inner_observer);}.bind(this);this._objectEventSetup(event_name);this._observers[event_name].push(inner_observer);};object.notify=function(event_name){this._objectEventSetup(event_name);var collected_return_values=[];var args=$A(arguments).slice(1);try{for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this,args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};if(object.prototype){object.prototype._objectEventSetup=object._objectEventSetup;object.prototype.observe=object.observe;object.prototype.stopObserving=object.stopObserving;object.prototype.observeOnce=object.observeOnce;object.prototype.notify=function(event_name){if(object.notify){var args=$A(arguments).slice(1);args.unshift(this);args.unshift(event_name);object.notify.apply(object,args);}
this._objectEventSetup(event_name);var args=$A(arguments).slice(1);var collected_return_values=[];try{if(this.options&&this.options[event_name]&&typeof(this.options[event_name])=='function')
collected_return_values.push(this.options[event_name].apply(this,args)||null);var callbacks_copy=this._observers[event_name];for(var i=0;i<callbacks_copy.length;++i)
collected_return_values.push(callbacks_copy[i].apply(this,args)||null);}catch(e){if(e==$break)
return false;else
throw e;}
return collected_return_values;};}}};Element.addMethods({observeOnce:function(element,event_name,outer_callback){var inner_callback=function(){outer_callback.apply(this,arguments);Element.stopObserving(element,event_name,inner_callback);};Element.observe(element,event_name,inner_callback);}});(function(){function wheel(event){var delta,element,custom_event;if(event.wheelDelta){delta=event.wheelDelta/120;}else if(event.detail){delta=-event.detail/3;}
if(!delta){return;}
element=Event.extend(event).target;element=Element.extend(element.nodeType===Node.TEXT_NODE?element.parentNode:element);custom_event=element.fire('mouse:wheel',{delta:delta});if(custom_event.stopped){Event.stop(event);return false;}}
document.observe('mousewheel',wheel);document.observe('DOMMouseScroll',wheel);})();var IframeShim=Class.create({initialize:function(){this.element=new Element('iframe',{style:'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',src:'javascript:void(0);',frameborder:0});$(document.body).insert(this.element);},hide:function(){this.element.hide();return this;},show:function(){this.element.show();return this;},positionUnder:function(element){var element=$(element);var offset=element.cumulativeOffset();var dimensions=element.getDimensions();this.element.setStyle({left:offset[0]+'px',top:offset[1]+'px',width:dimensions.width+'px',height:dimensions.height+'px',zIndex:element.getStyle('zIndex')-1}).show();return this;},setBounds:function(bounds){for(prop in bounds)
bounds[prop]+='px';this.element.setStyle(bounds);return this;},destroy:function(){if(this.element)
this.element.remove();return this;}});;if(typeof(Draggable)!='undefined'){Draggable.prototype.draw=function(point){var pos=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);pos[0]+=r[0]-Position.deltaX;pos[1]+=r[1]-Position.deltaY;}
var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}
var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));if(this.options.snap){if(typeof this.options.snap=='function'){p=this.options.snap(p[0],p[1],this);}else{if(this.options.snap instanceof Array){p=p.map(function(v,i){return Math.round(v/this.options.snap[i])*this.options.snap[i]}.bind(this))}else{p=p.map(function(v){return Math.round(v/this.options.snap)*this.options.snap}.bind(this))}}}
if(this.options.onDraw)
this.options.onDraw.bind(this)(p);else{var style=this.element.style;if(this.options.constrainToViewport){var viewport_dimensions=document.viewport.getDimensions();var container_dimensions=this.element.getDimensions();var margin_top=parseInt(this.element.getStyle('margin-top'));var margin_left=parseInt(this.element.getStyle('margin-left'));var boundary=[[0-margin_left,0-margin_top],[(viewport_dimensions.width-container_dimensions.width)-margin_left,(viewport_dimensions.height-container_dimensions.height)-margin_top]];if((!this.options.constraint)||(this.options.constraint=='horizontal')){if((p[0]>=boundary[0][0])&&(p[0]<=boundary[1][0]))
this.element.style.left=p[0]+"px";else
this.element.style.left=((p[0]<boundary[0][0])?boundary[0][0]:boundary[1][0])+"px";}
if((!this.options.constraint)||(this.options.constraint=='vertical')){if((p[1]>=boundary[0][1])&&(p[1]<=boundary[1][1]))
this.element.style.top=p[1]+"px";else
this.element.style.top=((p[1]<=boundary[0][1])?boundary[0][1]:boundary[1][1])+"px";}}else{if((!this.options.constraint)||(this.options.constraint=='horizontal'))
style.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
style.top=p[1]+"px";}
if(style.visibility=="hidden")
style.visibility="";}};}
if(typeof(Prototype)=="undefined")
throw"Control.Window requires Prototype to be loaded.";if(typeof(IframeShim)=="undefined")
throw"Control.Window requires IframeShim to be loaded.";if(typeof(Object.Event)=="undefined")
throw"Control.Window requires Object.Event to be loaded.";Control.Window=Class.create({initialize:function(container,options){Control.Window.windows.push(this);this.container=false;this.isOpen=false;this.href=false;this.sourceContainer=false;this.ajaxRequest=false;this.remoteContentLoaded=false;this.numberInSequence=Control.Window.windows.length+1;this.indicator=false;this.effects={fade:false,appear:false};this.indicatorEffects={fade:false,appear:false};this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:'center',offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:false,fade:false,fadeDuration:0.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,method:'post',parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},options||{});this.indicator=this.options.indicator?$(this.options.indicator):false;if(container){if(typeof(container)=="string"&&container.match(Control.Window.uriRegex))
this.href=container;else{this.container=$(container);this.createDefaultContainer(container);if(this.container&&((this.container.readAttribute('href')&&this.container.readAttribute('href')!='')||(this.options.hover&&this.options.hover!==true))){if(this.options.hover&&this.options.hover!==true)
this.sourceContainer=$(this.options.hover);else{this.sourceContainer=this.container;this.href=this.container.readAttribute('href');var rel=this.href.match(/^#(.+)$/);if(rel&&rel[1]){this.container=$(rel[1]);this.href=false;}else
this.container=false;}
this.sourceContainerOpenHandler=function(event){this.open(event);event.stop();return false;}.bindAsEventListener(this);this.sourceContainerCloseHandler=function(event){this.close(event);}.bindAsEventListener(this);this.sourceContainerMouseMoveHandler=function(event){this.position(event);}.bindAsEventListener(this);if(this.options.hover){this.sourceContainer.observe('mouseenter',this.sourceContainerOpenHandler);this.sourceContainer.observe('mouseleave',this.sourceContainerCloseHandler);if(this.options.position=='mouse')
this.sourceContainer.observe('mousemove',this.sourceContainerMouseMoveHandler);}else
this.sourceContainer.observe('click',this.sourceContainerOpenHandler);}}}
this.createDefaultContainer(container);if(this.options.insertRemoteContentAt===false)
this.options.insertRemoteContentAt=this.container;var styles={margin:0,position:'absolute',zIndex:Control.Window.initialZIndexForWindow()};if(this.options.width)
styles.width=$value(this.options.width)+'px';if(this.options.height)
styles.height=$value(this.options.height)+'px';this.container.setStyle(styles);if(this.options.className)
this.container.addClassName(this.options.className);this.positionHandler=this.position.bindAsEventListener(this);this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);this.container.observe('mousedown',this.bringToFrontHandler);this.container.hide();this.closeHandler=this.close.bindAsEventListener(this);if(this.options.iframeshim){this.iFrameShim=new IframeShim();this.iFrameShim.hide();}
this.applyResizable();this.applyDraggable();Event.observe(window,'resize',this.outOfBoundsPositionHandler);this.notify('afterInitialize');},open:function(event){if(this.isOpen){this.bringToFront();return false;}
if(this.notify('beforeOpen')===false)
return false;if(this.options.closeOnClick){if(this.options.closeOnClick===true)
this.closeOnClickContainer=$(document.body);else if(this.options.closeOnClick=='container')
this.closeOnClickContainer=this.container;else if(this.options.closeOnClick=='overlay'){Control.Overlay.load();this.closeOnClickContainer=Control.Overlay.container;}else
this.closeOnClickContainer=$(this.options.closeOnClick);this.closeOnClickContainer.observe('click',this.closeHandler);}
if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var img=new Element('img');img.observe('load',function(img){this.getRemoteContentInsertionTarget().insert(img);this.position();if(this.notify('onRemoteContentLoaded')!==false){if(this.options.indicator)
this.hideIndicator();this.finishOpen();}}.bind(this,img));img.writeAttribute('src',this.href);}else{if(!this.ajaxRequest){if(this.options.indicator)
this.showIndicator();this.ajaxRequest=new Ajax.Request(this.href,{method:this.options.method,parameters:this.options.parameters,onComplete:function(request){this.notify('onComplete',request);this.ajaxRequest=false;}.bind(this),onSuccess:function(request){this.getRemoteContentInsertionTarget().insert(request.responseText);this.notify('onSuccess',request);if(this.notify('onRemoteContentLoaded')!==false){if(this.options.indicator)
this.hideIndicator();this.finishOpen();}}.bind(this),onFailure:function(request){this.notify('onFailure',request);if(this.options.indicator)
this.hideIndicator();}.bind(this),onException:function(request,e){this.notify('onException',request,e);if(this.options.indicator)
this.hideIndicator();}.bind(this)});}}
return true;}else if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.options.indicator)
this.showIndicator();this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));var iframe=this.container.down('iframe');iframe.onload=function(){this.notify('onRemoteContentLoaded');if(this.options.indicator)
this.hideIndicator();iframe.onload=null;}.bind(this);}
this.finishOpen(event);return true},close:function(event){if(!this.isOpen||this.notify('beforeClose',event)===false)
return false;if(this.options.closeOnClick)
this.closeOnClickContainer.stopObserving('click',this.closeHandler);if(this.options.fade){this.effects.fade=new Effect.Fade(this.container,{queue:{position:'front',scope:'Control.Window'+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim)
this.iFrameShim.hide();this.isOpen=false;this.notify('afterClose');}.bind(this)});}else{this.container.hide();if(this.iFrameShim)
this.iFrameShim.hide();}
if(this.ajaxRequest)
this.ajaxRequest.transport.abort();if(!(this.options.draggable||this.options.resizable)&&this.options.position=='center')
Event.stopObserving(window,'resize',this.positionHandler);if(!this.options.draggable&&this.options.position=='center')
Event.stopObserving(window,'scroll',this.positionHandler);if(this.options.indicator)
this.hideIndicator();if(!this.options.fade){this.isOpen=false;this.notify('afterClose');}
return true;},position:function(event){if(this.options.position=='mouse'){var xy=[Event.pointerX(event),Event.pointerY(event)];this.container.setStyle({top:xy[1]+$value(this.options.offsetTop)+'px',left:xy[0]+$value(this.options.offsetLeft)+'px'});return;}
var container_dimensions=this.container.getDimensions();var viewport_dimensions=document.viewport.getDimensions();Position.prepare();var offset_left=(Position.deltaX+Math.floor((viewport_dimensions.width-container_dimensions.width)/2));var offset_top=(Position.deltaY+((viewport_dimensions.height>container_dimensions.height)?Math.floor((viewport_dimensions.height-container_dimensions.height)/2):0));if(this.options.position=='center'){this.container.setStyle({top:(container_dimensions.height<=viewport_dimensions.height)?((offset_top!=null&&offset_top>0)?offset_top:0)+'px':0,left:(container_dimensions.width<=viewport_dimensions.width)?((offset_left!=null&&offset_left>0)?offset_left:0)+'px':0});}else if(this.options.position=='relative'){var xy=this.sourceContainer.cumulativeOffset();var top=xy[1]+$value(this.options.offsetTop);var left=xy[0]+$value(this.options.offsetLeft);this.container.setStyle({top:(container_dimensions.height<=viewport_dimensions.height)?(this.options.constrainToViewport?Math.max(0,Math.min(viewport_dimensions.height-(container_dimensions.height),top)):top)+'px':0,left:(container_dimensions.width<=viewport_dimensions.width)?(this.options.constrainToViewport?Math.max(0,Math.min(viewport_dimensions.width-(container_dimensions.width),left)):left)+'px':0});}else if(this.options.position.length){var top=$value(this.options.position[1])+$value(this.options.offsetTop);var left=$value(this.options.position[0])+$value(this.options.offsetLeft);this.container.setStyle({top:(container_dimensions.height<=viewport_dimensions.height)?(this.options.constrainToViewport?Math.max(0,Math.min(viewport_dimensions.height-(container_dimensions.height),top)):top)+'px':0,left:(container_dimensions.width<=viewport_dimensions.width)?(this.options.constrainToViewport?Math.max(0,Math.min(viewport_dimensions.width-(container_dimensions.width),left)):left)+'px':0});}
if(this.iFrameShim)
this.updateIFrameShimZIndex();},ensureInBounds:function(){if(!this.isOpen)
return;var viewport_dimensions=document.viewport.getDimensions();var container_offset=this.container.cumulativeOffset();var container_dimensions=this.container.getDimensions();if(container_offset.left+container_dimensions.width>viewport_dimensions.width){this.container.setStyle({left:(Math.max(0,viewport_dimensions.width-container_dimensions.width))+'px'});}
if(container_offset.top+container_dimensions.height>viewport_dimensions.height){this.container.setStyle({top:(Math.max(0,viewport_dimensions.height-container_dimensions.height))+'px'});}},bringToFront:function(){Control.Window.bringToFront(this);this.notify('bringToFront');},destroy:function(){this.container.stopObserving('mousedown',this.bringToFrontHandler);if(this.draggable){Draggables.removeObserver(this.container);this.draggable.handle.stopObserving('mousedown',this.bringToFrontHandler);this.draggable.destroy();}
if(this.resizable){Resizables.removeObserver(this.container);this.resizable.handle.stopObserving('mousedown',this.bringToFrontHandler);this.resizable.destroy();}
if(this.container&&!this.sourceContainer)
this.container.remove();if(this.sourceContainer){if(this.options.hover){this.sourceContainer.stopObserving('mouseenter',this.sourceContainerOpenHandler);this.sourceContainer.stopObserving('mouseleave',this.sourceContainerCloseHandler);if(this.options.position=='mouse')
this.sourceContainer.stopObserving('mousemove',this.sourceContainerMouseMoveHandler);}else
this.sourceContainer.stopObserving('click',this.sourceContainerOpenHandler);}
if(this.iFrameShim)
this.iFrameShim.destroy();Event.stopObserving(window,'resize',this.outOfBoundsPositionHandler);Control.Window.windows=Control.Window.windows.without(this);this.notify('afterDestroy');},applyResizable:function(){if(this.options.resizable){if(typeof(Resizable)=="undefined")
throw"Control.Window requires resizable.js to be loaded.";var resizable_handle=null;if(this.options.resizable===true){resizable_handle=new Element('div',{className:'resizable_handle'});this.container.insert(resizable_handle);}else
resizable_handle=$(this.options.resziable);this.resizable=new Resizable(this.container,{handle:resizable_handle,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(element){return(document.viewport.getDimensions().height-parseInt(element.style.top||0))-(element.getHeight()-parseInt(element.style.height||0));}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(element){return(document.viewport.getDimensions().width-parseInt(element.style.left||0))-(element.getWidth()-parseInt(element.style.width||0));}:this.options.maxWidth});this.resizable.handle.observe('mousedown',this.bringToFrontHandler);Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim)
this.updateIFrameShimZIndex();this.notify('onResize');}.bind(this)));}},applyDraggable:function(){if(this.options.draggable){if(typeof(Draggables)=="undefined")
throw"Control.Window requires dragdrop.js to be loaded.";var draggable_handle=null;if(this.options.draggable===true){draggable_handle=new Element('div',{className:'draggable_handle'});this.container.insert(draggable_handle);}else
draggable_handle=$(this.options.draggable);this.draggable=new Draggable(this.container,{handle:draggable_handle,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle('z-index'),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;document.onselectstart=function(){return false;};}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart;}.bind(this)});this.draggable.handle.observe('mousedown',this.bringToFrontHandler);Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim)
this.updateIFrameShimZIndex();this.notify('onDrag');}.bind(this)));}},createDefaultContainer:function(container){if(!this.container){this.container=new Element('div',{id:'control_window_'+this.numberInSequence});$(document.body).insert(this.container);if(typeof(container)=="string"&&$(container)==null&&!container.match(/^#(.+)$/)&&!container.match(Control.Window.uriRegex))
this.container.update(container);}},finishOpen:function(event){this.bringToFront();if(this.options.fade){if(typeof(Effect)=="undefined")
throw"Control.Window requires effects.js to be loaded."
if(this.effects.fade)
this.effects.fade.cancel();this.effects.appear=new Effect.Appear(this.container,{queue:{position:'end',scope:'Control.Window.'+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim)
this.updateIFrameShimZIndex();this.isOpen=true;this.notify('afterOpen');}.bind(this)});}else
this.container.show();this.position(event);if(!(this.options.draggable||this.options.resizable)&&this.options.position=='center')
Event.observe(window,'resize',this.positionHandler,false);if(!this.options.draggable&&this.options.position=='center')
Event.observe(window,'scroll',this.positionHandler,false);if(!this.options.fade){this.isOpen=true;this.notify('afterOpen');}
return true;},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade){this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:'front',scope:'Control.Window.indicator.'+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2});}else
this.indicator.show();}.bind(this),Control.Window.indicatorTimeout);},hideIndicator:function(){if(this.showIndicatorTimeout)
window.clearTimeout(this.showIndicatorTimeout);this.indicator.hide();},getRemoteContentInsertionTarget:function(){return typeof(this.options.insertRemoteContentAt)=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt);},updateIFrameShimZIndex:function(){if(this.iFrameShim)
this.iFrameShim.positionUnder(this.container);}});Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(w){Control.Window.windows=Control.Window.windows.without(w);Control.Window.windows.push(w);Control.Window.windows.each(function(w,i){var z_index=Control.Window.baseZIndex+i;w.container.setStyle({zIndex:z_index});if(w.isOpen){if(w.iFrameShim)
w.updateIFrameShimZIndex();}
if(w.options.draggable)
w.draggable.options.zindex=z_index;});},open:function(container,options){var w=new Control.Window(container,options);w.open();return w;},initialZIndexForWindow:function(w){return Control.Window.baseZIndex+(Control.Window.windows.length-1);}});Object.Event.extend(Control.Window);Control.Window.LayoutUpdateObserver=Class.create({initialize:function(w,observer){this.w=w;this.element=$(w.container);this.observer=observer;},onStart:Prototype.emptyFunction,onEnd:function(event_name,instance){if(instance.element==this.element&&this.iFrameShim)
this.w.updateIFrameShimZIndex();},onResize:function(event_name,instance){if(instance.element==this.element)
this.observer(this.element);},onDrag:function(event_name,instance){if(instance.element==this.element)
this.observer(this.element);}});Control.Overlay={id:'control_overlay',loaded:false,container:false,lastOpacity:0,styles:{position:'fixed',top:0,left:0,width:'100%',height:'100%',zIndex:9998},ieStyles:{position:'absolute',top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded)
return false;Control.Overlay.loaded=true;Control.Overlay.container=new Element('div',{id:Control.Overlay.id});$(document.body).insert(Control.Overlay.container);if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);Event.observe(window,'scroll',Control.Overlay.positionOverlay);Event.observe(window,'resize',Control.Overlay.positionOverlay);Control.Overlay.observe('beforeShow',Control.Overlay.positionOverlay);}else
Control.Overlay.container.setStyle(Control.Overlay.styles);Control.Overlay.container.hide();return true;},unload:function(){if(!Control.Overlay.loaded)
return false;Event.stopObserving(window,'resize',Control.Overlay.positionOverlay);Control.Overlay.stopObserving('beforeShow',Control.Overlay.positionOverlay);Control.Overlay.container.remove();Control.Overlay.loaded=false;return true;},show:function(opacity,fade){if(Control.Overlay.notify('beforeShow')===false)
return false;Control.Overlay.lastOpacity=opacity;if(fade){if(typeof(Effect)=="undefined")
throw"Control.Window requires effects.js to be loaded."
if(Control.Overlay.effects.fade)
Control.Overlay.effects.fade.cancel();Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:'end',scope:'Control.Overlay'},afterFinish:function(){Control.Overlay.notify('afterShow');},from:0,to:Control.Overlay.lastOpacity,duration:(fade===true?0.75:fade)/2});}else{Control.Overlay.container.setStyle({opacity:opacity||1});Control.Overlay.container.show();Control.Overlay.notify('afterShow');}
return true;},hide:function(fade){if(Control.Overlay.notify('beforeHide')===false)
return false;if(Control.Overlay.effects.appear)
Control.Overlay.effects.appear.cancel();if(fade){Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:'front',scope:'Control.Overlay'},afterFinish:function(){Control.Overlay.notify('afterHide');},from:Control.Overlay.lastOpacity,to:0,duration:(fade===true?0.75:fade)/2});}else{Control.Overlay.container.hide();Control.Overlay.notify('afterHide');}
return true;},positionIFrameShim:function(){if(Control.Overlay.container.visible())
Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container);},positionOverlay:function(){Control.Overlay.container.setStyle({width:document.body.clientWidth+'px',height:document.body.clientHeight+'px'});}};Object.Event.extend(Control.Overlay);Control.ToolTip=Class.create(Control.Window,{initialize:function($super,container,tooltip,options){$super(tooltip,Object.extend(Object.extend(Object.clone(Control.ToolTip.defaultOptions),options||{}),{position:'mouse',hover:container}));}});Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});Control.Modal=Class.create(Control.Window,{initialize:function($super,container,options){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();$super(container,Object.extend(Object.clone(Control.Modal.defaultOptions),options||{}));},closeWithoutOverlay:function(){this.keepOverlay=true;this.close();}});Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:0.5,closeOnClick:'overlay'},current:false,open:function(container,options){var modal=new Control.Modal(container,options);modal.open();return modal;},close:function(){if(Control.Modal.current)
Control.Modal.current.close();},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();this.observe('beforeOpen',Control.Modal.Observers.beforeOpen.bind(this));this.observe('afterOpen',Control.Modal.Observers.afterOpen.bind(this));this.observe('afterClose',Control.Modal.Observers.afterClose.bind(this));}},Observers:{beforeOpen:function(){Control.Window.windows.without(this).each(function(w){if(w.closeWithoutOverlay&&w.isOpen){w.closeWithoutOverlay();}else{w.close();}});if(!Control.Overlay.overlayFinishedOpening){Control.Overlay.observeOnce('afterShow',function(){Control.Overlay.overlayFinishedOpening=true;this.open();}.bind(this));Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);throw $break;}},afterOpen:function(){Control.Overlay.show(this.options.overlayOpacity);Control.Overlay.overlayFinishedOpening=true;Control.Modal.current=this;},afterClose:function(){if(!this.keepOverlay){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);Control.Overlay.overlayFinishedOpening=false;}
this.keepOverlay=false;Control.Modal.current=false;}}});Control.LightBox=Class.create(Control.Window,{initialize:function($super,container,options){this.allImagesLoaded=false;if(options.modal){var options=Object.extend(Object.clone(Control.LightBox.defaultOptions),options||{});options=Object.extend(Object.clone(Control.Modal.defaultOptions),options);options=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(options);$super(container,options);}else
$super(container,Object.extend(Object.clone(Control.LightBox.defaultOptions),options||{}));this.hasRemoteContent=this.href&&!this.options.iframe;if(this.hasRemoteContent)
this.observe('onRemoteContentLoaded',Control.LightBox.Observers.onRemoteContentLoaded.bind(this));else
this.applyImageObservers();this.observe('beforeOpen',Control.LightBox.Observers.beforeOpen.bind(this));},applyImageObservers:function(){var images=this.getImages();this.numberImagesToLoad=images.length;this.numberofImagesLoaded=0;images.each(function(image){image.observe('load',function(image){++this.numberofImagesLoaded;if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;this.onAllImagesLoaded();}}.bind(this,image));image.hide();}.bind(this));},onAllImagesLoaded:function(){this.getImages().each(function(image){this.showImage(image);}.bind(this));if(this.hasRemoteContent){if(this.options.indicator)
this.hideIndicator();this.finishOpen();}else
this.open();},getImages:function(){return this.container.select(Control.LightBox.imageSelector);},showImage:function(image){image.show();}});Object.extend(Control.LightBox,{imageSelector:'img',defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded)
throw $break;},onRemoteContentLoaded:function(){this.applyImageObservers();if(!this.allImagesLoaded)
throw $break;}}});;if(typeof(Prototype)=="undefined")
throw"Control.ScrollBar requires Prototype to be loaded.";if(typeof(Control.Slider)=="undefined")
throw"Control.ScrollBar requires Control.Slider to be loaded.";if(typeof(Object.Event)=="undefined")
throw"Control.ScrollBar requires Object.Event to be loaded.";Control.ScrollBar=Class.create({initialize:function(container,track,options){Control.ScrollBar.instances.push(this);this.enabled=false;this.notificationTimeout=false;this.container=$(container);this.boundMouseWheelEvent=this.onMouseWheel.bindAsEventListener(this);this.boundResizeObserver=this.onWindowResize.bind(this);this.track=$(track);this.handle=this.track.firstDescendant();this.options=Object.extend({active_class_name:'scrolling',apply_active_class_name_to:this.container,notification_timeout_length:125,handle_minimum_length:25,scroll_to_smoothing:0.01,scroll_to_steps:15,scroll_to_precision:100,proportional:true,custom_event:null,custom_event_handler:null,scroll_axis:'vertical',slider_options:{}},options||{});this.slider=new Control.Slider(this.handle,this.track,Object.extend({axis:this.options.scroll_axis,onSlide:this.onChange.bind(this),onChange:this.onChange.bind(this)},this.options.slider_options));this.recalculateLayout();Event.observe(window,'resize',this.boundResizeObserver);if(this.options.custom_event){if(Object.isFunction(this.options.custom_event_handler)){this.container.observe(this.options.custom_event,this.options.custom_event_handler);}else{this.container.observe(this.options.custom_event,this.boundResizeObserver);}}
this.handle.observe('mousedown',function(){if(this.auto_sliding_executer)
this.auto_sliding_executer.stop();}.bind(this));},destroy:function(){Event.stopObserving(window,'resize',this.boundResizeObserver);if(this.options.active_class_name)
$(this.options.apply_active_class_name_to).removeClassName(this.options.active_class_name);if(this.options.custom_event){this.container.stopObserving(this.options.custom_event);}},scrollLength:function(){return(this.options.scroll_axis=='vertical')?this.container.scrollHeight:this.container.scrollWidth;},offsetLength:function(){return(this.options.scroll_axis=='vertical')?this.container.offsetHeight:this.container.offsetWidth;},enable:function(){this.enabled=true;this.container.observe('mouse:wheel',this.boundMouseWheelEvent);this.slider.setEnabled();this.track.show();if(this.options.active_class_name)
$(this.options.apply_active_class_name_to).addClassName(this.options.active_class_name);this.notify('enabled');},disable:function(){this.enabled=false;this.container.stopObserving('mouse:wheel',this.boundMouseWheelEvent);this.slider.setDisabled();this.track.hide();if(this.options.active_class_name)
$(this.options.apply_active_class_name_to).removeClassName(this.options.active_class_name);this.notify('disabled');this.reset();},reset:function(){this.slider.setValue(0);},recalculateLayout:function(){if(this.scrollLength()<=this.offsetLength())
this.disable();else{this.enable();this.slider.trackLength=this.slider.maximumOffset()-this.slider.minimumOffset();if(this.options.proportional){this.slider.handleLength=Math.max(this.offsetLength()*(this.offsetLength()/this.scrollLength()),this.options.handle_minimum_length);if(this.options.scroll_axis=='vertical')
this.handle.style.height=this.slider.handleLength+'px';else
this.handle.style.width=this.slider.handleLength+'px';}
this.scrollBy(0);}},onWindowResize:function(){this.recalculateLayout();this.scrollBy(0);},onMouseWheel:function(event){if(this.auto_sliding_executer)
this.auto_sliding_executer.stop();this.slider.setValueBy(-(event.memo.delta/20));event.stop();return false;},onChange:function(value){var scroll_pos=Math.round(value/this.slider.maximum*(this.scrollLength()-this.offsetLength()));if(this.options.scroll_axis=='vertical')
this.container.scrollTop=scroll_pos;else
this.container.scrollLeft=scroll_pos;if(this.notification_timeout)
window.clearTimeout(this.notificationTimeout);this.notificationTimeout=window.setTimeout(function(){this.notify('change',value);}.bind(this),this.options.notification_timeout_length);},getCurrentMaximumDelta:function(){return this.slider.maximum*(this.scrollLength()-this.offsetLength());},getContainerOffset:function(element){var offset=element.positionedOffset();while(element.getOffsetParent()!=this.container)
{element=element.getOffsetParent();offset[0]+=element.positionedOffset()[0];offset[1]+=element.positionedOffset()[1];offset.top+=element.positionedOffset().top;offset.left+=element.positionedOffset().left;}
return offset;},getDeltaToElement:function(element){if(this.options.scroll_axis=='vertical')
return this.slider.maximum*((this.getContainerOffset(element).top+(element.getHeight()/2))-(this.container.getHeight()/2));else
return this.slider.maximum*((this.getContainerOffset(element).left+(element.getWidth()/2))-(this.container.getWidth()/2));},scrollTo:function(y,animate){var precision=this.options.scroll_to_precision,current_maximum_delta=this.getCurrentMaximumDelta();if(precision=='auto')
precision=Math.pow(10,Math.ceil(Math.log(current_maximum_delta)/Math.log(10)));if(y=='top')
y=0;else if(y=='bottom')
y=current_maximum_delta;else if(typeof(y)!="number")
y=this.getDeltaToElement($(y));if(this.enabled){y=Math.max(0,Math.min(y,current_maximum_delta));if(this.auto_sliding_executer)
this.auto_sliding_executer.stop();var target_value=y/current_maximum_delta;var original_slider_value=this.slider.value;var delta=(target_value-original_slider_value)*current_maximum_delta;if(animate){this.auto_sliding_executer=new PeriodicalExecuter(function(){if(Math.round(this.slider.value*precision)/precision<Math.round(target_value*precision)/precision||Math.round(this.slider.value*precision)/precision>Math.round(target_value*precision)/precision){this.scrollBy(delta/this.options.scroll_to_steps);}else{this.auto_sliding_executer.stop();this.auto_sliding_executer=null;if(typeof(animate)=="function")
animate();}}.bind(this),this.options.scroll_to_smoothing);}else
this.scrollBy(delta);}else if(typeof(animate)=="function")
animate();},scrollBy:function(y){if(!this.enabled)
return false;this.slider.setValueBy(y/(this.getCurrentMaximumDelta()==0?1:this.getCurrentMaximumDelta()));}});Object.extend(Control.ScrollBar,{instances:[],findByElementId:function(id)
{return Control.ScrollBar.instances.find(function(instance)
{return(instance.container.id&&instance.container.id==id);});}});Object.Event.extend(Control.ScrollBar);;if(!window.Baobaz){window.Baobaz={};}
document.observe('dom:loaded',function(){if(!$('modal-loading')){$(document.body).insert({top:new Element('div',{id:'modal-loading'}).hide()});}})
Baobaz.Modal={init:function(link,options){this.modalClose=new Element('div').addClassName('modal-close');this.modalContent=new Element('div').addClassName('modal-content');this.modalOptions={beforeOpen:function(){$('modal-loading').setStyle({top:((document.viewport.getHeight()-$('modal-loading').getHeight())/2)+'px'});},overlayOpacity:0.75,fade:true,indicator:$('modal-loading'),closeOnClick:this.modalClose,insertRemoteContentAt:this.modalContent};options=options||{};Object.extend(this.modalOptions,options);this.modalOptions.className='modal-window '+(this.modalOptions.className?this.modalOptions.className:'');if(this.modalOptions.afterClose=='remove'){this.modalOptions.afterClose=function(){this.container.remove();};}
var modal=new Control.Modal(link,this.modalOptions);modal.container.insert(this.modalClose);modal.container.insert(this.modalContent);return modal;},open:function(link,options){var modal=this.init(link,options);modal.open();return modal;}};;function checkParent(id){var item=(id=='is_subscribed'||id=='subscription')?id:"list["+id+"]";if($(item)){$(item).checked=true;$(item).value=1;}else{if(id=='is_subscribed'){checkParent('subscription');}}}
function unCheckGroups(field){if($(field).select("input").length){$(field).select("input").each(function(input,index){if(input.type=='checkbox'||input.type=='radio'){input.checked=false;}});}
if($(field).select("select").length){$(field).select("select").each(function(select,index){if(select.type=='select-one'){select.value=select.down('option').value;}});}}
if(!window.Mailchimp){window.Mailchimp={};}
Mailchimp.general={initialize:function(element,fieldset){if($(element)){this.element=$(element);this.fieldset=fieldset;this.onElementMouseClick=this.handleMouseClick.bindAsEventListener(this);this.element.observe('click',this.onElementMouseClick);}},handleMouseClick:function(evt){if(this.element.checked==false)
unCheckGroups(this.fieldset);},hide:function(id){if($(id)){this.element=$(id);if(this.element.type=='checkbox'||this.element.type=='radio'){$(id).checked=true;this.container=this.element.up('li');this.container.hide();}}}};
