var bview = 0;

function flipMainImage(bid) {
	bview ++;
	if ( bview == 2 ) bview = 0;
	imgPath = '/img/shop/img/' + bid + '.' + bview + '.jpg';
	MM_swapImage('mainImage','',imgPath,1);
}

function moveThumbs (target, movement) {
	if (target == 0) {
		clearTimeout(thumbTimeout);
		return false;
	}
	
	// ----	get applied styles
	if (document.getElementById) {
		currentX = document.getElementById(target).style.left;
		thumbWidth = document.getElementById(target).style.width;
	} else if (document.all) {
		currentX = document.all[target].style.left;
		thumbWidth = document.all[target].style.width;
	} else {
		top.location = '/requirements.html';
	}
	
	currentX = currentX.substr(0, currentX.indexOf('px'));
	newX = (currentX *1) + movement;
	thumbWidth = thumbWidth.substr(0, thumbWidth.indexOf('px'));
	thumbWidth *= -1;
	thumbMask = 222 - 17;
	thumbStop = thumbWidth + thumbMask;
	
	// ----	make it move
	if ( (newX <= 0) && (newX > thumbStop) ) {
		if (document.getElementById) {
			document.getElementById(target).style.left = newX + "px";
		} else if (document.all) {
			document.all[target].style.left = newX + "px";
		} else {
			top.location = '/requirements.html';
		}
	}
	functionCall = "moveThumbs('" + target + "'," + movement + ")";
	thumbTimeout = setTimeout(functionCall, 10);
}

var prevcomtopThumbsNav = 1;
var prevproflexThumbsNav = 1;
var prevclassicThumbsNav = 1;
var prevwheelThumbsNav = 1;
var prevteesThumbsNav = 1;
var prevotherThumbsNav = 1;
function setThumbs (target, setNum, setPx) {
	msg = "target = " + target + "\r\n";
	msg += "setNum = " + setNum + "\r\n";
	msg += "setPx = " + setPx + "\r\n";
//	alert (msg);
	setX = setPx * (-1);
	if (document.getElementById) {
		document.getElementById(target).style.left = setX + "px";
	} else if (document.all) {
		document.all[target].style.left = setX + "px";
	} else {
		top.location = '/requirements.html';
	}
	
	prevNum = eval ('prev' + target + 'Nav');
	imgTarget = target + 'Nav' + prevNum;
	imgPath = '/img/btn/' + prevNum + '_off.gif';
	MM_swapImage (imgTarget,'',imgPath,1);
	
	imgTarget = target + 'Nav' + setNum;
	imgPath = '/img/btn/' + setNum + '_on.gif';
	MM_swapImage (imgTarget,'',imgPath,1);
	
	eval ('prev' + target + 'Nav = setNum;');
}

var complPop;
function viewComplete (category2, name, bid) {
	winHeight = 300;
	winWidth = 300;
	winX = 0;
	winY = 0;
	
	winURL = "/products/popup_complete.php?category2=" + category2 + "&name=" + name + "&bid=" + bid;
	
	winFeatures = "height=" +winHeight;
	winFeatures += ",width=" +winWidth;
	winFeatures += ",left=" +winX;
	winFeatures += ",top=" +winY;
	winFeatures += ",screenX=" +winX;
	winFeatures += ",screenY=" +winY;
	winFeatures += ",scrollbars=no";
	
	complPop = window.open (winURL,'complWin',winFeatures);
	setTimeout ('complPop.focus();',250);
}

var polPop
function viewPolicy (file) {
	winHeight = 300;
	winWidth = 315;
	winX = 0;
	winY = 0;
	
	winURL = "/products/popup_" + file + ".php";
	
	winFeatures = "height=" +winHeight;
	winFeatures += ",width=" +winWidth;
	winFeatures += ",left=" +winX;
	winFeatures += ",top=" +winY;
	winFeatures += ",screenX=" +winX;
	winFeatures += ",screenY=" +winY;
	winFeatures += ",scrollbars=yes";
	
	polPop = window.open (winURL,'polWin',winFeatures);
	setTimeout ('polPop.focus();',250);
}


