var showingPick = 1;
var pickWidth = 887;
var pickTo = 1;
picksSliding = false;
var autoSlideTimer;

function slideFeaturesLeft() {
	if (showingPick < 5) {
		pickTo = showingPick + 1;
		slidePicks();
	}		
}

function slideFeaturesRight() {
	if (showingPick > 1) {
		pickTo = showingPick - 1;
		slidePicks();
	}		
}

function autoSlideFeatures() {
	if (showingPick < 5) {
		pickTo = showingPick + 1;
		slidePicks();
		autoSlideTimer = setTimeout("autoSlideFeatures()", 5000);
	}
	else {
		pickTo = 1;
		wrapper = document.getElementById('featureSlider');
		wrapper.style.left = '0px';
		showingPick = 1;
		changeClass('horizFeatureNavLeft', 'horizFeatureNavLeftOff');
		changeClass('horizFeatureNavRight', 'horizFeatureNavRightOn');
//		document['featureLeftArrow'].src = '/simg/feature_nav_left_off.gif';
//		document['featureRightArrow'].src = '/simg/feature_nav_right_on.gif';
		autoSlideTimer = setTimeout("autoSlideFeatures()", 5000);
	}
}
	

function slidePicks () {
	if (showingPick < pickTo) {
		step = - Math.floor(pickWidth / 10)
	}
	else {	
		step = Math.floor(pickWidth / 10)
	}
	wrapper = document.getElementById('featureSlider');
	currentLeft = parseInt(wrapper.style.left);
	wrapper.style.left = (currentLeft + step) + 'px';
	currentLeft = parseInt(wrapper.style.left);
	if (Math.abs(currentLeft + ((pickTo - 1) * pickWidth)) < pickWidth / 10) {
		//near end, stop sliding
		wrapper.style.left = -((pickTo - 1) * pickWidth) + 'px';
		showingPick = pickTo;
		if (showingPick > 1) {
			changeClass('horizFeatureNavLeft', 'horizFeatureNavLeftOn');
//			document['featureLeftArrow'].src = '/simg/feature_nav_left_on.gif';
		}
		else {
			changeClass('horizFeatureNavLeft', 'horizFeatureNavLeftOff');			
//			document['featureLeftArrow'].src = '/simg/feature_nav_left_off.gif';
		}
		if (showingPick < 5) {
			changeClass('horizFeatureNavRight', 'horizFeatureNavRightOn');	
//			document['featureRightArrow'].src = '/simg/feature_nav_right_on.gif';
		}
		else {
			changeClass('horizFeatureNavRight', 'horizFeatureNavRightOff');	
//			document['featureRightArrow'].src = '/simg/feature_nav_right_off.gif';
		}
	}
	else {
		setTimeout("slidePicks()", 100);
	}
}

autoSlideTimer = setTimeout("autoSlideFeatures()", 5000);

