// JavaScript Document



// ----- START Text Resizer -----
// set the font size according to the user's preference, called by setFontSize() or user click
function chgFontSz(i) {
	var bodyID = document.getElementsByTagName("body")[0];
	setCookie(i);
	switch(i) {
		case "1":
			bodyID.style.fontSize="100%";
			break;
		case "2":
			bodyID.style.fontSize="115%";
			break;
		case "3":
			bodyID.style.fontSize="130%";
			break;
	}
	return false
}

// saves the font size preference to a cookie, expires in one year
function setCookie(i) {
	var nextyear = new Date();
	nextyear.setFullYear(nextyear.getFullYear() + 1);
	document.cookie = "fontsize=" + i + "; expires=" + nextyear.toGMTString() + "; path=/";
}

// sets the font size according to the cookie value, called by onload
function setFontSize() {
	var allCookies = document.cookie;
	var pos = allCookies.indexOf("fontsize=");
	if (pos != -1) {
		var start = pos + 9;
		var end = allCookies.indexOf(";", start);
		if (end == -1) end = allCookies.length;
		var value = allCookies.substring(start, end);
		chgFontSz(value);
	}
}
// ----- END Text Resizer -----


// ----- START Search box focus/blur clear + refill -----
function clearBox(objID) {
	if (objID.value == 'Search') {
		objID.value = '';
	}
}

function fillBox(objID) {
	if (objID.value == '') {
		objID.value = 'Search';
	}
}
// ----- END Search box focus/blur clear + refill -----


// ----- START MM Jump Select Menu function -----
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
// ----- END MM Jump Select Menu function -----

// ----- START Toggle Show Hide function -----
function showhide(hideableObj,textObj) {
	
	if (document.getElementById(hideableObj).style.display == 'none') {
		document.getElementById(hideableObj).style.display = 'block';
		if (textObj != "null") {
			document.getElementById(textObj).innerHTML = 'Hide individual notes';
		}
	} else {
		document.getElementById(hideableObj).style.display = 'none';
		if (textObj != "null") {
			document.getElementById(textObj).innerHTML = 'Select individual notes';
		}
	}
}
// ----- END Toggle Show Hide function -----


// ----- START Searchbox return submit -----
function submitenter(myfield,e)
    {
        var keycode;
        if (window.event) keycode = window.event.keyCode;
        else if (e) keycode = e.which;
        else return true;

        if (keycode == 13)
        {
            window.location.href='/search.aspx?usterms=' + document.getElementById('searchfield').value;
            return false;
        }
        else
            return true;
    }
// ----- END Searchbox return submit -----


