<!--

//****************************************************
//**********  Area Expander/Collapser code  **********
//****************************************************

	var expanderIconClosedOff = new Image();
	expanderIconClosedOff.src = "/images/common/expander/expander-icon-closed-off.gif";
	var expanderIconClosedOver = new Image();
	expanderIconClosedOver.src = "/images/common/expander/expander-icon-closed-over.gif";
	var expanderIconBusy = new Image();
	expanderIconBusy.src = "/images/common/expander/expander-icon-busy.gif";
	var expanderIconOpenOff = new Image();
	expanderIconOpenOff.src = "/images/common/expander/expander-icon-open-off.gif";
	var expanderIconOpenOver = new Image();
	expanderIconOpenOver.src = "/images/common/expander/expander-icon-open-over.gif";
	
	var areaExpanders = new Array();
	var expanderActive = false;
	var expanderIcon;
	var expanderTargetHeight;
	var expanderCurrentHeight;
	var expanderIncrement;
	var expanderInterval;
	var socialNetworkIndex;
	
	function initExpanders() {
		if(document.getElementsByClassName) {
			findExpanders = document.getElementsByClassName("areaExpander");
		} else {
			findExpanders = getElementsByClass("areaExpander",document,"div");
		}
		for(x=0; x<findExpanders.length ;x++) {
			// create area expander objects in an array
			areaExpanders[x] = new areaExpander(findExpanders[x], x);
		}
	}
	
	function areaExpander(getDiv, getIndex) {
		this.oDiv = getDiv;
		this.index = getIndex;
		// check initial expansion setting
		if(this.oDiv.className.indexOf("startOpen") > -1) {
			this.expanded = true;
		} else {
			this.expanded = false;
		}
		// check to see if this is the social networking area
		if(this.oDiv.className.indexOf("socialNetworkLinks") > -1) {
			this.socialNetworkLinks = true;
			socialNetworkIndex = this.index;
		} else {
			this.socialNetworkLinks = false;
		}
		// look for existing initContent div
		if(document.getElementsByClassName) {
			if(this.oDiv.getElementsByClassName("initContent")[0]) {
				this.initContent = this.oDiv.getElementsByClassName("initContent")[0];
				this.useInitContent = true;
			} else {
				this.useInitContent = false;
			}
		} else {
			if(getElementsByClass("initContent",this.oDiv,"div")[0]) {
				this.initContent = getElementsByClass("initContent",this.oDiv,"div")[0];
				this.useInitContent = true;
			} else {
				this.useInitContent = false;
			}
		}
		// get first H2
		this.firstH2 = this.oDiv.getElementsByTagName("H2")[0];
		this.firstH2clean = this.firstH2.innerHTML;
		// set 'closed' height for expander
		if(this.useInitContent) {
			this.closedHeight = parseFloat(this.initContent.offsetHeight);
		} else {
			this.closedHeight = parseFloat(this.firstH2.offsetHeight);
		}
		// set 'open' height for expander
		this.openHeight = parseFloat(this.oDiv.offsetHeight);
		// resize closed areas
		if(!this.expanded) this.oDiv.style.height = this.closedHeight + "px";
		// add expander link to h2 for closed areas
		this.firstH2closedHTML = "<a href='javascript:toggleAreaExpander(" + this.index + ");' title='Click here to expand this area' onmouseover='hoverExpanderIcon(" + this.index + ",true);' onmouseout='hoverExpanderIcon(" + this.index + ",false);'>";
		this.firstH2closedHTML += this.firstH2.innerHTML + "<\/a>";
		if(!this.expanded) {
			this.firstH2.innerHTML = this.firstH2closedHTML;
			this.oDiv.style.overflow = "hidden";
		}
		// add expander arrow icon to area
		this.iconHTML = "<div id='expanderIcon_" + this.index + "' class='areaExpanderIcon'>";
		this.iconHTML += "<a href='javascript:toggleAreaExpander(" + this.index + ");' onmouseover='hoverExpanderIcon(" + this.index + ",true);' onmouseout='hoverExpanderIcon(" + this.index + ",false);'>";
		this.iconHTML += "<img src='/images/common/expander/expander-icon-closed-off.gif' width='18' height='18' border='0' alt='' title='' /><\/a><\/div>";
		this.oDiv.innerHTML += this.iconHTML
		this.arrowIcon = document.getElementById("expanderIcon_" + this.index);
		this.arrowIcon.className = "areaExpanderIcon";
		this.arrowIconImg = this.arrowIcon.getElementsByTagName("IMG")[0];
		this.setExpanderIcon();
	}
	
	areaExpander.prototype.setExpanderIcon = function() {
		if(this.expanded) {
			this.arrowIconImg.src = expanderIconOpenOff.src;
			this.arrowIconImg.alt = "Click here to minimize this area";
			this.arrowIconImg.title = "Click here to minimize this area";
		} else {
			this.arrowIconImg.src = expanderIconClosedOff.src;
			this.arrowIconImg.alt = "Click here to expand this area";
			this.arrowIconImg.title = "Click here to expand this area";
		}
	}
	
	function hoverExpanderIcon(getIndex,getMode) {
		thisExpander = areaExpanders[getIndex];
		if(!expanderActive) {
			if(getMode) {
				if(thisExpander.expanded) {
					thisExpander.arrowIconImg.src = expanderIconOpenOver.src;
				} else {
					thisExpander.arrowIconImg.src = expanderIconClosedOver.src;
				}
			} else {
				if(thisExpander.expanded) {
					thisExpander.arrowIconImg.src = expanderIconOpenOff.src;
				} else {
					thisExpander.arrowIconImg.src = expanderIconClosedOff.src;
				}
			}
		}
	}
	
	function toggleAreaExpander(getIndex) {
		if(!expanderActive) {
			expanderActive = true;
			thisExpander = areaExpanders[getIndex];
			thisExpander.oDiv.style.overflow = "hidden";
			if(thisExpander.expanded) {
				// store an updated value for openHeight (in case of dynamic changes)
				thisExpander.openHeight = parseFloat(thisExpander.oDiv.offsetHeight);
				// is open
				expanderTargetHeight = thisExpander.closedHeight;
				expanderCurrentHeight = thisExpander.openHeight;
				thisExpander.arrowIconImg.src = expanderIconBusy.src;
				expanderIncrement = (expanderCurrentHeight - expanderTargetHeight) / 20;
				expanderInterval = setInterval("resizeAreaExpander(" + getIndex + ", false);", 5);
				// settings for social networking content
				if(thisExpander.socialNetworkLinks == true) {
					document.getElementById("socialBookmarks").className = "";
					document.getElementById("socialBookmarksHelp").className = "";
					document.getElementById("socialHelpLink").style.display = "inline";
				}
			} else {
				// is closed
				expanderTargetHeight = thisExpander.openHeight;
				expanderCurrentHeight = thisExpander.closedHeight;
				thisExpander.arrowIconImg.src = expanderIconBusy.src;
				expanderIncrement = (expanderTargetHeight - expanderCurrentHeight) / 20;
				expanderInterval = setInterval("resizeAreaExpander(" + getIndex + ", true);", 5);
				// settings for social networking content
				if(thisExpander.socialNetworkLinks == true) {
					document.getElementById("socialBookmarks").className = "show";
					document.getElementById("socialBookmarksHelp").className = "show";
					document.getElementById("socialHelpLink").style.display = "none";
				}
			}
		}
	}
	
	function resizeAreaExpander(getIndex, getMode) {
		if(expanderActive) {
			thisExpander = areaExpanders[getIndex];
			if(getMode) {
				// open the area
				if((expanderCurrentHeight + expanderIncrement) < expanderTargetHeight) {
					expanderCurrentHeight += expanderIncrement;
					thisExpander.oDiv.style.height = expanderCurrentHeight + "px";
				} else {
					expanderActive = false;
					thisExpander.expanded = true;
					clearInterval(expanderInterval);
					expanderInterval = null;
					// tidy up
					expanderCurrentHeight = expanderTargetHeight;
					thisExpander.oDiv.style.overflowY = "visible";
					thisExpander.oDiv.style.height = "auto";
					thisExpander.oDiv.getElementsByTagName("H2")[0].innerHTML = thisExpander.firstH2clean;
					thisExpander.setExpanderIcon();
				}
			} else {
				// close the area
				if((expanderCurrentHeight - expanderIncrement) > expanderTargetHeight) {
					thisExpander.oDiv.style.overflowY = "hidden";
					expanderCurrentHeight -= expanderIncrement;
					thisExpander.oDiv.style.height = expanderCurrentHeight + "px";
				} else {
					expanderActive = false;
					thisExpander.expanded = false;
					clearInterval(expanderInterval);
					expanderInterval = null;
					// tidy up
					expanderCurrentHeight = expanderTargetHeight;
					thisExpander.oDiv.style.height = expanderCurrentHeight + "px";
					thisExpander.oDiv.getElementsByTagName("H2")[0].innerHTML = thisExpander.firstH2closedHTML;
					thisExpander.setExpanderIcon();
				}
			}
		}
	}
	


// -->