
// reload flash content to remove "click here to activate" message
function reloadFlashObjects() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = 0; i < objects.length; i++) {
	    objects[i].outerHTML = objects[i].outerHTML;
		}
	}	


// decide to display the arrows for the additional product views
function setScrolling() {
	if (document.getElementById("associatedImagesDisplay_Scroll")) {
		if (document.getElementById("associatedImagesDisplay_P")) {
			pos = "offsetHeight";
			}
		else {
			pos = "offsetWidth";
			}	
		if (document.getElementById("associatedImagesDisplay_Scroll").childNodes[0][pos] > document.getElementById("associatedImagesDisplay_Scroll").parentNode[pos]) {
			document.getElementById("direction_1").style.display = "block";
			document.getElementById("direction_2").style.display = "block";
			if (document.getElementById("prodBr")) {
				document.getElementById("prodBr").style.display = "none";
				}
			}
		else {
			document.getElementById("direction_1").style.display = "none";
			document.getElementById("direction_2").style.display = "none";
			if (document.getElementById("prodBr")) {
				document.getElementById("prodBr").style.display = "block";
				}
			}
		}	
	}	

// switch thumbs for product page
currentThumb = null;
function expandThumb(imgSrc, srcObj) {
	
	srcThumb = document.getElementById(srcObj)
	targetDiv = document.getElementById("prodImage");
	display = "";
	
	if (imgSrc.indexOf(".swf") != -1) {
		display = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=7,0,19,0\" width=\"285\" height=\"290\">";
		display += "	<param name=\"movie\" value=\"" + imgSrc + "\">";
		display += "	<param name=\"quality\" value=\"high\">";
		display += "	<param name=\"wmode\" value=\"opaque\">";
		display += "	<param name=\"wmode\" value=\"transparent\">";
		display += "	<embed src=\"" + imgSrc + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"285\" height=\"290\"></embed>";
		display += "</object>";
		}
	else {
		display = "<img src=\"" + imgSrc + "\" alt=\"\" id=\"mainProductImage\">";
		}
	
	targetDiv.childNodes[0].innerHTML = display;
	reloadFlashObjects();
	if (currentThumb != null) {
		currentThumb.className = "thumb";
		}
	currentThumb = srcThumb;
	srcThumb.className = "highlightThumb";		
	}
	
var doLeft;
var doRight;
var doUp;
var doDown;
var p_currScrollObj ;
var l_currScrollObj ;

function textLeft () {
	if (arguments.length) {
		objId = arguments[0];
		p_currScrollObj = objId;
		}
	else {
		objId = p_currScrollObj;
		}
	clearTimeout(doLeft);
	obj = document.getElementById(objId);
	obj.style.marginLeft = Math.min(0, parseFloat(obj.style.marginLeft) + 5) + "px";
	doLeft = setTimeout("textLeft()", 100);
	}
	
function textRight () {
	if (arguments.length) {
		objId = arguments[0];
		p_currScrollObj = objId;
		}
	else {
		objId = p_currScrollObj;
		}
	
	obj = document.getElementById(objId);
	maxPos = (0 - (obj.childNodes[0].offsetWidth - obj.parentNode.offsetWidth));
	if (obj.childNodes[0].offsetWidth > obj.parentNode.offsetWidth) {
		obj.style.marginLeft = Math.max(maxPos, parseFloat(obj.style.marginLeft) - 5) + "px";
		clearTimeout(doRight);
		doRight = setTimeout("textRight()", 100);
		}
	}



function textUp () {
	if (arguments.length) {
		objId = arguments[0];
		l_currScrollObj = objId;
		}
	else {
		objId = l_currScrollObj;
		}
	clearTimeout(doUp);
	obj = document.getElementById(objId);
	obj.style.marginTop = Math.min(0, parseFloat(obj.style.marginTop) + 5) + "px";
	doUp = setTimeout("textUp()", 100);
	}
	
function textDown () {
	if (arguments.length) {
		objId = arguments[0];
		l_currScrollObj = objId;
		}
	else {
		objId = l_currScrollObj;
		}
	
	obj = document.getElementById(objId);
	maxPos = (0 - (obj.childNodes[0].offsetHeight - obj.parentNode.offsetHeight));
	if (obj.childNodes[0].offsetHeight > obj.parentNode.offsetHeight) {
		obj.style.marginTop = Math.max(maxPos, parseFloat(obj.style.marginTop) - 5) + "px";
		clearTimeout(doDown);
		doDown = setTimeout("textDown()", 100);
		}
	}	


function expandDIV(whichElement) {
	whichElement.style.display = (whichElement.style.display == "block" ) ? "none" : "block";
	}