
/**
* Div show / hide * 
*/



function isObject(id) {
	return (typeof(id) == 'object' && id != null);
}

function showDiv(div_id) 
{
	el = document.getElementById(div_id);
	if(isObject(el) == true) {
		el.style.display = 'block';
	}
}

function hideDiv(div_id)
{
	el = document.getElementById(div_id);
	if(isObject(el) == true) {
		el.style.display = 'none';
	}
}

var activeDetails = -1;
function toggleDetails(prod_id)
{
	if(activeDetails == prod_id) {
		hideDetails(activeDetails);
		activeDetails = -1;
	} else {
		hideDetails(activeDetails);
		activeDetails = prod_id;	
		showDetails(activeDetails);
	}
}

function showDetails(prod_id) 
{
	showDiv('details_'+prod_id+'_text');
	showDiv('details_'+prod_id+'_specs');	
	el = document.getElementById('details_'+prod_id+'_link');
	if(isObject(el) == true) {
		el.className = 'details_hide';
	}	
}

function hideDetails(prod_id) 
{
	hideDiv('details_'+prod_id+'_text');
	hideDiv('details_'+prod_id+'_specs');	
	el = document.getElementById('details_'+prod_id+'_link');
	if(isObject(el) == true) {
		el.className = 'details_show';
	}	
}

showForm = function() {
	document.getElementById('expanded_form').style.display = 'block';
}
hideForm = function() {
	document.getElementById('expanded_form').style.display = 'none';
}

/**
 * use appendChild (not +=) or else trouble in focus and form content
 */
add_extra_row = function(rownum, xhtml, delay ) {
	var rowdiv = document.getElementById('div_frm_pnum_'+rownum);
	if (!rowdiv) {
		var extrarows  = document.getElementById('extrarows');
		if (extrarows) {
			var newNode = document.createElement("DIV");
			newNode.innerHTML = xhtml;
			extrarows.appendChild( newNode );
		}
	}
}
