// JavaScript Document
var pDiv;
var cDiv;
var currentPos;
var posStep;
var newPos;
var change;
var sid;
var maxSlide;
var speed;
var flag=true;
var pDiv1;
var cDiv1;
var currentPos1;
var posStep1;
var newPos1;
var change1;
var sid1;
var maxSlide1;
var speed1;
var flag1=true;
function init(myDiv,s){
	cDiv=document.getElementById(myDiv);
	pDiv=cDiv.parentNode;
	cg=pDiv.style.width;
	change=cg.substr(0,cg.length-2);
	ms=cDiv.style.width;
	maxSlide=ms.substr(0,ms.length-2)-change;
	speed=s;
	//alert(cDiv.id+" "+pDiv.id);
}
function blank(){
alert("ok");
}
function moveForward(){
 	//document.onclick=blank;
	if(flag){
	flag=false;
	var pos=cDiv.style.left;
	currentPos=pos.substr(0,pos.length-2);
	
	//if(stepPos==currentPos){
	newPos=currentPos-change;
	//alert(newPos+" "+currentPos);
	//}
	if(newPos>=(-1*maxSlide)){
	sid=setInterval("moveF()",speed);
	}else{
		flag=true;	
			}
	}
	}
	
function moveF(){
	 var pos=currentPos-(change/4);
	cDiv.style.left=pos+"px";
	currentPos=pos;
	//alert(pos+"  "+newPos);
	if(currentPos==newPos){
		clearInterval(sid);
		flag=true;
		//document.onclick=null;
		}
}

function moveBack(){
	//document.onclick=blank;
	if(flag){
 	flag=false;
	var pos=cDiv.style.left;
	currentPos=new Number(pos.substr(0,pos.length-2));
	newPos=currentPos+new Number(change);
	if(newPos<=0){
	
	sid=setInterval("moveB()",speed);
	
			}else{
		flag=true;	
			}
	}
	}
	
function moveB(){
	var pos=currentPos+(change/4);
	cDiv.style.left=pos+"px";
	currentPos=pos;
	//alert(pos+"  "+newPos);
	if(currentPos==newPos){
		clearInterval(sid);
		flag=true;
		}
}

//for displayMyFreeVideos

function init1(myDiv,s){
	cDiv1=document.getElementById(myDiv);
	pDiv1=cDiv1.parentNode;
	cg=pDiv1.style.width;
	change1=cg.substr(0,cg.length-2);
	ms=cDiv1.style.width;
	maxSlide1=ms.substr(0,ms.length-2)-change1;
	//alert(maxSlide1);
	speed1=s;
	//alert(cDiv.id+" "+pDiv.id);
}
function blank1(){
alert("ok");
}
function moveForward1(){
 	//document.onclick=blank;
	if(flag1){
	flag1=false;
	var pos=cDiv1.style.left;
	currentPos1=pos.substr(0,pos.length-2);
	
	//if(stepPos==currentPos){
	newPos1=currentPos1-change1;
	//alert(newPos1+" "+currentPos1);
	//}
	if(newPos1>=(-1*maxSlide1)){
	sid1=setInterval("moveF1()",speed1);
	}else{
		flag1=true;	
			}
	}
	}
	
function moveF1(){
	 var pos=currentPos1-(change1/4);
	cDiv1.style.left=pos+"px";
	currentPos1=pos;
	//alert(pos+"  "+newPos1);
	if(currentPos1==newPos1){
		clearInterval(sid1);
		flag1=true;
		//document.onclick=null;
		}
}

function moveBack1(){
	//document.onclick=blank;
	if(flag1){
 	flag1=false;
	var pos=cDiv1.style.left;
	currentPos1=new Number(pos.substr(0,pos.length-2));
	newPos1=currentPos1+new Number(change1);
	if(newPos1<=0){
	
	sid1=setInterval("moveB1()",speed1);
	
			}else{
		flag1=true;	
			}
	}
	}
	
function moveB1(){
	var pos=currentPos1+(change1/4);
	cDiv1.style.left=pos+"px";
	currentPos1=pos;
	//alert(pos+"  "+newPos);
	if(currentPos1==newPos1){
		clearInterval(sid1);
		flag1=true;
		}
}

