
var x = 0; // number of pixels moved
var p1 = 0; // position of slider 1
var p2 = 0; // position of slider 2
var p3 = 0; // position of slider 3
var p4 = 0; // position of slider 4

var img1 = null;
function init(){
   img1 = document.getElementById('image1');
   img1.style.position= 'relative'; 
   img1.style.left = 0 + 'px';
   img2 = document.getElementById('image2');
   img2.style.position= 'relative'; 
   img2.style.left = 0 + 'px';
   img3 = document.getElementById('image3');
   img3.style.position= 'relative'; 
   img3.style.left = 0 + 'px';
   img4 = document.getElementById('image4');
   img4.style.position= 'relative'; 
   img4.style.left = 0 + 'px';
}
function moveRight1(){

   if(p1 < 0){

   img1.style.left = parseInt(img1.style.left) + 5 + 'px';
   
   x = x + 5;
   p1 = p1 + 5

   foo = setTimeout(moveRight1,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }   


}
function moveLeft1(){

   if(p1 > -1750){
   
   img1.style.left = parseInt(img1.style.left) - 5 + 'px';

   x = x + 5;
   p1 = p1 - 5  

   foo = setTimeout(moveLeft1,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }


}
function moveRight2(){


   if(p2 < 0){
   
   img2.style.left = parseInt(img2.style.left) + 5 + 'px';
   
   
   x = x + 5;
   p2 = p2 + 5

   foo = setTimeout(moveRight2,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }


}
function moveLeft2(){


   if(p2 > -2000){
  
   img2.style.left = parseInt(img2.style.left) - 5 + 'px';
   
   
   x = x + 5;
   p2 = p2 - 5

   foo = setTimeout(moveLeft2,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }

}
function moveRight3(){


   if(p3 < 0){
   
   img3.style.left = parseInt(img3.style.left) + 5 + 'px';
   
   x = x + 5;
   p3 = p3 + 5


   foo = setTimeout(moveRight3,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }


}
function moveLeft3(){


   if(p3 > -1750){
   
   img3.style.left = parseInt(img3.style.left) - 5 + 'px';
   
   x = x + 5;
   p3 = p3 - 5


   foo = setTimeout(moveLeft3,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }

}
function moveRight4(){


   if(p4 < 0){
   
   img4.style.left = parseInt(img4.style.left) + 5 + 'px';
   
   x = x + 5;
   p4 = p4 + 5


   foo = setTimeout(moveRight4,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }


}
function moveLeft4(){


   if(p4 > -2250){
   
   img4.style.left = parseInt(img4.style.left) - 5 + 'px';
   
   x = x + 5;
   p4 = p4 - 5


   foo = setTimeout(moveLeft4,25);
   if(x == 250){
	clearTimeout(foo);
	x = 0;
   }

   }else{


	return;


   }

}
window.onload=init;

