var iconPath = "/images/"; // icon image full web address or path
var boxC = new Image(14, 15); // icon dimensions
boxC.src = iconPath + "box_close.gif"; // icon, closed
var boxO = new Image(14, 15); // icon dimensions
boxO.src = iconPath + "box_open.gif"; // icon, opened
var d = document, icon = new Image();

function client() { // Client Type Identifier
	var nav = navigator;
	this.agt = nav.userAgent.toLowerCase();
	this.major = parseInt(nav.appVersion);
	this.ns = (d.layers);
	this.dom = (d.getElementById)? 1 : 0;
	this.ns4up = (this.ns && this.major >= 4);
	this.ns6 = (this.agt.indexOf("Netscape6") != -1);
	if (d.all) { this.ie = 1; }
	else { this.ie = 0; }
	this.ie4up = (this.ie && this.major >= 4);
	this.ie5 = (d.all && this.dom);
	this.op = (window.opera? 1 : 0);
	this.gk = (typeof(nav.product) != "undefine" && nav.product)? 1 : 0;
	this.fb = (this.agt.indexOf("firebird") != -1);
	this.fx = (this.agt.indexOf("firefox") != -1);
	this.sf = (this.agt.indexOf("safari") != -1);
	this.win = (this.agt.indexOf("win") != -1 || this.agt.indexOf("16bit") != -1);
	this.mac = (this.agt.indexOf("mac") != -1);
} var oWin = new client();

function getObject(id) {
	var i, x;
	if (!(x=d[id]) && d.all) { x = d.all[id]; }
	for (i=0; !x && i < d.forms.length; i++) { x = d.forms[i][id]; }
	if (!x && document.getElementById) { x = document.getElementById(id); }
	return x;
}
function setImg(id, newImg) { // swap icon state
	var oImg = getObject(id);
	if (!oImg) { return; }
	oImg.src = newImg.src;
}
function boxVis(o, v) { // change block visibility, v = none or block
	if (v == "block") { o.style.visibility = "visible"; }
	else { o.style.visibility = "hidden"; }
	(!v)? 0 : o.style.display = v;
}
function getStyle(o, s) { // tests current state
	if (oWin.ie5 || oWin.dom) { return eval("o.style." + s); }
}
function setState(lnk, s) { // sets new state
	icon.src = lnk.replace(/state=[0-1]/i, "state=" + s);
}
function MaxMin(id, lnk) {
	if (oWin.ie && oWin.mac) { return true; }
	if (oWin.ie || oWin.dom) {
		var m=getObject("m_"+id), i=getObject("i_"+id);
		if (getStyle(m, "display") == "" || i.src.match(/open/)) {
			setImg("i_" + id, boxC);
			boxVis(m, "none");
			setState(lnk.href + "&.jscall=1", 0);
			i.alt = i.alt.replace(/collapse/, "expand");
			i.parentNode.title = i.parentNode.title.replace(/collapse/, "expand");
		} else {
			setImg("i_" + id, boxO);
			boxVis(m, "block");
			setState(lnk.href + "&.jscall=1", 1);
			i.alt = i.alt.replace(/expand/, "collapse");
			i.parentNode.title = i.parentNode.title.replace(/expand/, "collapse");
		}
		return false;
	} else { return true; }
}

