/* GetClassAttribute must be determined since IE looks for 'className' instead of just 'class' when using getAttribute() */
var GetClassAttribute = 'class';
window.onload = function () {
	if ( document.body.getAttribute('className') != null ) GetClassAttribute = 'className';
	
	if ( document.getElementById('maincontent') != null ) {
		var allNodes = document.getElementById('maincontent').childNodes;
		for ( i=0 ; i < allNodes.length ; i++ ) {
			if ( ( allNodes[i].nodeType == 1 ) && ( allNodes[i].getAttribute(GetClassAttribute) != null ) && ( allNodes[i].getAttribute(GetClassAttribute).indexOf('product') != -1 ) && ( allNodes[i].getAttribute(GetClassAttribute).indexOf('new') != -1 ) ) {
				allNodes[i].innerHTML = '<img src="/images/printers/new.gif" style="position:absolute;margin-left:80px;">' + allNodes[i].innerHTML;
			}
		}
	}
}

function showHide(cls,container,state) {
	var contentchunk = document.getElementById(container); // isolate specific content to be altered
	itms = contentchunk.childNodes;
	for ( i=0 ; i < itms.length ; i++ ) {
		if ( itms[i].nodeType == 1 ) { /* ignore non-tag nodes by looking for ELEMENT_NODE */
			var curClass = itms[i].getAttribute(GetClassAttribute);
			/* if no specific class is provided, match all */
			if ( cls == '' ) {
				itms[i].style.display = state;
			}
			/* if an item is supposed to be hidden, make it hidden */
			if ( curClass && curClass.indexOf('hidden') != -1 ) {
				itms[i].style.display = 'none';
			}
			/* adjust the state of the tags specified by cls */
			if ( curClass && curClass.indexOf(cls) != -1 && cls != '' ) {
				itms[i].style.display = state;
			}
			/* this statement is to reestablish a CSS hack that IE needs to display floated DIVs properly */
			if ( itms[i].tagName == 'DIV' && itms[i].style.styleFloat != undefined && itms[i].style.display == 'block' ) {
				itms[i].style.display = 'inline';
			}
		}
	}
}

function hideAll(container) {
	showHide('',container,'none');
}
function showAll(container) {
	showHide('',container,'block');
}
function showOnly(cls,container) {
	if ( container == undefined ) container = "maincontent";
	hideAll(container);
	showHide(cls,container,'block');
}
