/************************************************ Switch Content script- © Dynamic Drive (www.dynamicdrive.com)* This notice must stay intact for legal use. Last updated Mar 23rd, 2004.* Visit http://www.dynamicdrive.com/ for full source code** 16/8/03 - Amended by Andrew Toon to included an Expand and Collapse* Image. See http://www.sysadmintips.com************************************************/var href = "../pict/plus.gif";var img_expand  = 	href	// Holds the Collapsed image.var href = "../pict/minus.gif";	var img_collapse = href	// Holds the expanded image.// Split out the file name from the "img_expand" path. If the variable// "img_expand" above doesn't have a path (i.e. "plus.gif" instead of// "/images/plus.gif", then the search won't fine the last "/" and will// return -1, however we are adding one onto the returned value, so we would// infact get 0, so it will still find the file name, because it will//start from 0.var img_expand_num = img_expand.lastIndexOf('/') + 1var img_expand_file_name = img_expand.substring(img_expand_num)  var enablepersist="of" //Enable saving state of content structure using session cookies? (on/off)var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)if (document.getElementById){document.write('<style type="text/css">')document.write('.switchcontent{display:none;}')document.write('</style>')}function getElementbyClass(classname){ccollect=new Array()var inc=0var alltags=document.all? document.all : document.getElementsByTagName("*")for (i=0; i<alltags.length; i++){if (alltags[i].className==classname)ccollect[inc++]=alltags[i]}}function contractcontent(omit){var inc=0while (ccollect[inc]){if (ccollect[inc].id!=omit)ccollect[inc].style.display="none"// Reset all the images to a plus. Then in the "expandcontent" function the selected// item will be set to minus.imgid1="i" + ccollect[inc].idif (document.getElementById(imgid1) != null) {	document.getElementById(imgid1).src=img_expand}inc++}}function expandcontent(cid){if (typeof ccollect!="undefined"){// Hold the prvious setting of the button so you know if the item was in a expanded or// contracted state. This way if they clicked on the same item that was selected before then// we can reset the image to the correct one.imgid="i" + cidif (document.getElementById(imgid) != null) {	curimg=document.getElementById(imgid).src}if (collapseprevious=="yes")contractcontent(cid)document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"// Only change the image to a minus if it was a plus before. Otherwise it must have been a minus// before, and has already been reset to plus by the "contractcontent" function.if (document.getElementById(imgid) != null) {	var file_name_num = curimg.lastIndexOf('/') + 1	var file_name = curimg.substring(file_name_num)  	if (file_name == img_expand_file_name) {		document.getElementById(imgid).src=img_collapse	}}}}function revivecontent(){contractcontent("omitnothing")selectedItem=getselectedItem()selectedComponents=selectedItem.split("|")for (i=0; i<selectedComponents.length-1; i++)document.getElementById(selectedComponents[i]).style.display="block"// Now reset the image to a collapse icon, if it has been selected.if (selectedComponents[1] != "none" && document.getElementById("i"+selectedComponents[0]) != null) {	document.getElementById("i"+selectedComponents[0]).src=img_collapse}}function get_cookie(Name) { var search = Name + "="var returnvalue = "";if (document.cookie.length > 0) {offset = document.cookie.indexOf(search)if (offset != -1) { offset += search.lengthend = document.cookie.indexOf(";", offset);if (end == -1) end = document.cookie.length;returnvalue=unescape(document.cookie.substring(offset, end))}}return returnvalue;}function getselectedItem(){if (get_cookie(window.location.pathname) != ""){selectedItem=get_cookie(window.location.pathname)return selectedItem}elsereturn ""}function saveswitchstate(){var inc=0, selectedItem=""while (ccollect[inc]){if (ccollect[inc].style.display=="block")selectedItem+=ccollect[inc].id+"|"inc++}document.cookie=window.location.pathname+"="+selectedItem}function do_onload(){// prend les href des images d'apres les elements linksif (document.getElementById){img_collapse = document.getElementById("img_collapse").href;img_expand = document.getElementById("img_expand").href;var dummyImage1 = new Image();dummyImage1.src = img_collapse;var dummyImage2 = new Image();dummyImage2.src = img_expand;img_expand_num = img_expand.lastIndexOf('/') + 1;img_expand_file_name = img_expand.substring(img_expand_num);uniqueidn=window.location.pathname+"firsttimeload"getElementbyClass("switchcontent")if (enablepersist=="on" && typeof ccollect!="undefined"){document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page loadif (!firsttimeload)revivecontent()}}}if (window.addEventListener)window.addEventListener("load", do_onload, false)else if (window.attachEvent)window.attachEvent("onload", do_onload)else if (document.getElementById)window.onload=do_onloadif (enablepersist=="on" && document.getElementById)window.onunload=saveswitchstate/************************************************ End of "Switch Content script"***********************************************/