function $(e) { return document.getElementById(e); }
function t(e){
    e.parentNode.className = (e.parentNode.className == "expand" ? "" : "expand");
	// ie fix
    $("content").style.height = $("content").offsetHeight; $("content").style.height = "auto";
    // deactivate href
	return false;
}
function getCartItems(cid,el,flag)
{

	divel = document.getElementById("invoiceTable");
	if (flag)
	{
	_el=el;
	
	for(;_el.nodeName.toLowerCase()!="tr";_el=_el.parentNode);
	
	getCartItems("","",0);
							
	_el.id="boldTR";
	
	eltbl = divel.getElementsByTagName("tr");
	for (i=0;i<eltbl.length && eltbl[i]!=_el;i++);
	eltbl[i+1].id="insertCart";
	}
	else 
	{
		
	__el = document.getElementById("boldTR");
	if (__el) { 
		__el.id="";
		__el = document.getElementById("insertCart");
		if (__el) __el.id="hideCart";
	}
	}
}

function showCart(cid,el,flag)
{
	
	if (flag)
	{
	for(;el.nodeName.toLowerCase()!="tr";el=el.parentNode);
	__el=el.getElementsByTagName("td");
	for(i=0;i<4;i++)
		__el[i].className="hidetd";

	__el[i].className="";
	}
	else 
	{
		for(;el.nodeName.toLowerCase()!="tr";el=el.parentNode);
		for(el=el.parentNode;el.nodeName.toLowerCase()!="tr";el=el.parentNode);
		__el=el.getElementsByTagName("td");
		for(i=0;i<4;i++)
		__el[i].className="";							
		__el[i].className="hidetd";
	}
}

var newWin = null; 
function winOpen(URL, windowName, windowWidth, windowHeight, scrollbars)
{
	if (!windowWidth) windowWidth=800;
	if (!windowHeight) windowHeight=600;
	var xposition = 400;
	var yposition = 300;
	
	if ((parseInt(navigator.appVersion) >= 4 )) {
		xposition = (screen.width - windowWidth) / 2;
		yposition = (screen.height - windowHeight) / 2;
	}
	
	if (!scrollbars) var scrollbars = 0;
	
	var args = "width=" + windowWidth + ","
			+ "height=" + windowHeight + ","
			+ "location=0,"
			+ "menubar=0,"
			+ "scrollbars=" + scrollbars + ","
			+ "status=0,"
			+ "titlebar=0,"
			+ "hotkeys=0,"
			+ "screenx=" + xposition + ","  // NN Only
			+ "screeny=" + yposition + ","  // NN Only
			+ "left=" + xposition + ","     // IE Only
			+ "top=" + yposition;           // IE Only
		
	if (newWin != null && !newWin.closed) {
		newWin.close();
	}
	newWin = window.open(URL, windowName, args);
	
	newWin.focus();
}