// Javascript to allow toggle display of <div>'s
// 
// Then, anywhere within the BODY of your doc, where you want it to appear, you would include something like this...
// 
// First example I posted above:
// 
// <div onClick="expandcontent('sc1')">1. Expandable Option 1</div>
// <div id="sc1" class="switchcontent">
// <span>Some text/content here</span>
// </div>
// <div onClick="expandcontent('sc2')">2. Expandable Option 2</div>
// <div id="sc2" class="switchcontent">
// <span>Some text/content here</span>
// </div>
// <div onClick="expandcontent('sc3')">3. Expandable Option 3</div>
// <div id="sc3" class="switchcontent">
// <span>Some text/content here</span>
// </div>
// 
// 
// Second (hidden table) example I posted above:
// 
// <span onClick="expandcontent('sc1')">Expandable Option</span>
// <div id="sc1" class="switchcontent">
// <table border="xx" width="xx" cellpadding="xx" cellspacing="xx">
// <tr><td>
// Table content here (could include many cells too)
// </td></tr></table>
// </div>
// 
// 
// The above example only calls for one choice/one table. You can include as many "expandcontent()" divs/spans as you'd like. Just make certain that you increment them by number correctly...
// expandcontent('sc1')
// expandcontent('sc2')
// expandcontent('sc3')
// expandcontent('sc4')
// expandcontent('sc5')
// etc., etc. ...
// 
// Also make certain that the corresponding div id's are also incremented by number correctly...
// <div id="sc1" class="switchcontent">
// <div id="sc2" class="switchcontent">
// <div id="sc3" class="switchcontent">
// <div id="sc4" class="switchcontent">
// <div id="sc5" class="switchcontent">
// etc., etc. ... 
// 

var enablepersist="on" //Enable saving state of content structure? (on/off)
if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function collapseAllSearchCriteriaRows() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchCriteriaRow') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchCriteriaRowExpanded').style.display = 'none';			
				document.getElementById('searchCriteriaRowContracted').style.display = '';			
			}
		}
	}
}

function expandAllSearchCriteriaRows() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchCriteriaRow') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchCriteriaRowContracted').style.display = 'none';			
				document.getElementById('searchCriteriaRowExpanded').style.display = '';			
			}
		}
	}
}

function collapseAllSearchCriteriaRowsIfOpen() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchCriteriaRow') {
			if (row.style.display != 'none'){
				row.style.display = 'none';
				document.getElementById('searchCriteriaRowExpanded').style.display = 'none';			
				document.getElementById('searchCriteriaRowContracted').style.display = '';			
			}
		}
	}
}

function collapseAllSearchResultsDetailRowsIfOpen() {
	collapseSearchResultsDetailRow1();
	collapseSearchResultsDetailRow2();
	collapseSearchResultsDetailRow3();
	collapseSearchResultsDetailRow4();
	collapseSearchResultsDetailRow5();
	collapseSearchResultsDetailRow6();
	collapseSearchResultsDetailRow7();
	collapseSearchResultsDetailRow8();
	collapseSearchResultsDetailRow9();
	collapseSearchResultsDetailRow10();
}

function collapseSearchResultsDetailRow1() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow1') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow1Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow1Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow1() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow1') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow1Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow1Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow2() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow2') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow2Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow2Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow2() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow2') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow2Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow2Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow3() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow3') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow3Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow3Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow3() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow3') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow3Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow3Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow4() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow4') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow4Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow4Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow4() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow4') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow4Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow4Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow5() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow5') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow5Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow5Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow5() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow5') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow5Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow5Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow6() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow6') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow6Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow6Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow6() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow6') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow6Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow6Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow7() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow7') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow7Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow7Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow7() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow7') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow7Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow7Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow8() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow8') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow8Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow8Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow8() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow8') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow8Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow8Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow9() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow9') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow9Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow9Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow9() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow9') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow9Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow9Expanded').style.display = '';			
			}
		}
	}
}

function collapseSearchResultsDetailRow10() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow10') {
			if (row.style.display == '') {
				row.style.display = 'none'
				document.getElementById('searchResultsDetailRow10Expanded').style.display = 'none';			
				document.getElementById('searchResultsDetailRow10Contracted').style.display = '';			
			}
		}
	}
}

function expandSearchResultsDetailRow10() {
	var rows = document.getElementsByTagName('tr');
	for (var i=0; i<rows.length; i++) {
		var row = rows[i];
		if (row.className == 'searchResultsDetailRow10') {
			if (row.style.display == 'none') {
				row.style.display = '';
				document.getElementById('searchResultsDetailRow10Contracted').style.display = 'none';			
				document.getElementById('searchResultsDetailRow10Expanded').style.display = '';			
			}
		}
	}
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (var 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"){
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
selectedItem=cid+"|"+document.getElementById(cid).style.display
}
}
function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
contractcontent(selectedComponents[0])
document.getElementById(selectedComponents[0]).style.display=selectedComponents[1]
}
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(){
if (typeof selectedItem!="undefined")
document.cookie=window.location.pathname+"="+selectedItem
}
function do_onload(){
getElementbyClass("switchcontent")
if ((enablepersist=="undefined" || enablepersist=="on") && getselectedItem()!="")
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=="undefined" || enablepersist=="on") && document.getElementById)
window.onunload=saveswitchstate

