
function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// begin footer placement
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('wrapper').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
			}
			else {
				footerElement.style.top = '0px';
			}
		}
	}
}

window.onload = function() {
	setFooter();
}

window.onresize = function() {
	setFooter();
}
// end foot placement

// begin contract content
var enablepersist="off"

if (document.getElementById){
	document.write('<style type="text/css">')
	document.write('.switchcontent{display:none;}')
	document.write('</style>')
}

function getElementbyClass(classname){
	ccollect = new Array()
	var inc = 0
	var alltags = document.all? document.all : document.getElementsByTagName("*")
	for (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"){
		if (document.getElementById(cid).style.display != "block") {
			contractcontent(cid)
			document.getElementById(cid).style.display = (document.getElementById(cid).style.display!="block")? "block" : "none"
			selectedItem = cid+"|"+document.getElementById(cid).style.display
		}
		//subnav_timeout();
	}
}

function subnav_timeout() {
	//snto = window.setTimeout('closeSubNav()', 10000);
}

function load_timeout() {
	//snto = window.setTimeout('closeSubNav()', 10000);
}

function cancel_timeout(snto) {
	//window.clearTimeout(snto);
}

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 == "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 == "on" && document.getElementById)
	window.onunload = saveswitchstate
// end contract content

// begin close subnav
function closeSubNav() {
	var div = document.getElementsByTagName('div');
	for (var i=0;i<div.length;i++) {
		if (div[i].className == 'switchcontent')
			div[i].style.display = 'none';
	}
}
// end close subnav

// begin crumbtrail
function breadCrumbs(base,delStr,defp,cStyle,tStyle,dStyle,nl) {
	loc=window.location.toString();subs=loc.substr(loc.indexOf(base)+base.length+1).split("/");
	document.write('<a href="'+getLoc(subs.length-1)+defp+'" class="'+cStyle+'">Home</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
	a=(loc.indexOf(defp)==-1)?1:2;for (i=0;i<(subs.length-a);i++) { subs[i]=makeCaps(unescape(subs[i]));
	document.write('<a href="'+getLoc(subs.length-i-2)+defp+'" class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');}
	if (nl==1) document.write("<br>");document.write('<span class="'+tStyle+'">'+document.title+'</span>');
}
function makeCaps(a) {
	g=a.split(' ');for (l=0;l<g.length;l++) g[l]=g[l].toUpperCase().slice(0,1)+g[l].slice(1);
	g=a.split('_');for (l=0;l<g.length;l++) g[l]=g[l].toUpperCase().slice(0,1)+g[l].slice(1);
	return g.join(" ");
}
function getLoc(c) {
	var d="";if (c>0) for (k=0;k<c;k++) d=d+"../"; return d;
}
// end crumbtrail
