/*

DHTML API from quirksmode.org

*/

var DHTML = (document.getElementById || document.all || document.layers);
var imageWidth = 490;
var xNow = 0;
var buttonPress = 0;
var slideStep = 0;
var distance = new Array();
distance[0] = Math.floor(imageWidth / 256);
distance[1] = Math.floor(imageWidth / 128);
distance[2] = Math.floor(imageWidth / 64);
distance[3] = Math.floor(imageWidth / 32);
distance[4] = Math.floor(imageWidth / 16);
distance[5] = Math.floor(imageWidth / 8);
distance[6] = Math.floor(imageWidth / 4);
distance[7] = Math.floor(imageWidth / 2);
distance[8] = imageWidth - distance[7];
distance[9] = imageWidth - distance[6];
distance[10] = imageWidth - distance[5];
distance[11] = imageWidth - distance[4];
distance[12] = imageWidth - distance[3];
distance[13] = imageWidth - distance[2];
distance[14] = imageWidth - distance[1];
distance[15] = imageWidth;

function move(x,total)
{
	
	if (buttonPress == 0)
	{
	
		imageLength = -(imageWidth * total);
	
		movement = xNow + (imageWidth * x);
		
//		alert('current location:' + xNow + ', next location:' + movement);
	
		if (movement <= 0 && movement > imageLength)
		{
			buttonPress = 1;
//			object.style.left = movement+"px";
			
// Change leftArrow if necessary			
			
			if (!leftArrow) var leftArrow = new getObj('imageNavLeft');	
			if (xNow == 0) leftArrow.style.color = "#4A2632";
			if (movement == 0) leftArrow.style.color = "#fff";

// Change rightArrow if necessary			
			
			if (!rightArrow) var rightArrow = new getObj('imageNavRight');	
			if (xNow == (imageLength + imageWidth)) rightArrow.style.color = "#4A2632";
			if (movement == (imageLength + imageWidth)) rightArrow.style.color = "#fff";
			
			slideImages(0,xNow,movement,x);
		}
	}
} 

function slideImages(step,start,end,direction)
{

//	alert('step: ' + step + ', start: ' + start + ', direction: ' + direction);

	if (!imageWindow) var imageWindow = new getObj('images');

	imageWindow.style.left = (start + (distance[step] * direction)) + "px";
	
	step++;
	
	if (step != 16)
	{
		imageWindow.slider = setTimeout('slideImages('+ step +','+ start +','+ end +',' + direction + ')', 25);  
	}
	else
	{
		buttonPress = 0;
		xNow = end;
	}
}

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}