function showImage(element) {
	var parentEle = element;
	while (parentEle && parentEle.tagName.toUpperCase() != "DIV") {
		parentEle = parentEle.parentElement || parentEle.parentNode;
	}

	if (parentEle) {
		parentEle.style.display = '';
	}
}

function slideSwitch(bannerIndex) {
	clearTimeout(window.slideTimer);

	var current = null, next = null;
	var currentIndex = -1, nextIndex = -1;

	var bannerNodes = document.getElementById('slideshow').getElementsByTagName('div');
	for (var i = 0, l = bannerNodes.length; i < l; i++) {
		if (bannerNodes[i].className == 'current') {
			currentIndex = i;
			current = bannerNodes[i];

			break;
		}
	}

	if (typeof(bannerIndex) == "number") {
		if (bannerIndex < bannerNodes.length) {
			nextIndex = bannerIndex;
			next = bannerNodes[bannerIndex];
		}
	} else {
		if (currentIndex + 1 < bannerNodes.length) {
			nextIndex = currentIndex + 1;
			next = bannerNodes[currentIndex + 1];
		}
	}

	if (!next) {
		nextIndex = 0;
		next = bannerNodes[0];
	}

	var productLinkNodes = null;
	//var productLinkNodes = document.getElementById('productLinkList').getElementsByTagName('li');
	if (current) {
		current.className = 'normal';
		if (productLinkNodes) {
			var currentProductLink = productLinkNodes[currentIndex];
			currentProductLink.className = "product-link";
			currentProductLink = null;
		}
	}

	if (next) {
		next.className = 'current';
		if (productLinkNodes) {
			var nexProductLink = productLinkNodes[nextIndex];
			nexProductLink.className = "product-link-current";
			nexProductLink = null;
		}
		animateShow(next);
	}

	current = null;
	next = null;

	if (bannerNodes.length > 1)
	{
		window.slideTimer = setTimeout("slideSwitch()", 10000);
	}
}

function slidePre() {
	clearTimeout(window.slideTimer);

	var currentIndex = -1, nextIndex = 0;
	
	var bannerNodes = document.getElementById('slideshow').getElementsByTagName('div');
	for (var i = 0, l = bannerNodes.length; i < l; i++) {
		if (bannerNodes[i].className == 'current') {
			currentIndex = i;
			break;
		}
	}
	
	if (currentIndex == 0)
	{
		nextIndex = bannerNodes.length - 1;
	} else if (currentIndex > 0) {
		nextIndex = currentIndex - 1;
	}

	slideSwitch(nextIndex);
}

function slideNext() {
	clearTimeout(window.slideTimer);

	var currentIndex = -1, nextIndex = 0;
	
	var bannerNodes = document.getElementById('slideshow').getElementsByTagName('div');
	for (var i = 0, l = bannerNodes.length; i < l; i++) {
		if (bannerNodes[i].className == 'current') {
			currentIndex = i;
			break;
		}
	}
	
	if (currentIndex == bannerNodes.length - 1)
	{
		nextIndex = 0;
	} else if (currentIndex >= 0) {
		nextIndex = currentIndex + 1;
	}

	slideSwitch(nextIndex);
}

function animateShow(item) {
	if (item.filters) {
		var opacity = 0;
		var style = item.style;
		style.zoom = 1;

		var animateFunIE = function() {
			style.filter = 'alpha(opacity=' + opacity + ')';
			if (opacity < 100) {
				opacity += 20;
				setTimeout(animateFunIE, 50);
			} else {
				item = null;
			}
		};

		animateFunIE();
	} else {
		item.style.opacity = "0";
		var animateFunFF = function() {
			item.style.opacity = Number(item.style.opacity) + 0.2;

			if (Number(item.style.opacity) < 1) {
				setTimeout(animateFunFF, 50);
			} else {
				item = null;
			}
		};
		
		animateFunFF();
	}
}
