//Default to Certain Section in Expand Sections
//Requirements:
//1. Sections need to be named "icon_XX" where XX is the variable
//2. Query parameter needs to be called "expand"
//3. Anchor tag section needs to be the same as the XX variable to auto scroll
function defaultExpand() {
	var browserName=navigator.appName; 
	var expand = getURLParam('expand') || '';
	if (expand != '' && document.getElementById("icon_" + expand)) {
		if (browserName=="Microsoft Internet Explorer") {
			document.getElementById("icon_" + expand).fireEvent("onclick");
		}
		else {
			var evt = document.createEvent("MouseEvents");
			evt.initEvent("click", true, true);
			document.getElementById("icon_" + expand).dispatchEvent(evt); 
	
		}		
		
		var link = '#' + expand;
		window.location.href += link;
	}
}


/***********************************************************************/
/* Expand/Collapse Content
/* - Rewritten from UOS version to allow explicit always expand or always collapse parameter
/* - Third parameter definition:
/*		0 - behaves normally as a toggle
/*		1 - opens all elements
/* 		2 - closes all elements
/***********************************************************************/
function toggleIconRevised(obj, a_id, state) {
	var opener = document.getElementById(a_id)
	var content = getElementsByClass(obj);
	iconState = opener.firstChild.alt;
	iconState = iconState.replace("Collapse","");
	iconState = iconState.replace("Expand","");

	for ( i=0;i<content.length;i++ ) {
		//Toggle
		if(state == 0) {
			if (content[i].style.display != "none" ) {
				content[i].style.display = 'none';
				opener.firstChild.src = opener.firstChild.src.replace("collapse","expand");
				opener.firstChild.alt = 'Expand' + iconState;
			} 
			else {
				content[i].style.display = '';
	           	opener.firstChild.src = opener.firstChild.src.replace("expand","collapse");
				opener.firstChild.alt = 'Collapse' + iconState;
	
			}	
		}
		//Open
		if(state == 1) {
			content[i].style.display = '';
           	opener.firstChild.src = opener.firstChild.src.replace("expand","collapse");
			opener.firstChild.alt = 'Collapse' + iconState;
		}	
		//Close
		if(state == 2) {
			content[i].style.display = 'none';
			opener.firstChild.src = opener.firstChild.src.replace("collapse","expand");
			opener.firstChild.alt = 'Expand' + iconState;	
		}		
	}
}