﻿// for individual collection pages
function swapMainCollectionImage(argMainID, argThumbID)
{
	document.getElementById(argMainID).src = document.getElementById(argThumbID).getAttribute("asset");
}

// for product detail tabs
//var currentProdTabName = "Downloads";
//var currentImageTabID = "pdImagesTabColors";
//var currentImageID = "1";

function swapTabClass(argTabId) {
	obj = document.getElementById(argTabId);
	if (obj.className.indexOf("pdTabSelected") != -1) {
		obj.className = obj.className.replace("pdTabSelected", "pdTabDeSelected");
	} else {
		obj.className = obj.className.replace("pdTabDeSelected", "pdTabSelected");
	}
}

function toggleTab(argTabID, argTabContentID) {
	if (argTabID != currentProdTabID) {
		swapTabClass(currentProdTabID);
		swapTabClass(argTabID);
		hide(currentProdTabContentID);
		show(argTabContentID);
		currentProdTabID = argTabID;
		currentProdTabContentID = argTabContentID;
	}
}

function pdImagesTabShow(argImageID, argTabID) {
	if (argTabID != currentImageTabID) {
		// switch tabs look
		if (argTabID == "pdImagesTabColors") {
			show("pdImagesTabColorLimg");
			document.getElementById("pdImagesTabImagesInner").className = "pdImagesTabInnerOff";
			document.getElementById("pdImagesTabImages").className = "";
			document.getElementById("pdImagesTabImagesB").className = "";
			document.getElementById("pdImagesTabColorBL").className = "";
			document.getElementById("pdImagesTabColors").className = "";
			document.getElementById("pdImagesTabBM").className = "";
			document.getElementById("pdImagesTabColorsB").className = "";
			document.getElementById("pdImagesTabColorsInner").className = "pdImagesTabInnerOn";
		} else {
			hide("pdImagesTabColorLimg"); 
			document.getElementById("pdImagesTabColorBL").className = "off";
			document.getElementById("pdImagesTabColors").className = "off";
			document.getElementById("pdImagesTabBM").className = "off";
			document.getElementById("pdImagesTabColorsB").className = "off";
			document.getElementById("pdImagesTabColorsInner").className = "pdImagesTabInnerOff";
			document.getElementById("pdImagesTabImages").className = "on";
			document.getElementById("pdImagesTabImagesB").className = "on";
			document.getElementById("pdImagesTabImagesInner").className = "pdImagesTabInnerOn";
		}
		
		currentImageTabID = argTabID;
	}
	
	// hides the current main image
	hide("pdImageMain" + currentImageID);
	
	// shows the passed main image
	//show("pdImageMain" + argImageID);
	$("#pdImageMain" + argImageID).fadeIn("fast");
	
	// turns off the current thumbnail
	document.getElementById("pdImageThumb" + currentImageID).className = " ";
	
	// turns on the passed thumbnail
	document.getElementById("pdImageThumb" + argImageID).className = "pdSelectedImg";
	
	currentImageID = argImageID;
}

if ($.browser.msie && (parseInt($.browser.version) < 7)) {
	$(document).ready(function(){
		$("div.zoomIcon img").css('display', 'block');
		$("div.zoomIcon img").attr("src","/assets/images/products/zoomIcon.gif");
	});
}

