var z7productCatDefault = {};
var z7productBlocked = {};

/**
 * Hide or show one single element.
 *
 * @param string unique: The unique identifier key
 */
function z7productDetails(unique) {

	var options = {duration: 0.7};

	if(!z7productBlocked[unique] && $('productdetails-'+unique).style.display == 'none') {
		z7productBlocked[unique] = true;
		Effect.SlideDown('productdetails-'+unique, options);
		$('productopenicon-'+unique).src = $('productopenicon-'+unique).src.split('open.png').join('close.png');
		setTimeout('z7productBlocked["'+unique+'"] = false;', options.duration*1000);
	}
	else if(!z7productBlocked[unique]) {
		z7productBlocked[unique] = true;
		Effect.SlideUp('productdetails-'+unique, options);
		$('productopenicon-'+unique).src = $('productopenicon-'+unique).src.split('close.png').join('open.png');
		setTimeout('z7productBlocked["'+unique+'"] = false;', options.duration*1000);
	}
}


/**
 * Use this function to hide/show more than one element. This is called by onload event.
 *
 * @param string list: A comma separated list of ids
 * @param integer max: Define a max limit. -1 means umlimited 
 */
function z7productMultiDetails(list,max) {

	// create an array from given string
	list = list.split(',');
	
	// decide if we use the given max or length of the list as limit
	n = list.length > max ? max : list.length;
	
	// call z7productDetails()
	for(i=0; i<n; i++) {
		z7productDetails(list[i]);
	}
}


/*
 * add some stuff to document's onload event
 */
if (window.addEventListener) {
	window.addEventListener('load', function() { z7productMultiDetails(z7productDetailsList,z7productDetailsMax); }, true);
}
else if(window.attachEvent) {
	window.attachEvent('onload', function() { z7productMultiDetails(z7productDetailsList,z7productDetailsMax); });
}
