/*collapse expand 
by Leo Charre & Jesse Fergusson
Internet Connection  2004 2005 ©
www.internetconnection.net


usage example:

place  in head tags:

	<script language="javascript">
	var ids=new Array("first","second"); 
	</script>



this is body :

	<body onLoad="closeallbut('ia');">

this in html body part:

	<img src="u.gif" name="imgfirst" width="9" height="9" border="0">
	<a href="#" onClick="javascript:closeallbut('first');">first</a>
	<div style="display: block;" id="first" >
	stuff to collapse and expand here, all html is go 
	</div>
	
	<br><!-- yes you need the style is block code - the name of the image must be img+id as shown, if you reference in <a href="#" to <a href="#first" instead, it will assure that when expanded, all of first will be focused on by browser -->
	
	<img src="u.gif" name="imgsecond" width="9" height="9" border="0">
	<a href="#" onClick="javascript:closeallbut('second');">second</a>
	<div style="display: block;" id="second" >
	stuff to collapse and expand here, all html is go 
	</div>

have to tweak the images if you want to use them


*/

//these are the collapsed and expanded icons
imgout=new Image(9,9); //9,9 is height and width
imgout.src="/gfx_shared/u.gif";
imgin=new Image(9,9);
imgin.src="/gfx_shared/d.gif";

//this switches expand collapse icons
function filter(imagename,objectsrc){
	if (document.images){
		document.images[imagename].src=eval(objectsrc+".src");
	}
}


//closes everything and checks to close id or not
function closeallbut(id){
	var e=0;
	while (ids[e]){
		if (id!=ids[e]){
			hidediv(ids[e]);
		} else {
			shoh(id);
		}
		e++; 
	}

}

function shoh(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			showdiv(id);			
		} else {
			hidediv(id);			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				showdiv(id);
			} else {	
				hidediv(id);
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				showdiv(id);
			} else {
				hidediv(id);
			}
		}
	}
}

function hidediv(id) {
	filter(("img"+id),'imgout');
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {

	filter(("img"+id),'imgin');
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
