<!--
/***********************************************
* Contractible Headers 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
***********************************************/

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //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"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

//*** Swap Image
//if (document.images) {
///   var pic1 = new Image();
//   pic1.src = "../images/left_arrow.gif";
//   var pic2 = new Image();
//   pic2.src = "../images/down_arrow.gif";
//}

function show_left_arrow() {
	if (document.images) {
		document["pic"].src = pic1.src;
	}
}

function show_down_arrow() {
	if (document.images) {
		document["pic"].src = pic2.src;
	}
}	



//**** Fix for onkeypress
function switchContent(e,rid,iLevel,iStatus) {
   var characterCode; //literal character code will be stored in this variable
   var mouseCode;
   var imgRef = 'im_'+rid;
   
   var icon_left = "/images/closed_arrow.gif"
   var icon_down = "/images/down_arrow.gif"
   var icon_high = "/images/left_arrowWhite.gif"
   // Arrows according to levels
   //if(iLevel==2) {
   //		icon_left = "/images/left_arrow.gif"
  //		icon_down = "/images/down_arrow.gif"				
   //}
   
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which; //character code is contained in NN4's which property
		mouseCode = e.type; //Capture mouse events
	} else {
		e = event;
		characterCode = e.keyCode; //character code is contained in IE's keyCode property
		mouseCode = e.type; //Capture mouse events
	}

	if(characterCode == 13||mouseCode=='click'){ //if generated character code is equal to ascii 13 (if enter key) or click
		expandcontent(rid);
	}
	// Swap colours
	if(document.getElementById(rid)){
		var cid = rid.substr(1)
		 if(document.getElementById(rid).style.display=="block")  {
		  //if{document.getElementById(rid).style.display=="../images/down_arrow3.gif") {
			//var regexp = /s/; //expanding, change to 3 so it stays high
			//cid.replace(regexp,"");
			//alert(cid);
			//changeImga(imgRef,2)
			document.getElementById(imgRef).src = icon_high;
			//changeNavBKG(cid,2,iLevel); 
			
			
		} else {
		 //{document.getElementById(rid).style.display=="../images/left_arrow.gif")
		//	changeImga(imgRef,1,)
			//if(iStatus==3) {
				document.getElementById(imgRef).src = icon_high;
			//} else {
			//	document.getElementById(imgRef).src = icon_left;
			//}
			//changeNavBKG(cid,3,iLevel); //collapsing, so set to over to it changes to normal
		}
	}	
	
}

function changeNavBKG(rid,iStatus, iLevel){
	// Change background on rollover
	var icon_down = "/images/left_arrow.gif"
    var icon_high = "/images/left_arrowWhite.gif"
	var imgRef = 'im_s'+rid;
	
	var strClass = 'clink'+iLevel;
	var strClassOver ='clink'+iLevel+'_2';
	var strClassHigh = 'clink'+iLevel+'_3';
	
	if(iLevel==1) {
		var strClass = rid+strClass;
		var strClassOver = rid+strClassOver;
		var strClassHigh = rid+strClassHigh;
	}
	
	//alert(strClass);
	
	if(iStatus==1) { // simple rollover unless it's hightlighted
		if(document.getElementById(rid).className != strClassHigh) {
			document.getElementById(rid).className = strClassOver;
			if(iLevel==1) document.getElementById(imgRef).src = icon_high;
		}	
	} else if(iStatus==2) { // change to hightlight
		document.getElementById(rid).className = strClassHigh;
		if(iLevel==1) document.getElementById(imgRef).src = icon_high;
	} else if(iStatus==3) { // return to normal when closing
		document.getElementById(rid).className = strClassOver;
		if(iLevel==1) document.getElementById(imgRef).src = icon_high;
	} else { // return unless it's highlighted
		if(document.getElementById(rid).className != strClassHigh) { 
			document.getElementById(rid).className = strClass;
			if(iLevel==1) document.getElementById(imgRef).src = icon_down;
		}	
	}	

}

function revivecontent(){
	
	var icon_down = "/images/down_arrow.gif"
	
	contractcontent("omitnothing");
	selectedItem=getselectedItem();
	selectedComponents=selectedItem.split("|");
	for (i=0; i<selectedComponents.length-1; i++){
		document.getElementById(selectedComponents[i]).style.display="block";
		document.getElementById('im_'+selectedComponents[i]).src = icon_down;
	}
}

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(){
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(intThisPage>5&&doHighPage) changeNavBKG('c'+intThisPage,1,intThisLevel);
}


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
//-->
