// $Id: visitor_functions.js,v 1.6 2005/03/21 09:46:27 davel Exp $


// Ripped from the CMP : Id: useful.js,v 1.1 2003/12/15 18:55:59 davel Exp

// Generally useful functions



// Generally useful function
function findElement(s, d) {
	if (d && (!d.all || !d.getElementById)) d = d.document;
	if (!d) { d = document; }
	
	if (d.getElementById) {
		return d.getElementById(s);
	} else if (d.all) {
		return d.all[s];
	} else {
		alert("Browser DOM does not provide method to locate elements by id.");
	}
}

function set_top_shown() {
	if (top_shown) {
	} else {
		top_shown = findElement("root_menu");
	}
}

function totalXOffset(o) {
	var x=0;

	while (o) { x+=o.offsetLeft; o = o.offsetParent; }
	return x;
}

function totalYOffset(o) {
	var y=0;

	while (o) { y+=o.offsetTop; o = o.offsetParent; }
	return y;
}

/* --CUT HERE -----------------------------------------------------*/





// Used for exploding lists
function ss_do_show(o, id) {

	var a = findElement(id);
//	alert(a);


	if (a.className=="ss_hide_sub") {
		o.innerHTML="or click here to hide details";
		a.className="ss_show_sub";
	} else {
		o.innerHTML="or click here to show more detail";
		a.className="ss_hide_sub";
	}
}

function ss_do_hide(o) {
	o.parentNode.className="ss_hide_sub";
}


