
var timeOutValue=50;
var speedscroll=10;
var curentPage = 1;
var val2 = gIncVal = gLeft = check = t1 = t2 = 0;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

if(ns4){speedscroll=4}
if(ns6){speedscroll=4}
if(ie4){speedscroll=8;timeOutValue=25;}

function scrollMe(endPage){
	if(curentPage==endPage)return;
	
	curentPage=endPage;  
	var objEncNav=document.getElementById('encNav');
	
	var objEncNavWidth=width;
	var objendPageLeft=(endPage-1)*objEncNavWidth;
	if(right_left=='right'){
		var objCurrentLeft=objEncNav.style.right;
	}else if(right_left=='left'){
		var objCurrentLeft=objEncNav.style.left;
	}

	
	var barWidth=width;   
	
	if(!objCurrentLeft)
		objCurrentLeft=0;
	else
		objCurrentLeft=objCurrentLeft.substring(0,objCurrentLeft.length-2);
	  
	incrementValue=parseInt(objendPageLeft)+parseInt(objCurrentLeft);
	if(incrementValue > 0){
		encSmoothScroll("minus", parseInt(objCurrentLeft), parseInt(incrementValue));
	}else{
		incrementValue=incrementValue*(-1);
		encSmoothScroll("plus", parseInt(objCurrentLeft), parseInt(incrementValue));
	}		  	
}


function encSmoothScroll(dir, currentVal, incValue){
	if(check==1)check=0 ;
	else check=1;
	val2=1;
	
	gLeft=currentVal;
	gIncVal=incValue;
	encScrollBy(dir, 0);
}

function encScrollBy(dir, val){
	if(val<gIncVal){
	  var tmpInc;      
	  if((gIncVal-val)>1) {
		tmpInc=Math.ceil((gIncVal-val)/speedscroll);
		if(val2 < tmpInc){
			tmpInc=Math.ceil(val2);
		}
		val2+=tmpInc;
		if(tmpInc <1)
		  tmpInc=1;
	  }else{
		tmpInc=gIncVal-val;
	  }
	  val+=tmpInc;
	  
	  var objEncNav=document.getElementById('encNav');
	  if(dir=="plus"){
		var left_move=gLeft+val+"px";
	  }else if(dir=="minus"){
		var left_move=gLeft-val+"px";
	  }

	if(right_left=='right'){
		objEncNav.style.right=left_move;
	}else if(right_left=='left'){
		objEncNav.style.left=left_move;
	}


	if(check==1){
		  t1=setTimeout("encScrollBy('"+dir+"', "+val+");", timeOutValue);
		  clearTimeout(t2);
		}else{
		  t2=setTimeout("encScrollBy('"+dir+"', "+val+");", timeOutValue);
		  clearTimeout(t1);
		}
	}else{
	  clearTimeout(t1);
	  clearTimeout(t2);
	  check=0;
	}
}

function setopacity_over(img){
	img.style.opacity="0.75";
	img.style.filter="alpha(opacity=75)";
}

function setopacity_out(img){
	img.style.opacity="1";
	img.style.filter="alpha(opacity=100)";
}

