var Prototip={Version:"1.1.0",REQUIRED_Prototype:"1.6.0",REQUIRED_Scriptaculous:"1.8.0",start:function(){this.require("Prototype")},require:function(a){if((typeof window[a]=="undefined")||(this.convertVersionString(window[a].Version)<this.convertVersionString(this["REQUIRED_"+a]))){throw ("Prototip requires "+a+" >= "+this["REQUIRED_"+a])}},convertVersionString:function(a){var b=a.split(".");return parseInt(b[0])*100000+parseInt(b[1])*1000+parseInt(b[2])},viewport:{getDimensions:function(){var a={};var b=Prototype.Browser;$w("width height").each(function(e){var c=e.capitalize();if(b.Opera){a[e]=document.body["client"+c]}else{if(b.WebKit){a[e]=self["inner"+c]}else{a[e]=document.documentElement["client"+c]}}});return a}}};Prototip.start();var Tips={closeButtons:false,zIndex:1200,fixIE:(function(b){var a=new RegExp("MSIE ([\\d.]+)").exec(b);return a?(parseFloat(a[1])<=6):false})(navigator.userAgent),tips:[],visible:[],add:function(a){this.tips.push(a)},remove:function(a){var b=this.tips.find(function(c){return c.element==$(a)});if(b){b.deactivate();if(b.tooltip){b.wrapper.remove();if(Tips.fixIE){b.iframeShim.remove()}}this.tips=this.tips.without(b)}},zIndexRestore:1200,raise:function(c){var a=this.zIndexHighest();if(!a){c.style.zIndex=this.zIndexRestore;return}var b=(c.style.zIndex!=a)?a+1:a;this.tips.pluck("wrapper").invoke("removeClassName","highest");c.setStyle({zIndex:b}).addClassName("highest")},zIndexHighest:function(){var a=this.visible.max(function(b){return parseInt(b.style.zIndex)});return a},addVisibile:function(a){this.removeVisible(a);this.visible.push(a)},removeVisible:function(a){this.visible=this.visible.without(a)}};var Tip=Class.create({initialize:function(a,b){this.element=$(a);Tips.remove(this.element);this.content=b;var d=(arguments[2]&&arguments[2].hook);var c=(arguments[2]&&arguments[2].showOn=="click");this.options=Object.extend({className:"default",closeButton:Tips.closeButtons,delay:!c?0.2:false,duration:0.3,effect:false,hideOn:"mouseout",hook:false,offset:d?{x:0,y:0}:{x:16,y:16},fixed:d?true:false,showOn:"mousemove",target:this.element,title:false,viewport:d?false:true},arguments[2]||{});this.target=$(this.options.target);this.setup();if(this.options.effect){Prototip.require("Scriptaculous");this.queue={position:"end",limit:1,scope:this.wrapper.identify()}}Tips.add(this);this.activate()},setup:function(){this.wrapper=new Element("div",{"class":"prototip"}).setStyle({display:"none",zIndex:Tips.zIndex++});this.wrapper.identify();if(Tips.fixIE){this.iframeShim=new Element("iframe",{"class":"iframeShim",src:"javascript:false;"}).setStyle({display:"none",zIndex:Tips.zIndexRestore-1})}this.tip=new Element("div",{"class":"content"}).update(this.content);this.tip.insert(new Element("div").setStyle({clear:"both"}));if(this.options.closeButton||(this.options.hideOn.element&&this.options.hideOn.element=="closeButton")){this.closeButton=new Element("a",{href:"javascript:;","class":"close"})}},build:function(){if(Tips.fixIE){document.body.appendChild(this.iframeShim).setOpacity(0)}var d="wrapper";if(this.options.effect){this.effectWrapper=this.wrapper.appendChild(new Element("div",{"class":"effectWrapper"}));d="effectWrapper"}this.tooltip=this[d].appendChild(new Element("div",{"class":"tooltip "+this.options.className}));if(this.options.title||this.options.closeButton){this.toolbar=this.tooltip.appendChild(new Element("div",{"class":"toolbar"}));this.title=this.toolbar.appendChild(new Element("div",{"class":"title"}).update(this.options.title||" "))}this.tooltip.insert(this.tip);document.body.appendChild(this.wrapper);var a=(this.options.effect)?[this.wrapper,this.effectWrapper]:[this.wrapper];if(Tips.fixIE){a.push(this.iframeShim)}var c=this.wrapper.getWidth();a.invoke("setStyle",{width:c+"px"});if(this.toolbar){this.wrapper.setStyle({visibility:"hidden"}).show();this.toolbar.setStyle({width:this.toolbar.getWidth()+"px"});this.wrapper.hide().setStyle({visibility:"visible"})}if(this.closeButton){this.title.insert({top:this.closeButton}).insert(new Element("div").setStyle({clear:"both"}))}var b=this.wrapper.getHeight();a.invoke("setStyle",{width:c+"px",height:b+"px"});this[this.options.effect?d:"tooltip"].hide()},activate:function(){this.eventShow=this.showDelayed.bindAsEventListener(this);this.eventHide=this.hide.bindAsEventListener(this);if(this.options.fixed&&this.options.showOn=="mousemove"){this.options.showOn="mouseover"}if(this.options.showOn==this.options.hideOn){this.eventToggle=this.toggle.bindAsEventListener(this);this.element.observe(this.options.showOn,this.eventToggle)}this.hideElement=Object.isUndefined(this.options.hideOn.element)?"element":this.options.hideOn.element;var a={element:this.eventToggle?[]:[this.element],target:this.eventToggle?[]:[this.target],tip:this.eventToggle?[]:[this.wrapper],closeButton:[],".close":this.tip.select(".close")};this.hideTargets=a[this.hideElement];if(this.element&&!this.eventToggle){this.element.observe(this.options.showOn,this.eventShow)}this.hideAction=(this.options.hideOn.event||this.options.hideOn);if(this.hideTargets){this.hideTargets.invoke("observe",this.hideAction,this.eventHide)}if(!this.options.fixed&&this.options.showOn=="click"){this.eventPosition=this.position.bindAsEventListener(this);this.element.observe("mousemove",this.eventPosition)}if(this.closeButton){this.closeButton.observe("click",this.eventHide)}if(this.options.showOn!="click"&&this.hideElement!="element"){this.eventCheckDelay=this.checkDelay.bindAsEventListener(this);this.element.observe("mouseout",this.eventCheckDelay)}this.wrapper.observe("mouseover",function(){Tips.raise(this.wrapper)}.bind(this))},deactivate:function(){if(this.options.showOn==this.options.hideOn){this.element.stopObserving(this.options.showOn,this.eventToggle)}else{this.element.stopObserving(this.options.showOn,this.eventShow);this.hideTargets.invoke("stopObserving",this.hideAction,this.eventHide)}if(this.eventPosition){this.element.stopObserving("mousemove",this.eventPosition)}if(this.closeButton){this.closeButton.stopObserving()}if(this.eventCheckDelay){this.element.stopObserving("mouseout",this.eventCheckDelay)}this.wrapper.stopObserving()},showDelayed:function(a){if(!this.tooltip){this.build()}this.position(a);if(this.wrapper.visible()){return}this.checkDelay();this.timer=this.show.bind(this).delay(this.options.delay)},checkDelay:function(){if(this.timer){clearTimeout(this.timer);this.timer=null}},show:function(){if(this.wrapper.visible()&&this.options.effect!="appear"){return}if(Tips.fixIE){this.iframeShim.show()}Tips.addVisibile(this.wrapper);this.wrapper.show();if(!this.options.effect){this.tooltip.show()}else{if(this.activeEffect){Effect.Queues.get(this.queue.scope).remove(this.activeEffect)}this.activeEffect=Effect[Effect.PAIRS[this.options.effect][0]](this.effectWrapper,{duration:this.options.duration,queue:this.queue})}},hide:function(){this.checkDelay();if(!this.wrapper.visible()){return}if(!this.options.effect){if(Tips.fixIE){this.iframeShim.hide()}this.tooltip.hide();this.wrapper.hide();Tips.removeVisible(this.wrapper)}else{if(this.activeEffect){Effect.Queues.get(this.queue.scope).remove(this.activeEffect)}this.activeEffect=Effect[Effect.PAIRS[this.options.effect][1]](this.effectWrapper,{duration:this.options.duration,queue:this.queue,afterFinish:function(){if(Tips.fixIE){this.iframeShim.hide()}this.wrapper.hide();Tips.removeVisible(this.wrapper)}.bind(this)})}},toggle:function(a){if(this.wrapper&&this.wrapper.visible()){this.hide(a)}else{this.showDelayed(a)}},position:function(a){if(!this.wrapper.hasClassName("highest")){Tips.raise(this.wrapper)}var e={left:this.options.offset.x,top:this.options.offset.y};var f=Position.cumulativeOffset(this.target);var b=this.wrapper.getDimensions();var i={left:(this.options.fixed)?f[0]:Event.pointerX(a),top:(this.options.fixed)?f[1]:Event.pointerY(a)};i.left+=e.left;i.top+=e.top;if(this.options.hook){var k={target:this.target.getDimensions(),tip:b};var l={target:Position.cumulativeOffset(this.target),tip:Position.cumulativeOffset(this.target)};for(var h in l){switch(this.options.hook[h]){case"topRight":l[h][0]+=k[h].width;break;case"topMiddle":l[h][0]+=(k[h].width/2);break;case"rightMiddle":l[h][0]+=k[h].width;l[h][1]+=(k[h].height/2);break;case"bottomLeft":l[h][1]+=k[h].height;break;case"bottomRight":l[h][0]+=k[h].width;l[h][1]+=k[h].height;break;case"bottomMiddle":l[h][0]+=(k[h].width/2);l[h][1]+=k[h].height;break;case"leftMiddle":l[h][1]+=(k[h].height/2);break}}i.left+=-1*(l.tip[0]-l.target[0]);i.top+=-1*(l.tip[1]-l.target[1])}if(!this.options.fixed&&this.element!==this.target){var c=Position.cumulativeOffset(this.element);i.left+=-1*(c[0]-f[0]);i.top+=-1*(c[1]-f[1])}if(!this.options.fixed&&this.options.viewport){var j=document.viewport.getScrollOffsets();var g=Prototip.viewport.getDimensions();var d={left:"width",top:"height"};for(var h in d){if((i[h]+b[d[h]]-j[h])>g[d[h]]){i[h]=i[h]-b[d[h]]-2*e[h]}}}var m={left:i.left+"px",top:i.top+"px"};this.wrapper.setStyle(m);if(Tips.fixIE){this.iframeShim.setStyle(m)}}});