// JavaScript Document

function goNextSlideNew () {
	nextSlide = currentSlide + 1;
	if (nextSlide > maxSlides) {
		nextSlide = 1;
	}
	goSlideNew (nextSlide);
}
function goSlideNew (which){
	if (counter == 0) {
		window.clearTimeout (slideShow);
		currentSlide = which;
		endPos = (which - 1) * -635;
		var slideObj = window.setTimeout("slide()", ticks);
	}
	for (f=1;f<=maxSlides;f++) {
		if (f==currentSlide) {
			document.getElementById("slide_"+f+"_button").className="over";	
		} else { 
			document.getElementById("slide_"+f+"_button").className="";
		}
		document.getElementById("slideButtons").style.display="block";						
	}
	return false;
}
function slide() {
	counter++;	
	propor = ((Math.sin((((counter / steps) * 2) - 1) * (Math.PI/2))) + 1) / 2;
	currentPos = parseInt (((endPos - startPos) * propor) + startPos);
	document.getElementById("slider").style.left = currentPos+"px";
	if (counter < steps) {
		var slideObj = window.setTimeout("slide()", ticks);
	} else {
		startPos = endPos;
		counter = 0;
		slideShow = window.setTimeout("goNextSlideNew()", 10000)
	}		
}
function moveBrands (speed, direction){
	currentSpeed = speed;
	if (direction!=0) {
		currentDirection = direction;
	}
}
function updateBrands(){
	if (currentSpeed!=0) {
		currentOffset = (parseInt (document.getElementById("brandsInner").style.left) * -1) + (currentSpeed * currentDirection);
		if (currentOffset < 0) {
			currentOffset = 0;
			if (currentSpeed==1&&currentDirection==-1) {
				currentDirection = 1;
			}
		}
		if (currentOffset > maxOffset) {
			currentOffset = maxOffset;
			if (currentSpeed==1 && currentDirection==1) {
				currentDirection = -1;
			}
		}
		document.getElementById("brandsInner").style.left= (-1 * currentOffset)+"px";
	}
	brandsObj = window.setTimeout("updateBrands()", 40);
}
function mailpage(){
	mail_str = "mailto:?subject=Check out the " + document.title;
	mail_str += "&body=I thought you might be interested in the " + document.title;
	mail_str += ". You can view it at, " + location.href; 
	location.href = mail_str;
}
var clearedFields = new Array();
function clearDefault(ID){
	var found = false;
	for (f=0;f<clearedFields.length;f++) {
		if (clearedFields[f]==ID){
			found = true;
		}
	}
	if (found==false) {
		document.getElementById(ID).value="";
		clearedFields.push (ID);
	}
}
function showQtySelect(ID){
	document.getElementById("qtyStatic_"+ID).style.display = "none";
	document.getElementById("qtySelect_"+ID).style.display = "inline";								
	return false;
}

$(document).ready(function() {

$('a[href=#wrapper]').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});

});



function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=420,height=440');");
}


