if(typeof Prototype=='undefined'||!Prototype.Version.match("1.6"))
throw("Prototype-UI library require Prototype library >= 1.6.0");(function(p){var b=p.Browser,n=navigator;if(b.WebKit){b.WebKitVersion=parseFloat(n.userAgent.match(/AppleWebKit\/([\d\.\+]*)/)[1]);b.Safari2=(b.WebKitVersion<420);}
if(b.IE){b.IEVersion=parseFloat(n.appVersion.split(';')[1].strip().split(' ')[1]);b.IE6=b.IEVersion==6;b.IE7=b.IEVersion==7;}
p.falseFunction=function(){return false};p.trueFunction=function(){return true};})(Prototype);var UI={Abstract:{},Ajax:{}};Object.extend(Class.Methods,{extend:Object.extend.methodize(),addMethods:Class.Methods.addMethods.wrap(function(proceed,source){if(!source)return this;if(!source.hasOwnProperty('methodsAdded'))
return proceed(source);var callback=source.methodsAdded;delete source.methodsAdded;proceed(source);callback.call(source,this);source.methodsAdded=callback;return this;}),addMethod:function(name,lambda){var methods={};methods[name]=lambda;return this.addMethods(methods);},method:function(name){return this.prototype[name].valueOf();},classMethod:function(){$A(arguments).flatten().each(function(method){this[method]=(function(){return this[method].apply(this,arguments);}).bind(this.prototype);},this);return this;},undefMethod:function(name){this.prototype[name]=undefined;return this;},removeMethod:function(name){delete this.prototype[name];return this;},aliasMethod:function(newName,name){this.prototype[newName]=this.prototype[name];return this;},aliasMethodChain:function(target,feature){feature=feature.camelcase();this.aliasMethod(target+"Without"+feature,target);this.aliasMethod(target,target+"With"+feature);return this;}});Object.extend(Number.prototype,{snap:function(round){return parseInt(round==1?this:(this/round).floor()*round);}});Object.extend(String.prototype,{camelcase:function(){var string=this.dasherize().camelize();return string.charAt(0).toUpperCase()+string.slice(1);},makeElement:function(){var wrapper=new Element('div');wrapper.innerHTML=this;return wrapper.down();}});Object.extend(Array.prototype,{isEmpty:function(){return!this.length;},at:function(index){return this[index<0?this.length+index:index];},removeAt:function(index){if(-index>this.length)return;return this.splice(index,1)[0];},removeIf:function(iterator,context){for(var i=this.length-1,objects=[];i>=0;i--)
if(iterator.call(context,this[i],i))
objects.push(this.removeAt(i));return objects.reverse();},remove:function(object){return this.removeIf(function(member){return member===object}).length;},insert:function(index){if(index>this.length)
this.length=index;else if(index<0)
index=this.length+index+1;this.splice.apply(this,[index,0].concat($A(arguments).slice(1)));return this;}});Array.prototype.empty=Array.prototype.isEmpty;Element.addMethods({getScrollDimensions:function(element){element=$(element);return{width:element.scrollWidth,height:element.scrollHeight}},getScrollOffset:function(element){element=$(element);return Element._returnOffset(element.scrollLeft,element.scrollTop);},setScrollOffset:function(element,offset){element=$(element);if(arguments.length==3)
offset={left:offset,top:arguments[2]};element.scrollLeft=offset.left;element.scrollTop=offset.top;return element;},getNumStyle:function(element,style){var value=parseFloat($(element).getStyle(style));return isNaN(value)?null:value;},appendText:function(element,text){element=$(element);element.appendChild(document.createTextNode(String.interpret(text)));return element;}});document.whenReady=(function(){var queue=[];document.observe('dom:loaded',function(){queue.invoke('call',document);queue.clear();document.whenReady=function(callback){callback.bind(document).defer()};});return function(callback){queue.push(callback)};})();Object.extend(document.viewport,{getScrollOffset:document.viewport.getScrollOffsets,setScrollOffset:function(offset){Element.setScrollOffset(Prototype.Browser.WebKit?document.body:document.documentElement,offset);},getScrollDimensions:function(){return Element.getScrollDimensions(Prototype.Browser.WebKit?document.body:document.documentElement);}});document.whenReady(function(){window.$head=$(document.getElementsByTagName('head')[0]);window.$body=$(document.body);});(function(){UI.Options={methodsAdded:function(klass){klass.classMethod($w(' setOptions allOptions optionsGetter optionsSetter optionsAccessor '));},setOptions:function(options){if(!this.hasOwnProperty('options'))
this.options=this.allOptions();this.options=Object.extend(this.options,options||{});},allOptions:function(){var superclass=this.constructor.superclass,ancestor=superclass&&superclass.prototype;return(ancestor&&ancestor.allOptions)?Object.extend(ancestor.allOptions(),this.options):Object.clone(this.options);},optionsGetter:function(){addOptionsAccessors(this,arguments,false);},optionsSetter:function(){addOptionsAccessors(this,arguments,true);},optionsAccessor:function(){this.optionsGetter.apply(this,arguments);this.optionsSetter.apply(this,arguments);}};function addOptionsAccessors(receiver,names,areSetters){names=$A(names).flatten();if(names.empty())
names=Object.keys(receiver.allOptions());names.each(function(name){var accessorName=(areSetters?'set':'get')+name.camelcase();receiver[accessorName]=receiver[accessorName]||(areSetters?function(value){return this.options[name]=value}:function(){return this.options[name]});});}})();var CSS=(function(){function fixPNG(){parseStylesheet.apply(this,$A(arguments).concat(fixRule));};function parseStylesheet(){var patterns=$A(arguments);var method=patterns.pop();var styleSheets=$A(document.styleSheets);if(patterns.length>0){styleSheets=styleSheets.select(function(css){return patterns.any(function(pattern){return css.href&&css.href.match(pattern)});});}
styleSheets.each(function(styleSheet){fixStylesheet.call(this,styleSheet,method)});};function fixStylesheet(stylesheet,method){if(stylesheet.imports)
$A(stylesheet.imports).each(fixStylesheet);var href=stylesheet.href||document.location.href;var docPath=href.substr(0,href.lastIndexOf('/'));$A(stylesheet.rules||stylesheet.cssRules).each(function(rule){method.call(this,rule,docPath)});};var filterPattern='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="#{src}",sizingMethod="#{method}")';function fixRule(rule,docPath){var bgImg=rule.style.backgroundImage;if(bgImg&&bgImg!='none'&&bgImg.match(/^url[("']+(.*\.png)[)"']+$/i)){var src=RegExp.$1;var bgRepeat=rule.style.backgroundRepeat;if(src[0]!='/')
src=docPath+"/"+src;rule.style.filter=filterPattern.interpolate({src:src,method:bgRepeat=="no-repeat"?"crop":"scale"});rule.style.backgroundImage="none";}};var preloadedImages=new Hash();function preloadRule(rule,docPath){var bgImg=rule.style.backgroundImage;if(bgImg&&bgImg!='none'&&bgImg!='initial'){if(!preloadedImages.get(bgImg)){bgImg.match(/^url[("']+(.*)[)"']+$/i);var src=RegExp.$1;if(!(src[0]=='/'||src.match(/^file:/)||src.match(/^https?:/)))
src=docPath+"/"+src;preloadedImages.set(bgImg,true);var image=new Image();image.src=src;}}}
return{fixPNG:(Prototype.Browser.IE&&Prototype.Browser.IEVersion<7)?fixPNG:Prototype.emptyFunction,addRule:function(css){var style=new Element('style',{type:'text/css',media:'screen'});$head.insert(style);if(style.styleSheet)style.styleSheet.cssText=css;else style.appendText(css);return style;},preloadImages:function(){parseStylesheet.apply(this,$A(arguments).concat(preloadRule));}};})();Object.extend(Date.prototype,{addDays:function(days){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+days,this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds());},succ:function(){return this.addDays(1);},firstOfMonth:function(){return new Date(this.getFullYear(),this.getMonth(),1);},endOfMonth:function(){return new Date(this.getFullYear(),this.getMonth()+1,0);},getDayOfYear:function(){return Math.ceil((this-new Date(this.getFullYear(),0,1))/86400000);},strftime:function(grammar){var parts={},i18n=Date.default_i18n;var lambda=function(date,part){switch(part){case'a':return i18n.WEEKDAYS_MEDIUM[date.getDay()];case'A':return i18n.WEEKDAYS[date.getDay()];case'b':case'h':return i18n.MONTHS_SHORT[date.getMonth()];case'B':return i18n.MONTHS[date.getMonth()];case'C':return Math.floor(date.getFullYear()/100);case'd':return date.getDate().toPaddedString(2);case'e':return date.getDate();case'j':return date.getDayOfYear();case'm':return(date.getMonth()+1).toPaddedString(2);case'u':return date.getDay()||7;case'w':return date.getDay();case'y':return date.getFullYear().toString().substring(2);case'Y':return date.getFullYear();case'H':return date.getHours().toPaddedString(2);case'I':return(date.getHours()%12).toPaddedString(2);case'M':return date.getMinutes().toPaddedString(2);case'p':return date.getHours()<12?'am':'pm';case'S':return date.getSeconds().toPaddedString(2);case'n':return'\n';case't':return'\t';case'D':return date.strftime('%m/%d/%y');case'r':return date.strftime('%I:%M:%S %p');case'R':return date.strftime('%H:%M:%S');case'T':return date.strftime('%H:%M:%S');case'c':return date.strftime(i18n.FORMAT_DATETIME);case'x':return date.strftime(i18n.FORMAT_DATE);case'X':return date.strftime(i18n.FORMAT_TIME);}};grammar.scan(/\w+/,function(e){var part=e.first();parts[part]=lambda(this,part);}.bind(this));return grammar.interpolate(parts,Date.STRFT_GRAMMER);},equalsDate:function(other){return(this.getMonth()==other.getMonth()&&this.getDate()==other.getDate()&&this.getFullYear()==other.getFullYear());}});Object.extend(Date,{STRFT_GRAMMER:/(^|.|\r|\n)(\%(\w+))/,default_i18n:{MONTHS_SHORT:$w('Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'),MONTHS:$w('January February March April May June July August September October November December'),WEEKDAYS_MEDIUM:$w('Sun Mon Tue Wed Thu Fri Sat'),WEEKDAYS:$w('Sunday Monday Tuesday Wednesday Thursday Friday Saturday'),FORMAT_DATE:'%m/%d/%Y',FORMAT_TIME:'%H:%M:%S',FORMAT_DATETIME:'%x %X'},parseString:function(dateString,format){var date=new Date(),i18n=Date.default_i18n;format=format.replace('%D','%m/%d/%y');format=format.replace('%T','%H:%M:%S').replace('%r','%I:%M:%S %p').replace('%R','%H:%M:%S');format=format.replace('%c',i18n.FORMAT_DATETIME).replace('%x',i18n.FORMAT_DATE).replace('%X',i18n.FORMAT_TIME);var tokens=format.match(/%./g);dateString.split(/[^A-Za-z0-9\u00A1-\uFFFF]+/).each(function(e,i){switch(tokens[i]){case'%a':case'%A':case'%u':case'%w':break;case'%b':case'%h':date.setMonth(i18n.MONTHS_SHORT.indexOf(e));break;case'%B':date.setMonth(i18n.MONTHS.indexOf(e));break;case'%C':break;case'%d':case'%e':date.setDate(parseInt(e,10));break;case'%j':break;case'%m':date.setMonth(parseInt(e,10)-1);break;case'%w':date.setDay(parseInt(e,10));break;case'%y':var year=parseInt(e,10);if(year<50)year+=2000;if(year<100)year+=1900;date.setYear(year);break;case'%Y':date.setFullYear(parseInt(e,10));break;case'%H':date.setHours(parseInt(e,10));break;case'%I':date.setHours(parseInt(e,10));break;case'%M':date.setMinutes(parseInt(e,10));break;case'%p':if(e=='pm')date.setHours(date.getHours()+12);break;case'%S':date.setSeconds(parseInt(e,10));break;}});return date;}});UI.Benchmark={benchmark:function(lambda,iterations){var date=new Date();(iterations||1).times(lambda);return(new Date()-date)/1000;}};Element.addMethods({enableDrag:function(element){return $(element).writeAttribute('draggable');},disableDrag:function(element){return $(element).writeAttribute('draggable',null);},isDraggable:function(element){return $(element).hasAttribute('draggable');}});(function(){var initPointer,draggedElement;document.observe('mousedown',function(event){if(draggedElement=findDraggable(event.element())){event.preventDefault();initPointer=event.pointer();document.observe('mousemove',startDrag);document.observe('mouseup',cancelDrag);}});function findDraggable(element){while(element&&element!==document){if(element.hasAttribute('draggable'))return element;element=$(element.parentNode);}};function startDrag(event){document.stopObserving('mousemove',startDrag).stopObserving('mouseup',cancelDrag).observe('mousemove',drag).observe('mouseup',endDrag);fire('drag:started',event);};function cancelDrag(event){document.stopObserving('mousemove',startDrag).stopObserving('mouseup',cancelDrag);};function drag(event){fire('drag:updated',event);};function endDrag(event){document.stopObserving('mousemove',drag).stopObserving('mouseup',endDrag);fire('drag:ended',event);};function fire(eventName,event){var pointer=event.pointer();draggedElement.fire(eventName,{dx:pointer.x-initPointer.x,dy:pointer.y-initPointer.y,mouseEvent:event});};})();UI.State=(function(browser){var watch,change,changed,fragment;function getFragment(){var fragment=top.location.hash;return fragment&&fragment!='#'?fragment.substr(1):null;}
function fragmentChanged(newFragment){fragment=newFragment;if(fragment&&fragment.include('state:'))
document.fire('state:changed',{name:fragment.sub('state:','')});else if(!fragment&&changed)
document.fire('state:changed',{name:'initial'});}
document.whenReady(function(){fragmentChanged(getFragment());if(browser.IE){var iframe=new Element('iframe',{style:'display: none'});$body.insert(iframe);var contentWindow=iframe.contentWindow;function writeToIFrame(html){var doc=contentWindow.document;doc.open();doc.write(html);doc.close();}
function readFromIFrame(){return contentWindow.document.body.innerText;}
writeToIFrame(fragment||'');watch=function(){var newFragment=readFromIFrame();if(newFragment!==fragment){top.location.hash=newFragment;fragmentChanged(newFragment);}};change=function(fragment){writeToIFrame(fragment);};}else if(browser.WebKit){var counter=history.length,fragments=[];change=function(fragment){top.location.hash=fragment;fragments[history.length]=fragment;};watch=function(){var newFragment=getFragment(),newCounter=history.length;if(newFragment!==fragment)fragmentChanged(newFragment);else if(newCounter!=counter){fragmentChanged(fragments[newCounter-1]);fragment=newFragment;}
counter=newCounter;};}else{watch=function(){var newFragment=getFragment();if(newFragment!==fragment)fragmentChanged(newFragment);};change=function(fragment){top.location.hash=fragment;};}
setInterval(function(){if(changed)watch()},50);});return{change:function(name){change('state:'+name);changed=true;},isSupported:function(){return!browser.Opera;}}})(Prototype.Browser);UI.IframeShim=Class.create(UI.Options,{initialize:function(){this.element=new Element('iframe',{style:'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',src:'javascript:false;',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),offset=element.cumulativeOffset(),dimensions=element.getDimensions(),style={left:offset[0]+'px',top:offset[1]+'px',width:dimensions.width+'px',height:dimensions.height+'px',zIndex:element.getStyle('zIndex')-1};this.element.setStyle(style).show();return this;},setBounds:function(bounds){for(prop in bounds){bounds[prop]+='px';}
this.element.setStyle(bounds);return this;},setSize:function(width,height){this.element.style.width=parseInt(width)+"px";this.element.style.height=parseInt(height)+"px";return this;},setPosition:function(top,left){this.element.style.top=parseInt(top)+"px";this.element.style.left=parseInt(left)+"px";return this;},destroy:function(){if(this.element)
this.element.remove();return this;}});UI.Abstract.Logger=Class.create({level:'debug'});(function(){var levels=$w(" debug info warn error ");levels.each(function(level,index){UI.Abstract.Logger.addMethod(level,function(message){if(index>=levels.indexOf(this.level))
this._log({level:level,message:message,date:new Date()});});});})();UI.NullLogger=Class.create(UI.Abstract.Logger,{_log:Prototype.emptyFunction});UI.MemLogger=Class.create(UI.Abstract.Logger,{initialize:function(){this.logs=[];},_log:function(log){this.logs.push(log);}});UI.ConsoleLogger=Class.create(UI.Abstract.Logger,{_log:function(log){console[log.level](log.message);}});UI.ElementLogger=Class.create(UI.Abstract.Logger,{initialize:function(element){this.element=$(element);},format:'<p>(<span class="date">#{date}</span>) '+'<span class="level">#{level}</span> : '+'<span class="message">#{message}</span></p>',_log:function(log){var entry=this.format.interpolate({level:log.level.toUpperCase(),message:log.message.escapeHTML(),date:log.date.toLocaleTimeString()});this.element.insert({top:entry});}});document.whenReady(function(){if($('log'))UI.logger=new UI.ElementLogger('log');else if(window.console)UI.logger=new UI.ConsoleLogger();else UI.logger=new UI.MemLogger();});UI.Shadow=Class.create(UI.Options,{options:{theme:"mac_shadow",focus:false,zIndex:100},initialize:function(element,options){this.setOptions(options);this.element=$(element);this.create();this.iframe=Prototype.Browser.IE?new UI.IframeShim():null;if(Object.isElement(this.element.parentNode))
this.render();},destroy:function(){if(this.shadow.parentNode)
this.remove();},setPosition:function(top,left){if(this.shadowSize){var shadowStyle=this.shadow.style;top=parseInt(top)-this.shadowSize.top+this.shadowShift.top;left=parseInt(left)-this.shadowSize.left+this.shadowShift.left;shadowStyle.top=top+'px';shadowStyle.left=left+'px';if(this.iframe)
this.iframe.setPosition(top,left);}
return this;},setSize:function(width,height){if(this.shadowSize){try{var w=Math.max(0,parseInt(width)+this.shadowSize.width-this.shadowShift.width)+"px";this.shadow.style.width=w;var h=Math.max(0,parseInt(height)-this.shadowShift.height)+"px";this.shadowContents[1].childElements().each(function(e){e.style.height=h});this.shadowContents.each(function(item){item.style.width=w});if(this.iframe)
this.iframe.setSize(width+this.shadowSize.width-this.shadowShift.width,height+this.shadowSize.height-this.shadowShift.height);}
catch(e){}}
return this;},setBounds:function(bounds){return this.setPosition(bounds.top,bounds.left).setSize(bounds.width,bounds.height);},setZIndex:function(zIndex){this.shadow.style.zIndex=zIndex;return this;},show:function(){this.render();this.shadow.show();if(this.iframe)
this.iframe.show();return this;},hide:function(){this.shadow.hide();if(this.iframe)
this.iframe.hide();return this;},remove:function(){this.shadow.remove();return this;},focus:function(){this.options.focus=true;this.updateShadow();return this;},blur:function(){this.options.focus=false;this.updateShadow();return this;},render:function(){if(this.element.parentNode&&!Object.isElement(this.shadow.parentNode)){this.element.parentNode.appendChild(this.shadow);this.computeSize();this.setBounds(Object.extend(this.element.getDimensions(),this.getElementPosition()));this.shadow.show();}
return this;},create:function(){var zIndex=this.element.getStyle('zIndex');if(!zIndex)
this.element.setStyle({zIndex:this.options.zIndex});zIndex=(zIndex||this.options.zIndex)-1;this.shadowContents=new Array(3);this.shadowContents[0]=new Element("div").insert(new Element("div",{className:"shadow_center_wrapper"}).insert(new Element("div",{className:"n_shadow"}))).insert(new Element("div",{className:"shadow_right ne_shadow"})).insert(new Element("div",{className:"shadow_left nw_shadow"}));this.shadowContents[1]=new Element("div").insert(new Element("div",{className:"shadow_center_wrapper c_shadow"})).insert(new Element("div",{className:"shadow_right e_shadow"})).insert(new Element("div",{className:"shadow_left w_shadow"}));this.centerElements=this.shadowContents[1].childElements();this.shadowContents[2]=new Element("div").insert(new Element("div",{className:"shadow_center_wrapper"}).insert(new Element("div",{className:"s_shadow"}))).insert(new Element("div",{className:"shadow_right se_shadow"})).insert(new Element("div",{className:"shadow_left sw_shadow"}));this.shadow=new Element("div",{className:"shadow_container "+this.options.theme,style:"position:absolute; top:-10000px; left:-10000px; display:none; z-index:"+zIndex}).insert(this.shadowContents[0]).insert(this.shadowContents[1]).insert(this.shadowContents[2]);},computeSize:function(){if(this.focusedShadowShift)
return;this.shadow.show();var content=this.shadowContents[1].select("div.c_shadow").first();this.unfocusedShadowShift={};this.focusedShadowShift={};$w("top left bottom right").each(function(pos){this.unfocusedShadowShift[pos]=content.getNumStyle("padding-"+pos)||0}.bind(this));this.unfocusedShadowShift.width=this.unfocusedShadowShift.left+this.unfocusedShadowShift.right;this.unfocusedShadowShift.height=this.unfocusedShadowShift.top+this.unfocusedShadowShift.bottom;$w("top left bottom right").each(function(pos){this.focusedShadowShift[pos]=content.getNumStyle("margin-"+pos)||0}.bind(this));this.focusedShadowShift.width=this.focusedShadowShift.left+this.focusedShadowShift.right;this.focusedShadowShift.height=this.focusedShadowShift.top+this.focusedShadowShift.bottom;this.shadowShift=this.options.focus?this.focusedShadowShift:this.unfocusedShadowShift;this.shadowSize={top:this.shadowContents[0].childElements()[1].getNumStyle("height"),left:this.shadowContents[0].childElements()[1].getNumStyle("width"),bottom:this.shadowContents[2].childElements()[1].getNumStyle("height"),right:this.shadowContents[0].childElements()[2].getNumStyle("width")};this.shadowSize.width=this.shadowSize.left+this.shadowSize.right;this.shadowSize.height=this.shadowSize.top+this.shadowSize.bottom;content.setStyle("padding:0; margin:0");this.shadow.hide();},updateShadow:function(){this.shadowShift=this.options.focus?this.focusedShadowShift:this.unfocusedShadowShift;var shadowStyle=this.shadow.style,pos=this.getElementPosition(),size=this.element.getDimensions();shadowStyle.top=pos.top-this.shadowSize.top+this.shadowShift.top+'px';shadowStyle.left=pos.left-this.shadowSize.left+this.shadowShift.left+'px';shadowStyle.width=size.width+this.shadowSize.width-this.shadowShift.width+"px";var h=size.height-this.shadowShift.height+"px";this.centerElements.each(function(e){e.style.height=h});var w=size.width+this.shadowSize.width-this.shadowShift.width+"px";this.shadowContents.each(function(item){item.style.width=w});},getElementPosition:function(){return{top:this.element.getNumStyle("top"),left:this.element.getNumStyle("left")}}});document.whenReady(function(){CSS.fixPNG("shadow")});UI.IframeShim=Class.create(UI.Options,{initialize:function(){this.element=new Element('iframe',{style:'position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none',src:'javascript:false;',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),offset=element.cumulativeOffset(),dimensions=element.getDimensions(),style={left:offset[0]+'px',top:offset[1]+'px',width:dimensions.width+'px',height:dimensions.height+'px',zIndex:element.getStyle('zIndex')-1};this.element.setStyle(style).show();return this;},setBounds:function(bounds){for(prop in bounds){bounds[prop]+='px';}
this.element.setStyle(bounds);return this;},setSize:function(width,height){this.element.style.width=parseInt(width)+"px";this.element.style.height=parseInt(height)+"px";return this;},setPosition:function(top,left){this.element.style.top=parseInt(top)+"px";this.element.style.left=parseInt(left)+"px";return this;},destroy:function(){if(this.element)
this.element.remove();return this;}});UI.AutoComplete=Class.create(UI.Options,{options:{className:"pui-autocomplete",maxItem:10,url:false,delay:0.2,infoMessage:false,progressMessage:false,noMatchMessage:false,shadow:false},initialize:function(element,options){this.setOptions(options);this.element=$(element).hide();this.render();this.updateInputSize();this.list=[];document.observe('keypress',this.removeSelected.bind(this));},add:function(text,options){var li=new Element("li",Object.extend({className:this.getClassName("box")},options||{}));li.observe("click",this.focus.bind(this,li)).observe("mouseover",this.over.bind(this,li)).observe("mouseout",this.out.bind(this,li));var close=new Element('a',{'href':'#','class':'closebutton'});li.insert(new Element("span").update(text).insert(close));close.observe("click",this.remove.bind(this,li));this.input.parentNode.insert({before:li});this.updateInputSize();return this.fire("element:added",{element:li});},remove:function(element){element.remove();this.updateInputSize();return this.fire("element:removed",{element:element});},removeSelected:function(event){if(event.element().readAttribute("type")!="text"&&event.keyCode==Event.KEY_BACKSPACE){this.container.select("li."+this.getClassName("box")).each(function(element){if(this.isSelected(element))
this.remove(element);}.bind(this));if(event)
event.stop();}
return this;},focus:function(element,event){if(event)
event.stop();if(event&&!event.shiftKey)
this.deselectAll();element=element||this.input;if(element==this.input){this.input.focus();this.displayCompletion();}
else{this.out(element,event);element.addClassName(this.getClassName("selected"));if(element!=this.input)
this.blur();}
return this.fire("element:focus",{element:element});},blur:function(element,event){if(event)
event.stop();if(!element)
this.input.blur();this.hideAutocomplete();return this.fire("element:blur",{element:element});},over:function(element,event){if(!this.isSelected(element))
element.addClassName(this.getClassName("over"));if(event)
event.stop();return this.fire("element:over",{element:element});},out:function(element,event){if(!this.isSelected(element))
element.removeClassName(this.getClassName("over"));if(event)
event.stop();return this.fire("element:out",{element:element});},isSelected:function(element){return element.hasClassName(this.getClassName("selected"));},deselectAll:function(){this.container.select("li."+this.getClassName("box")).invoke("removeClassName",this.getClassName("selected"));return this;},setAutocompleteList:function(list){this.list=list;return this;},fire:function(eventName,memo){memo=memo||{};memo.autocomplete=this;return this.element.fire('autocomplete:'+eventName,memo);},observe:function(eventName,handler){this.element.observe('autocomplete:'+eventName,handler.bind(this));return this;},stopObserving:function(eventName,handler){this.element.stopObserving('autocomplete:'+eventName,handler);return this;},moveSelection:function(element){var current=null;if(!this.current)
current=this.autocompletionContainer.firstDescendant();else if(element=="next"){current=this.current[element]()||this.autocompletionContainer.firstDescendant();}
else if(element=="previous"){current=this.current[element]()||this.autocompletionContainer.childElements().last();}
else
current=element;if(this.current)
this.current.removeClassName(this.getClassName("current"));this.current=current;if(this.current)
this.current.addClassName(this.getClassName("current"));},addCurrent:function(){if(this.current){var index=this.autocompletionContainer.childElements().indexOf(this.current);this.add(this.selectedList[index].text);this.current=null;this.input.clear();(function(){this.input.focus()}.bind(this)).defer();this.displayCompletion();}},showMessage:function(text){if(text){this.message.update(text);this.message.show();this.showAutocomplete();}
else
this.hideAutocomplete();},runRequest:function(search){this.autocompletionContainer.hide();this.showMessage(this.options.progressMessage);new Ajax.Request(this.options.url,{parameters:{search:search,max:this.options.maxItem},onComplete:function(transport){this.setAutocompleteList(transport.responseText.evalJSON());this.timer=null;this.displayCompletion();}.bind(this)});},getClassName:function(className){return this.options.className+"-"+className;},keydown:function(event){switch(event.keyCode){case Event.KEY_UP:this.moveSelection('previous');event.stop();return false;case Event.KEY_DOWN:this.moveSelection('next');event.stop();return false;case Event.KEY_RETURN:this.addCurrent();event.stop();return false;}},keyup:function(event){switch(event.keyCode){case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_RETURN:break;default:this.displayCompletion(event);}},updateInputSize:function(){var top;var w=this.container.select("li."+this.getClassName("box")).inject(0,function(sum,element){if(Object.isUndefined(top))
top=element.cumulativeOffset().top;else if(top!=element.cumulativeOffset().top){top=element.cumulativeOffset().top;sum=0;}
return sum+element.getWidth()+element.getMarginDimensions().width+element.getBorderDimensions().width;});var margin=this.container.getMarginDimensions().width+this.container.getBorderDimensions().width+this.container.getPaddingDimensions().width;var width=this.container.getWidth()-w-margin;if(width<50)
width=this.container.getWidth()-margin;this.input.parentNode.style.width=width+"px";this.input.style.width=width+"px";},displayCompletion:function(event){var value=this.input.value.strip();this.current=null;if(!value.empty()){if(event&&this.options.url){if(this.timer)
clearTimeout(this.timer);this.timer=this.runRequest.bind(this,value).delay(this.options.delay);}
else{this.message.hide();this.selectedList=this.list.findAll(function(entry){return entry.text.match(value)}).slice(0,this.options.maxItem);this.autocompletionContainer.update("");if(this.selectedList.empty())
this.showMessage(this.options.noMatchMessage);else{this.selectedList.each(function(entry){var li=new Element("li").update(entry.text.gsub(value,"<em>"+value+"</em>"));li.observe("mouseover",this.moveSelection.bind(this,li)).observe("mousedown",this.addCurrent.bind(this));this.autocompletionContainer.insert(li);}.bind(this));this.autocompletionContainer.show();this.moveSelection("next");this.showAutocomplete();}}}
else{this.showMessage(this.options.infoMessage);this.autocompletionContainer.hide();this.showAutocomplete();}},showAutocomplete:function(){this.autocompletion.clonePosition(this.container,{setHeight:false,offsetTop:this.container.offsetHeight});var w=this.autocompletion.getWidth();var h=this.autocompletion.getHeight();var t=parseInt(this.autocompletion.style.top);var l=parseInt(this.autocompletion.style.left);if(this.shadow){this.shadow.setBounds({top:t,left:l,width:w,height:h});this.shadow.show();}
if(this.iframe)
this.iframe.show().setPosition(t,l).setSize(w,h);this.autocompletion.show();},hideAutocomplete:function(){if(this.shadow)
this.shadow.hide();if(this.iframe)
this.iframe.hide();this.autocompletion.hide();},render:function(){this.autocompletion=new Element("div",{className:this.getClassName("result")}).hide();this.autocompletionContainer=new Element("ul",{className:this.getClassName("results")}).hide();this.message=new Element("div",{className:this.getClassName("message")}).hide();this.element.insert({after:this.autocompletion.insert(this.message).insert(this.autocompletionContainer)});this.input=new Element("input",{type:"text"});this.input.observe("focus",this.focus.bind(this,this.input)).observe("blur",this.blur.bind(this,this.input)).observe("keyup",this.keyup.bind(this)).observe("keydown",this.keydown.bind(this));this.container=new Element('ul',{className:this.getClassName("holder")}).insert(new Element("li",{className:this.getClassName("input")}).insert(this.input));this.element.insert({before:this.container});this.autocompletion.style.width=this.container.getWidth()-this.container.getBorderDimensions().width+"px";if(this.options.shadow)
this.shadow=new UI.Shadow(this.autocompletion,{theme:this.options.shadow}).hide();else
this.iframe=Prototype.Browser.IE?new UI.IframeShim():null;}});Element.addMethods({getAttributeDimensions:function(element,attribut){var dim=$w('top bottom left right').inject({},function(dims,key){dims[key]=element.getNumStyle(attribut+"-"+key+(attribut=="border"?"-width":""));return dims;});dim.width=dim.left+dim.right;dim.height=dim.top+dim.bottom;return dim;},getBorderDimensions:function(element){return element.getAttributeDimensions("border")},getMarginDimensions:function(element){return element.getAttributeDimensions("margin")},getPaddingDimensions:function(element){return element.getAttributeDimensions("padding")}});Object.extend(Date.prototype,{addDays:function(days){return new Date(this.getFullYear(),this.getMonth(),this.getDate()+days,this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds());},succ:function(){return this.addDays(1);},firstOfMonth:function(){return new Date(this.getFullYear(),this.getMonth(),1);},endOfMonth:function(){return new Date(this.getFullYear(),this.getMonth()+1,0);},getDayOfYear:function(){return Math.ceil((this-new Date(this.getFullYear(),0,1))/86400000);},strftime:function(grammar){var parts={},i18n=Date.default_i18n;var lambda=function(date,part){switch(part){case'a':return i18n.WEEKDAYS_MEDIUM[date.getDay()];case'A':return i18n.WEEKDAYS[date.getDay()];case'b':case'h':return i18n.MONTHS_SHORT[date.getMonth()];case'B':return i18n.MONTHS[date.getMonth()];case'C':return Math.floor(date.getFullYear()/100);case'd':return date.getDate().toPaddedString(2);case'e':return date.getDate();case'j':return date.getDayOfYear();case'm':return(date.getMonth()+1).toPaddedString(2);case'u':return date.getDay()||7;case'w':return date.getDay();case'y':return date.getFullYear().toString().substring(2);case'Y':return date.getFullYear();case'H':return date.getHours().toPaddedString(2);case'I':return(date.getHours()%12).toPaddedString(2);case'M':return date.getMinutes().toPaddedString(2);case'p':return date.getHours()<12?'am':'pm';case'S':return date.getSeconds().toPaddedString(2);case'n':return'\n';case't':return'\t';case'D':return date.strftime('%m/%d/%y');case'r':return date.strftime('%I:%M:%S %p');case'R':return date.strftime('%H:%M:%S');case'T':return date.strftime('%H:%M:%S');case'c':return date.strftime(i18n.FORMAT_DATETIME);case'x':return date.strftime(i18n.FORMAT_DATE);case'X':return date.strftime(i18n.FORMAT_TIME);}};grammar.scan(/\w+/,function(e){var part=e.first();parts[part]=lambda(this,part);}.bind(this));return grammar.interpolate(parts,Date.STRFT_GRAMMER);},equalsDate:function(other){return(this.getMonth()==other.getMonth()&&this.getDate()==other.getDate()&&this.getFullYear()==other.getFullYear());}});Object.extend(Date,{STRFT_GRAMMER:/(^|.|\r|\n)(\%(\w+))/,default_i18n:{MONTHS_SHORT:$w('Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'),MONTHS:$w('January February March April May June July August September October November December'),WEEKDAYS_MEDIUM:$w('Sun Mon Tue Wed Thu Fri Sat'),WEEKDAYS:$w('Sunday Monday Tuesday Wednesday Thursday Friday Saturday'),FORMAT_DATE:'%m/%d/%Y',FORMAT_TIME:'%H:%M:%S',FORMAT_DATETIME:'%x %X'},parseString:function(dateString,format){var date=new Date(),i18n=Date.default_i18n;format=format.replace('%D','%m/%d/%y');format=format.replace('%T','%H:%M:%S').replace('%r','%I:%M:%S %p').replace('%R','%H:%M:%S');format=format.replace('%c',i18n.FORMAT_DATETIME).replace('%x',i18n.FORMAT_DATE).replace('%X',i18n.FORMAT_TIME);var tokens=format.match(/%./g);dateString.split(/[^A-Za-z0-9\u00A1-\uFFFF]+/).each(function(e,i){switch(tokens[i]){case'%a':case'%A':case'%u':case'%w':break;case'%b':case'%h':date.setMonth(i18n.MONTHS_SHORT.indexOf(e));break;case'%B':date.setMonth(i18n.MONTHS.indexOf(e));break;case'%C':break;case'%d':case'%e':date.setDate(parseInt(e,10));break;case'%j':break;case'%m':date.setMonth(parseInt(e,10)-1);break;case'%w':date.setDay(parseInt(e,10));break;case'%y':var year=parseInt(e,10);if(year<50)year+=2000;if(year<100)year+=1900;date.setYear(year);break;case'%Y':date.setFullYear(parseInt(e,10));break;case'%H':date.setHours(parseInt(e,10));break;case'%I':date.setHours(parseInt(e,10));break;case'%M':date.setMinutes(parseInt(e,10));break;case'%p':if(e=='pm')date.setHours(date.getHours()+12);break;case'%S':date.setSeconds(parseInt(e,10));break;}});return date;}});Element.addMethods({center:function(container,element){element=$(element);container=$(container);var cBorders=container.borderDimensions(),eBorders=element.borderDimensions();var height=container.getHeight()-(cBorders.top+cBorders.bottom);var width=container.getWidth()-(cBorders.left+cBorders.right);var setX=((width-element.getWidth()-(eBorders.left+eBorders.right))/2);var setY=((height-element.getHeight()-(eBorders.top+eBorders.bottom))/2);setX=(setX<0)?0:setX;setY=(setY<0)?0:setY;container.relativize();return element.setStyle({top:setY+'px',left:setX+'px'});},borderDimensions:function(element){return $w('top bottom left right').inject({},function(dims,key){dims[key]=parseFloat(element.getStyle('border-'+key+'-width')||0);return dims;});}});UI.Calendar=Class.create(UI.Options,{options:{theme:'mac_os_x',format:'%m/%d/%Y',startWeekday:0,startDate:new Date()},initialize:function(element,options){this.setOptions(options);this.element=$(element);this.element.identify();this.container=new Element('div').addClassName('ui_calendar_container');this.container.setStyle({position:'relative'});this.element.addClassName(this.options.theme).insert({top:this.container});this.initDate(this.options.startDate);this.buildTable();this.buildSelector();this.update(this.date);},fire:function(eventName,memo){memo=memo||{};memo.calendar=this;return this.element.fire('calendar:'+eventName,memo);},observe:function(eventName,handler){this.element.observe('calendar:'+eventName,handler.bind(this));return this;},stopObserving:function(eventName,handler){this.element.stopObserving('calendar:'+eventName,handler);return this;},generateId:function(name){return this.element.id+name;},initDate:function(date){this.date=this.convertDate(date);},convertDate:function(date){if(!date)return null;return Object.isString(date)?Date.parseString(date,this.options.format):date;},update:function(newDate){this.updateDaysRow();this.date=newDate;var today=new Date();this.headerSpan.innerHTML=UI.Calendar.Options.MONTHS[this.date.getMonth()]+' '+this.date.getFullYear();var days=$R(this.startDay(this.date),this.lastDay(this.date));if(days.size()<42){days=$R(this.startDay(this.date),this.lastDay(this.date).addDays(42-days.size()));}
days=$A(days);var day,cell,classNames,monthDate,index,l;for(index=0,l=days.length;index<l;++index){day=days[index];cell=this.cells[index];classNames=[];cell.date=day;monthDate=day.getDate();if(day.getMonth()!=this.date.getMonth()){classNames.push('non_current');cell.innerHTML=monthDate;}else{cell.innerHTML='<a href="#">'+monthDate+'</a>';if(this.selectedDay&&this.selectedDay.equalsDate(day))classNames.push('selected');}
if(today.equalsDate(day))classNames.push('today');if(cell.hasClassName('weekend'))classNames.push('weekend');if(cell.hasClassName('first'))classNames.push('first');if(cell.hasClassName('last'))classNames.push('last');cell.className=classNames.join(' ');}},updateDaysRow:function(){var dayNames=this.dayNames();this.daysRow.update('');$R(0,6).each(function(n){this.daysRow.insert({bottom:new Element('th',{'class':'dayname'}).update(dayNames[n].truncate(2,''))});}.bind(this));},onCellClick:function(event){event.stop();var element=event.element();if(element.tagName=='A')element=element.up('td');if(element.hasClassName('non_current'))return;var day=element.date;this.selectedDay=day;$w('selected selected_next selected_prev').each(function(e){this.table.select('.'+e).invoke('removeClassName',e);}.bind(this));element.addClassName('selected');var next=element.next(),prev=element.previous();if(next)next.addClassName('selected_next');if(prev)prev.addClassName('selected_prev');this.fire('click',{date:day,formattedDate:day.strftime(this.options.format)});},onMonthClick:function(event){event.stop();this.selector.setStyle({position:'absolute',top:0,left:0,'float':'left',zIndex:3});this._showSelector();},_showMask:function(){if(Prototype.Browser.IE){var borderDimensions=this.container.borderDimensions();if(!this.containerWidth){this.containerWidth=this.container.getWidth()-(borderDimensions.left+borderDimensions.right);}
if(!this.containerHeight){this.containerHeight=this.container.getHeight()-(borderDimensions.top+borderDimensions.bottom);}
this.mask.setStyle({width:this.containerWidth+'px',height:this.containerHeight+'px'});}
this.mask.show();},_hideSelector:function(){this.mask.hide();this.selector.hide();},_showSelector:function(){this.container.center(this.selector);this._showMask();this.selector.show();},buildTable:function(){this.table=new Element('table').addClassName('ui_calendar');this.table.setStyle({position:'relative'});this.buildHeader(this.date);var tbody=new Element('tbody');$R(1,42).inGroupsOf(7).each(function(week,index){var row=new Element('tr');week.each(function(day,i){var cell=new Element('td');if(i==0||i==6)cell.addClassName('weekend');if(i==0)cell.addClassName('first');if(i==6)cell.addClassName('last');row.insert({bottom:cell});});tbody.insert({bottom:row});}.bind(this));this.cells=tbody.select('td');this.cells.invoke('observe','click',this.onCellClick.bind(this));this.table.insert({bottom:tbody});this.container.insert({top:this.table});},buildSelector:function(){this.selector=new Element('div').addClassName('selector').hide();this.mask=new Element('div').hide().addClassName('ui_calendar_mask').setOpacity(0.3);this.container.insert({bottom:this.selector}).insert({bottom:this.mask});this.selector.insert({top:new Element('label',{'for':this.generateId('_select')}).update(UI.Calendar.Options.LABEL_MONTH)});var select=new Element('select');for(var i=0;i<12;i++){select.insert({bottom:new Element('option',{value:i}).update(UI.Calendar.Options.MONTHS[i])});}
this.selector.insert({bottom:select}).insert({bottom:new Element('label',{'for':this.generateId('_input')}).update(UI.Calendar.Options.LABEL_YEAR)});var input=new Element('input',{type:'text',size:4,maxLength:4,value:this.date.getFullYear()});this.selector.insert({bottom:input});var createButton=function(name,onClick){return new Element('span').addClassName('ui_calendar_button').insert({top:new Element('button',{type:'button'}).update(name).observe('click',onClick.bind(this))});};var btnCn=createButton('Cancel',function(e){this._hideSelector();}.bind(this));var btnOk=createButton('OK',function(e){this._hideSelector();this.update(new Date(input.value,select.value,1));}.bind(this));this.selector.insert({bottom:new Element('div',{textAlign:'center',width:'100%'}).addClassName('ui_calendar_button_div').insert({bottom:btnCn}).insert({bottom:btnOk})});},buildHeader:function(date){var header=new Element('thead');this.daysRow=new Element('tr',{id:this.generateId('_days_row')});var initMonthLink=function(link,direction,self){link.observe('click',function(e){e.stop();self[direction+'Month'].call(self);}).observe('mousedown',function(e){var p=new PeriodicalExecuter(function(pe){self[direction+'Month'].call(self);},.25);document.observe('mouseup',function(e){p.stop();});});};$w('prev next').each(function(d){this[d+'Link']=new Element('a').addClassName(d);initMonthLink(this[d+'Link'],d,this);}.bind(this));this.headerSpan=new Element('a',{href:'#'}).update(UI.Calendar.Options.MONTHS[date.getMonth()]+' '+date.getFullYear()).observe('click',this.onMonthClick.bind(this));var headerDiv=new Element('div').addClassName('header').insert({bottom:this.prevLink}).insert({bottom:this.headerSpan}).insert({bottom:this.nextLink});this.updateDaysRow();header.insert({bottom:new Element('tr').insert({top:new Element('th',{colspan:7}).update(headerDiv).addClassName('monthname')})}).insert({bottom:this.daysRow});this.table.insert({top:header});},nextMonth:function(){this.date.setMonth(this.date.getMonth()+1);this.update(this.date);},prevMonth:function(){this.date.setMonth(this.date.getMonth()-1);this.update(this.date);},startDay:function(date){var startDate=date.firstOfMonth();startDate.setDate(-(startDate.getDay()%7));startDate.setDate(startDate.getDate()+1+parseInt(this.options.startWeekday));return startDate;},lastDay:function(date){var endDate=date.endOfMonth();endDate.setDate(endDate.getDate()+6-(endDate.getDay()%7));return endDate;},dayNames:function(){var days=UI.Calendar.Options.WEEKDAYS.slice(this.options.startWeekday);for(var i=0;i<this.options.startWeekday;i++)days.push(UI.Calendar.Options.WEEKDAYS[i]);return days;},setStartWeekday:function(start){this.options.startWeekday=start;this.update(this.date);}});UI.Calendar.Options={MONTHS_SHORT:$w('Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'),MONTHS:$w('January February March April May June July August September October November December'),WEEKDAYS_1CHAR:$w('S M T W T F S'),WEEKDAYS_SHORT:$w('Su Mo Tu We Th Fr Sa'),WEEKDAYS_MEDIUM:$w('Sun Mon Tue Wed Thu Fri Sat'),WEEKDAYS:$w('Sunday Monday Tuesday Wednesday Thursday Friday Saturday'),FORMAT_DATE:'%m/%d/%Y',FORMAT_TIME:'%H:%M:%S',FORMAT_DATETIME:'%x %X',LABEL_MONTH:"Month",LABEL_YEAR:"Year"};UI.Carousel=Class.create(UI.Options,{options:{direction:"horizontal",previousButton:".previous_button",nextButton:".next_button",container:".container",scrollInc:"auto",disabledButtonSuffix:'_disabled',overButtonSuffix:'_over'},initialize:function(element,options){this.setOptions(options);this.element=$(element);this.id=this.element.id;this.container=this.element.down(this.options.container).firstDescendant();this.elements=this.container.childElements();this.previousButton=this.options.previousButton==false?null:this.element.down(this.options.previousButton);this.nextButton=this.options.nextButton==false?null:this.element.down(this.options.nextButton);this.posAttribute=(this.options.direction=="horizontal"?"left":"top");this.dimAttribute=(this.options.direction=="horizontal"?"width":"height");this.elementSize=this.computeElementSize();this.nbVisible=this.currentSize()/this.elementSize;var scrollInc=this.options.scrollInc;if(scrollInc=="auto")
scrollInc=Math.floor(this.nbVisible);[this.previousButton,this.nextButton].each(function(button){if(!button)return;var className=(button==this.nextButton?"next_button":"previous_button")+this.options.overButtonSuffix;button.clickHandler=this.scroll.bind(this,(button==this.nextButton?-1:1)*scrollInc*this.elementSize);button.observe("click",button.clickHandler).observe("mouseover",function(){button.addClassName(className)}.bind(this)).observe("mouseout",function(){button.removeClassName(className)}.bind(this));},this);this.updateButtons();},destroy:function($super){[this.previousButton,this.nextButton].each(function(button){if(!button)return;button.stopObserving("click",button.clickHandler);},this);this.element.remove();this.fire('destroyed');},fire:function(eventName,memo){memo=memo||{};memo.carousel=this;return this.element.fire('carousel:'+eventName,memo);},observe:function(eventName,handler){this.element.observe('carousel:'+eventName,handler.bind(this));return this;},stopObserving:function(eventName,handler){this.element.stopObserving('carousel:'+eventName,handler);return this;},checkScroll:function(position,updatePosition){if(position>0)
position=0;else{var limit=this.elements.last().positionedOffset()[this.posAttribute]+this.elementSize;var carouselSize=this.currentSize();if(position+limit<carouselSize)
position+=carouselSize-(position+limit);position=Math.min(position,0);}
if(updatePosition)
this.container.style[this.posAttribute]=position+"px";return position;},scroll:function(deltaPixel){if(this.animating)
return this;var position=this.currentPosition()+deltaPixel;position=this.checkScroll(position,false);deltaPixel=position-this.currentPosition();if(deltaPixel!=0){this.animating=true;this.fire("scroll:started");var that=this;this.container.morph("opacity:1",{duration:0.2,afterFinish:function(){that.container.morph(that.posAttribute+": "+position+"px",{duration:0.4,delay:0.2,afterFinish:function(){that.container.morph("opacity:1",{duration:0.2,afterFinish:function(){that.animating=false;that.updateButtons().fire("scroll:ended",{shift:deltaPixel/that.currentSize()});}});}});}});}
return this;},scrollTo:function(index){if(this.animating||index<0||index>this.elements.length||index==this.currentIndex()||isNaN(parseInt(index)))
return this;return this.scroll((this.currentIndex()-index)*this.elementSize);},updateButtons:function(){this.updatePreviousButton();this.updateNextButton();return this;},updatePreviousButton:function(){if(!this.previousButton)
return;var position=this.currentPosition();var previousClassName="previous_button"+this.options.disabledButtonSuffix;if(this.previousButton.hasClassName(previousClassName)&&position!=0){this.previousButton.removeClassName(previousClassName);this.fire('previousButton:enabled');}
if(!this.previousButton.hasClassName(previousClassName)&&position==0){this.previousButton.addClassName(previousClassName);this.fire('previousButton:disabled');}},updateNextButton:function(){if(!this.nextButton)
return;var lastPosition=this.currentLastPosition();var size=this.currentSize();var nextClassName="next_button"+this.options.disabledButtonSuffix;if(this.nextButton.hasClassName(nextClassName)&&lastPosition!=size){this.nextButton.removeClassName(nextClassName);this.fire('nextButton:enabled');}
if(!this.nextButton.hasClassName(nextClassName)&&lastPosition==size){this.nextButton.addClassName(nextClassName);this.fire('nextButton:disabled');}},computeElementSize:function(){return this.elements.first().getDimensions()[this.dimAttribute];},currentIndex:function(){return-this.currentPosition()/this.elementSize;},currentLastPosition:function(){if(this.container.childElements().empty())
return 0;return this.currentPosition()+
this.elements.last().positionedOffset()[this.posAttribute]+
this.elementSize;},currentPosition:function(){return this.container.getNumStyle(this.posAttribute);},currentSize:function(){return this.container.parentNode.getDimensions()[this.dimAttribute];},updateSize:function(){this.nbVisible=this.currentSize()/this.elementSize;var scrollInc=this.options.scrollInc;if(scrollInc=="auto")
scrollInc=Math.floor(this.nbVisible);[this.previousButton,this.nextButton].each(function(button){if(!button)return;button.stopObserving("click",button.clickHandler);button.clickHandler=this.scroll.bind(this,(button==this.nextButton?-1:1)*scrollInc*this.elementSize);button.observe("click",button.clickHandler);},this);this.checkScroll(this.currentPosition(),true);this.updateButtons().fire('sizeUpdated');return this;}});UI.Ajax.Carousel=Class.create(UI.Carousel,{options:{elementSize:-1,url:null},initialize:function($super,element,options){if(!options.url)
throw("url option is required for UI.Ajax.Carousel");if(!options.elementSize)
throw("elementSize option is required for UI.Ajax.Carousel");$super(element,options);this.endIndex=0;this.hasMore=true;this.updateHandler=this.update.bind(this);this.updateAndScrollHandler=function(nbElements,transport,json){this.update(transport,json);this.scroll(nbElements);}.bind(this);this.runRequest.bind(this).defer({parameters:{from:0,to:Math.ceil(this.nbVisible)-1},onSuccess:this.updateHandler});},runRequest:function(options){this.requestRunning=true;new Ajax.Request(this.options.url,Object.extend({method:"GET"},options));this.fire("request:started");return this;},scroll:function($super,deltaPixel){if(this.animating||this.requestRunning)
return this;var nbElements=(-deltaPixel)/this.elementSize;if(this.hasMore&&nbElements>0&&this.currentIndex()+this.nbVisible+nbElements-1>this.endIndex){var from=this.endIndex+1;var to=Math.ceil(from+this.nbVisible-1);this.runRequest({parameters:{from:from,to:to},onSuccess:this.updateAndScrollHandler.curry(deltaPixel).bind(this)});return this;}
else
$super(deltaPixel);},update:function(transport,json){this.requestRunning=false;this.fire("request:ended");if(!json)
json=transport.responseJSON;this.hasMore=json.more;this.endIndex=Math.max(this.endIndex,json.to);this.elements=this.container.insert({bottom:json.html}).childElements();return this.updateButtons();},computeElementSize:function(){return this.options.elementSize;},updateSize:function($super){var nbVisible=this.nbVisible;$super();if(Math.floor(this.nbVisible)-Math.floor(nbVisible)>=1&&this.hasMore){if(this.currentIndex()+Math.floor(this.nbVisible)>=this.endIndex){var nbNew=Math.floor(this.currentIndex()+Math.floor(this.nbVisible)-this.endIndex);this.runRequest({parameters:{from:this.endIndex+1,to:this.endIndex+nbNew},onSuccess:this.updateHandler});}}
return this;},updateNextButton:function($super){if(!this.nextButton)
return;var lastPosition=this.currentLastPosition();var size=this.currentSize();var nextClassName="next_button"+this.options.disabledButtonSuffix;if(this.nextButton.hasClassName(nextClassName)&&lastPosition!=size){this.nextButton.removeClassName(nextClassName);this.fire('nextButton:enabled');}
if(!this.nextButton.hasClassName(nextClassName)&&lastPosition==size&&!this.hasMore){this.nextButton.addClassName(nextClassName);this.fire('nextButton:disabled');}}});UI.Dock=Class.create(UI.Options,{options:{maxItemSize:96,range:2,hideLabels:false,labelsSelector:'.label'},initialize:function(element,options){this.element=$(element);this.setOptions(options);this.scale=0;this.create();},create:function(){this.createSchedulers();this.parseItems();this.observeElement();if(this.options.hideLabels)
this.items.pluck('label').invoke('hide');this.options.itemSize=this.options.itemSize||this.items.first().size;var offset=this.options.maxItemSize-this.options.itemSize;this.items.pluck('element').invoke('setStyle',{top:"-"+offset+"px",position:"relative"},this);this.element.style.height=this.options.itemSize+"px";this.redrawItems();},parseItems:function(){var selector=this.options.labelsSelector;this.items=this.element.select('LI').collect(function(LI,i){LI._dockPosition=i;return{element:LI,image:LI.down('img'),size:parseInt(LI.down('img').readAttribute('width')),label:LI.down(selector)}});},findEventItem:function(event){var element=event.findElement('LI');return element&&this.items[element._dockPosition];},createSchedulers:function(){this.magnifyScheduler=new PeriodicalExecuter(this.magnifyStep.bind(this),0.01);this.magnifyScheduler.stop();this.closeScheduler=new PeriodicalExecuter(this.closeStep.bind(this),0.01);this.closeScheduler.stop();},onMouseOver:function(event){var item=this.findEventItem(event);if(!item)return;if(this.options.hideLabels)
this.shownLabel=item.label.show();},onMouseMove:function(event){this.magnify();var item=this.findEventItem(event);if(!item)return;var index=this.items.indexOf(item),across=(event.layerX||event.offsetX)/this.items[index].size;if(!across)return;this.items.each(function(item,i){item.size=this.itemSize+(((i<index-this.range)||(i>index+this.range))?0:((this.maxItemSize-this.itemSize)*(Math.cos(i-index-across+0.5)+1)/2).ceil());},this.options);this.redrawItems();},onMouseOut:function(event){if(this.closeTimeout||this.closeScheduler.timer)
return;this.closeTimeout=this.close.bind(this).delay(0.05);if(this.options.hideLabels)
this.shownLabel.hide();},magnify:function(){if(this.closeTimeout){window.clearTimeout(this.closeTimeout);this.closeTimeout=false;}
this.closeScheduler.stop();if(this.scale!=1&&!this.magnifyScheduler.timer)
this.magnifyScheduler.registerCallback();},close:function(){this.closeTimeout=false;this.magnifyScheduler.stop();this.closeScheduler.registerCallback();},magnifyStep:function(scheduler){if(this.scale<1)this.scale+=0.125;else{this.scale=1;scheduler.stop();}
this.redrawItems();},closeStep:function(scheduler){if(this.scale>0)this.scale-=0.125;else{this.scale=0;scheduler.stop();}
this.redrawItems();},observeElement:function(){this.element.observe('mouseover',this.onMouseOver.bind(this)).observe('mousemove',this.onMouseMove.bind(this)).observe('mouseout',this.onMouseOut.bind(this));},redrawItems:function(){var itemSize=this.options.itemSize,maxSize=this.options.maxItemSize,totalSize=0;this.items.each(function(item){var size=itemSize+this.scale*(item.size-itemSize),image=item.image;image.setAttribute('width',size);image.setAttribute('height',size);image.style.marginTop=maxSize-size+'px';if(item.label)
item.label.style.width=size+'px';totalSize+=size;},this);this.element.style.width=totalSize+'px';}});UI.ContextMenu=Class.create(UI.Options,{options:{className:'ui-context_menu',beforeShow:Prototype.emptyFunction,beforeHide:Prototype.emptyFunction,beforeSelect:Prototype.emptyFunction,zIndex:900,pageOffset:25,showEffect:false,hideEffect:false,shadow:"mac_shadow"},initialize:function(options){this.setOptions(options);if(Object.isUndefined(Effect)){this.options.showEffect=this.options.hideEffect=false;}
this.iframe=Prototype.Browser.IE?new UI.IframeShim():null;this.create();this.shadow=this.options.shadow?UI.ContextMenu.shadow||new UI.Shadow(this.element,{theme:this.options.shadow}).focus().hide():null;if(this.shadow)
UI.ContextMenu.shadow=this.shadow;this.initObservers();},create:function(){this.element=new Element('div',{className:this.options.className,style:'display: none'});this.element.insert(this.createList(this.options.menuItems));$(document.body).insert(this.element.observe('contextmenu',Event.stop));},createList:function(items){var list=new Element('ul');items.each(function(item){list.insert(new Element('li',{className:item.separator?'separator':''}).insert(!item.separator?Object.extend(new Element('a',{href:'#',title:item.name,className:(item.className||'')
+(item.disabled?' disabled':'')
+(item.submenu?' submenu':'')}),{_callback:item.callback}).observe('click',item.callback?this.onSelect.bind(this):Event.stop).observe('contextmenu',Event.stop).update(item.name).insert(item.submenu?this.createList(item.submenu).wrap({className:this.options.className,style:'display:none'}):''):''))}.bind(this));return list;},initObservers:function(){var contextEvent=Prototype.Browser.Opera?'click':'contextmenu';document.observe('click',function(e){if(this.element.visible()&&!e.isRightClick()){this.options.beforeHide();if(this.iframe)
this.iframe.hide();this.hide();}}.bind(this));$$(this.options.selector).invoke('observe',contextEvent,function(e){if(Prototype.Browser.Opera&&!e.ctrlKey)return;this.show(e);}.bind(this));this.element.select('a.submenu').invoke('observe','mouseover',function(e){if(this.hasClassName('disabled'))return;this.down('.menu').setStyle({top:0,left:this.getWidth()+'px'}).show();}).invoke('observe','mouseout',function(e){this.down('.menu').hide();});if(this.shadow)
this.shadow.shadow.observe('contextmenu',Event.stop);},show:function(e){if(e)e.stop();this.options.beforeShow();this.fire('showing');if(UI.ContextMenu.shownMenu){UI.ContextMenu.shownMenu.hide();}
UI.ContextMenu.shownMenu=this;this.position(e);if(this.options.showEffect){Effect.Appear(this.element,{duration:0.25,afterFinish:function(){this.fire('shown')}.bind(this)})}
else{this.element.show();this.fire('shown');}
this.event=e;return this;},position:function(e){var x=Event.pointer(e).x,y=Event.pointer(e).y,vpDim=document.viewport.getDimensions(),vpOff=document.viewport.getScrollOffset(),elDim=this.element.getDimensions(),elOff={left:((x+elDim.width+this.options.pageOffset)>vpDim.width?(vpDim.width-elDim.width-this.options.pageOffset):x),top:((y-vpOff.top+elDim.height)>vpDim.height&&(y-vpOff.top)>elDim.height?(y-elDim.height):y)},elBounds=Object.clone(Object.extend(elOff,elDim));for(prop in elOff){elOff[prop]+='px';}
this.element.setStyle(elOff).setStyle({zIndex:this.options.zIndex});if(this.iframe){this.iframe.setBounds(elBounds).show();}
if(this.shadow){this.shadow.setBounds(elBounds).show();}
return this;},hide:function(){this.options.beforeHide();if(this.iframe)
this.iframe.hide();if(this.shadow)
this.shadow.hide();if(this.options.hideEffect){Effect.Fade(this.element,{duration:0.25,afterFinish:function(){this.fire('hidden')}.bind(this)})}
else{this.element.hide();this.fire('hidden')}
return this;},onSelect:function(e){if(e.target._callback&&!e.target.hasClassName('disabled')){this.options.beforeSelect();this.fire('selected');this.hide();e.target._callback(e,this.event);}},fire:function(eventName){this.element.fire('contextmenu:'+eventName);}});UI.Window=Class.create(UI.Options,{options:{theme:null,shadowTheme:null,id:null,windowManager:null,top:null,left:null,width:200,height:300,minHeight:100,minWidth:200,maxHeight:null,maxWidth:null,altitude:"front",resizable:true,draggable:true,wired:false,show:Element.show,hide:Element.hide,superflousEffects:!Object.isUndefined(window.Effect),shadow:false,activeOnClick:true,gridX:1,gridY:1,close:'destroy',minimize:'toggleFold',maximize:'toggleMaximize'},initialize:function(options){this.setOptions(options);this.windowManager=this.options.windowManager||UI.defaultWM;this.create();this.id=this.element.id;this.windowManager.register(this);this.render();if(this.options.activeOnClick)
this.overlay.setStyle({zIndex:this.lastZIndex+1}).show();},destroy:function($super){this.hide();if(this.centerOptions)
Event.stopObserving(this.windowManager.scrollContainer,"scroll",this.centerOptions.handler);this.windowManager.unregister(this);this.fire('destroyed');},fire:function(eventName,memo){memo=memo||{};memo.window=this;return(this.savedElement||this.element).fire('window:'+eventName,memo);},observe:function(eventName,handler){this.element.observe('window:'+eventName,handler.bind(this));return this;},show:function(modal){if(this.visible)return this;this.fire('showing');this.effect('show');if(modal){this.windowManager.startModalSession(this);this.modalSession=true;}
this.addElements();this.visible=true;new PeriodicalExecuter(function(executer){if(!this.element.visible())return;this.fire('shown');executer.stop();}.bind(this),0.1);return this;},hide:function(){if(!this.visible)return this;this.fire('hiding');this.effect('hide');if(this.modalSession){this.windowManager.endModalSession(this);this.modalSession=false;}
this.windowManager.hide(this);new PeriodicalExecuter(function(executer){if(this.element.visible())return;this.visible=false;this.element.remove();this.fire('hidden');executer.stop();}.bind(this),0.1);return this;},close:function(){return this.action('close');},activate:function(){return this.bringToFront().focus();},bringToFront:function(){return this.setAltitude('front');},sendToBack:function(){return this.setAltitude('back');},focus:function(){if(this.focused)return this;this.windowManager.focus(this);this.overlay.hide();this.element.addClassName(this.options.theme+'_focused');this.focused=true;this.fire('focused');return this;},blur:function(){if(!this.focused)return this;this.windowManager.blur(this);this.element.removeClassName(this.options.theme+'_focused');if(this.options.activeOnClick)
this.overlay.setStyle({zIndex:this.lastZIndex+1}).show();this.focused=false;this.fire('blurred');return this;},maximize:function(){if(this.maximized)return this;var bounds=this.getBounds();if(this.windowManager.maximize(this)){this.disableButton('minimize').setResizable(false).setDraggable(false);this.activate();this.maximized=true;this.savedArea=bounds;var newBounds=Object.extend(this.windowManager.viewport.getDimensions(),{top:0,left:0});this[this.options.superflousEffects&&!Prototype.Browser.IE?"morph":"setBounds"](newBounds);this.fire('maximized');return this;}},restore:function(){if(!this.maximized)return this;if(this.windowManager.restore(this)){this[this.options.superflousEffects&&!Prototype.Browser.IE?"morph":"setBounds"](this.savedArea);this.enableButton("minimize").setResizable(true).setDraggable(true);this.maximized=false;this.fire('restored');return this;}},toggleMaximize:function(){return this.maximized?this.restore():this.maximize();},adapt:function(){var dimensions=this.content.getScrollDimensions();if(this.options.superflousEffects)
this.morph(dimensions,true);else
this.setSize(dimensions.width,dimensions.height,true);return this;},fold:function(){if(!this.folded){var size=this.getSize(true);this.folded=true;this.savedInnerHeight=size.height;if(this.options.superflousEffects)
this.morph({width:size.width,height:0},true);else
this.setSize(size.width,0,true);this.setResizable(false);this.fire("fold");}
return this;},unfold:function(){if(this.folded){var size=this.getSize(true);this.folded=false;if(this.options.superflousEffects)
this.morph({width:size.width,height:this.savedInnerHeight},true);else
this.setSize(size.width,this.savedInnerHeight,true);this.setResizable(true);this.fire("unfold");}
return this;},toggleFold:function(){return this.folded?this.unfold():this.fold();},setHeader:function(header){this.header.update(header);return this;},setContent:function(content){this.content.update(content);return this;},setFooter:function(footer){this.footer.update(footer);return this;},setAjaxContent:function(url,options){if(!options)
options={};Object.keys(options).each(function(name){if(Object.isFunction(options[name]))
options[name]=options[name].bind(this);},this);var onComplete=options.onComplete;options.onComplete=(function(response,json){this.setContent(response.responseText);if(Object.isFunction(onComplete))onComplete(response,json);}).bind(this);new Ajax.Request(url,options);return this;},getPosition:function(){return{left:this.options.left,top:this.options.top};},setPosition:function(top,left){var pos=this.computePosition(top,left);this.options.top=pos.top;this.options.left=pos.left;var elementStyle=this.element.style;elementStyle.top=pos.top+'px';elementStyle.left=pos.left+'px';this.fire('position:changed');return this;},center:function(options){var size=this.getSize(),windowManager=this.windowManager,viewport=windowManager.viewport;viewportArea=viewport.getDimensions(),offset=viewport.getScrollOffset();if(options&&options.auto){this.centerOptions=Object.extend({handler:this.recenter.bind(this)},options);Event.observe(this.windowManager.scrollContainer,"scroll",this.centerOptions.handler);Event.observe(window,"resize",this.centerOptions.handler);}
options=Object.extend({top:(viewportArea.height-size.height)/2,left:(viewportArea.width-size.width)/2},options||{});return this.setPosition(options.top+offset.top,options.left+offset.left);},getSize:function(innerSize){if(innerSize)
return{width:this.options.width-this.borderSize.width,height:this.options.height-this.borderSize.height};else
return{width:this.options.width,height:this.options.height};},setSize:function(width,height,innerSize){var size=this.computeSize(width,height,innerSize);var elementStyle=this.element.style,contentStyle=this.content.style;this.options.width=size.outerWidth;this.options.height=size.outerHeight;elementStyle.width=size.outerWidth+"px",elementStyle.height=size.outerHeight+"px";contentStyle.width=size.innerWidth+"px",contentStyle.height=size.innerHeight+"px";this.overlay.style.height=size.innerHeight+"px";this.fire('size:changed');return this;},getBounds:function(innerSize){return Object.extend(this.getPosition(),this.getSize(innerSize));},setBounds:function(bounds,innerSize){return this.setPosition(bounds.top,bounds.left).setSize(bounds.width,bounds.height,innerSize);},morph:function(bounds,innerSize){bounds=Object.extend(this.getBounds(innerSize),bounds||{});if(this.centerOptions&&this.centerOptions.auto)
bounds=Object.extend(bounds,this.computeRecenter(bounds));if(innerSize){bounds.width+=this.borderSize.width;bounds.height+=this.borderSize.height;}
this.animating=true;new UI.Window.Effects.Morph(this,bounds,{duration:0.5,afterFinish:function(){this.animating=false}.bind(this)});Object.extend(this.options,bounds);return this;},getAltitude:function(){return this.windowManager.getAltitude(this);},setAltitude:function(altitude){if(this.windowManager.setAltitude(this,altitude))
this.fire('altitude:changed');return this;},setResizable:function(resizable){this.options.resizable=resizable;var toggleClassName=(resizable?'add':'remove')+'ClassName';this.element[toggleClassName]('resizable').select('div:[class*=_sizer]').invoke(resizable?'show':'hide');if(resizable)
this.createResizeHandles();this.element.select('div.se').first()[toggleClassName]('se_resize_handle');return this;},setDraggable:function(draggable){this.options.draggable=draggable;this.element[(draggable?'add':'remove')+'ClassName']('draggable');return this;},getTheme:function(){return this.options.theme||this.windowManager.getTheme();},setTheme:function(theme,windowManagerTheme){this.element.removeClassName(this.getTheme()).addClassName(theme);if(!windowManagerTheme)
this.options.theme=theme;return this;},getShadowTheme:function(){return this.options.shadowTheme||this.windowManager.getShadowTheme();}});UI.Window.addMethods(UI.Window.Buttons);UI.Window.addMethods(UI.Window.Shadow);UI.Window.optionsAccessor($w(" minWidth minHeight maxWidth maxHeight gridX gridY altitude "));UI.Window.addMethods({style:"position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;",action:function(name){var action=this.options[name];if(action)
Object.isString(action)?this[action]():action.call(this,this);},create:function(){function createDiv(className,options){return new Element('div',Object.extend({className:className},options));};this.element=createDiv("ui-window "+this.getTheme(),{id:this.options.id,style:"top:-10000px; left:-10000px"});this.header=createDiv('n move_handle').enableDrag();this.content=createDiv('content').appendText(' ');this.footer=createDiv('s move_handle').enableDrag();var header=createDiv('nw').insert(createDiv('ne').insert(this.header));var content=createDiv('w').insert(createDiv('e',{style:"position:relative"}).insert(this.content));var footer=createDiv('sw').insert(createDiv('se'+(this.options.resizable?" se_resize_handle":"")).insert(this.footer));this.element.insert(header).insert(content).insert(footer).identify('ui-window');this.header.observe('mousedown',this.activate.bind(this));this.setDraggable(this.options.draggable);this.setResizable(this.options.resizable);this.overlay=new Element('div',{style:this.style+"display: none"}).observe('mousedown',this.activate.bind(this));if(this.options.activeOnClick)
this.content.insert({before:this.overlay});},createWiredElement:function(){this.wiredElement=this.wiredElement||new Element("div",{className:this.getTheme()+"_wired",style:"display: none; position: absolute; top: 0; left: 0"});},createResizeHandles:function(){$w(" n  w  e  s  nw  ne  sw  se ").each(function(id){this.insert(new Element("div",{className:id+"_sizer resize_handle",drag_prefix:id}).enableDrag());},this.element);this.createResizeHandles=Prototype.emptyFunction;},render:function(){this.addElements();this.computeBorderSize();this.updateButtonsOrder();this.element.hide().remove();return this.setBounds(this.options);},addElements:function(){this.windowManager.container.appendChild(this.element);},setZIndex:function(zIndex){if(this.zIndex!=zIndex){this.zIndex=zIndex;[this.element].concat(this.element.childElements()).each(function(element){element.style.zIndex=zIndex++;});this.lastZIndex=zIndex;}
return this;},effect:function(name,element,options){var effect=this.options[name]||Prototype.emptyFunction;effect(element||this.element,options||{});},computeBorderSize:function(){if(this.element){if(Prototype.Browser.IEVersion>=7)
this.content.style.width="100%";var dim=this.element.getDimensions(),pos=this.content.positionedOffset();this.borderSize={top:pos[1],bottom:dim.height-pos[1]-this.content.getHeight(),left:pos[0],right:dim.width-pos[0]-this.content.getWidth()};this.borderSize.width=this.borderSize.left+this.borderSize.right;this.borderSize.height=this.borderSize.top+this.borderSize.bottom;if(Prototype.Browser.IEVersion>=7)
this.content.style.width="auto";}},computeSize:function(width,height,innerSize){var innerWidth,innerHeight,outerWidth,outerHeight;if(innerSize){outerWidth=width+this.borderSize.width;outerHeight=height+this.borderSize.height;}else{outerWidth=width;outerHeight=height;}
if(!this.animating){outerWidth=outerWidth.snap(this.options.gridX);outerHeight=outerHeight.snap(this.options.gridY);if(!this.folded){if(outerWidth<this.options.minWidth)
outerWidth=this.options.minWidth;if(outerHeight<this.options.minHeight)
outerHeight=this.options.minHeight;}
if(this.options.maxWidth&&outerWidth>this.options.maxWidth)
outerWidth=this.options.maxWidth;if(this.options.maxHeight&&outerHeight>this.options.maxHeight)
outerHeight=this.options.maxHeight;}
if(this.centerOptions&&this.centerOptions.auto)
this.recenter();innerWidth=outerWidth-this.borderSize.width;innerHeight=outerHeight-this.borderSize.height;return{innerWidth:innerWidth,innerHeight:innerHeight,outerWidth:outerWidth,outerHeight:outerHeight};},computePosition:function(top,left){if(this.centerOptions&&this.centerOptions.auto)
return this.computeRecenter(this.getSize());;return{top:this.animating?top:top.snap(this.options.gridY),left:this.animating?left:left.snap(this.options.gridX)};},computeRecenter:function(size){var viewport=this.windowManager.viewport,area=viewport.getDimensions(),offset=viewport.getScrollOffset(),center={top:Object.isUndefined(this.centerOptions.top)?(area.height-size.height)/2:this.centerOptions.top,left:Object.isUndefined(this.centerOptions.left)?(area.width-size.width)/2:this.centerOptions.left};return{top:parseInt(center.top+offset.top),left:parseInt(center.left+offset.left)};},recenter:function(event){var pos=this.computeRecenter(this.getSize());this.setPosition(pos.top,pos.left);}});UI.URLWindow=Class.create(UI.Window,{options:{url:'about:blank'},afterClassCreate:function(){this.undefMethod('setAjaxContent');},initialize:function($super,options){$super(options);this.createIFrame();},destroy:function($super){this.iframe.src=null;$super();},getUrl:function(){return this.iframe.src;},setUrl:function(url,options){this.iframe.src=url;return this;},createIFrame:function($super){this.iframe=new Element('iframe',{style:this.style,frameborder:0,src:this.options.url,name:this.element.id+"_frame",id:this.element.id+"_frame"});this.content.insert(this.iframe);}});if(!Object.isUndefined(window.Effect)){UI.Window.Effects=UI.Window.Effects||{};UI.Window.Effects.Morph=Class.create(Effect.Base,{initialize:function(window,bounds){this.window=window;var options=Object.extend({fromBounds:this.window.getBounds(),toBounds:bounds,from:0,to:1},arguments[2]||{});this.start(options);},update:function(position){var t=this.options.fromBounds.top+(this.options.toBounds.top-this.options.fromBounds.top)*position;var l=this.options.fromBounds.left+(this.options.toBounds.left-this.options.fromBounds.left)*position;var ow=this.options.fromBounds.width+(this.options.toBounds.width-this.options.fromBounds.width)*position;var oh=this.options.fromBounds.height+(this.options.toBounds.height-this.options.fromBounds.height)*position;this.window.setBounds({top:t,left:l,width:ow,height:oh})}});}
UI.Window.addMethods({startDrag:function(handle){this.initBounds=this.getBounds();this.activate();if(this.options.wired){this.createWiredElement();this.wiredElement.style.cssText=this.element.style.cssText;this.element.hide();this.saveElement=this.element;this.windowManager.container.appendChild(this.wiredElement);this.element=this.wiredElement;}
handle.hasClassName('resize_handle')?this.startResize(handle):this.startMove();},endDrag:function(){this.element.hasClassName('resized')?this.endResize():this.endMove();if(this.options.wired){this.saveElement.style.cssText=this.wiredElement.style.cssText;this.wiredElement.remove();this.element=this.saveElement;this.saveElement=false;}},startMove:function(){this.drag=this.moveDrag;this.element.addClassName('moved');this.fire('move:started');},endMove:function(){this.element.removeClassName('moved');this.fire('move:ended');},startResize:function(handle){this.drag=this[handle.readAttribute('drag_prefix')+'Drag'];this.element.addClassName('resized');this.fire('resize:started');},endResize:function(){this.element.removeClassName('resized');this.fire('resize:ended');},moveDrag:function(dx,dy){this.setPosition(this.initBounds.top+dy,this.initBounds.left+dx);},swDrag:function(dx,dy){var initBounds=this.initBounds;this.setSize(initBounds.width-dx,initBounds.height+dy).setPosition(initBounds.top,initBounds.left+(initBounds.width-this.getSize().width));},seDrag:function(dx,dy){this.setSize(this.initBounds.width+dx,this.initBounds.height+dy);},nwDrag:function(dx,dy){var initBounds=this.initBounds;this.setSize(initBounds.width-dx,initBounds.height-dy).setPosition(initBounds.top+(initBounds.height-this.getSize().height),initBounds.left+(initBounds.width-this.getSize().width));},neDrag:function(dx,dy){var initBounds=this.initBounds;this.setSize(initBounds.width+dx,initBounds.height-dy).setPosition(initBounds.top+(initBounds.height-this.getSize().height),initBounds.left);},wDrag:function(dx,dy){var initBounds=this.initBounds;this.setSize(initBounds.width-dx,initBounds.height).setPosition(initBounds.top,initBounds.left+(initBounds.width-this.getSize().width));},eDrag:function(dx,dy){this.setSize(this.initBounds.width+dx,this.initBounds.height);},nDrag:function(dx,dy){var initBounds=this.initBounds;this.setSize(initBounds.width,initBounds.height-dy).setPosition(initBounds.top+(initBounds.height-this.getSize().height),initBounds.left);},sDrag:function(dx,dy){this.setSize(this.initBounds.width,this.initBounds.height+dy);}});UI.Window.addMethods({methodsAdded:function(base){base.aliasMethodChain('create','buttons');base.aliasMethodChain('destroy','buttons');},createWithButtons:function(){this.createWithoutButtons();if(!this.options.resizable){this.options.minimize=false;this.options.maximize=false;}
this.buttons=new Element("div",{className:"buttons"}).observe('click',this.onButtonsClick.bind(this)).observe('mouseover',this.onButtonsHover.bind(this)).observe('mouseout',this.onButtonsOut.bind(this));this.element.insert(this.buttons);this.defaultButtons.each(function(button){if(this.options[button]!==false)
this.addButton(button);},this);},destroyWithButtons:function(){this.buttons.stopObserving();this.destroyWithoutButtons();},defaultButtons:$w(' minimize maximize close '),getButtonElement:function(buttonName){return this.buttons.down("."+buttonName);},addButton:function(buttonName,action){this.buttons.insert(new Element("a",{className:buttonName,href:"#"}));if(action)
this.options[buttonName]=action;return this;},removeButton:function(buttonName){this.getButtonElement(buttonName).remove();return this;},disableButton:function(buttonName){this.getButtonElement(buttonName).addClassName("disabled");return this;},enableButton:function(buttonName){this.getButtonElement(buttonName).removeClassName("disabled");return this;},onButtonsClick:function(event){var element=event.findElement('a:not(.disabled)');if(element)this.action(element.className);event.stop();},onButtonsHover:function(event){this.buttons.addClassName("over");},onButtonsOut:function(event){this.buttons.removeClassName("over");},updateButtonsOrder:function(){var buttons=this.buttons.childElements();buttons.inject(new Array(buttons.length),function(array,button){array[parseInt(button.getStyle("padding-top"))]=button.setStyle("padding: 0");return array;}).each(function(button){this.buttons.insert(button)},this);}});UI.Window.addMethods({methodsAdded:function(base){(function(methods){$w(methods).each(function(m){base.aliasMethodChain(m,'shadow')});})(' create addElements setZIndex setPosition setSize setBounds ');},showShadow:function(){if(this.shadow){this.shadow.hide();this.effect('show',this.shadow.shadow);}},hideShadow:function(){if(this.shadow)
this.effect('hide',this.shadow.shadow);},removeShadow:function(){if(this.shadow)
this.shadow.remove();},focusShadow:function(){if(this.shadow)
this.shadow.focus();},blurShadow:function(){if(this.shadow)
this.shadow.blur();},createWithShadow:function(){this.createWithoutShadow();this.observe('showing',this.showShadow).observe('hiding',this.hideShadow).observe('hidden',this.removeShadow).observe('focused',this.focusShadow).observe('blurred',this.blurShadow);if(this.options.shadow)
this.shadow=new UI.Shadow(this.element,{theme:this.getShadowTheme()});},addElementsWithShadow:function(){this.addElementsWithoutShadow();if(this.shadow){this.shadow.setBounds(this.options).render();}},setZIndexWithShadow:function(zIndex){if(this.zIndex!=zIndex){if(this.shadow)
this.shadow.setZIndex(zIndex-1);this.setZIndexWithoutShadow(zIndex);this.zIndex=zIndex;}
return this;},setPositionWithShadow:function(top,left){this.setPositionWithoutShadow(top,left);if(this.shadow){var pos=this.getPosition();this.shadow.setPosition(pos.top,pos.left);}
return this;},setSizeWithShadow:function(width,height,innerSize){this.setSizeWithoutShadow(width,height,innerSize);if(this.shadow){var size=this.getSize();this.shadow.setSize(size.width,size.height);}
return this;},setBoundsWithShadow:function(bounds,innerSize){this.setBoundsWithoutShadow(bounds,innerSize);if(this.shadow)
this.shadow.setBounds(this.getBounds());}});UI.Dialog=Class.create(UI.Window,{options:{buttons:null,beforeSelect:Prototype.trueFunction,close:false,resizable:false,activeOnClick:false},disableDialogButton:function(index){var button=this.getDialogButton(index);if(button)
button.addClassName("disabled");return this;},enableDialogButton:function(index){var button=this.getDialogButton(index);if(button)
button.removeClassName("disabled");return this;},getDialogButton:function(index){var buttons=this.buttonContainer.childElements();if(index>=0&&index<buttons.length)
return buttons[index];else
return null;},create:function($super){$super();this.buttonContainer=this.createButtons();this.dialogContent=new Element('div',{className:'ui-dialog-content'});this.content.update(this.dialogContent);this.content.insert(this.buttonContainer);},addElements:function($super){$super();this.buttonsHeight=this.buttonContainer.getHeight()||this.buttonsHeight;this.setDialogSize();},setContent:function(content,withoutButton){this.dialogContent.update(content);if(withoutButton&&this.buttonContainer.parentNode)
this.buttonContainer.remove();else
this.content.insert(this.buttonContainer);this.setDialogSize();return this;},onSelect:function(e){var element=e.element();if(element.callback&&!element.hasClassName('disabled')){if(this.options.beforeSelect(element))
element.callback(this);}},createButtons:function(dialogButtons){var buttonContainer=new Element('div',{className:'ui-dialog-buttons'});(this.options.buttons||UI.Dialog.okCancelButtons).each(function(item){var button;if(item.separator)
button=new Element('span',{className:'separator'});else
button=new Element('button',{title:item.title,className:(item.className||'')+(item.disabled?' disabled':'')}).observe('click',this.onSelect.bind(this)).update(item.title);buttonContainer.insert(button);button.callback=item.callback;}.bind(this));return buttonContainer;},setDialogSize:function(){if(!this.borderSize)
return;this.buttonsHeight=this.buttonContainer.getHeight()||this.buttonsHeight;var style=this.dialogContent.style,size=this.getSize(true);style.width=size.width+"px",style.height=size.height-this.buttonsHeight+"px";},setSize:function($super,width,height,innerSize){$super(width,height,innerSize);this.setDialogSize();return this;}});UI.Dialog=Object.extend(UI.Dialog,{okButton:[{title:'Ok',className:'ok',callback:function(win){win.destroy();}}],okCancelButtons:[{title:'Ok',className:'ok',callback:function(win){win.destroy();}},{title:'Cancel',className:'cancel',callback:function(win){win.destroy();}}]})
UI.WindowManager=Class.create(UI.Options,{options:{container:null,zIndex:0,theme:"alphacube",shadowTheme:"mac_shadow",showOverlay:Element.show,hideOverlay:Element.hide,positionningStrategy:function(win,area){UI.WindowManager.DumbPositionningStrategy(win,area);}},initialize:function(options){this.setOptions(options);this.container=$(this.options.container||document.body);if(this.container===$(document.body)){this.viewport=document.viewport;this.scrollContainer=window;}else{this.viewport=this.scrollContainer=this.container;}
this.container.observe('drag:started',this.onStartDrag.bind(this)).observe('drag:updated',this.onDrag.bind(this)).observe('drag:ended',this.onEndDrag.bind(this));this.stack=new UI.WindowManager.Stack();this.modalSessions=0;this.createOverlays();this.resizeEvent=this.resize.bind(this);Event.observe(window,"resize",this.resizeEvent);},destroy:function(){this.windows().invoke('destroy');this.stack.destroy();Event.stopObserving(window,"resize",this.resizeEvent);},setTheme:function(theme){this.stack.windows.select(function(w){return!w.options.theme;}).invoke('setTheme',theme,true);this.options.theme=theme;return this;},register:function(win){if(this.getWindow(win.id))return;this.handlePosition(win);this.stack.add(win);this.restartZIndexes();},unregister:function(win){this.stack.remove(win);if(win==this.focusedWindow)
this.focusedWindow=null;},getWindow:function(element){element=$(element);if(!element)return;if(!element.hasClassName('ui-window'))
element=element.up('.ui-window');var id=element.id;return this.stack.windows.find(function(win){return win.id==id});},windows:function(){return this.stack.windows.clone();},getFocusedWindow:function(){return this.focusedWindow;},startModalSession:function(win){if(!this.modalSessions){this.removeOverflow();this.modalOverlay.className=win.getTheme()+"_overlay";this.container.appendChild(this.modalOverlay);if(!this.modalOverlay.opacity)
this.modalOverlay.opacity=this.modalOverlay.getOpacity();this.modalOverlay.setStyle("height: "+this.viewport.getHeight()+"px");this.options.showOverlay(this.modalOverlay,{from:0,to:this.modalOverlay.opacity});}
this.modalOverlay.setStyle({zIndex:win.zIndex-1});this.modalSessions++;},endModalSession:function(win){this.modalSessions--;if(this.modalSessions){this.modalOverlay.setStyle({zIndex:this.stack.getPreviousWindow(win).zIndex-1});}else{this.resetOverflow();this.options.hideOverlay(this.modalOverlay,{from:this.modalOverlay.opacity,to:0});}},moveHandleSelector:'.ui-window.draggable .move_handle',resizeHandleSelector:'.ui-window.resizable .resize_handle',onStartDrag:function(event){var handle=event.element(),isMoveHandle=handle.match(this.moveHandleSelector),isResizeHandle=handle.match(this.resizeHandleSelector);if(isResizeHandle||isMoveHandle){event.stop();var win=this.getWindow(event.findElement('.ui-window'));this.container.insert(this.dragOverlay.setStyle({zIndex:this.getLastZIndex()}));win.startDrag(handle);this.draggedWindow=win;}},onDrag:function(event){if(this.draggedWindow){event.stop();this.draggedWindow.drag(event.memo.dx,event.memo.dy);}},onEndDrag:function(event){if(this.draggedWindow){event.stop();this.dragOverlay.remove();this.draggedWindow.endDrag();this.draggedWindow=null;}},maximize:function(win){this.removeOverflow();this.maximizedWindow=win;return true;},restore:function(win){if(this.maximizedWindow){this.resetOverflow();this.maximizedWindow=false;}
return true;},removeOverflow:function(){var container=this.container;container.savedOverflow=container.style.overflow||"auto";container.savedOffset=this.viewport.getScrollOffset();container.style.overflow="hidden";this.viewport.setScrollOffset({top:0,left:0});if(this.container==document.body&&Prototype.Browser.IE)
this.cssRule=CSS.addRule("html { overflow: hidden }");},resetOverflow:function(){var container=this.container;if(container.savedOverflow){if(this.container==document.body&&Prototype.Browser.IE)
this.cssRule.remove();container.style.overflow=container.savedOverflow;this.viewport.setScrollOffset(container.savedOffset);container.savedOffset=container.savedOverflow=null;}},hide:function(win){var previous=this.stack.getPreviousWindow(win);if(previous)previous.focus();},restartZIndexes:function(){var zIndex=this.getZIndex()+1;this.stack.windows.each(function(w){w.setZIndex(zIndex);zIndex=w.lastZIndex+1;});},getLastZIndex:function(){return this.stack.getFrontWindow().lastZIndex+1;},overlayStyle:"position: absolute; top: 0; left: 0; display: none; width: 100%;",createOverlays:function(){this.modalOverlay=new Element("div",{style:this.overlayStyle});this.dragOverlay=new Element("div",{style:this.overlayStyle+"height: 100%"});},focus:function(win){if(this.focusedWindow)
this.focusedWindow.blur();this.focusedWindow=win;},blur:function(win){if(win==this.focusedWindow)
this.focusedWindow=null;},setAltitude:function(win,altitude){var stack=this.stack;if(altitude==="front"){if(stack.getFrontWindow()===win)return;stack.bringToFront(win);}else if(altitude==="back"){if(stack.getBackWindow()===win)return;stack.sendToBack(win);}else{if(stack.getPosition(win)==altitude)return;stack.setPosition(win,altitude);}
this.restartZIndexes();return true;},getAltitude:function(win){return this.stack.getPosition(win);},resize:function(event){var area=this.viewport.getDimensions();if(this.maximizedWindow)
this.maximizedWindow.setSize(area.width,area.height);if(this.modalOverlay.visible())
this.modalOverlay.setStyle("height:"+area.height+"px");},handlePosition:function(win){if(Object.isNumber(win.options.top)&&Object.isNumber(win.options.left))
return;var strategy=this.options.positionningStrategy,area=this.viewport.getDimensions();Object.isFunction(strategy)?strategy(win,area):strategy.position(win,area);}});UI.WindowManager.DumbPositionningStrategy=function(win,area){size=win.getSize();var top=area.height-size.height,left=area.width-size.width;top=top<0?0:Math.random()*top;left=left<0?0:Math.random()*left;win.setPosition(top,left);};UI.WindowManager.optionsAccessor('zIndex','theme','shadowTheme');UI.WindowManager.Stack=Class.create(Enumerable,{initialize:function(){this.windows=[];},each:function(iterator){this.windows.each(iterator);},add:function(win,position){this.windows.splice(position||this.windows.length,0,win);},remove:function(win){this.windows=this.windows.without(win);},sendToBack:function(win){this.remove(win);this.windows.unshift(win);},bringToFront:function(win){this.remove(win);this.windows.push(win);},getPosition:function(win){return this.windows.indexOf(win);},setPosition:function(win,position){this.remove(win);this.windows.splice(position,0,win);},getFrontWindow:function(){return this.windows.last();},getBackWindow:function(){return this.windows.first();},getPreviousWindow:function(win){return(win==this.windows.first())?null:this.windows[this.windows.indexOf(win)-1];}});document.whenReady(function(){UI.defaultWM=new UI.WindowManager();});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._observers[event_name][i],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);for(var i=0;i<this._observers[event_name].length;++i)
collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],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);}});Object.extend(Event,(function(){var cache=Event.cache;function getEventID(element){if(element._prototypeEventID)return element._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return element._prototypeEventID=[++arguments.callee.id];}
function getDOMEventName(eventName){if(eventName&&eventName.include(':'))return"dataavailable";if(!Prototype.Browser.IE){eventName={mouseenter:'mouseover',mouseleave:'mouseout'}[eventName]||eventName;}
return eventName;}
function getCacheForID(id){return cache[id]=cache[id]||{};}
function getWrappersForEventName(id,eventName){var c=getCacheForID(id);return c[eventName]=c[eventName]||[];}
function createWrapper(element,eventName,handler){var id=getEventID(element);var c=getWrappersForEventName(id,eventName);if(c.pluck("handler").include(handler))return false;var wrapper=function(event){if(!Event||!Event.extend||(event.eventName&&event.eventName!=eventName))
return false;Event.extend(event);handler.call(element,event);};if(!(Prototype.Browser.IE)&&['mouseenter','mouseleave'].include(eventName)){wrapper=wrapper.wrap(function(proceed,event){var rel=event.relatedTarget;var cur=event.currentTarget;if(rel&&rel.nodeType==Node.TEXT_NODE)
rel=rel.parentNode;if(rel&&rel!=cur&&!rel.descendantOf(cur))
return proceed(event);});}
wrapper.handler=handler;c.push(wrapper);return wrapper;}
function findWrapper(id,eventName,handler){var c=getWrappersForEventName(id,eventName);return c.find(function(wrapper){return wrapper.handler==handler});}
function destroyWrapper(id,eventName,handler){var c=getCacheForID(id);if(!c[eventName])return false;c[eventName]=c[eventName].without(findWrapper(id,eventName,handler));}
function destroyCache(){for(var id in cache)
for(var eventName in cache[id])
cache[id][eventName]=null;}
if(window.attachEvent){window.attachEvent("onunload",destroyCache);}
return{observe:function(element,eventName,handler){element=$(element);var name=getDOMEventName(eventName);var wrapper=createWrapper(element,eventName,handler);if(!wrapper)return element;if(element.addEventListener){element.addEventListener(name,wrapper,false);}else{element.attachEvent("on"+name,wrapper);}
return element;},stopObserving:function(element,eventName,handler){element=$(element);var id=getEventID(element),name=getDOMEventName(eventName);if(!handler&&eventName){getWrappersForEventName(id,eventName).each(function(wrapper){element.stopObserving(eventName,wrapper.handler);});return element;}else if(!eventName){Object.keys(getCacheForID(id)).each(function(eventName){element.stopObserving(eventName);});return element;}
var wrapper=findWrapper(id,eventName,handler);if(!wrapper)return element;if(element.removeEventListener){element.removeEventListener(name,wrapper,false);}else{element.detachEvent("on"+name,wrapper);}
destroyWrapper(id,eventName,handler);return element;},fire:function(element,eventName,memo){element=$(element);if(element==document&&document.createEvent&&!element.dispatchEvent)
element=document.documentElement;var event;if(document.createEvent){event=document.createEvent("HTMLEvents");event.initEvent("dataavailable",true,true);}else{event=document.createEventObject();event.eventType="ondataavailable";}
event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event);}else{element.fireEvent(event.eventType,event);}
return Event.extend(event);}};})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});(function(){function wheel(event){var delta;if(event.wheelDelta)
delta=event.wheelDelta/120;else if(event.detail)
delta=-event.detail/3;if(!delta)
return;var custom_event=event.element().fire('mouse:wheel',{delta:delta});if(custom_event.stopped){event.stop();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(Prototype)=="undefined")
throw"Control.Tabs requires Prototype to be loaded.";if(typeof(Object.Event)=="undefined")
throw"Control.Tabs requires Object.Event to be loaded.";Control.Tabs=Class.create({initialize:function(tab_list_container,options){if(!$(tab_list_container))
throw"Control.Tabs could not find the element: "+tab_list_container;this.activeContainer=false;this.activeLink=false;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:'li a',setClassOnContainer:false,activeClassName:'active',defaultTab:'first',autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};Object.extend(this.options,options||{});(typeof(this.options.linkSelector=='string')?$(tab_list_container).select(this.options.linkSelector):this.options.linkSelector($(tab_list_container))).findAll(function(link){return(/^#/).exec((Prototype.Browser.WebKit?decodeURIComponent(link.href):link.href).replace(window.location.href.split('#')[0],''));}).each(function(link){this.addTab(link);}.bind(this));this.containers.values().each(Element.hide);if(this.options.defaultTab=='first')
this.setActiveTab(this.links.first());else if(this.options.defaultTab=='last')
this.setActiveTab(this.links.last());else
this.setActiveTab(this.options.defaultTab);var targets=this.options.targetRegExp.exec(window.location);if(targets&&targets[1]){targets[1].split(',').each(function(target){this.setActiveTab(this.links.find(function(link){return link.key==target;}));}.bind(this));}
if(this.options.autoLinkExternal){$A(document.getElementsByTagName('a')).each(function(a){if(!this.links.include(a)){var clean_href=a.href.replace(window.location.href.split('#')[0],'');if(clean_href.substring(0,1)=='#'){if(this.containers.keys().include(clean_href.substring(1))){$(a).observe('click',function(event,clean_href){this.setActiveTab(clean_href.substring(1));}.bindAsEventListener(this,clean_href));}}}}.bind(this));}},addTab:function(link){this.links.push(link);link.key=link.getAttribute('href').replace(window.location.href.split('#')[0],'').split('/').last().replace(/#/,'');var container=$(link.key);if(!container)
throw"Control.Tabs: #"+link.key+" was not found on the page."
this.containers.set(link.key,container);link[this.options.hover?'onmouseover':'onclick']=function(link){if(window.event)
Event.stop(window.event);this.setActiveTab(link);return false;}.bind(this,link);},setActiveTab:function(link){if(!link&&typeof(link)=='undefined')
return;if(typeof(link)=='string'){this.setActiveTab(this.links.find(function(_link){return _link.key==link;}));}else if(typeof(link)=='number'){this.setActiveTab(this.links[link]);}else{if(this.notify('beforeChange',this.activeContainer,this.containers.get(link.key))===false)
return;if(this.activeContainer)
this.options.hideFunction(this.activeContainer);this.links.each(function(item){(this.options.setClassOnContainer?$(item.parentNode):item).removeClassName(this.options.activeClassName);}.bind(this));(this.options.setClassOnContainer?$(link.parentNode):link).addClassName(this.options.activeClassName);this.activeContainer=this.containers.get(link.key);this.activeLink=link;this.options.showFunction(this.containers.get(link.key));this.notify('afterChange',this.containers.get(link.key));}},next:function(){this.links.each(function(link,i){if(this.activeLink==link&&this.links[i+1]){this.setActiveTab(this.links[i+1]);throw $break;}}.bind(this));},previous:function(){this.links.each(function(link,i){if(this.activeLink==link&&this.links[i-1]){this.setActiveTab(this.links[i-1]);throw $break;}}.bind(this));},first:function(){this.setActiveTab(this.links.first());},last:function(){this.setActiveTab(this.links.last());}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(id){return Control.Tabs.instances.find(function(tab){return tab.links.find(function(link){return link.key==id;});});}});Object.Event.extend(Control.Tabs);document.observe('dom:loaded',function(e){if($('slideshow-title'))
$('slideshow-title').hide();$$('div#s1 img').each(function(i){if($$('div#s1 img').first()!=i)
i.hide();});});var Slideshow={Version:"1.5.5",Browser:{IE:Prototype.Browser.IE,IE6:parseInt(navigator.appVersion.split('MSIE')[1])==6?true:false,Opera:Prototype.Browser.Opera,Safari:Prototype.Browser.WebKit},Settings:{Fade:false,Speed:0,Pause:false,Manual:false,UpperLimit:0,Transition:1},Control:{Images:{Active:null,Next:null,Largest:null,All:null},Container:null,Executer:null,PauseMessage:null,Titlebar:null},Util:{Images:null,Container:null,Titlebar:null,Executer:null,PauseMessage:null,Image:{Active:null,Next:null,Widest:null,Tallest:null}},Methods:{start:function(){Slideshow.Methods._setupImages();Slideshow.Methods._setupContainer();Slideshow.Methods._startExecuter();},_setupImages:function(){Slideshow.Control.Images.All.each(function(i){Slideshow.Methods._setImageStyles(i);if(Slideshow.Control.Images.All.first()==i){Slideshow.Control.Images.Active=i;Slideshow.Methods._updateCaption(Slideshow.Control.Images.Active);}else{i.hide();}});},_setImageStyles:function(image){var leftMargin=((Slideshow.Control.Images.Widest.getWidth()-image.getWidth())/2);leftMargin+='px';if(Slideshow.Browser.Opera)
leftMargin=0+'px';var margin='-'+image.height+'px';if(image.getStyle('margin-bottom')!=margin){image.setStyle({marginBottom:margin,float:'left',marginLeft:leftMargin});}},_setupContainer:function(){Slideshow.Control.Container.setStyle({height:Slideshow.Control.Images.Tallest.getHeight()+'px',width:Slideshow.Control.Images.Widest.getWidth()+'px',position:'relative'});Slideshow.Control.Container.classNames().each(function(n){n=n.toLowerCase();if(n=='fade')
Slideshow.Settings.Fade=true;if(n=='pause'){Slideshow.Settings.Pause=true;Slideshow.Control.Container.observe('mouseover',function(e){Slideshow.Methods._mouseOverHandler(e);});Slideshow.Control.Container.observe('mouseout',function(e){Slideshow.Methods._mouseOutHandler(e);});}
if(n=='manual'){Slideshow.Settings.Manual=true;Slideshow.Control.Container.observe('click',function(e){Slideshow.Methods._mouseClickHandler(e);});}
var strParam=n.split(':');if(strParam[0].toLowerCase()=='speed')
Slideshow.Settings.Speed=strParam[1];if(strParam[0].toLowerCase()=='limit')
Slideshow.Settings.UpperLimit=strParam[1];if(strParam[0].toLowerCase()=='transition')
Slideshow.Settings.Transition=strParam[1];});if(!Slideshow.Control.PauseMessage&&Slideshow.Settings.Pause)
Slideshow.Methods._createPauseMessage();if(Slideshow.Control.Titlebar){Slideshow.Control.Titlebar.setStyle({position:'absolute',bottom:0});Slideshow.Control.Titlebar.show();}},_startExecuter:function(){if(Slideshow.Settings.Speed!=0){Slideshow.Control.Executer=new PeriodicalExecuter(function(pe){Slideshow.Methods._rotate();},Slideshow.Settings.Speed);}},_rotate:function(){var images=Slideshow.Control.Images.All;var image=Slideshow.Control.Images;image.Active==images.last()?image.Next=images.first():image.Next=images[images.indexOf(image.Active)+1];if(Slideshow.Settings.UpperLimit!=1){Slideshow.Methods._swap(image.Active,image.Next);Slideshow.Settings.UpperLimit--;}},_swap:function(current,next){Slideshow.Methods._setImageStyles(current);if(Slideshow.Settings.Fade&&!Slideshow.Browser.IE6){new Effect.Fade(current,{duration:Slideshow.Settings.Transition});new Effect.Appear(next,{duration:Slideshow.Settings.Transition});}else{current.hide();next.show();}
if(Slideshow.Control.Titlebar)
Slideshow.Methods._updateCaption(next);Slideshow.Control.Images.Active=next;},_updateCaption:function(image){var titlebar=null;if(Slideshow.Control.Titlebar)
titlebar=Slideshow.Control.Titlebar;else
return;if(titlebar.down(0))
titlebar.removeChild(titlebar.down(0))
var captionContainer=$(document.createElement('span'));var captionText=$(document.createTextNode(image.readAttribute('alt')));captionContainer.appendChild(captionText);titlebar.appendChild(captionContainer);},_createPauseMessage:function(){var PauseMessage=$(document.createElement('div'));var message=document.createTextNode('paused');PauseMessage.setAttribute('id','slideshow-pause');PauseMessage.appendChild(message);PauseMessage.setStyle({top:'0',right:'0',position:'absolute'});PauseMessage.hide();Slideshow.Control.Container.appendChild(PauseMessage);Slideshow.Control.PauseMessage=PauseMessage;},_mouseOverHandler:function(e){e.stopPropagation();if(Slideshow.Control.Executer)
Slideshow.Control.Executer.stop();Slideshow.Control.PauseMessage.show();},_mouseOutHandler:function(e){e.stopPropagation();if(Slideshow.Control.Executer)
Slideshow.Methods._startExecuter();Slideshow.Control.PauseMessage.hide();},_mouseClickHandler:function(e){e.stopPropagation();if(Slideshow.Control.Executer)
Slideshow.Control.Executer.stop();if(Slideshow.Control.PauseMessage)
Slideshow.Control.PauseMessage.hide();Slideshow.Methods._rotate();if(Slideshow.Control.Executer)
Slideshow.Methods._startExecuter();}}};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;if(!document.myGetElementsByClassName){document.myGetElementsByClassName=function(className){var children=document.getElementsByTagName('*')||document.all;var elements=new Array();for(var i=0;i<children.length;i++){var child=children[i];var classNames=child.className.split(' ');for(var j=0;j<classNames.length;j++){if(classNames[j]==className){elements.push(child);break;}}}
return elements;}}
var Reflection={defaultHeight:0.5,defaultOpacity:0.5,add:function(image,options){Reflection.remove(image);doptions={"height":Reflection.defaultHeight,"opacity":Reflection.defaultOpacity}
if(options){for(var i in doptions){if(!options[i]){options[i]=doptions[i];}}}else{options=doptions;}
try{var d=document.createElement('div');var p=image;var classes=p.className.split(' ');var newClasses='';for(j=0;j<classes.length;j++){if(classes[j]!="reflect"){if(newClasses){newClasses+=' '}
newClasses+=classes[j];}}
var reflectionHeight=Math.floor(p.height*options['height']);var divHeight=Math.floor(p.height*(1+options['height']));var reflectionWidth=p.width;if(document.all&&!window.opera){if(p.parentElement.tagName=='A'){var d=document.createElement('a');d.href=p.parentElement.href;}
d.className=newClasses;p.className='reflected';d.style.cssText=p.style.cssText;p.style.cssText='vertical-align: bottom';var reflection=document.createElement('img');reflection.src=p.src;reflection.style.width=reflectionWidth+'px';reflection.style.display='block';reflection.style.height=p.height+"px";reflection.style.marginBottom="-"+(p.height-reflectionHeight)+'px';reflection.style.filter='flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';d.style.width=reflectionWidth+'px';d.style.height=divHeight+'px';p.parentNode.replaceChild(d,p);d.appendChild(p);d.appendChild(reflection);}else{var canvas=document.createElement('canvas');if(canvas.getContext){d.className=newClasses;p.className='reflected';d.style.cssText=p.style.cssText;p.style.cssText='vertical-align: bottom';var context=canvas.getContext("2d");canvas.style.height=reflectionHeight+'px';canvas.style.width=reflectionWidth+'px';canvas.height=reflectionHeight;canvas.width=reflectionWidth;d.style.width=reflectionWidth+'px';d.style.height=divHeight+'px';p.parentNode.replaceChild(d,p);d.appendChild(p);d.appendChild(canvas);context.save();context.translate(0,image.height-1);context.scale(1,-1);context.drawImage(image,0,0,reflectionWidth,image.height);context.restore();context.globalCompositeOperation="destination-out";var gradient=context.createLinearGradient(0,0,0,reflectionHeight);gradient.addColorStop(1,"rgba(255, 255, 255, 1.0)");gradient.addColorStop(0,"rgba(255, 255, 255, "+(1-options['opacity'])+")");context.fillStyle=gradient;context.rect(0,0,reflectionWidth,reflectionHeight*2);context.fill();}}}catch(e){}},remove:function(image){if(image.className=="reflected"){image.className=image.parentNode.className;image.parentNode.parentNode.replaceChild(image,image.parentNode);}}}
function addReflections(){var rimages=document.myGetElementsByClassName('reflect');for(i=0;i<rimages.length;i++){var rheight=null;var ropacity=null;var classes=rimages[i].className.split(' ');for(j=0;j<classes.length;j++){if(classes[j].indexOf("rheight")==0){var rheight=classes[j].substring(7)/100;}else if(classes[j].indexOf("ropacity")==0){var ropacity=classes[j].substring(8)/100;}}
Reflection.add(rimages[i],{height:rheight,opacity:ropacity});}}
var previousOnload=window.onload;window.onload=function(){if(previousOnload)previousOnload();addReflections();}
var Behaviour={list:new Array,register:function(sheet){Behaviour.list.push(sheet);},start:function(){Behaviour.addLoadEvent(function(){Behaviour.apply();});},apply:function(){for(h=0;sheet=Behaviour.list[h];h++){for(selector in sheet){list=document.getElementsBySelector(selector);if(!list){continue;}
for(i=0;element=list[i];i++){sheet[selector](element);}}}},addLoadEvent:function(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}}
Behaviour.start();function getAllChildren(e){return e.all?e.all:e.getElementsByTagName('*');}
document.getElementsBySelector=function(selector){if(!document.getElementsByTagName){return new Array();}
var tokens=selector.split(' ');var currentContext=new Array(document);for(var i=0;i<tokens.length;i++){token=tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;if(token.indexOf('#')>-1){var bits=token.split('#');var tagName=bits[0];var id=bits[1];var element=document.getElementById(id);if(tagName&&element.nodeName.toLowerCase()!=tagName){return new Array();}
currentContext=new Array(element);continue;}
if(token.indexOf('.')>-1){var bits=token.split('.');var tagName=bits[0];var className=bits[1];if(!tagName){tagName='*';}
var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(found[k].className&&found[k].className.match(new RegExp('\\b'+className+'\\b'))){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){var tagName=RegExp.$1;var attrName=RegExp.$2;var attrOperator=RegExp.$3;var attrValue=RegExp.$4;if(!tagName){tagName='*';}
var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements;if(tagName=='*'){elements=getAllChildren(currentContext[h]);}else{elements=currentContext[h].getElementsByTagName(tagName);}
for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=new Array;var currentContextIndex=0;var checkFunction;switch(attrOperator){case'=':checkFunction=function(e){return(e.getAttribute(attrName)==attrValue);};break;case'~':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b')));};break;case'|':checkFunction=function(e){return(e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?')));};break;case'^':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)==0);};break;case'$':checkFunction=function(e){return(e.getAttribute(attrName).lastIndexOf(attrValue)==e.getAttribute(attrName).length-attrValue.length);};break;case'*':checkFunction=function(e){return(e.getAttribute(attrName).indexOf(attrValue)>-1);};break;default:checkFunction=function(e){return e.getAttribute(attrName);};}
currentContext=new Array;var currentContextIndex=0;for(var k=0;k<found.length;k++){if(checkFunction(found[k])){currentContext[currentContextIndex++]=found[k];}}
continue;}
if(!currentContext[0]){return;}
tagName=token;var found=new Array;var foundCount=0;for(var h=0;h<currentContext.length;h++){var elements=currentContext[h].getElementsByTagName(tagName);for(var j=0;j<elements.length;j++){found[foundCount++]=elements[j];}}
currentContext=found;}
return currentContext;}
window.tooltips=[];TooltipFactory=Class.create();TooltipFactory.prototype={initialize:function(selector,options){this.selector=selector;this.elements=[];this.tooltips=[];this.options=options||{};},areSupported:function(){return(document.getElementById!=null);},activate:function(elements,options){this.elements=document.getElementsBySelector(this.selector);Object.extend(this.options,options||{});for(var i=0;i<this.elements.length;i++){var tooltip=new Tooltip(this.elements[i],this);if(tooltip){this.tooltips.push(tooltip);}}},activateOnLoad:function(options){if(this.areSupported()){Object.extend(this.options,options||{});Event.observe(window,"load",this.activate.bind(this));}}}
Tooltip=Class.create();Tooltip.prototype={initialize:function(trigger,options){this.trigger=trigger;if(options instanceof TooltipFactory){this.factory=options;options=options.options;}
this.setOptions(options);if(this.options.getPopUp){this.popUp=this.options.getPopUp.bind(this)(event);}else if(!this.popUp&&this.options.popUp){this.popUp=$(this.options.popUp);}else if(this.trigger.href&&this.trigger.href.indexOf("#")!=-1){this.popUp=$(this.trigger.href.split("#").pop());}
if(!this.popUp&&this.trigger.id)this.popUp=$(this.trigger.id+"PopUp");if(!this.popUp&&this.trigger.title){this.popUp=document.createElement("div");document.body.appendChild(this.popUp);this.popUp.className=this.options.popUpClassName;this.popUp.innerHTML=this.trigger.title;this.trigger.removeAttribute("title");}
if(!this.popUp)return;window.tooltips.push(this);this.runningEffect=null;if(this.options.openingEvent==this.options.closingEvent){Event.observe(this.trigger,this.options.openingEvent||'click',this.toggle.bind(this));}else{Event.observe(this.trigger,this.options.openingEvent||'mouseover',this.open.bind(this));Event.observe(this.trigger,this.options.closingEvent||'mouseout',this.close.bind(this));}
if(this.options.onInitialize)this.options.onInitialize.bind(this)();},setOptions:function(options){this.options={queue:{position:"end",scope:"tooltip"+window.tooltips.length,limit:1}};Object.extend(this.options,Tooltips.options);Object.extend(this.options,options||{});if(this.setInitialPosition)this.setInitialPosition=this.options.setInitialPosition.bind(this);if(this.getPosition)this.getPosition=this.options.getPosition.bind(this);if(window.opera&&this.options.effect.toLowerCase()=="appear"){this.options.duration=0;}},open:function(event){var duration=this.options.duration;if(this.runningEffect){var queue=Effect.Queues.get(this.options.queue.scope);duration=Math.min(new Date().getTime()-this.runningEffect.startOn,duration);queue.remove(this.runningEffect);}
if(this.options.setPosition)this.options.setPosition.bind(this)(event);this.runningEffect=Effect[Effect.PAIRS[this.options.effect][0]](this.popUp,Object.extend(Object.extend(Object.extend({},this.options),{duration:duration}),this.options.open||{}));if(this.options.onOpen)this.options.onOpen.bind(this)(event);},close:function(event){var duration=this.options.duration;if(this.runningEffect){var queue=Effect.Queues.get(this.options.queue.scope);duration=Math.min(new Date().getTime()-this.runningEffect.startOn,duration);queue.remove(this.runningEffect);}
this.runningEffect=Effect[Effect.PAIRS[this.options.effect][1]](this.popUp,Object.extend(Object.extend(Object.extend({},this.options),{duration:duration}),this.options.close||{}));if(this.options.onClose)this.options.onClose.bind(this)(event);},toggle:function(event){Element.visible(this.popUp)?this.close(event):this.open(event);}};Tooltips=new TooltipFactory(".tooltipTrigger",{popUpClassName:"tooltip",offsetLeft:18,offsetTop:-70,effect:"appear",duration:0.7,openingEvent:"click",closingEvent:"click",onInitialize:function(){this.popUp.style.position="absolute";this.popUp.style.left="0";this.popUp.style.top="0";Element.hide(this.popUp);},onOpen:function(event){var x=Event.pointerX(event)+this.options.offsetLeft;var triggerY=Position.cumulativeOffset(this.trigger)[1];var y=triggerY+this.trigger.offsetHeight+this.options.offsetTop;Position.prepare();var popUp=Element.getDimensions(this.popUp);if(x+popUp.width+this.options.offsetLeft>(Position.deltaX+Position.visibleWidth))
x=Math.max(this.options.offsetLeft,((Position.deltaX+Position.visibleWidth)-popUp.width-this.options.offsetLeft));if(y+popUp.height+this.options.offsetTop>(Position.deltaY+Position.visibleHeight)){y=triggerY-popUp.height-this.options.offsetTop;}
this.popUp.style.left=x+"px";this.popUp.style.top=y+"px";}});ActionHints=new TooltipFactory(".actionHintTrigger",{popUpClassName:"tooltip",offsetLeft:20,offsetTop:20,effect:"appear",openingEvent:"click",closingEvent:"mouseout",open:{duration:0.0},close:{delay:1.0,duration:1.0},onInitialize:function(){this.popUp.style.position="absolute";this.popUp.style.left="0";this.popUp.style.top="0";Element.hide(this.popUp);},onOpen:function(event){var triggerPos=Position.cumulativeOffset(this.trigger);var x=triggerPos[0]+this.options.offsetLeft;var y=triggerPos[1]-this.options.offsetTop-this.trigger.offsetHeight;Position.prepare();var popUp=Element.getDimensions(this.popUp);if(x+popUp.width+this.options.offsetLeft>(Position.deltaX+Position.visibleWidth))
x=Math.max(this.options.offsetLeft,((Position.deltaX+Position.visibleWidth)-popUp.width-this.options.offsetLeft));this.popUp.style.left=x+"px";this.popUp.style.top=y+"px";}});SectionTriggers=new TooltipFactory(".sectionTrigger",{effect:"appear",openingEvent:"click",closingEvent:"click",text:{show:"show",hide:"hide"},duration:1.0,onInitialize:function(){},onOpen:function(event){this.trigger.innerHTML=this.trigger.getAttribute("hide")||this.options.text.hide;Event.stop(event);},onClose:function(event){this.trigger.innerHTML=this.trigger.getAttribute("show")||this.options.text.show;Event.stop(event);}});function loadevents_mapnav(evt){spas_loaded(evt);}
function spas_loaded(evt){}
function rollover(evt){var child=Event.element(evt);if(child.hasClassName("activemavnap")){$('mapdetail').innerHTML=child.firstChild.innerHTML;Event.stop(evt);}else{index=idx.indexOf(child.id);aux=posx[index]+"px -75px";child.style.backgroundPosition=aux;$('mapdetail').innerHTML=child.firstChild.innerHTML;}}
function rollexit(evt){var child=Event.element(evt);index=idx.indexOf(child.id);yahactive=$$('.activemavnap');if(child.hasClassName("activemavnap")){Event.stop(evt);}else{index=idx.indexOf(child.id);aux=posx[index]+"px 0px";child.style.backgroundPosition=aux;if(yahactive.length>0){$('mapdetail').innerHTML=yahactive[0].firstChild.innerHTML;}else{$('mapdetail').innerHTML=$('filterworld').firstChild.innerHTML;}}}
function scrolltoevent(evt){var child=Event.element(evt);allmaps=$$('.mapscrollto');cc=0;index=idx.indexOf(child.id);if(child.id=="filterworld"){$('brandselect').innerHTML="0";while(cc<5){activex=posx[cc]+"px 0px";allmaps[cc].style.backgroundPosition=activex;if($(idx[cc]).hasClassName("activemavnap")){$(idx[cc]).removeClassName("activemavnap");}
cc++;}
$('sparesultlistcontainer').style.display="none";allbrands=$$('#brandselector .result_item');cont=0;while(cont<allbrands.length){allbrands[cont].removeClassName('brandactivated');aux="0px 0px";allbrands[cont].style.backgroundPosition=aux;cont++;}
checkmenustyle_spas($('menu_style').innerHTML,"spas","yhispa");}else{alert(child.id);while(cc<5){if(index==cc){activex=posx[cc]+"px -75px";$(idx[cc]).style.backgroundPosition=activex;$(idx[cc]).addClassName("activemavnap");}else{activex=posx[cc]+"px 0px";allmaps[cc].style.backgroundPosition=activex;if($(idx[cc]).hasClassName("activemavnap")){$(idx[cc]).removeClassName("activemavnap");}}
cc++;}}
$("numberclicks").innerHTML=actx[index];if($('brandselect').innerHTML=="0"){if(child.id=="filterworld"){$('spa_r_brand').style.display="block";$('spa_r').style.display="none";}else{$('spa_r_brand').style.display="none";$('spa_r').style.display="block";hCarousel.scrollTo(index+1);}}else{if(child.id=="filterworld"){$('spa_r_brand').style.display="block";$('spa_r').style.display="none";}else{$('spa_r_brand').style.display="none";$('spa_r').style.display="block";hCarousel.scrollTo(index+1);}}
$("mapdetail").innerHTML=locationtext[index];if(child.id==id[$("numberclicks").innerHTML]){aux=posx[index]+"px -75px";child.style.backgroundPosition=aux;}
else{Event.stop(evt);}}
function brandselector_set(brand){allbrands=$$('#brandselector .result_item');cont=0;while(cont<allbrands.length){if(allbrands[cont].id==brand){allbrands[cont].addClassName('brandactivated');aux="0px -63px";allbrands[cont].style.backgroundPosition=aux;}else{allbrands[cont].removeClassName('brandactivated');aux="0px 0px";allbrands[cont].style.backgroundPosition=aux;}
cont++;}}
function rollmeover(evt){var child=Event.element(evt);aux="0px -63px";child.style.backgroundPosition=aux;Event.stop(evt);}
function rollmeout(evt){var child=Event.element(evt);aux="0px 0px";if(child.hasClassName("brandactivated")){child.style.backgroundPosition="0px -63px";}else{child.style.backgroundPosition=aux;}
Event.stop(evt);}
function brandresults(evt){var child=Event.element(evt);aux=child.id;index=brand.indexOf(child.id);$('brandselect').innerHTML=brandindex[index];checkmenustyle($('menu_style').innerHTML,"spas",aux);brandselector_set(brand[index]);if($("numberclicks").innerHTML=="-1"){hCarousel.scrollTo(1);$("numberclicks").innerHTML=="0";}else{$('sparesultlistcontainer').style.display="block";}
brandedresults=$$('li.active');if(brandedresults.length>6){}
$('spa_r_brand').style.display="none";$('spa_r').style.display="block";$('mapdetail').innerHTML="WORLD";}
function limpieza_marca(b){allresults=$$('#resultselector .result_item')
cont=0;total=allresults.length;if(b=="0"){while(cont<total){x=allresults[cont].id;aux=x.split("_");if(aux.length=="7"){itooltip="iberiatooltipTrigger"+aux[1];activate_div(itooltip);}
wtooltip="worldtooltipTrigger"+aux[1];tooltip="tooltipTrigger"+aux[1];activate_div(x);$(x).addClassName("active");activate_div(wtooltip);activate_div(tooltip);cont++;}}else{while(cont<total){x=allresults[cont].id;aux=x.split("_");wtooltip="worldtooltipTrigger"+aux[1];tooltip="tooltipTrigger"+aux[1];if(aux[5]==b-1){activate_div(x);$(x).addClassName("active");activate_div(wtooltip);activate_div(tooltip);if(aux.length=="7"){itooltip="iberiatooltipTrigger"+aux[1];activate_div(itooltip);}}else{if(aux.length=="7"){itooltip="iberiatooltipTrigger"+aux[1];deactivate_div(itooltip);}
deactivate_div(x);$(x).removeClassName("active");deactivate_div(wtooltip);deactivate_div(tooltip);}
cont++;}}}
function page_loadedfirst(){ax=$$('.activated');ax1=nav.indexOf(ax[0].id);aux=navw[ax1]+" -44px";ax[0].style.backgroundPosition=aux;}
function page_loaded(evt){Event.observe('menubar','mouseover',rollon,false);Event.observe('menubar','mouseout',rollout,false);Event.observe('menubar','click',redirect_to_controller,false);Event.observe('showfilefooter','mouseover',slogofooter_on,false);Event.observe('showfilefooter','mouseout',slogofooter_out,false);Event.observe('showfilefooter','click',logofooter_click,false);$('showfilefooter').appear({duration:3});y=controller.indexOf($('menucontroller').innerHTML);active=$(nav[y]);if(active==undefined){active=$('menucontroller');active.addClassName('activated');}else{activex=navw[y]+" -44px";active.addClassName('activated');active.style.backgroundPosition=activex;}}
function redirect_to_controller(evt){var child=Event.element(evt);if(child.firstChild.href!="undefined"){window.location.href=child.firstChild.href;}}
function rollon(evt){a=$$('.activated');var child=Event.element(evt);if(child.id==a[0].id){if(($('menucontroller').innerHTML==controller[2])&&(child.id==nav[2])){}}else{rolloverindex=nav.indexOf(child.id);if(rolloverindex>=0){aux=navw[rolloverindex]+" -44px";child.style.backgroundPosition=aux;}
Event.stop(evt);}}
function rollout(evt){a=$$('.activated');var child=Event.element(evt);if(child.id==a[0].id){if(($('menucontroller').innerHTML==controller[2])&&(child.id==nav[2])){}}else{rolloverindex=nav.indexOf(child.id);if(rolloverindex>=0){paux=navw[rolloverindex]+" 0px";child.style.backgroundPosition=paux;}
Event.stop(evt);}}
function item_clicked(evt){var child=Event.element(evt);alert('The child node with id='+child.id+' was called');Event.stop(evt);}
function concepts_loaded(evt){Event.observe('vertical_carousel','click',showdiv_vc,false);}
function showdiv(evt){var child=Event.element(evt);$('indexfooter').style.display="none";activate_div('showfilefooter');$('showfilefooter').style.marginLeft="157px;"
$("conceptboxcontainer").style.display="none";$("spa_r").style.display="block";aux_id=child.id;aux=aux_id.split("_");tabs=$$('#vertical_carousel img');j=0;while(j<tabs.length){if(tabs[j].hasClassName("active_concept")){tabs[j].removeClassName("active_concept");s=tabs[j].id;auxs=s.split("_");src="../images/system/myhi/concept_buttons_"+auxs[1]+"_off.jpg";tabs[j].src=src}
j++;}
if(aux.length>1){auxs="yhiconcept_"+aux[1];content=$(auxs);content.style.display="block";vc_s="vc_"+aux[1];vc_img=$(vc_s);src="../images/system/myhi/concept_buttons_"+aux[1]+"_on.jpg";vc_img.addClassName("active_concept");vc_img.src=src;}}
function rollon_vc(evt){var child=Event.element(evt);aux_id=child.id
aux=aux_id.split("_");if(aux.length>1){if(child.hasClassName("active_concept")){Event.stop(evt);}else{src="../images/system/myhi/concept_buttons_"+aux[1]+"_on.jpg";child.src=src;}}}
function rollout_vc(evt){var child=Event.element(evt);aux_id=child.id
aux=aux_id.split("_");if(aux.length>1){if(child.hasClassName("active_concept")){Event.stop(evt);}else{src="../images/system/myhi/concept_buttons_"+aux[1]+"_off.jpg";child.src=src;}}}
function showdiv_vc(evt){var child=Event.element(evt);activate=child.id;aux=activate.split("_");content=$$(".fulltherapy");i=0;while(i<content.length){content[i].style.display="none";i++;}
tabs=$$('#vertical_carousel img');j=0;while(j<tabs.length){if(tabs[j].hasClassName("active_concept")){tabs[j].removeClassName("active_concept");s=tabs[j].id;auxs=s.split("_");src="../images/system/myhi/concept_buttons_"+auxs[1]+"_off.jpg";tabs[j].src=src}
j++;}
child.src="../images/system/myhi/concept_buttons_"+aux[1]+"_on.jpg";child.addClassName("active_concept");concept="yhiconcept_"+aux[1];activate_div(concept);}
function showdiv_vc_new(child){activate=child;aux=activate.split("_");content=$$(".fulltherapy");i=0;while(i<content.length){content[i].style.display="none";i++;}
tabs=$$('#vertical_carousel img');j=0;while(j<tabs.length){if(tabs[j].hasClassName("active_concept")){tabs[j].removeClassName("active_concept");s=tabs[j].id;auxs=s.split("_");src="../images/system/myhi/concept_buttons_"+auxs[1]+"_off.jpg";tabs[j].src=src}
j++;}
child.src="../images/system/myhi/concept_buttons_"+aux[1]+"_on.jpg";child.addClassName("active_concept");concept="yhiconcept_"+aux[1];activate_div(concept);}
function file_loaded(evt){Event.observe('logofooter','mouseover',slogofooter_on,false);Event.observe('logofooter','mouseout',slogofooter_out,false);Event.observe('showfilefooter','click',logofooter_click,false);$('showfilefooter').appear({duration:3});}
function hotelspa_loaded(evt){galleryactivate();}
function rollon_zoom(evt){var child=Event.element(evt);child.style.backgroundImage="url(../images/system/buttons/nav/nav_icons_zoom_over.png";}
function rollout_zoom(evt){var child=Event.element(evt);child.style.backgroundImage="url(../images/system/buttons/nav/nav_icons_zoom.png";}
function showdiv_gallery(evt){var child=Event.element(evt);activate=child.id;aux=activate.split("_");content=$$(".fulltherapy");i=0;while(i<content.length){content[i].style.display="none";i++;}
to_deactive=$$('.active_concept');s=to_deactive[0].id;auxs=s.split("_");to_deactive[0].removeClassName("active_concept");src="../images/system/myhi/concept_buttons_"+auxs[1]+"_off.jpg";to_deactive[0].src=src;child.src="../images/system/myhi/concept_buttons_"+aux[1]+"_on.jpg";child.addClassName("active_concept");concept="yhiconcept_"+aux[1];activate_div(concept);}
function gallery_loaded(evt){Event.observe('largeimage_carousel','mouseover',rollon_thumb,false);Event.observe('largeimage_carousel','mouseout',rollout_thumb,false);}
function rollon_thumb(evt){if($('extrastate').innerHTML=="yes"){Event.stop(evt);}else{var child=Event.element(evt);s=child.id;aux=s.split("_");if(aux.length>1){auxs="thumb";activate_div(auxs);Event.observe("pr",'click',check_thumbstate,false);Event.observe("nx",'click',check_thumbstate,false);Event.observe(auxs,'click',thumblauncher,false);}else{}}}
function check_thumbstate(evt){allthumb=$('thumb');cont=0;if($('thumbstate').innerHTML=="close"){allthumb.style.bottom="80px";}else{allthumb.style.bottom="0px";}
activate_div(allthumb[0]);}
function rollout_thumb(evt){var child=Event.element(evt);s=child.id;aux=s.split("_");if(aux.length>1){auxs="thumb"}}
function thumblauncher(evt){}
function thumblauncherfun(s,childid){thumbimage=$("thumbimage_holder");child=$(childid);switch(s){case"open":activate_div(thumbimage);activate_div(child.id);child.style.bottom="80px";$('thumbstate').innerHTML="close";break;case"close":deactivate_div(thumbimage);deactivate_div(child.id);child.style.bottom="0px";$('thumbstate').innerHTML="open";v=$$('gallerythumb');i=0;while(i<v.length){deactivate_div(v[i].id);}
break;}}
function close_thumb(evt){thumbimage=$("thumbimage_holder");deactivate_div(thumbimage);}
function logofooter_on(evt){var child=Event.element(evt);s=child.id;aux=s.split("_");if(aux.length>1){child.style.backgroundImage="url(../images/system/menu/"+aux[1]+"_orange.png)";}}
function logofooter_out(evt){var child=Event.element(evt);s=child.id;aux=s.split("_");if(aux[2]=="light"){child.style.backgroundImage="url(../images/system/menu/"+aux[1]+"_white.png)";}else{child.style.backgroundImage="url(../images/system/menu/"+aux[1]+"_black.png)";}}
function logofooter_click(evt){auxbrandpagetitle=['Gran Meliá','Meliá','Me','Paradisus'];var child=Event.element(evt);x=child.id;num=x.split("_");if(num.length>1){if(child.firstChild.href!="undefined"){window.open(child.firstChild.href,auxbrandpagetitle[1],'width=800,height=600,resizable=yes,scrollbars=yes');}}}
function slogofooter_on(evt){var child=Event.element(evt);s=child.id;aux=s.split("_");if(aux.length>2){child.style.backgroundImage="url(/images/system/menu/"+aux[1]+"_orange.png)";}}
function slogofooter_out(evt){var child=Event.element(evt);s=child.id;aux=s.split("_");if(aux.length>2){if(aux[2]=="light"){child.style.backgroundImage="url(/images/system/menu/"+aux[1]+"_white.png)";}else{child.style.backgroundImage="url(/images/system/menu/"+aux[1]+"_black.png)";}}}
function bgselector_on(evt){var child=Event.element(evt);s=child.id;alert(child.id);}
function rollover_extimages(evt){var child=Event.element(evt);s=child.id;x=s.split("_");if(x.length==2){child.src="/images/system/file/generic_thumb_rollover.png)";alert(child.id);}}
function loadmediafilters(){Event.observe('videofilter','mouseover',mediafilter_on,false);Event.observe('podcastfilter','mouseover',mediafilter_on,false);Event.observe('videofilter','mouseout',mediafilter_out,false);Event.observe('podcastfilter','mouseout',mediafilter_out,false);Event.observe('videofilter','click',mediafilter_click,false);Event.observe('podcastfilter','click',mediafilter_click,false);}
function mediafilter_on(evt){var child=Event.element(evt);if(child.hasClassName("filtered")){if(child.id=="videofilter"){child.src="../images/system/media/inactive/videos_on.jpg";}else{child.src="../images/system/media/inactive/podcast_on.jpg";}}else{if(child.id=="videofilter"){child.src="../images/system/media/active/videos_on.jpg";}else{child.src="../images/system/media/active/podcast_on.jpg";}}}
function mediafilter_out(evt){var child=Event.element(evt);if(child.hasClassName("filtered")){if(child.id=="videofilter"){child.src="../images/system/media/inactive/videos_off.jpg";}else{child.src="../images/system/media/inactive/podcast_off.jpg";}}else{if(child.id=="videofilter"){child.src="../images/system/media/active/videos_off.jpg";}else{child.src="../images/system/media/active/podcast_off.jpg";}}}
function mediafilter_click(evt){var child=Event.element(evt);if(child.hasClassName("filtered")){child.removeClassName("filtered");if(child.id=="videofilter"){$('videostate').innerHTML="on";child.src="../images/system/media/active/videos_off.jpg";}else{$('podcaststate').innerHTML="on";child.src="../images/system/media/active/podcast_off.jpg";}}else{child.addClassName("filtered");if(child.id=="videofilter"){$('videostate').innerHTML="off";child.src="../images/system/media/videos_off.jpg";}else{$('podcaststate').innerHTML="off";child.src="../images/system/media/podcast_off.jpg";}}}
function limpieza_marca_hardcore(b){allresults=$$('.worldtrigger')
brandedresults=$$('li.active');cont=0;total=allresults.length;branddata=b-1;if(b=="0"){while(cont<total){x=allresults[cont].id;aux_id=x.substring(19);aux=x.split("worldtooltipTrigger");wtooltip="worldtooltipTrigger"+aux_id;tooltip="tooltipTrigger"+aux_id;activate_div(wtooltip);activate_div(tooltip);cont++;}
ib="ibbrand_"+branddata;ib_brand=".ibbrand_"+branddata;auxiliar_ib_brand=$$(ib_brand);alliberia=$$(".iberia");var cer=0;while(cer<alliberia.length){activate_div(alliberia[cer].id);cer++;}}else{while(cont<total){x=allresults[cont].id;aux_id=x.substring(19);wtooltip="worldtooltipTrigger"+aux_id;tooltip="tooltipTrigger"+aux_id;if(allresults[cont].hasClassName("brand_"+branddata)){activate_div(x);$(x).addClassName("active");activate_div(wtooltip);activate_div(tooltip);}else{deactivate_div(wtooltip);deactivate_div(tooltip);}
cont++;}
ib="ibbrand_"+branddata;ib_brand=".ibbrand_"+branddata;auxiliar_ib_brand=$$(ib_brand);alliberia=$$(".iberia");var cer=0;while(cer<alliberia.length){if(alliberia[cer].hasClassName(ib)){activate_div(alliberia[cer].id);}else{deactivate_div(alliberia[cer].id);}
cer++;}}}
function scrolltoevent_from_controller(child_id){var posx=[0,-77,231,154,77];var actx=[0,2,1,3,4];var ind=[0,1,2,3,4];var locationtext=['WORLD','ASIA','CARRIBBEAN','EUROPE','SPAIN'];var idx=['filterworld','filterasia','filtercarr','filtereurope','filteriberia'];var id=['filterworld','filtercarr','filtereurope','filterasia','filteriberia'];var brand=['yhi','granmelia','melia','me','paradisus'];var brandindex=[0,1,2,3,4];var nav=['mh','mc','ms','mt','mr','mm'];var controller=["home",'concept','spas','therapies','packages','media'];var navw=['0','-76px','-174px','-246px','-357px','-463px'];var child=$(child_id);allmaps=$$('.mapscrollto');cc=0;index=idx.indexOf(child_id);if(child_id=="filterworld"){$('brandselect').innerHTML="0";while(cc<5){activex=posx[cc]+"px 0px";allmaps[cc].style.backgroundPosition=activex;if($(idx[cc]).hasClassName("activemavnap")){$(idx[cc]).removeClassName("activemavnap");}
cc++;}
$('sparesultlistcontainer').style.display="none";allbrands=$$('#brandselector .result_item');cont=0;while(cont<allbrands.length){allbrands[cont].removeClassName('brandactivated');aux="0px 0px";allbrands[cont].style.backgroundPosition=aux;cont++;}
checkmenustyle_spas($('menu_style').innerHTML,"spas","yhispa");}else{while(cc<5){if(index==cc){activex=posx[cc]+"px -75px";$(idx[cc]).style.backgroundPosition=activex;$(idx[cc]).addClassName("activemavnap");}else{activex=posx[cc]+"px 0px";allmaps[cc].style.backgroundPosition=activex;if($(idx[cc]).hasClassName("activemavnap")){$(idx[cc]).removeClassName("activemavnap");}}
cc++;}}
$("numberclicks").innerHTML=actx[index];if($('brandselect').innerHTML=="0"){if(child_id=="filterworld"){$('spa_r_brand').style.display="block";$('spa_r').style.display="none";}else{$('spa_r_brand').style.display="none";$('spa_r').style.display="block";hCarousel.scrollTo(index+1);}}else{if(child_id=="filterworld"){$('spa_r_brand').style.display="block";$('spa_r').style.display="none";}else{$('spa_r_brand').style.display="none";$('spa_r').style.display="block";hCarousel.scrollTo(index+1);}}
if(child_id==id[$("numberclicks").innerHTML]){$("mapdetail").innerHTML=locationtext[index];aux=posx[index]+"px -75px";child.style.backgroundPosition=aux;}}
function brandresults_from_controller(child_id){aux=child_id;index=brand.indexOf(child_id);$('brandselect').innerHTML=brandindex[index];checkmenustyle($('menu_style').innerHTML,"spas",aux);brandselector_set(brand[index]);if($("numberclicks").innerHTML=="-1"){hCarousel.scrollTo(1);$("numberclicks").innerHTML=="0";}else{$('sparesultlistcontainer').style.display="block";}
brandedresults=$$('li.active');if(brandedresults.length>6){}
$('spa_r_brand').style.display="none";$('spa_r').style.display="block";$('mapdetail').innerHTML="WORLD";}
function galleryactivate(){$('s1').style.display="block";$('zoom').style.display="block";}
if(!window.Modalbox)
var Modalbox=new Object();Modalbox.Methods={overrideAlert:false,focusableElements:new Array,currFocused:0,initialized:false,active:true,options:{title:"ModalBox Window",overlayClose:true,width:500,height:90,overlayOpacity:.65,overlayDuration:.25,slideDownDuration:.5,slideUpDuration:.5,resizeDuration:.25,inactiveFade:true,transitions:false,loadingString:"Please wait. Loading...",closeString:"Close window",closeValue:"&times;",params:{},method:'get',autoFocusing:true,aspnet:false},_options:new Object,setOptions:function(options){Object.extend(this.options,options||{});},_init:function(options){Object.extend(this._options,this.options);this.setOptions(options);this.MBoverlay=new Element("div",{id:"MB_overlay",opacity:"0"});this.MBwindow=new Element("div",{id:"MB_window",style:"display: none"}).update(this.MBframe=new Element("div",{id:"MB_frame"}).update(this.MBheader=new Element("div",{id:"MB_header"})));this.MBclose=new Element("a",{id:"MB_close",title:this.options.closeString,href:"#"}).update("<span>"+this.options.closeValue+"</span>");this.MBheader.insert({'bottom':this.MBclose});this.MBcontent=new Element("div",{id:"MB_content"}).update(this.MBloading=new Element("div",{id:"MB_loading"}).update(this.options.loadingString));this.MBframe.insert({'bottom':this.MBcontent});var injectToEl=this.options.aspnet?$(document.body).down('form'):$(document.body);injectToEl.insert({'top':this.MBwindow});injectToEl.insert({'top':this.MBoverlay});this.initScrollX=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft;this.initScrollY=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;this.hideObserver=this._hide.bindAsEventListener(this);this.kbdObserver=this._kbdHandler.bindAsEventListener(this);this._initObservers();this.initialized=true;},show:function(content,options){if(!this.initialized)this._init(options);this.content=content;this.setOptions(options);if(this.MBwindow.style.display=="none"){this._appear();this.event("onShow");}
else{this._update();this.event("onUpdate");}},hide:function(options){if(this.initialized){if(options&&typeof options.element!='function')Object.extend(this.options,options);this.event("beforeHide");if(this.options.transitions)
Effect.SlideUp(this.MBwindow,{duration:this.options.slideUpDuration,transition:Effect.Transitions.sinoidal,afterFinish:this._deinit.bind(this)});else{$(this.MBwindow).hide();this._deinit();}}else throw("Modalbox is not initialized.");},_hide:function(event){event.stop();if(event.element().id=='MB_overlay'&&!this.options.overlayClose)return false;this.hide();},alert:function(message){var html='<div class="MB_alert"><p>'+message+'</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';Modalbox.show(html,{title:'Alert: '+document.title,width:300});},_appear:function(){if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){window.scrollTo(0,0);this._prepareIE("100%","hidden");}
this._setWidth();this._setPosition();if(this.options.transitions){$(this.MBoverlay).setStyle({opacity:0});new Effect.Fade(this.MBoverlay,{from:0,to:this.options.overlayOpacity,duration:this.options.overlayDuration,afterFinish:function(){new Effect.SlideDown(this.MBwindow,{duration:this.options.slideDownDuration,transition:Effect.Transitions.sinoidal,afterFinish:function(){this._setPosition();this.loadContent();}.bind(this)});}.bind(this)});}else{$(this.MBoverlay).setStyle({opacity:this.options.overlayOpacity});$(this.MBwindow).show();this._setPosition();this.loadContent();}
this._setWidthAndPosition=this._setWidthAndPosition.bindAsEventListener(this);Event.observe(window,"resize",this._setWidthAndPosition);},resize:function(byWidth,byHeight,options){var wHeight=$(this.MBwindow).getHeight();var wWidth=$(this.MBwindow).getWidth();var hHeight=$(this.MBheader).getHeight();var cHeight=$(this.MBcontent).getHeight();var newHeight=((wHeight-hHeight+byHeight)<cHeight)?(cHeight+hHeight-wHeight):byHeight;if(options)this.setOptions(options);if(this.options.transitions){new Effect.ScaleBy(this.MBwindow,byWidth,newHeight,{duration:this.options.resizeDuration,afterFinish:function(){this.event("_afterResize");this.event("afterResize");}.bind(this)});}else{this.MBwindow.setStyle({width:wWidth+byWidth+"px",height:wHeight+newHeight+"px"});setTimeout(function(){this.event("_afterResize");this.event("afterResize");}.bind(this),1);}},resizeToContent:function(options){var byHeight=this.options.height-this.MBwindow.offsetHeight;if(byHeight!=0){if(options)this.setOptions(options);Modalbox.resize(0,byHeight);}},resizeToInclude:function(element,options){var el=$(element);var elHeight=el.getHeight()+parseInt(el.getStyle('margin-top'))+parseInt(el.getStyle('margin-bottom'))+parseInt(el.getStyle('border-top-width'))+parseInt(el.getStyle('border-bottom-width'));if(elHeight>0){if(options)this.setOptions(options);Modalbox.resize(0,elHeight);}},_update:function(){$(this.MBcontent).update("");this.MBcontent.appendChild(this.MBloading);$(this.MBloading).update(this.options.loadingString);this.currentDims=[this.MBwindow.offsetWidth,this.MBwindow.offsetHeight];Modalbox.resize((this.options.width-this.currentDims[0]),(this.options.height-this.currentDims[1]),{_afterResize:this._loadAfterResize.bind(this)});},loadContent:function(){if(this.event("beforeLoad")!=false){if(typeof this.content=='string'){var htmlRegExp=new RegExp(/<\/?[^>]+>/gi);if(htmlRegExp.test(this.content)){this._insertContent(this.content.stripScripts());this._putContent(function(){this.content.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));}.bind(this));}else
new Ajax.Request(this.content,{method:this.options.method.toLowerCase(),parameters:this.options.params,onSuccess:function(transport){var response=new String(transport.responseText);this._insertContent(transport.responseText.stripScripts());this._putContent(function(){response.extractScripts().map(function(script){return eval(script.replace("<!--","").replace("// -->",""));}.bind(window));});}.bind(this),onException:function(instance,exception){Modalbox.hide();throw('Modalbox Loading Error: '+exception);}});}else if(typeof this.content=='object'){this._insertContent(this.content);this._putContent();}else{Modalbox.hide();throw('Modalbox Parameters Error: Please specify correct URL or HTML element (plain HTML or object)');}}},_insertContent:function(content){$(this.MBcontent).hide().update("");if(typeof content=='string'){setTimeout(function(){this.MBcontent.update(content);}.bind(this),1);}else if(typeof content=='object'){var _htmlObj=content.cloneNode(true);if(content.id)content.id="MB_"+content.id;$(content).select('*[id]').each(function(el){el.id="MB_"+el.id;});this.MBcontent.appendChild(_htmlObj);this.MBcontent.down().show();if(Prototype.Browser.IE)
$$("#MB_content select").invoke('setStyle',{'visibility':''});}},_putContent:function(callback){if(this.options.height==this._options.height){setTimeout(function(){Modalbox.resize(0,$(this.MBcontent).getHeight()-$(this.MBwindow).getHeight()+$(this.MBheader).getHeight(),{afterResize:function(){this.MBcontent.show().makePositioned();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}.bind(this)});}.bind(this),1);}else{this._setWidth();this.MBcontent.setStyle({overflow:'auto',height:$(this.MBwindow).getHeight()-$(this.MBheader).getHeight()-13+'px'});this.MBcontent.show();this.focusableElements=this._findFocusableElements();this._setFocus();setTimeout(function(){if(callback!=undefined)
callback();this.event("afterLoad");}.bind(this),1);}},activate:function(options){this.setOptions(options);this.active=true;$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);$(this.MBclose).show();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Appear(this.MBwindow,{duration:this.options.slideUpDuration});},deactivate:function(options){this.setOptions(options);this.active=false;$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);$(this.MBclose).hide();if(this.options.transitions&&this.options.inactiveFade)
new Effect.Fade(this.MBwindow,{duration:this.options.slideUpDuration,to:.75});},_initObservers:function(){$(this.MBclose).observe("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).observe("click",this.hideObserver);if(Prototype.Browser.IE)
Event.observe(document,"keydown",this.kbdObserver);else
Event.observe(document,"keypress",this.kbdObserver);},_removeObservers:function(){$(this.MBclose).stopObserving("click",this.hideObserver);if(this.options.overlayClose)
$(this.MBoverlay).stopObserving("click",this.hideObserver);if(Prototype.Browser.IE)
Event.stopObserving(document,"keydown",this.kbdObserver);else
Event.stopObserving(document,"keypress",this.kbdObserver);},_loadAfterResize:function(){this._setWidth();this._setPosition();this.loadContent();},_setFocus:function(){if(this.focusableElements.length>0&&this.options.autoFocusing==true){var firstEl=this.focusableElements.find(function(el){return el.tabIndex==1;})||this.focusableElements.first();this.currFocused=this.focusableElements.toArray().indexOf(firstEl);firstEl.focus();}else if($(this.MBclose).visible())
$(this.MBclose).focus();},_findFocusableElements:function(){this.MBcontent.select('input:not([type~=hidden]), select, textarea, button, a[href]').invoke('addClassName','MB_focusable');return this.MBcontent.select('.MB_focusable');},_kbdHandler:function(event){var node=event.element();switch(event.keyCode){case Event.KEY_TAB:event.stop();if(node!=this.focusableElements[this.currFocused])
this.currFocused=this.focusableElements.toArray().indexOf(node);if(!event.shiftKey){if(this.currFocused==this.focusableElements.length-1){this.focusableElements.first().focus();this.currFocused=0;}else{this.currFocused++;this.focusableElements[this.currFocused].focus();}}else{if(this.currFocused==0){this.focusableElements.last().focus();this.currFocused=this.focusableElements.length-1;}else{this.currFocused--;this.focusableElements[this.currFocused].focus();}}
break;case Event.KEY_ESC:if(this.active)this._hide(event);break;case 32:this._preventScroll(event);break;case 0:if(event.which==32)this._preventScroll(event);break;case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_PAGEDOWN:case Event.KEY_PAGEUP:case Event.KEY_HOME:case Event.KEY_END:if(Prototype.Browser.WebKit&&!["textarea","select"].include(node.tagName.toLowerCase()))
event.stop();else if((node.tagName.toLowerCase()=="input"&&["submit","button"].include(node.type))||(node.tagName.toLowerCase()=="a"))
event.stop();break;}},_preventScroll:function(event){if(!["input","textarea","select","button"].include(event.element().tagName.toLowerCase()))
event.stop();},_deinit:function()
{this._removeObservers();Event.stopObserving(window,"resize",this._setWidthAndPosition);if(this.options.transitions){Effect.toggle(this.MBoverlay,'appear',{duration:this.options.overlayDuration,afterFinish:this._removeElements.bind(this)});}else{this.MBoverlay.hide();this._removeElements();}
$(this.MBcontent).setStyle({overflow:'',height:''});},_removeElements:function(){$(this.MBoverlay).remove();$(this.MBwindow).remove();if(Prototype.Browser.IE&&!navigator.appVersion.match(/\b7.0\b/)){this._prepareIE("","");window.scrollTo(this.initScrollX,this.initScrollY);}
if(typeof this.content=='object'){if(this.content.id&&this.content.id.match(/MB_/)){this.content.id=this.content.id.replace(/MB_/,"");}
this.content.select('*[id]').each(function(el){el.id=el.id.replace(/MB_/,"");});}
this.initialized=false;this.event("afterHide");this.setOptions(this._options);},_setWidth:function(){$(this.MBwindow).setStyle({width:this.options.width+"px",height:this.options.height+"px"});},_setPosition:function(){$(this.MBwindow).setStyle({left:Math.round((Element.getWidth(document.body)-Element.getWidth(this.MBwindow))/2)+"px"});},_setWidthAndPosition:function(){$(this.MBwindow).setStyle({width:this.options.width+"px"});this._setPosition();},_getScrollTop:function(){var theTop;if(document.documentElement&&document.documentElement.scrollTop)
theTop=document.documentElement.scrollTop;else if(document.body)
theTop=document.body.scrollTop;return theTop;},_prepareIE:function(height,overflow){$$('html, body').invoke('setStyle',{width:height,height:height,overflow:overflow});$$("select").invoke('setStyle',{'visibility':overflow});},event:function(eventName){if(this.options[eventName]){var returnValue=this.options[eventName]();this.options[eventName]=null;if(returnValue!=undefined)
return returnValue;else
return true;}
return true;}};Object.extend(Modalbox,Modalbox.Methods);if(Modalbox.overrideAlert)window.alert=Modalbox.alert;Effect.ScaleBy=Class.create();Object.extend(Object.extend(Effect.ScaleBy.prototype,Effect.Base.prototype),{initialize:function(element,byWidth,byHeight,options){this.element=$(element)
var options=Object.extend({scaleFromTop:true,scaleMode:'box',scaleByWidth:byWidth,scaleByHeight:byHeight},arguments[3]||{});this.start(options);},setup:function(){this.elementPositioning=this.element.getStyle('position');this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];this.deltaY=this.options.scaleByHeight;this.deltaX=this.options.scaleByWidth;},update:function(position){var currentHeight=this.dims[0]+(this.deltaY*position);var currentWidth=this.dims[1]+(this.deltaX*position);currentHeight=(currentHeight>0)?currentHeight:0;currentWidth=(currentWidth>0)?currentWidth:0;this.setDimensions(currentHeight,currentWidth);},setDimensions:function(height,width){var d={};d.width=width+'px';d.height=height+'px';var topd=Math.round((height-this.dims[0])/2);var leftd=Math.round((width-this.dims[1])/2);if(this.elementPositioning=='absolute'||this.elementPositioning=='fixed'){if(!this.options.scaleFromTop)d.top=this.originalTop-topd+'px';d.left=this.originalLeft-leftd+'px';}else{if(!this.options.scaleFromTop)d.top=-topd+'px';d.left=-leftd+'px';}
this.element.setStyle(d);}});var checkboxHeight="25";var radioHeight="25";var selectWidth="176";document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: '+selectWidth+'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');var Custom={init:function(){var inputs=document.getElementsByTagName("input"),span=Array(),textnode,option,active;for(a=0;a<inputs.length;a++){if((inputs[a].type=="checkbox"||inputs[a].type=="radio")&&inputs[a].className=="styled"){span[a]=document.createElement("span");span[a].className=inputs[a].type;if(inputs[a].checked==true){if(inputs[a].type=="checkbox"){position="0 -"+(checkboxHeight*2)+"px";span[a].style.backgroundPosition=position;}else{position="0 -"+(radioHeight*2)+"px";span[a].style.backgroundPosition=position;}}
inputs[a].parentNode.insertBefore(span[a],inputs[a]);inputs[a].onchange=Custom.clear;span[a].onmousedown=Custom.pushed;span[a].onmouseup=Custom.check;document.onmouseup=Custom.clear;}}
inputs=document.getElementsByTagName("select");for(a=0;a<inputs.length;a++){if(inputs[a].className=="styled"){option=inputs[a].getElementsByTagName("option");active=option[0].childNodes[0].nodeValue;textnode=document.createTextNode(active);for(b=0;b<option.length;b++){if(option[b].selected==true){textnode=document.createTextNode(option[b].childNodes[0].nodeValue);}}
span[a]=document.createElement("span");span[a].className="select";span[a].id="select"+inputs[a].name;span[a].appendChild(textnode);inputs[a].parentNode.insertBefore(span[a],inputs[a]);inputs[a].onchange=Custom.choose;}}},pushed:function(){element=this.nextSibling;if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkboxHeight*3+"px";}else if(element.checked==true&&element.type=="radio"){this.style.backgroundPosition="0 -"+radioHeight*3+"px";}else if(element.checked!=true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkboxHeight+"px";}else{this.style.backgroundPosition="0 -"+radioHeight+"px";}},check:function(){element=this.nextSibling;if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 0";element.checked=false;}else{if(element.type=="checkbox"){this.style.backgroundPosition="0 -"+checkboxHeight*2+"px";}else{this.style.backgroundPosition="0 -"+radioHeight*2+"px";group=this.nextSibling.name;inputs=document.getElementsByTagName("input");for(a=0;a<inputs.length;a++){if(inputs[a].name==group&&inputs[a]!=this.nextSibling){inputs[a].previousSibling.style.backgroundPosition="0 0";}}}
element.checked=true;}},clear:function(){inputs=document.getElementsByTagName("input");for(var b=0;b<inputs.length;b++){if(inputs[b].type=="checkbox"&&inputs[b].checked==true&&inputs[b].className=="styled"){inputs[b].previousSibling.style.backgroundPosition="0 -"+checkboxHeight*2+"px";}else if(inputs[b].type=="checkbox"&&inputs[b].className=="styled"){inputs[b].previousSibling.style.backgroundPosition="0 0";}else if(inputs[b].type=="radio"&&inputs[b].checked==true&&inputs[b].className=="styled"){inputs[b].previousSibling.style.backgroundPosition="0 -"+radioHeight*2+"px";}else if(inputs[b].type=="radio"&&inputs[b].className=="styled"){inputs[b].previousSibling.style.backgroundPosition="0 0";}}},choose:function(){option=this.getElementsByTagName("option");for(d=0;d<option.length;d++){if(option[d].selected==true){document.getElementById("select"+this.name).childNodes[0].nodeValue=option[d].childNodes[0].nodeValue;}}}}
window.onload=Custom.init;Array.prototype.removeDuplicates=function(){for(var i=1;i<this.length;i++){if(this[i][0]==this[i-1][0]){this.splice(i,1);}}}
Array.prototype.empty=function(){for(var i=0;i<=this.length;i++){this.shift();}}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');}
function LyteBox(){this.theme='grey';this.hideFlash=true;this.outerBorder=false;this.resizeSpeed=8;this.maxOpacity=65;this.navType=1;this.autoResize=true;this.doAnimations=false;this.borderSize=0;this.slideInterval=10000;this.showNavigation=true;this.showClose=true;this.showDetails=false;this.showPlayPause=true;this.autoEnd=true;this.pauseOnNextClick=false;this.pauseOnPrevClick=true;if(this.resizeSpeed>10){this.resizeSpeed=10;}
if(this.resizeSpeed<1){resizeSpeed=1;}
this.resizeDuration=(11-this.resizeSpeed)*0.15;this.resizeWTimerArray=new Array();this.resizeWTimerCount=0;this.resizeHTimerArray=new Array();this.resizeHTimerCount=0;this.showContentTimerArray=new Array();this.showContentTimerCount=0;this.overlayTimerArray=new Array();this.overlayTimerCount=0;this.imageTimerArray=new Array();this.imageTimerCount=0;this.timerIDArray=new Array();this.timerIDCount=0;this.slideshowIDArray=new Array();this.slideshowIDCount=0;this.imageArray=new Array();this.activeImage=null;this.slideArray=new Array();this.activeSlide=null;this.frameArray=new Array();this.activeFrame=null;this.checkFrame();this.isSlideshow=false;this.isLyteframe=false;this.ie=false;this.ie7=(this.ie&&window.XMLHttpRequest);this.initialize();}
LyteBox.prototype.initialize=function(){this.updateLyteboxItems();var objBody=this.doc.getElementsByTagName("body").item(0);if(this.doc.getElementById('lbOverlay')){objBody.removeChild(this.doc.getElementById("lbOverlay"));objBody.removeChild(this.doc.getElementById("lbMain"));}
var objOverlay=this.doc.createElement("div");objOverlay.setAttribute('id','lbOverlay');objOverlay.setAttribute((this.ie?'className':'class'),this.theme);if((this.ie&&!this.ie7)||(this.ie7&&this.doc.compatMode=='BackCompat')){objOverlay.style.position='absolute';}
objOverlay.style.display='none';objBody.appendChild(objOverlay);var objLytebox=this.doc.createElement("div");objLytebox.setAttribute('id','lbMain');objLytebox.style.display='none';objBody.appendChild(objLytebox);var objOuterContainer=this.doc.createElement("div");objOuterContainer.setAttribute('id','lbOuterContainer');objOuterContainer.setAttribute((this.ie?'className':'class'),this.theme);objLytebox.appendChild(objOuterContainer);var objIframeContainer=this.doc.createElement("div");objIframeContainer.setAttribute('id','lbIframeContainer');objIframeContainer.style.display='none';objOuterContainer.appendChild(objIframeContainer);var objIframe=this.doc.createElement("iframe");objIframe.setAttribute('id','lbIframe');objIframe.setAttribute('name','lbIframe');objIframe.style.display='none';objIframeContainer.appendChild(objIframe);var objImageContainer=this.doc.createElement("div");objImageContainer.setAttribute('id','lbImageContainer');objOuterContainer.appendChild(objImageContainer);var objLyteboxImage=this.doc.createElement("img");objLyteboxImage.setAttribute('id','lbImage');objImageContainer.appendChild(objLyteboxImage);var objLoading=this.doc.createElement("div");objLoading.setAttribute('id','lbLoading');objOuterContainer.appendChild(objLoading);var objDetailsContainer=this.doc.createElement("div");objDetailsContainer.setAttribute('id','lbDetailsContainer');objDetailsContainer.setAttribute((this.ie?'className':'class'),this.theme);objLytebox.appendChild(objDetailsContainer);var objDetailsData=this.doc.createElement("div");objDetailsData.setAttribute('id','lbDetailsData');objDetailsData.setAttribute((this.ie?'className':'class'),this.theme);objDetailsContainer.appendChild(objDetailsData);var objDetails=this.doc.createElement("div");objDetails.setAttribute('id','lbDetails');objDetailsData.appendChild(objDetails);var objCaption=this.doc.createElement("span");objCaption.setAttribute('id','lbCaption');objDetails.appendChild(objCaption);var objHoverNav=this.doc.createElement("div");objHoverNav.setAttribute('id','lbHoverNav');objImageContainer.appendChild(objHoverNav);var objBottomNav=this.doc.createElement("div");objBottomNav.setAttribute('id','lbBottomNav');objDetailsData.appendChild(objBottomNav);var objPrev=this.doc.createElement("a");objPrev.setAttribute('id','lbPrev');objPrev.setAttribute((this.ie?'className':'class'),this.theme);objPrev.setAttribute('href','#');objHoverNav.appendChild(objPrev);var objNext=this.doc.createElement("a");objNext.setAttribute('id','lbNext');objNext.setAttribute((this.ie?'className':'class'),this.theme);objNext.setAttribute('href','#');objHoverNav.appendChild(objNext);var objNumberDisplay=this.doc.createElement("span");objNumberDisplay.setAttribute('id','lbNumberDisplay');objDetails.appendChild(objNumberDisplay);var objNavDisplay=this.doc.createElement("span");objNavDisplay.setAttribute('id','lbNavDisplay');objNavDisplay.style.display='none';objDetails.appendChild(objNavDisplay);var objClose=this.doc.createElement("a");objClose.setAttribute('id','lbClose');objClose.setAttribute((this.ie?'className':'class'),this.theme);objClose.setAttribute('href','#');objBottomNav.appendChild(objClose);var objPause=this.doc.createElement("a");objPause.setAttribute('id','lbPause');objPause.setAttribute((this.ie?'className':'class'),this.theme);objPause.setAttribute('href','#');objPause.style.display='none';objBottomNav.appendChild(objPause);var objPlay=this.doc.createElement("a");objPlay.setAttribute('id','lbPlay');objPlay.setAttribute((this.ie?'className':'class'),this.theme);objPlay.setAttribute('href','#');objPlay.style.display='none';objBottomNav.appendChild(objPlay);};LyteBox.prototype.updateLyteboxItems=function(){var anchors=(this.isFrame)?window.parent.frames[window.name].document.getElementsByTagName('a'):document.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){var anchor=anchors[i];var relAttribute=String(anchor.getAttribute('rel'));if(anchor.getAttribute('href')){if(relAttribute.toLowerCase().match('lytebox')){anchor.onclick=function(){myLytebox.start(this,false,false);return false;}}else if(relAttribute.toLowerCase().match('lyteshow')){anchor.onclick=function(){myLytebox.start(this,true,false);return false;}}else if(relAttribute.toLowerCase().match('lyteframe')){anchor.onclick=function(){myLytebox.start(this,false,true);return false;}}}}};LyteBox.prototype.start=function(imageLink,doSlide,doFrame){if(this.ie&&!this.ie7){this.toggleSelects('hide');}
if(this.hideFlash){this.toggleFlash('hide');}
this.isLyteframe=(doFrame?true:false);var pageSize=this.getPageSize();var objOverlay=this.doc.getElementById('lbOverlay');var objBody=this.doc.getElementsByTagName("body").item(0);objOverlay.style.height=pageSize[1]+"px";objOverlay.style.display='';this.appear('lbOverlay',(this.doAnimations?0:this.maxOpacity));var anchors=(this.isFrame)?window.parent.frames[window.name].document.getElementsByTagName('a'):document.getElementsByTagName('a');if(this.isLyteframe){this.frameArray=[];this.frameNum=0;if((imageLink.getAttribute('rel')=='lyteframe')){var rev=imageLink.getAttribute('rev');this.frameArray.push(new Array(imageLink.getAttribute('href'),imageLink.getAttribute('title'),(rev==null||rev==''?'width: 400px; height: 400px; scrolling: auto;':rev)));}else{if(imageLink.getAttribute('rel').indexOf('lyteframe')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){var rev=anchor.getAttribute('rev');this.frameArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title'),(rev==null||rev==''?'width: 400px; height: 400px; scrolling: auto;':rev)));}}
this.frameArray.removeDuplicates();while(this.frameArray[this.frameNum][0]!=imageLink.getAttribute('href')){this.frameNum++;}}}}else{this.imageArray=[];this.imageNum=0;this.slideArray=[];this.slideNum=0;if((imageLink.getAttribute('rel')=='lytebox')){this.imageArray.push(new Array(imageLink.getAttribute('href'),imageLink.getAttribute('title')));}else{if(imageLink.getAttribute('rel').indexOf('lytebox')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){this.imageArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title')));}}
this.imageArray.removeDuplicates();while(this.imageArray[this.imageNum][0]!=imageLink.getAttribute('href')){this.imageNum++;}}
if(imageLink.getAttribute('rel').indexOf('lyteshow')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){this.slideArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title')));}}
this.slideArray.removeDuplicates();while(this.slideArray[this.slideNum][0]!=imageLink.getAttribute('href')){this.slideNum++;}}}}
var object=this.doc.getElementById('lbMain');object.style.top=(this.getPageScroll()+(pageSize[3]/15))+"px";object.style.display='';if(!this.outerBorder){this.doc.getElementById('lbOuterContainer').style.border='none';this.doc.getElementById('lbDetailsContainer').style.border='none';}else{this.doc.getElementById('lbOuterContainer').style.borderBottom='';this.doc.getElementById('lbOuterContainer').setAttribute((this.ie?'className':'class'),this.theme);}
this.doc.getElementById('lbOverlay').onclick=function(){myLytebox.end();return false;}
this.doc.getElementById('lbMain').onclick=function(e){var e=e;if(!e){if(window.parent.frames[window.name]&&(parent.document.getElementsByTagName('frameset').length<=0)){e=window.parent.window.event;}else{e=window.event;}}
var id=(e.target?e.target.id:e.srcElement.id);if(id=='lbMain'){myLytebox.end();return false;}}
this.doc.getElementById('lbClose').onclick=function(){myLytebox.end();return false;}
this.doc.getElementById('lbPause').onclick=function(){myLytebox.togglePlayPause("lbPause","lbPlay");return false;}
this.doc.getElementById('lbPlay').onclick=function(){myLytebox.togglePlayPause("lbPlay","lbPause");return false;}
this.isSlideshow=doSlide;this.isPaused=(this.slideNum!=0?true:false);if(this.isSlideshow&&this.showPlayPause&&this.isPaused){this.doc.getElementById('lbPlay').style.display='';this.doc.getElementById('lbPause').style.display='none';}
if(this.isLyteframe){this.changeContent(this.frameNum);}else{if(this.isSlideshow){this.changeContent(this.slideNum);}else{this.changeContent(this.imageNum);}}};LyteBox.prototype.changeContent=function(imageNum){if(this.isSlideshow){for(var i=0;i<this.slideshowIDCount;i++){window.clearTimeout(this.slideshowIDArray[i]);}}
this.activeImage=this.activeSlide=this.activeFrame=imageNum;if(!this.outerBorder){this.doc.getElementById('lbOuterContainer').style.border='none';this.doc.getElementById('lbDetailsContainer').style.border='none';}else{this.doc.getElementById('lbOuterContainer').style.borderBottom='';this.doc.getElementById('lbOuterContainer').setAttribute((this.ie?'className':'class'),this.theme);}
this.doc.getElementById('lbLoading').style.display='';this.doc.getElementById('lbImage').style.display='none';this.doc.getElementById('lbIframe').style.display='none';this.doc.getElementById('lbPrev').style.display='none';this.doc.getElementById('lbNext').style.display='none';this.doc.getElementById('lbIframeContainer').style.display='none';this.doc.getElementById('lbDetailsContainer').style.display='none';this.doc.getElementById('lbNumberDisplay').style.display='none';if(this.navType==2||this.isLyteframe){object=this.doc.getElementById('lbNavDisplay');object.innerHTML='&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="'+this.theme+'">&laquo; prev</span><a href="#" id="lbPrev2" class="'+this.theme+'" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="'+this.theme+'">||</b> <span id="lbNext2_Off" style="display: none;" class="'+this.theme+'">next &raquo;</span><a href="#" id="lbNext2" class="'+this.theme+'" style="display: none;">next &raquo;</a>';object.style.display='none';}
if(this.isLyteframe){var iframe=myLytebox.doc.getElementById('lbIframe');var styles=this.frameArray[this.activeFrame][2];var aStyles=styles.split(';');for(var i=0;i<aStyles.length;i++){if(aStyles[i].indexOf('width:')>=0){var w=aStyles[i].replace('width:','');iframe.width=w.trim();}else if(aStyles[i].indexOf('height:')>=0){var h=aStyles[i].replace('height:','');iframe.height=h.trim();}else if(aStyles[i].indexOf('scrolling:')>=0){var s=aStyles[i].replace('scrolling:','');iframe.scrolling=s.trim();}else if(aStyles[i].indexOf('border:')>=0){}}
this.resizeContainer(parseInt(iframe.width),parseInt(iframe.height));}else{imgPreloader=new Image();imgPreloader.onload=function(){var imageWidth=imgPreloader.width;var imageHeight=imgPreloader.height;if(myLytebox.autoResize){var pagesize=myLytebox.getPageSize();var x=pagesize[2]-150;var y=pagesize[3]-150;if(imageWidth>x){imageHeight=Math.round(imageHeight*(x/imageWidth));imageWidth=x;if(imageHeight>y){imageWidth=Math.round(imageWidth*(y/imageHeight));imageHeight=y;}}else if(imageHeight>y){imageWidth=Math.round(imageWidth*(y/imageHeight));imageHeight=y;if(imageWidth>x){imageHeight=Math.round(imageHeight*(x/imageWidth));imageWidth=x;}}}
var lbImage=myLytebox.doc.getElementById('lbImage')
lbImage.src=(myLytebox.isSlideshow?myLytebox.slideArray[myLytebox.activeSlide][0]:myLytebox.imageArray[myLytebox.activeImage][0]);lbImage.width=imageWidth;lbImage.height=imageHeight;myLytebox.resizeContainer(imageWidth,imageHeight);imgPreloader.onload=function(){};}
imgPreloader.src=(this.isSlideshow?this.slideArray[this.activeSlide][0]:this.imageArray[this.activeImage][0]);}};LyteBox.prototype.resizeContainer=function(imgWidth,imgHeight){this.wCur=this.doc.getElementById('lbOuterContainer').offsetWidth;this.hCur=this.doc.getElementById('lbOuterContainer').offsetHeight;this.xScale=((imgWidth+(this.borderSize*2))/this.wCur)*100;this.yScale=((imgHeight+(this.borderSize*2))/this.hCur)*100;var wDiff=(this.wCur-this.borderSize*2)-imgWidth;var hDiff=(this.hCur-this.borderSize*2)-imgHeight;if(!(hDiff==0)){this.hDone=false;this.resizeH('lbOuterContainer',this.hCur,imgHeight+this.borderSize*2,this.getPixelRate(this.hCur,imgHeight));}else{this.hDone=true;}
if(!(wDiff==0)){this.wDone=false;this.resizeW('lbOuterContainer',this.wCur,imgWidth+this.borderSize*2,this.getPixelRate(this.wCur,imgWidth));}else{this.wDone=true;}
if((hDiff==0)&&(wDiff==0)){if(this.ie){this.pause(250);}else{this.pause(100);}}
this.doc.getElementById('lbPrev').style.height=imgHeight+"px";this.doc.getElementById('lbNext').style.height=imgHeight+"px";this.doc.getElementById('lbDetailsContainer').style.width=(imgWidth+(this.borderSize*2)+(this.ie&&this.doc.compatMode=="BackCompat"&&this.outerBorder?2:0))+"px";this.showContent();};LyteBox.prototype.showContent=function(){if(this.wDone&&this.hDone){for(var i=0;i<this.showContentTimerCount;i++){window.clearTimeout(this.showContentTimerArray[i]);}
if(this.outerBorder){this.doc.getElementById('lbOuterContainer').style.borderBottom='none';}
this.doc.getElementById('lbLoading').style.display='none';if(this.isLyteframe){this.doc.getElementById('lbIframe').style.display='';this.appear('lbIframe',(this.doAnimations?0:100));}else{this.doc.getElementById('lbImage').style.display='';this.appear('lbImage',(this.doAnimations?0:100));this.preloadNeighborImages();}
if(this.isSlideshow){if(this.activeSlide==(this.slideArray.length-1)){if(this.autoEnd){this.slideshowIDArray[this.slideshowIDCount++]=setTimeout("myLytebox.end('slideshow')",this.slideInterval);}}else{if(!this.isPaused){this.slideshowIDArray[this.slideshowIDCount++]=setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")",this.slideInterval);}}
this.doc.getElementById('lbHoverNav').style.display=(this.showNavigation&&this.navType==1?'':'none');this.doc.getElementById('lbClose').style.display=(this.showClose?'':'none');this.doc.getElementById('lbDetails').style.display=(this.showDetails?'':'none');this.doc.getElementById('lbPause').style.display=(this.showPlayPause&&!this.isPaused?'':'none');this.doc.getElementById('lbPlay').style.display=(this.showPlayPause&&!this.isPaused?'none':'');this.doc.getElementById('lbNavDisplay').style.display=(this.showNavigation&&this.navType==2?'':'none');}else{this.doc.getElementById('lbHoverNav').style.display=(this.navType==1&&!this.isLyteframe?'':'none');if((this.navType==2&&!this.isLyteframe&&this.imageArray.length>1)||(this.frameArray.length>1&&this.isLyteframe)){this.doc.getElementById('lbNavDisplay').style.display='';}else{this.doc.getElementById('lbNavDisplay').style.display='none';}
this.doc.getElementById('lbClose').style.display='';this.doc.getElementById('lbDetails').style.display='';this.doc.getElementById('lbPause').style.display='none';this.doc.getElementById('lbPlay').style.display='none';}
this.doc.getElementById('lbImageContainer').style.display=(this.isLyteframe?'none':'');this.doc.getElementById('lbIframeContainer').style.display=(this.isLyteframe?'':'none');try{this.doc.getElementById('lbIframe').src=this.frameArray[this.activeFrame][0];}catch(e){}}else{this.showContentTimerArray[this.showContentTimerCount++]=setTimeout("myLytebox.showContent()",200);}};LyteBox.prototype.updateDetails=function(){var object=this.doc.getElementById('lbCaption');var sTitle=(this.isSlideshow?this.slideArray[this.activeSlide][1]:(this.isLyteframe?this.frameArray[this.activeFrame][1]:this.imageArray[this.activeImage][1]));object.style.display='';object.innerHTML=(sTitle==null?'':sTitle);this.updateNav();this.doc.getElementById('lbDetailsContainer').style.display='';object=this.doc.getElementById('lbNumberDisplay');if(this.isSlideshow&&this.slideArray.length>1){object.style.display='';object.innerHTML="Image "+eval(this.activeSlide+1)+" of "+this.slideArray.length;this.doc.getElementById('lbNavDisplay').style.display=(this.navType==2&&this.showNavigation?'':'none');}else if(this.imageArray.length>1&&!this.isLyteframe){object.style.display='';object.innerHTML="Image "+eval(this.activeImage+1)+" of "+this.imageArray.length;this.doc.getElementById('lbNavDisplay').style.display=(this.navType==2?'':'none');}else if(this.frameArray.length>1&&this.isLyteframe){object.style.display='';object.innerHTML="Page "+eval(this.activeFrame+1)+" of "+this.frameArray.length;this.doc.getElementById('lbNavDisplay').style.display='';}else{this.doc.getElementById('lbNavDisplay').style.display='none';}
this.appear('lbDetailsContainer',(this.doAnimations?0:100));};LyteBox.prototype.updateNav=function(){if(this.isSlideshow){if(this.activeSlide!=0){var object=(this.navType==2?this.doc.getElementById('lbPrev2'):this.doc.getElementById('lbPrev'));object.style.display='';object.onclick=function(){if(myLytebox.pauseOnPrevClick){myLytebox.togglePlayPause("lbPause","lbPlay");}
myLytebox.changeContent(myLytebox.activeSlide-1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbPrev2_Off').style.display='';}}
if(this.activeSlide!=(this.slideArray.length-1)){var object=(this.navType==2?this.doc.getElementById('lbNext2'):this.doc.getElementById('lbNext'));object.style.display='';object.onclick=function(){if(myLytebox.pauseOnNextClick){myLytebox.togglePlayPause("lbPause","lbPlay");}
myLytebox.changeContent(myLytebox.activeSlide+1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbNext2_Off').style.display='';}}}else if(this.isLyteframe){if(this.activeFrame!=0){var object=this.doc.getElementById('lbPrev2');object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeFrame-1);return false;}}else{this.doc.getElementById('lbPrev2_Off').style.display='';}
if(this.activeFrame!=(this.frameArray.length-1)){var object=this.doc.getElementById('lbNext2');object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeFrame+1);return false;}}else{this.doc.getElementById('lbNext2_Off').style.display='';}}else{if(this.activeImage!=0){var object=(this.navType==2?this.doc.getElementById('lbPrev2'):this.doc.getElementById('lbPrev'));object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeImage-1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbPrev2_Off').style.display='';}}
if(this.activeImage!=(this.imageArray.length-1)){var object=(this.navType==2?this.doc.getElementById('lbNext2'):this.doc.getElementById('lbNext'));object.style.display='';object.onclick=function(){myLytebox.changeContent(myLytebox.activeImage+1);return false;}}else{if(this.navType==2){this.doc.getElementById('lbNext2_Off').style.display='';}}}
this.enableKeyboardNav();};LyteBox.prototype.enableKeyboardNav=function(){document.onkeydown=this.keyboardAction;};LyteBox.prototype.disableKeyboardNav=function(){document.onkeydown='';};LyteBox.prototype.keyboardAction=function(e){var keycode=key=escape=null;keycode=(e==null)?event.keyCode:e.which;key=String.fromCharCode(keycode).toLowerCase();escape=(e==null)?27:e.DOM_VK_ESCAPE;if((key=='x')||(key=='c')||(keycode==escape)){myLytebox.end();}else if((key=='p')||(keycode==37)){if(myLytebox.isSlideshow){if(myLytebox.activeSlide!=0){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeSlide-1);}}else if(myLytebox.isLyteframe){if(myLytebox.activeFrame!=0){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeFrame-1);}}else{if(myLytebox.activeImage!=0){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeImage-1);}}}else if((key=='n')||(keycode==39)){if(myLytebox.isSlideshow){if(myLytebox.activeSlide!=(myLytebox.slideArray.length-1)){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeSlide+1);}}else if(myLytebox.isLyteframe){if(myLytebox.activeFrame!=(myLytebox.frameArray.length-1)){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeFrame+1);}}else{if(myLytebox.activeImage!=(myLytebox.imageArray.length-1)){myLytebox.disableKeyboardNav();myLytebox.changeContent(myLytebox.activeImage+1);}}}};LyteBox.prototype.preloadNeighborImages=function(){if(this.isSlideshow){if((this.slideArray.length-1)>this.activeSlide){preloadNextImage=new Image();preloadNextImage.src=this.slideArray[this.activeSlide+1][0];}
if(this.activeSlide>0){preloadPrevImage=new Image();preloadPrevImage.src=this.slideArray[this.activeSlide-1][0];}}else{if((this.imageArray.length-1)>this.activeImage){preloadNextImage=new Image();preloadNextImage.src=this.imageArray[this.activeImage+1][0];}
if(this.activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=this.imageArray[this.activeImage-1][0];}}};LyteBox.prototype.togglePlayPause=function(hideID,showID){if(this.isSlideshow&&hideID=="lbPause"){for(var i=0;i<this.slideshowIDCount;i++){window.clearTimeout(this.slideshowIDArray[i]);}}
this.doc.getElementById(hideID).style.display='none';this.doc.getElementById(showID).style.display='';if(hideID=="lbPlay"){this.isPaused=false;if(this.activeSlide==(this.slideArray.length-1)){this.end();}else{this.changeContent(this.activeSlide+1);}}else{this.isPaused=true;}};LyteBox.prototype.end=function(caller){var closeClick=(caller=='slideshow'?false:true);if(this.isSlideshow&&this.isPaused&&!closeClick){return;}
this.disableKeyboardNav();this.doc.getElementById('lbMain').style.display='none';this.fade('lbOverlay',(this.doAnimations?this.maxOpacity:0));this.toggleSelects('visible');if(this.hideFlash){this.toggleFlash('visible');}
if(this.isSlideshow){for(var i=0;i<this.slideshowIDCount;i++){window.clearTimeout(this.slideshowIDArray[i]);}}
if(this.isLyteframe){this.initialize();}};LyteBox.prototype.checkFrame=function(){if(window.parent.frames[window.name]&&(parent.document.getElementsByTagName('frameset').length<=0)){this.isFrame=true;this.lytebox="window.parent."+window.name+".myLytebox";this.doc=parent.document;}else{this.isFrame=false;this.lytebox="myLytebox";this.doc=document;}};LyteBox.prototype.getPixelRate=function(cur,img){var diff=(img>cur)?img-cur:cur-img;if(diff>=0&&diff<=100){return 10;}
if(diff>100&&diff<=200){return 15;}
if(diff>200&&diff<=300){return 20;}
if(diff>300&&diff<=400){return 25;}
if(diff>400&&diff<=500){return 30;}
if(diff>500&&diff<=600){return 35;}
if(diff>600&&diff<=700){return 40;}
if(diff>700){return 45;}};LyteBox.prototype.appear=function(id,opacity){var object=this.doc.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+(opacity+10)+")";if(opacity==100&&(id=='lbImage'||id=='lbIframe')){try{object.removeAttribute("filter");}catch(e){}
this.updateDetails();}else if(opacity>=this.maxOpacity&&id=='lbOverlay'){for(var i=0;i<this.overlayTimerCount;i++){window.clearTimeout(this.overlayTimerArray[i]);}
return;}else if(opacity>=100&&id=='lbDetailsContainer'){try{object.removeAttribute("filter");}catch(e){}
for(var i=0;i<this.imageTimerCount;i++){window.clearTimeout(this.imageTimerArray[i]);}
this.doc.getElementById('lbOverlay').style.height=this.getPageSize()[1]+"px";}else{if(id=='lbOverlay'){this.overlayTimerArray[this.overlayTimerCount++]=setTimeout("myLytebox.appear('"+id+"', "+(opacity+20)+")",1);}else{this.imageTimerArray[this.imageTimerCount++]=setTimeout("myLytebox.appear('"+id+"', "+(opacity+10)+")",1);}}};LyteBox.prototype.fade=function(id,opacity){var object=this.doc.getElementById(id).style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";if(opacity<=0){try{object.display='none';}catch(err){}}else if(id=='lbOverlay'){this.overlayTimerArray[this.overlayTimerCount++]=setTimeout("myLytebox.fade('"+id+"', "+(opacity-20)+")",1);}else{this.timerIDArray[this.timerIDCount++]=setTimeout("myLytebox.fade('"+id+"', "+(opacity-10)+")",1);}};LyteBox.prototype.resizeW=function(id,curW,maxW,pixelrate,speed){if(!this.hDone){this.resizeWTimerArray[this.resizeWTimerCount++]=setTimeout("myLytebox.resizeW('"+id+"', "+curW+", "+maxW+", "+pixelrate+")",100);return;}
var object=this.doc.getElementById(id);var timer=speed?speed:(this.resizeDuration/2);var newW=(this.doAnimations?curW:maxW);object.style.width=(newW)+"px";if(newW<maxW){newW+=(newW+pixelrate>=maxW)?(maxW-newW):pixelrate;}else if(newW>maxW){newW-=(newW-pixelrate<=maxW)?(newW-maxW):pixelrate;}
this.resizeWTimerArray[this.resizeWTimerCount++]=setTimeout("myLytebox.resizeW('"+id+"', "+newW+", "+maxW+", "+pixelrate+", "+(timer+0.02)+")",timer+0.02);if(parseInt(object.style.width)==maxW){this.wDone=true;for(var i=0;i<this.resizeWTimerCount;i++){window.clearTimeout(this.resizeWTimerArray[i]);}}};LyteBox.prototype.resizeH=function(id,curH,maxH,pixelrate,speed){var timer=speed?speed:(this.resizeDuration/2);var object=this.doc.getElementById(id);var newH=(this.doAnimations?curH:maxH);object.style.height=(newH)+"px";if(newH<maxH){newH+=(newH+pixelrate>=maxH)?(maxH-newH):pixelrate;}else if(newH>maxH){newH-=(newH-pixelrate<=maxH)?(newH-maxH):pixelrate;}
this.resizeHTimerArray[this.resizeHTimerCount++]=setTimeout("myLytebox.resizeH('"+id+"', "+newH+", "+maxH+", "+pixelrate+", "+(timer+.02)+")",timer+.02);if(parseInt(object.style.height)==maxH){this.hDone=true;for(var i=0;i<this.resizeHTimerCount;i++){window.clearTimeout(this.resizeHTimerArray[i]);}}};LyteBox.prototype.getPageScroll=function(){if(self.pageYOffset){return this.isFrame?parent.pageYOffset:self.pageYOffset;}else if(this.doc.documentElement&&this.doc.documentElement.scrollTop){return this.doc.documentElement.scrollTop;}else if(document.body){return this.doc.body.scrollTop;}};LyteBox.prototype.getPageSize=function(){var xScroll,yScroll,windowWidth,windowHeight;if(window.innerHeight&&window.scrollMaxY){xScroll=this.doc.scrollWidth;yScroll=(this.isFrame?parent.innerHeight:self.innerHeight)+(this.isFrame?parent.scrollMaxY:self.scrollMaxY);}else if(this.doc.body.scrollHeight>this.doc.body.offsetHeight){xScroll=this.doc.body.scrollWidth;yScroll=this.doc.body.scrollHeight;}else{xScroll=this.doc.getElementsByTagName("html").item(0).offsetWidth;yScroll=this.doc.getElementsByTagName("html").item(0).offsetHeight;xScroll=(xScroll<this.doc.body.offsetWidth)?this.doc.body.offsetWidth:xScroll;yScroll=(yScroll<this.doc.body.offsetHeight)?this.doc.body.offsetHeight:yScroll;}
if(self.innerHeight){windowWidth=(this.isFrame)?parent.innerWidth:self.innerWidth;windowHeight=(this.isFrame)?parent.innerHeight:self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=this.doc.documentElement.clientWidth;windowHeight=this.doc.documentElement.clientHeight;}else if(document.body){windowWidth=this.doc.getElementsByTagName("html").item(0).clientWidth;windowHeight=this.doc.getElementsByTagName("html").item(0).clientHeight;windowWidth=(windowWidth==0)?this.doc.body.clientWidth:windowWidth;windowHeight=(windowHeight==0)?this.doc.body.clientHeight:windowHeight;}
var pageHeight=(yScroll<windowHeight)?windowHeight:yScroll;var pageWidth=(xScroll<windowWidth)?windowWidth:xScroll;return new Array(pageWidth,pageHeight,windowWidth,windowHeight);};LyteBox.prototype.toggleFlash=function(state){var objects=this.doc.getElementsByTagName("object");for(var i=0;i<objects.length;i++){objects[i].style.visibility=(state=="hide")?'hidden':'visible';}
var embeds=this.doc.getElementsByTagName("embed");for(var i=0;i<embeds.length;i++){embeds[i].style.visibility=(state=="hide")?'hidden':'visible';}
if(this.isFrame){for(var i=0;i<parent.frames.length;i++){try{objects=parent.frames[i].window.document.getElementsByTagName("object");for(var j=0;j<objects.length;j++){objects[j].style.visibility=(state=="hide")?'hidden':'visible';}}catch(e){}
try{embeds=parent.frames[i].window.document.getElementsByTagName("embed");for(var j=0;j<embeds.length;j++){embeds[j].style.visibility=(state=="hide")?'hidden':'visible';}}catch(e){}}}};LyteBox.prototype.toggleSelects=function(state){var selects=this.doc.getElementsByTagName("select");for(var i=0;i<selects.length;i++){selects[i].style.visibility=(state=="hide")?'hidden':'visible';}
if(this.isFrame){for(var i=0;i<parent.frames.length;i++){try{selects=parent.frames[i].window.document.getElementsByTagName("select");for(var j=0;j<selects.length;j++){selects[j].style.visibility=(state=="hide")?'hidden':'visible';}}catch(e){}}}};LyteBox.prototype.pause=function(numberMillis){var now=new Date();var exitTime=now.getTime()+numberMillis;while(true){now=new Date();if(now.getTime()>exitTime){return;}}};if(window.addEventListener){window.addEventListener("load",initLytebox,false);}else if(window.attachEvent){window.attachEvent("onload",initLytebox);}else{window.onload=function(){initLytebox();}}
function initLytebox(){myLytebox=new LyteBox();}