
 
var PhotoNav = {
	containerWidth: 0,
	container: "",
	photo: "",
	photoWidth: 0,
        startX:0,
		
	init: function(id, width, width2) {
		PhotoNav.container = id;
		PhotoNav.containerWidth = width;
		PhotoNav.photoWidth = width2;

		$("#" + id + " .fixed").each(function(i) {
			PhotoNav.photo = $(this);
			PhotoNav.photo.css({"width":width2 + "px"});
		});


           PhotoNav.incrementX(PhotoNav.startX);
	},

	incrementX: function(x) {
              var perc = (100 / (PhotoNav.containerWidth / x));	
	      PhotoNav.posPicture(perc);
              PhotoNav.myx=x+1;

              if (PhotoNav.myx > (PhotoNav.photoWidth-PhotoNav.containerWidth) ){
                  //PhotoNav.myx = 0;
                  return;
              }
              clearTimeout(t);
              var speed = 100;		//the number of microseconds to pause between x shift - 1000 = 1 sec
              var t=setTimeout("PhotoNav.incrementX(PhotoNav.myx)",speed);
 //clearTimeout(t);	
	},
	

	posPicture: function(x) {
		var full = PhotoNav.photoWidth;
		full = full - PhotoNav.containerWidth;
		var curX = full * (x / 100);
		if (curX < 0) {
			curX = 0;
		}
		PhotoNav.photo.css({
			marginLeft: "-"+curX+"px"
		});
	}
}
