Slider = newClass(null, {
	 
    construct : function() {
		this.theInterval = 60;
		this.prevStop = 0;
		this.buttonOffClass='off';
		this.tab_next_btn_class="";
		this.tab_prev_btn_class="off";
		this.tab1_next_btn_class="";
		this.tab1_prev_btn_class="off";
		this.tab2_next_btn_class="";
		this.tab2_prev_btn_class="off";
		this.btnNextClassState=new Array();
		this.btnPrevClassState=new Array();
		 
		
		 
	},
	 
	SetParams:function() {
	  
	   if(document.getElementById(this.container))
	   {
			this.ULStyle = getStyle(document.getElementById(this.container));
			
			this.nextStop = - this.stopPoint; 
			
			if(!this.totalSize)
			{
				if(this.orientation=='vertical') 
					this.totalSize = document.getElementById(this.container).scrollHeight-this.visibleAreaSize;
				else
					this.totalSize = document.getElementById(this.container).scrollWidth-this.visibleAreaSize;
			}
	   }
  
	},
 		
	DoScroll:function (dir){
	 
		this.Stop();
    	if(dir=="prev") 
    	{ 
    		this.direction='prev'; 
			eval("this.slideFunc=setInterval('"+this.objectName+".Slide("+this.stepPixels+")',this.theInterval)"); 
    	}
    	else
    	{ 
    		this.direction='next'; 
    		eval("this.slideFunc=setInterval('"+this.objectName+".Slide(-"+this.stepPixels+")',this.theInterval)"); 
    	}
	},
	
	Move:function (pixels){
		
		if(this.orientation=='vertical')
			document.getElementById(this.container).style.marginTop = pixels+"px";
	    else 
			document.getElementById(this.container).style.marginRight=pixels+"px";
 
        try 
        {
	      if(pixels<= - this.totalSize) 
			 document.getElementById(this.objectNameForIds+"_next").className+=" "+this.buttonOffClass;
	      else 
			 document.getElementById(this.objectNameForIds+"_next").className = document.getElementById(this.objectNameForIds+"_next").className.replace(this.buttonOffClass,'');
	      
	      if(pixels==0) 
			 document.getElementById(this.objectNameForIds+"_prev").className+=" "+this.buttonOffClass;
	      else 
			 document.getElementById(this.objectNameForIds	+"_prev").className = document.getElementById(this.objectNameForIds+"_prev").className.replace(this.buttonOffClass,'');
         }
         catch(e){}
    },
	
	
	Slide:function (pixels){
	
	  if(!this.ULStyle) 
			this.position = 0;
	  else 
	  {	
			if(this.orientation=='vertical') 
			{
				if(this.ULStyle.marginTop == "auto")
					this.position = 0;
				else
					this.position=parseInt(this.ULStyle.marginTop);  
			}
			else 
			{
				if(this.ULStyle.marginRight == "auto")
					this.position = 0;
				else
					this.position=parseInt(this.ULStyle.marginRight); 
			}
			 
	  }
	  
	  if(this.direction=='next' && this.position<=this.nextStop) 
	  {
      	this.prevStop=this.nextStop;
      	this.nextStop=this.nextStop-this.stopPoint;
      }
      
     
      if(this.direction=='next' && (this.stop || this.nextStop<=-this.totalSize))
      {
		  	if(this.position-this.stepPixels<=this.nextStop)
		  	{
				this.Move(this.nextStop); 
				this.Stop(); return;
		    }
	  }
      	
      if(this.direction=='prev' && this.position>=this.prevStop) 
      {
      	this.nextStop=this.prevStop;
      	this.prevStop=this.prevStop+this.stopPoint;
      }
	
	 if(this.direction=='prev' && (this.stop || this.prevStop==0))
	 {
			if(this.position+this.stepPixels>=this.prevStop)
			{
		  	  	this.Move(this.prevStop); 
			    this.Stop(); return;
		    }
	  }
  	   
  	  if((this.position>-this.totalSize && pixels<0) || (this.position<0 && pixels>0))
  	  {
   	  	this.Move(this.position+pixels); 
   	  }
    	  
    },

    
	Stop: function(){
	  
	  this.stop=false;
	  clearInterval(this.slideFunc)
    }
    
});



function SetSliders(obj,objectName,objectNameForIds,container,visibleAreaSize){
     obj.objectName = objectName; 
     obj.objectNameForIds = objectNameForIds; 
	 obj.container = container;
	 obj.stopPoint = 50; 
	 obj.stepPixels = 5;
	 obj.orientation = 'vertical';
	 if(typeof(visibleAreaSize) == 'undefined')
		obj.visibleAreaSize = 100;
	else
		obj.visibleAreaSize = visibleAreaSize;
}
 
function getStyle(myObj)
{
	if(window.getComputedStyle)
		return window.getComputedStyle(myObj,null);
	else
		return myObj.currentStyle;
}
 

function newClass(parent, prop) {
  var clazz = function() {
    if (clazz.preparing) return delete(clazz.preparing);
    if (clazz.constr) {
      this.constructor = clazz;
      clazz.constr.apply(this, arguments);
    }
  }
  clazz.prototype = {};
  if (parent) {
    parent.preparing = true;
    clazz.prototype = new parent;
    clazz.prototype.constructor = parent;
    clazz.constr = parent;
  }
  if (prop) {
    var cname = "construct";
    for (var k in prop) {
      if (k != cname) clazz.prototype[k] = prop[k];
    }
    if (prop[cname] && prop[cname] != Object)
      clazz.constr = prop[cname];
  }
  return clazz;
}


