

//alert('dddd');
	var a=1;
	var HT=1;
	var count=1;
	var chk=0;
	var cN=0;
	var strt=0;
	var sWidth=270;
	//var maxLength=1;
	var maxDFector=(maxLength-1)*sWidth;
	var tDelay = 6000;
	
	function stDelay(){	
	
	setTimeout("calculat("+1+","+1+","+1+")",3);	
	
	}
	
	window.onLoad=stDelay();
	
	function calculat(m,p,btn){
	
	var OBc=document.getElementById("containr");
	var OBcH=OBc.style.marginLeft.replace("px","")*1;	
	
		if(m==0 && p==1 && btn==1){ 
		
			if(a==1){HT=maxDFector; plus(); a=maxLength; cpos(a) }
			else{ HT=sWidth; a--; minus(); cpos(a)}
			clearTimeout (autoRuns);
			m=1;
			autoRuns =setTimeout("calculat("+m+","+p+","+btn+")",tDelay);
		
		}else if(m==1 && p==0 && btn==1){
	
			if(a==maxLength){HT=sWidth*(a-1); end();a=1; cpos(a) }
			else{plus();HT=OBcH+(sWidth*a); a++; cpos(a)}
			clearTimeout (autoRuns);
			p=1;
			autoRuns =setTimeout("calculat("+m+","+p+","+btn+")",tDelay);
		
		}else if(m==1 && p==1 && btn==1){
			
			if(strt==0){autoRuns = setTimeout("calculat("+m+","+p+","+btn+")",tDelay); strt=1; }
			else if(strt==1){
				//alert(a)
				clearTimeout (autoRuns);
				if(a==maxLength){HT=sWidth*(a-1); end();a=1; cpos(a) }
				else{plus();HT=OBcH+(sWidth*a); a++; cpos(a);}	
				autoRuns = setTimeout("calculat("+m+","+p+","+btn+")",tDelay);
			}
			
		} else if(m==1 && p==1 && btn==0){
			
			if (cN>a){HT=(cN-a)*sWidth; plus(); a=cN; 
			}else{HT=(a-cN)*sWidth; minus(); a=cN; 	}
			clearTimeout (autoRuns);
			btn=1;
			autoRuns =setTimeout("calculat("+m+","+p+","+btn+")",tDelay);
		}
	
	}
	

	
	function plus(){
		ease=Math.ceil(HT/5);
		var OB=document.getElementById('containr');
		var OBH=OB.style.marginLeft.replace("px", "")*1
		OB.style.marginLeft=(OBH-ease)+"px";
		
		if(count<=30){
		setTimeout("plus()",30);
		count++;
		HT=HT-ease;	
		}else {count=1;}	
	}
	
	
	function minus(){
		//document.getElementById('disTxt').innerHTML=HT+".........";
		ease=Math.ceil(HT/5);
		var OB=document.getElementById('containr');
		var OBH=OB.style.marginLeft.replace("px", "")*1
		OB.style.marginLeft=(OBH+ease)+"px";
		
		if(count<=30){
		setTimeout("minus()",20);
		count++;
		HT=HT-ease;	
		}else {count=1;}
	}
	
	
	function end(){
		ease=Math.ceil(HT/5);
		var OB=document.getElementById('containr');
		var OBH=OB.style.marginLeft.replace("px", "")*1
		OB.style.marginLeft=(OBH+ease)+"px";
		
		if(count<=35){
		setTimeout("end()",30);
		count++;
		HT=HT-ease;	
		}else {count=1;}
	}
	
	
	
	
	function cposP(c)
	{
		if (count==1){
			cN=c;
			//alert(cN)
			calculat(1,1,0); 
			cpos(c); 			
		}
	}
	
	
	function cpos(c){	
			
		
		for(i=1; i<=maxLength; i++){
			if(c==i){
				document.getElementById("but"+i).className='actv';
			}else{
				document.getElementById("but"+i).className='num';
			}
		}
	}


