this.slideGallery=new Class({options:{prefix:"slider",sliderGallery:null,sliderMask:null,slider:null,sliderLeft:null,sliderRight:null,sliderInfo:null,
sliderObjects:null,orientation:"h",positionParm:null,ObjectsSizes:new Array(),fxTween:null,currentObject:0,
objectSelector:"a",objectsCount:0,objectsPerSlide:1,objectsPerMask:5,infoPattern:""},
initialize:function(D,A){if(D){this.options.prefix=D}if(A){for(var B in A){this.options[B]=A[B]}}
if(!this.options.sliderGallery){this.options.sliderGallery=$(this.options.prefix+"_gallery")}
if(!this.options.sliderGallery){return }if(!this.options.sliderMask){this.options.sliderMask=$(this.options.prefix+"_mask")}
if(!this.options.slider){this.options.slider=$(this.options.prefix)}
if(!this.options.sliderLeft){this.options.sliderLeft=$(this.options.prefix+"_left")}
if(!this.options.sliderRight){this.options.sliderRight=$(this.options.prefix+"_right")}
if(!this.options.sliderObjects){this.options.sliderObjects=this.options.slider.getElements(this.options.objectSelector)}
if(!this.options.fxTween){this.options.fxTween=new Fx.Tween(this.options.slider)}
if(!this.options.positionParm){this.options.positionParm=(this.options.orientation=="v")?"marginTop":"marginLeft"}
if(!this.options.sliderInfo){this.options.sliderInfo=$(this.options.prefix+"_info")}
var C=0;if(this.options.sliderObjects){this.options.objectsCount=this.options.sliderObjects.length;
for(i=0;i<this.options.objectsCount;i++){this.options.ObjectsSizes[i]=this.sliderWidth(this.options.sliderObjects[i]);
C+=this.options.ObjectsSizes[i]}}this.options.slider.setStyle(((this.options.orientation=="v")?"height":"width"),C+"px");
this.options.sliderLeft.addEvent("click",this.slideLeft.bind(this));
this.options.sliderRight.addEvent("click",this.slideRight.bind(this));
this.hideLinks();this.praseInfo()},sliderWidth:function(B){var A=B.getSize();
if(this.options.orientation=="v"){var C=B.getStyles("marginTop","marginBottom","paddingTop","paddingBottom",
"borderTopWidth","borderBottomWidth");sliderWidth=A.y.toInt()+C.marginTop.toInt()+C.marginBottom.toInt()}
else{var C=B.getStyles("marginLeft","marginRight","paddingLeft","paddingRight","borderLeftWidth","borderRightWidth");
sliderWidth=A.x.toInt()+C.marginLeft.toInt()+C.marginRight.toInt()}return sliderWidth},slideLeft:function(){
if(!this.options.fxTween.check()){return false}var C=0;for(var A=0;A<this.options.objectsPerSlide&&this.options.currentObject>0;A++){
if(this.options.currentObject>0){C+=this.options.ObjectsSizes[this.options.currentObject];this.options.currentObject--}}
if(C){var B=this.options.slider.getStyle(this.options.positionParm).toInt();
this.options.fxTween.start(this.options.positionParm,B+"px",(B+C)+"px")}this.hideLinks();this.praseInfo()},slideRight:function(){
if(!this.options.fxTween.check()){return false}var C=0;
for(var A=0;A<this.options.objectsPerSlide&&this.options.currentObject<this.options.objectsCount;A++){
if(this.options.currentObject<this.options.objectsCount-this.options.objectsPerMask)
{C+=this.options.ObjectsSizes[this.options.currentObject];this.options.currentObject++}}if(C)
{var B=this.options.slider.getStyle(this.options.positionParm).toInt();
this.options.fxTween.start(this.options.positionParm,B+"px",(B-C)+"px")}this.hideLinks();
this.praseInfo()},hideLinks:function(){if(this.options.currentObject==0)
{this.options.sliderLeft.addClass("hide")}else{if(this.options.currentObject>0)
{this.options.sliderLeft.removeClass("hide")}}if(this.options.currentObject<this.options.objectsCount-this.options.objectsPerMask)
{this.options.sliderRight.removeClass("hide")}else{this.options.sliderRight.addClass("hide")}},praseInfo:function(){
if(this.options.sliderInfo&&this.options.infoPattern){var A=this.options.infoPattern;A=A.replace("{object_from}",
this.options.currentObject+1);var B=this.options.currentObject+this.options.objectsPerMask;if(B>this.options.objectsCount)
{B=this.options.objectsCount}A=A.replace("{object_to}",B);A=A.replace("{object_count}",this.options.objectsCount);
this.options.sliderInfo.set("html",A)}}});

