﻿<!--
/***********************************************
* Switch Content script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* 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)

var contractsymbol='- ' //HTML for contract symbol. For image, use: <img src="whatever.gif">
var expandsymbol='+ ' //HTML for expand symbol.
var curopen = "";		// keeps track of IDs of revealed abstracts; list separated by "|"


if (document.getElementById){
document.write('<style type="text/css">')
document.write('.abstracttxt{display:none;}')
document.write('</style>')
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var thestate=(ec=="expand")? "block" : "none"
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=thestate;
altercuropen(thestate,ccollect[inc].id);
inc++
}
var tcollect = checkdivptr.getElementsByTagName("p");
tcollect = getElementbyClass(tcollect,"abstracttxt");
inc=0;
while (tcollect[inc]) {
	tcollect[inc].style.display=thestate;
	altercuropen(thestate,tcollect[inc].id);
	inc++
};
document.getElementById("container").focus();
}

function panelclick(evt) {
	var iet = (BrowserDetect.browser == "Explorer");
	var obj = (!iet) ? evt.currentTarget : event.srcElement;
	if (!obj) {return};
	if (iet) {if (obj.tagName.toLowerCase()=="input") {return}}
	else if (evt.target.tagName.toLowerCase() == "input") {return};
	var parr = obj.parentNode.getElementsByTagName("p");
	if (!parr[0]) {return;};
	newdisp = (parr[0].style.display == "block") ? "none" : "block";
	for (var i=0;i<parr.length;i++) {
		parr[i].style.display=newdisp;
	};
};


function contractcontent(){
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display="none"
inc++
}
}

function doswitch(idx, status) {
	document.getElementById(idx).style.display = status;
};

function altercuropen(switcher, cid) {
	var curloc = curopen.indexOf(cid);
	if (curloc > 0) { if (curopen.indexOf("|"+cid) != curloc - 1) {curloc = curopen.indexOf(cid,curloc+1)}};
	if (switcher == "block") {	//make sure when writing to curopen that the id in the string is not part of some larger id (like starting with an x)
		if (curloc==-1) {curopen += cid+"|"}
	}
	else {
		if (curloc!=-1) {curopen = curopen.substring(0,curloc)+curopen.substring(curloc+cid.length+1,curopen.length)};
	};
};

function expandcontent(curobj, cid){
// curobj is unused, was used for a character that indicates an openable item
if (ccollect.length>0 && document.getElementById(cid)) {
	switcher = document.getElementById(cid).style.display;
	switcher = (switcher != "block") ? "block" : "none";
	doswitch(cid,switcher);
	altercuropen(switcher,cid);
};
}

function revivecontent(firsttime){
contractcontent()
selectedItem = (firsttime) ? getselectedItem() : curopen;
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
expandcontent(document, selectedComponents[i]);
}

function expandbysearch(formobj){
// fix icab to do a regular submit when "enter" is pressed
var obj=formobj.elements["searchterm"]
var searchterm=obj.value
var selObj = window.getSelection();
if (selObj == null || selObj == "") {checkdivptr.focus()};
var inc=0
while (ccollect[inc]){
	if (ccollect[inc].innerHTML.toLowerCase().search(searchterm.toLowerCase())>0 ) {
		if (ccollect[inc].style.display == "none") {expandcontent(null,ccollect[inc].getAttribute("id"))};
	}
inc++
}
var tcollect = checkdivptr.getElementsByTagName("p");
tcollect = getElementbyClass(tcollect,"abstracttxt");
inc=0;
while (tcollect[inc]) {
	if (tcollect[inc].innerHTML.toLowerCase().search(searchterm.toLowerCase())>0 ) {
		if (tcollect[inc].style.display == "none") {expandcontent(null,tcollect[inc].getAttribute("id"))};
	};
	inc++
};
if (window.find) {window.find(searchterm, false, false, true, false,false, false)};
return false; //nothing gets submitted so no page reload
}


function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="block")
statecollect[inc].innerHTML=contractsymbol
else
statecollect[inc].innerHTML=expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
var temcook = unescape(document.cookie);
offset = temcook.indexOf(search)
if (offset != -1) { 
offset += search.length
end = temcook.indexOf(";", offset);
if (end == -1) end = temcook.length;
returnvalue=temcook.substring(offset, end)
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie("revealed") != ""){
selectedItem=get_cookie("revealed")
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].getAttribute("id")+"|"
inc++
}
expire = new Date(2008,0,1,12,0);
document.cookie= "revealed="+escape(selectedItem)+"; expires=15/01/2008 00:00:00";
document.cookie= "checked="+ escape(curcheck)+"; expires=15/01/2008 00:00:00";
}

function do_onsubmit() {
return;
event.stopImmediatePropagation();
event.preventDefault();
}

// -->
