//IE4 throws javascript errors when java disabled. This method catches 
//those errors and suppresses them.
onerror=handleErr
function handleErr(msg,url,l){
	return true;
}

//Hides all toggle sub-menus. If javascript is disabled on the client browser, the toggles won't collapse.
function hide_all() {
	var arr = document.getElementsByTagName("dt");
    for (var i = 1; i<=arr.length; i++) {
        document.getElementById('smenu'+i).style.display='none';
		document.getElementById('toggle'+i).innerHTML = " [ + ]";
    }
}

function show_all() {
	var arr = document.getElementsByTagName("dt");
    for (var i = 1; i<=arr.length; i++) {
        document.getElementById('smenu'+i).style.display='block';
		document.getElementById('toggle'+i).innerHTML = " [ - ]";
    }
}

function show(id, toggle) {
	
	var d = document.getElementById(id);
	var tog = document.getElementById(toggle);
	/*var arr = document.getElementsByTagName("dt");
		for (var i = 1; i<=arr.length; i++) {
			if (document.getElementById('smenu'+i)) {
				document.getElementById('smenu'+i).style.display='none';
				document.getElementById('toggle' + i).innerHTML = " [ + ]";
			}
		}*/
	if (d) {
		if (d.style.display == 'none') {
			d.style.display='block';
			tog.innerHTML = " [ - ]";
		}
		else {
			d.style.display = 'none';
			tog.innerHTML = " [ + ]";
		}
	}
}

var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css){
    lyr.css.visibility = "visible";
  }
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

function initButton(id){
		//Highlight the initial state of the serving ohio buttons/links
		resetButtons();
		//document.getElementById(id).style.backgroundColor="#3A5DBF";
		document.getElementById(id).src = "img/tabs_governor_on.gif";
}

/*function resetButtons(){
	//grab all the buttons and drop the style off the links
	var panel = document.getElementById("serving_buttons");
	var mainlinks = panel.getElementsByTagName("a");
	var mainMenuA;

	//reset the buttons to show no background on the link/button elements
	for (k=0; k < mainlinks.length; k++) {
		if (mainlinks[k].id.toString() != ""){
				mainMenuA = document.getElementById(mainlinks[k].id);
				mainMenuA.style.background = "none";
				mainMenuA.style.backgroundColor = "#a0c3df";
				mainMenuA.style.color = "#FFFFFF";
		}
	}
	
}*/

//Used in conjunction with the Government Tabs on the homepage. Resets all buttons to the "off" image.
function resetButtons() {
    if (document.getElementById('linkServing_Ohio') != null) {
        document.getElementById('linkServing_Ohio').src = "img/tabs_governor.gif";
    }
    if (document.getElementById('linkExecutive') != null) {
        document.getElementById('linkExecutive').src = "img/tabs_executive.gif";
    }
    if (document.getElementById('linkJudicial') != null) {
        document.getElementById('linkJudicial').src = "img/tabs_judicial.gif";
    }
    if (document.getElementById('linkLegislative') != null) {
        document.getElementById('linkLegislative').src = "img/tabs_legislative.gif";
    }
}
    

function checkEmail() {
var email = document.getElementById('email');
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email.value)) {
	alert('Please provide a valid email address!');
	email.focus
	return false;
	}
}

<!-- Begin
ContactMaxLen = 1200; // max number of characters allowed

function checkContactInput(form) {
if (form.message.value.length > ContactMaxLen) // if too long.... trim it!
form.message.value = form.message.value.substring(0, ContactMaxLen);
// otherwise, update 'characters left' counter
else form.ContactremLen.value = ContactMaxLen - form.message.value.length;
}
//-->

