if(typeof(Control)=="undefined"){Control={}
}var $proc=function(a){return typeof(a)=="function"?a:function(){return a
}
};
var $value=function(a){return typeof(a)=="function"?a():a
};
Object.Event={extend:function(a){a._objectEventSetup=function(b){this._observers=this._observers||{};
this._observers[b]=this._observers[b]||[]
};
a.observe=function(d,b){if(typeof(d)=="string"&&typeof(b)!="undefined"){this._objectEventSetup(d);
if(!this._observers[d].include(b)){this._observers[d].push(b)
}}else{for(var c in d){this.observe(c,d[c])
}}};
a.stopObserving=function(c,b){this._objectEventSetup(c);
if(c&&b){this._observers[c]=this._observers[c].without(b)
}else{if(c){this._observers[c]=[]
}else{this._observers={}
}}};
a.observeOnce=function(d,c){var b=function(){c.apply(this,arguments);
this.stopObserving(d,b)
}.bind(this);
this._objectEventSetup(d);
this._observers[d].push(b)
};
a.notify=function(g){this._objectEventSetup(g);
var d=[];
var b=$A(arguments).slice(1);
try{for(var c=0;
c<this._observers[g].length;
++c){d.push(this._observers[g][c].apply(this._observers[g][c],b)||null)
}}catch(f){if(f==$break){return false
}else{throw f
}}return d
};
if(a.prototype){a.prototype._objectEventSetup=a._objectEventSetup;
a.prototype.observe=a.observe;
a.prototype.stopObserving=a.stopObserving;
a.prototype.observeOnce=a.observeOnce;
a.prototype.notify=function(g){if(a.notify){var b=$A(arguments).slice(1);
b.unshift(this);
b.unshift(g);
a.notify.apply(a,b)
}this._objectEventSetup(g);
var b=$A(arguments).slice(1);
var d=[];
try{if(this.options&&this.options[g]&&typeof(this.options[g])=="function"){d.push(this.options[g].apply(this,b)||null)
}for(var c=0;
c<this._observers[g].length;
++c){d.push(this._observers[g][c].apply(this._observers[g][c],b)||null)
}}catch(f){if(f==$break){return false
}else{throw f
}}return d
}
}}};
Element.addMethods({observeOnce:function(c,d,b){var a=function(){b.apply(this,arguments);
Element.stopObserving(c,d,a)
};
Element.observe(c,d,a)
}});
Object.extend(Event,(function(){var b=Event.cache;
function c(j){if(j._prototypeEventID){return j._prototypeEventID[0]
}arguments.callee.id=arguments.callee.id||1;
return j._prototypeEventID=[++arguments.callee.id]
}function g(j){if(j&&j.include(":")){return"dataavailable"
}if(!Prototype.Browser.IE){j={mouseenter:"mouseover",mouseleave:"mouseout"}[j]||j
}return j
}function a(j){return b[j]=b[j]||{}
}function f(l,j){var k=a(l);
return k[j]=k[j]||[]
}function h(k,j,l){var o=c(k);
var n=f(o,j);
if(n.pluck("handler").include(l)){return false
}var m=function(p){if(!Event||!Event.extend||(p.eventName&&p.eventName!=j)){return false
}Event.extend(p);
l.call(k,p)
};
if(!(Prototype.Browser.IE)&&["mouseenter","mouseleave"].include(j)){m=m.wrap(function(r,q){var p=q.relatedTarget;
var s=q.currentTarget;
if(p&&p.nodeType==Node.TEXT_NODE){p=p.parentNode
}if(p&&p!=s&&!p.descendantOf(s)){return r(q)
}})
}m.handler=l;
n.push(m);
return m
}function i(m,j,k){var l=f(m,j);
return l.find(function(n){return n.handler==k
})
}function d(m,j,k){var l=a(m);
if(!l[j]){return false
}l[j]=l[j].without(i(m,j,k))
}function e(){for(var k in b){for(var j in b[k]){b[k][j]=null
}}}if(window.attachEvent){window.attachEvent("onunload",e)
}return{observe:function(l,j,m){l=$(l);
var k=g(j);
var n=h(l,j,m);
if(!n){return l
}if(l.addEventListener){l.addEventListener(k,n,false)
}else{l.attachEvent("on"+k,n)
}return l
},stopObserving:function(l,j,m){l=$(l);
var o=c(l),k=g(j);
if(!m&&j){f(o,j).each(function(p){l.stopObserving(j,p.handler)
});
return l
}else{if(!j){Object.keys(a(o)).each(function(p){if(l.stopObserving){l.stopObserving(p)
}});
return l
}}var n=i(o,j,m);
if(!n){return l
}if(l.removeEventListener){l.removeEventListener(k,n,false)
}else{l.detachEvent("on"+k,n)
}d(o,j,m);
return l
},fire:function(l,k,j){l=$(l);
if(l==document&&document.createEvent&&!l.dispatchEvent){l=document.documentElement
}var m;
if(document.createEvent){m=document.createEvent("HTMLEvents");
m.initEvent("dataavailable",true,true)
}else{m=document.createEventObject();
m.eventType="ondataavailable"
}m.eventName=k;
m.memo=j||{};
if(document.createEvent){l.dispatchEvent(m)
}else{l.fireEvent(m.eventType,m)
}return Event.extend(m)
}}
})());
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 a(c){var d;
if(c.wheelDelta){d=c.wheelDelta/120
}else{if(c.detail){d=-c.detail/3
}}if(!d){return
}var b=Event.element(c).fire("mouse:wheel",{delta:d});
if(b.stopped){Event.stop(c);
return false
}}document.observe("mousewheel",a);
document.observe("DOMMouseScroll",a)
})();
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(a){var a=$(a);
var c=a.cumulativeOffset();
var b=a.getDimensions();
this.element.setStyle({left:c[0]+"px",top:c[1]+"px",width:b.width+"px",height:b.height+"px",zIndex:a.getStyle("zIndex")-1}).show();
return this
},setBounds:function(a){for(prop in a){a[prop]+="px"
}this.element.setStyle(a);
return this
},destroy:function(){if(this.element){this.element.remove()
}return this
}});
