var showObject = null;
function initProducts() {
	var body = document.getElementsByTagName('BODY');
	body = body[0];
	var node = getDeepSub(body,'DIV','product');
	var hide = false;
	while(node) {
		node.style.width = ' ' + node.offsetWidth + 'px';
		if (hide) {
			addClass(node, 'hidden');
		}
		hide = true;
		var h2 = getDeepSub(node,'H2',null);
		if (h2) {
			addClass(h2, 'hasJs');
		}
		node = findNextSub(node,'DIV','product');
	}
	var node = getDeepSub(body,'DIV','productNavi');
	if (node) {
		var ul = getDeepSub(node,'UL',null);
		if (ul) {
			addClass(ul, 'hasJs');
		}
	
		var li = getDeepSub(node,'LI',null);
		active = true;
		while (li) {
			var link = getDeepSub(li,'A',null);
			if (link) {
				addClass(link, 'hasJs');
				if (active) {
					addClass(link, 'active');
				}
				link.onclick = function() {
					linkId = this.getAttribute('HREF');
					linkId = linkId.replace(/^[^#]*#/, '');
					var li = getDeepSub(this.parentNode.parentNode,'LI',null);
					while(li) {
						var a = getDeepSub(li,'A',null);
						if (a) {
							removeClass(a,'active');
						}
						li = findNextSub(li, 'LI', null);
					}
					var product = document.getElementById(linkId);
					if (product) {
						hideProducts();
		   				removeClass(product.parentNode,'hidden');
		   				this.blur();
		   				var table = getDeepSub(product.parentNode,'TABLE',null);
		   				if (table) {
		   					addClass(table,'wait');
		   					window.setTimeout("showValues()", 300);
		   				} 
		   				addClass(this, 'active');
					}
					
					return false;
				}
				
			}
			active = false;
			li = findNextSub(li,'LI',null);
		}
	}
}

function showValues() {
	var body = document.getElementsByTagName('BODY');
	body = body[0];
	var node = getDeepSub(body,'DIV','product');
	while(node) {
		var table = getDeepSub(node, 'TABLE', null);
		if (table) {
			removeClass(table,'wait');
		}
		node = findNextSub(node,'DIV','product');
	}
}

function hideProducts() {
	var body = document.getElementsByTagName('BODY');
	body = body[0];
	var node = getDeepSub(body,'DIV','product');
	while(node) {
		if (!matchClassName('hidden', node.className)) {
   				addClass(node,'hidden');
		}
		node = findNextSub(node,'DIV','product');
	}
}


addInitFunction(initProducts);