//IE4 and Netscape4 should not use any of the CSS styles or Javascript.  They are too old for most of the functionality to work properly.
//This function detects for IE4 and Netscape4, IE5+, Netscape 5+, and any other browser (Mozilla, Firefox, Safari, etc).  It sets no styles
//or Javascript for IE4 or less, Netscape4 or less. It sets a special style for IE5, and the default styles for IE6+ and the other browsers.
function detectBrowser() {
    var IE5detected = false;
    var Net5detected = false;
	var stylesheet1; 
	var stylesheet2;
	var jScript;
	
	//for modern browsers
	if (document.getElementById) {
		stylesheet1 = document.getElementById("default_css");
		stylesheet2 = document.getElementById("ie5_css");
		jScript = document.getElementById("standard_js");
	}
	//for older browsers (IE4)
	else if (document.all) {
		stylesheet1 = document.all["default_css"];
		stylesheet2 = document.all["ie5_css"];
		jScript = document.all["standard_js"];
	}
	
	stylesheet1.disabled = true;
	stylesheet2.disabled = true;
	jScript.disabled = true;
    
    //detect IE 5.x+
    var version=0
    if (navigator.appVersion.indexOf("MSIE")!=-1){
        temp=navigator.appVersion.split("MSIE");
        version=parseFloat(temp[1]);
        
        if (version >= 5) {
            IE5detected = true;
        }
    }
    
    //detect Netscape 5.x+
    if (navigator.appName=="Netscape" && parseFloat(navigator.appVersion) >= 5.0) {
        Net5detected = true;
    }
    
    //if either browser detected, enable CSS and Javascript
    if (IE5detected || Net5detected) {
		
		if (IE5detected && version < 6) {
			stylesheet1.disabled = true;
			stylesheet2.disabled = false;
		}
		else {
			stylesheet1.disabled = false;
			stylesheet2.disabled = true;
		}
		
		jScript.disabled = false;
    }
	//IE5 or Netscape5 not detected - could be older browser or different browser
	else {
		//detect IE version 4.x -        
        if (version < 5 && version != 0) {
			stylesheet1.disabled = true;
			stylesheet2.disabled = true;
			jScript.disabled = true;
		}
		//detect Netscape 4.x -
		else if(navigator.appName=="Netscape" && parseFloat(navigator.appVersion) < 5.0) {
			stylesheet1.disabled = true;
			stylesheet2.disabled = true;
			jScript.disabled = true;
		}
		//some other browser - Mozilla, Firefox, etc
		else {
			stylesheet1.disabled = false;
			stylesheet2.disabled = true;
			jScript.disabled = false;
		}
	}
}

//remove the word "search" from the search bar when the user selects the textbox
function clearSearch() {
	var box = document.getElementById("text_search");
	if (box.value == "search" || box.value == undefined) {
		box.value = "";
	}
}

//populate the search box with "search" for IE
function setSearch() {
	var box = document.getElementById("text_search");
	box.value = "search";
}
        
/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

/************ Highlights **************/

	var highlights=null,highlights_total=0,highlights_current=1,highlights_return=false;

	function highlights_update() {
		$("div.highlights ul.nav li a.active").removeClass("active");
		var items = $("div.highlights ul.nav li");
		if(highlights_return) {
			$(items[highlights_return-1]).find("a").addClass("active");
		} else {
			$(items[highlights_current-1]).find("a").addClass("active");
		}
	}

	function highlights_rotate() {
		highlights_current++;
		if(highlights_current > highlights_total) { highlights_current = 1; }
		highlights_show(highlights_current);
	}

	function highlights_show(story) {
		highlights_current = story;
		highlights_update();
		$("div.highlights div.highlight ul li:visible").fadeOut(800);
		var items = $("div.highlights div.highlight ul li");
		$(items[story-1]).fadeIn(1600);
	}

	function highlights_prepare() {
		highlights_total = $("div.highlights div.highlight ul li").length;
		highlights = setInterval(highlights_rotate,8000);
		$("div.highlights").hover(function() { clearInterval(highlights); highlights=null; },function() { highlights = setInterval(highlights_rotate,8000); });
		$("div.highlights ul.nav li a").click(function() { highlights_show($(this).text()); return false; });
	}


/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
* Special Ajax for toggles in right column
* Start toggle and menu numbers at 11
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpageRight(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpageRight(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpageRight(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){ 
document.getElementById(containerid).innerHTML=page_request.responseText
var i= 0;
for (i=11;i<=12;i++){
document.getElementById('smenu' +i).style.display='none';
document.getElementById('toggle' +i).innerHTML = " [ + ]";
}
}
}

/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=15//Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="/img/tip.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function SetActiveTab(tabControl, tabNumber) 
{
var ctrl = $find(tabControl); 
ctrl.set_activeTab(ctrl.get_tabs()[tabNumber]); 
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip
