
var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}}
Object.extend=function(destination,source){for(property in source)destination[property]=source[property];return destination;}
Function.prototype.bind=function(object){var __method=this;return function(){return __method.apply(object,arguments);}}
Function.prototype.bindAsEventListener=function(object){var __method=this;return function(event){__method.call(object,event||window.event);}}
function $(){if(arguments.length==1)return get$(arguments[0]);var elements=[];$c(arguments).each(function(el){elements.push(get$(el));});return elements;function get$(el){if(typeof el=='string')el=document.getElementById(el);return el;}}
if(!window.Element)var Element=new Object();Object.extend(Element,{remove:function(element){element=$(element);element.parentNode.removeChild(element);},hasClassName:function(element,className){element=$(element);if(!element)return;var hasClass=false;element.className.split(' ').each(function(cn){if(cn==className)hasClass=true;});return hasClass;},addClassName:function(element,className){element=$(element);Element.removeClassName(element,className);element.className+=' '+className;},removeClassName:function(element,className){element=$(element);if(!element)return;var newClassName='';element.className.split(' ').each(function(cn,i){if(cn!=className){if(i>0)newClassName+=' ';newClassName+=cn;}});element.className=newClassName;},cleanWhitespace:function(element){element=$(element);$c(element.childNodes).each(function(node){if(node.nodeType==3&&!/\S/.test(node.nodeValue))Element.remove(node);});},find:function(element,what){element=$(element)[what];while(element.nodeType!=1)element=element[what];return element;}});var Position={cumulativeOffset:function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}while(element);return[valueL,valueT];}};document.getElementsByClassName=function(className){var children=document.getElementsByTagName('*')||document.all;var elements=[];$c(children).each(function(child){if(Element.hasClassName(child,className))elements.push(child);});return elements;}
Array.prototype.iterate=function(func){for(var i=0;i<this.length;i++)func(this[i],i);}
if(!Array.prototype.each)Array.prototype.each=Array.prototype.iterate;function $c(array){var nArray=[];for(var i=0;i<array.length;i++)nArray.push(array[i]);return nArray;}

var MyJSSscrollerHASDragging=false;var MyJSScrollerHandler={scrollers:[],intvals:[],initByClassName:function(className){i=this.scrollers.length;document.getElementsByClassName(className).each(function(node){var orient,dir,speed;MyJSScrollerHandler.scrollers[i]=new MyJSScroller(node,i,orient,dir,speed);i++;});},attachMouseWheel:function(el,index){if(window.addEventListener)
el.addEventListener('DOMMouseScroll',function(event){MyJSScrollerHandler.wheel(event,index);},false);el.onmousewheel=function(event){MyJSScrollerHandler.wheel(event,index);};},handleWheelMovement:function(delta,index){MyJSScrollerHandler.scrollers[index].move(-(delta*10));},wheel:function(event,index){var delta=0;if(!event)
event=window.event;if(event.wheelDelta){delta=event.wheelDelta/120;if(window.opera)
delta=-delta;}else if(event.detail){delta=-event.detail/3;}
if(delta)
MyJSScrollerHandler.handleWheelMovement(delta,index);if(event.preventDefault)
event.preventDefault();event.returnValue=false;}};function MyJSScroller(node,index,orient,dir,speed){if(MyJSScrollerHandler.scrollers[index]){return false;}
if(node.getAttribute('myjsscroller')=='true'){return false;}
node.setAttribute('myjsscroller','true');this.pausePoints=[];this.pauseTimer=0;this.node=node;this.index=index;this.orient=orient||node.getAttribute('orientation');this.dir=dir||node.getAttribute('direction');spd=speed||node.getAttribute('scrollspeed');if(!spd){spd=20;}
this.speed=1000/spd;wraper=document.createElement('DIV');wraper.style.height='100%';node.style.overflow='hidden';wraper.style.overflow='hidden';wraper.style.position='relative';wraper.style.top='0px';wraper.style.left='0px';this.wraper=wraper;movingWraper=document.createElement('DIV');if(this.orient=='horizontal'){movingWraper.style.whiteSpace='nowrap';}
movingWraper.style.position='absolute';this.movingWraper=movingWraper;wraper.appendChild(movingWraper);movingWraper.innerHTML=node.innerHTML;node.innerHTML='';node.appendChild(wraper);this.w=movingWraper.offsetWidth;this.h=movingWraper.offsetHeight;if(this.orient!='horizontal'&&this.dir=='down'){this.movingWraper.style.top=-this.h+'px';}
if(MyJSSscrollerHASDragging){if(this.orient=='horizontal'){drg=Drag.init(movingWraper,null,-this.w,this.w,0,0);}else{drg=Drag.init(movingWraper,null,0,0,-this.h,this.h);}}
for(var i=0;i<movingWraper.childNodes.length;i++){ch=movingWraper.childNodes[i];if(ch.className=='scrollpauser'){if(ch.getAttribute('scrollhide')=="1"){ch.style.visibility='hidden';ch.style.display='inline';ch.style.margin='0px';ch.style.border='0px';}
if(ch.getAttribute('scrolldelay')>0){delay=ch.getAttribute('scrolldelay');}else{delay=2000;}
this.pausePoints.push([ch.offsetTop,ch.offsetLeft,delay]);}}
movingWraper.onDragStart=function(x,y){MyJSScrollerHandler.scrollers[index].dragged=true;MyJSScrollerHandler.scrollers[index].pause();}
movingWraper.onDragEnd=function(){MyJSScrollerHandler.scrollers[index].dragged=false;MyJSScrollerHandler.scrollers[index].resume();}
node.onmouseover=function(){MyJSScrollerHandler.scrollers[index].pause();}
node.onmouseout=function(){if(!MyJSScrollerHandler.scrollers[index].dragged){MyJSScrollerHandler.scrollers[index].resume();}}
MyJSScrollerHandler.attachMouseWheel(node,index);this.start();}
MyJSScroller.prototype.start=function(){if(!MyJSScrollerHandler.intvals[this.index]){MyJSScrollerHandler.intvals[this.index]=window.setInterval('MyJSScrollerHandler.scrollers[\''+this.index+'\'].move()',this.speed);}}
MyJSScroller.prototype.move=function(delta){mw=this.movingWraper;slf=this;if(!delta){delta=1}
if(this.orient=='horizontal'){if(this.dir!="right"){if(mw.offsetLeft<-this.w){mw.style.left=this.wraper.offsetWidth+'px';}else{mw.style.left=(mw.offsetLeft-delta)+'px';}}else{if(mw.offsetLeft>this.wraper.offsetWidth){mw.style.left=-mw.offsetWidth+'px';}else{mw.style.left=(mw.offsetLeft+delta)+'px';}}}else{if(this.dir!="down"){if(mw.offsetTop>-this.h){this.pausePoints.each(function(point){if(-point[0]==mw.offsetTop){slf.pause();window.setTimeout('MyJSScrollerHandler.scrollers[\''+slf.index+'\'].start()',point[2]);}});mw.style.top=(mw.offsetTop-delta)+'px';}else{mw.style.top=this.wraper.offsetHeight+'px';}}else{if(-mw.offsetTop+this.wraper.offsetHeight>0){mw.style.top=(mw.offsetTop+delta)+'px';}else{mw.style.top=-mw.offsetHeight+'px';}}}}
MyJSScroller.prototype.pause=function(){window.clearInterval(MyJSScrollerHandler.intvals[this.index]);MyJSScrollerHandler.intvals[this.index]=false;}
MyJSScroller.prototype.resume=function(){this.start();}
