// show each individual summary elements from the recordset

function showSummary(x){
sumArea = document.getElementById("summary"+x).style
sumArea.display = "block"

mytext = document.getElementById("notice"+x).style
mytext.display = "none"

return true
	}

// fudge for showing 2 sets of records on criminology page
function showSummary1(x){
sumArea = document.getElementById("summary"+x).style
sumArea.display = "block"

mytext = document.getElementById("notice"+x).style
mytext.display = "none"

return true
	}
	
// close each individual summary element

function closeSummary(x){
sumArea = document.getElementById("summary"+x).style
sumArea.display = "none"
mytext = document.getElementById("notice"+x).style
mytext.display = "block"

return true
	}

function closeSummary1(x){
sumArea = document.getElementById("summary"+x).style
sumArea.display = "none"
mytext = document.getElementById("notice"+x).style
mytext.display = "block"

return true
	}
	
// expand all summary elements
	
function expandAll(v){

	myCount = document.getElementById("total")
	 for(i=0;i<myCount.childNodes.length;i++){
		mytotal = myCount.childNodes[i].lastChild.nodeValue
			if(v=="y"){		
			showAll(mytotal)}
			else if(v=="n"){	
			closeAll(mytotal)
			
			}
		return true
		}
}	

function showAll(x){			
			for(i=1;i<=x;i++){
			sumArea = document.getElementById("summary"+i).style
			sumArea.display = "block"
			
			mytext = document.getElementById("notice"+i).style
			mytext.display = "none"	
			}
return true
}


function closeAll(x){			
			for(i=1;i<=x;i++){
			sumArea = document.getElementById("summary"+i).style
			sumArea.display = "none"
			
			mytext = document.getElementById("notice"+i).style
			mytext.display = "block"
			}
return true
}

// stylesheet changer for text sizes, load specific additional sheet then set size cookie
	
function setActiveStyleSheet(title) {
	linksFound = document.getElementsByTagName("link")
	for (i=0; i<linksFound.length; i++) {
	thisLink = linksFound[i]
		if (thisLink.getAttribute("rel").indexOf("style") > -1 && thisLink.getAttribute("title")) {
		thisLink.disabled = true
			if (thisLink.getAttribute("title") == title) {
			thisLink.disabled = false
				}
		}
	}
	textCookie(title)
}
	
function textCookie(size){
	document.cookie = "textsize=" +size+ ";;path=/";

}

// generic cookie value extraction

function cookieVal(cookieName) 
{
	thisCookie = document.cookie.split("; ");
	for (i=0; i<thisCookie.length; i++) 
	{
		if (cookieName == thisCookie[i].split("=")[0])
		{
			return thisCookie[i].split("=")[1];
		}
	}
	return 0;
}

// called from body onload to see if a size has been set in present session

function SetCookie() {
	tCookie = cookieVal("textsize")
		if (tCookie){
		setActiveStyleSheet(tCookie)
		}
}