






var quickLinksHTML = '<select onchange="navigateWithQuickLinks(this)">'
                      + '<option>Quick Links</option>'

					  + '<option value="../government/bcc/agendas.html|_self">BCC Agenda</option>'

					  + '<option value="http://www.mcohio.org/montcnty/RESOLUTIONS/DEFAULTSELECT.CFM|_self">BCC Resolutions</option>'

					  + '<option value="../visiting/directions.html|_self">Driving Directions</option>'

					  + '<option value="../visiting/parking.html|_self">Parking Garages</option>'

					  + '<option value="../services/hr/jobs.html|_self">Find a Job</option>'

					  + '<option value="http://www.phdmc.org/index.php?/programs/vital_statistics/|_new">Birth & Death Records</option>'

					  + '<option value="http://www.mcohio.org/RZ/RZ_bidsummary.cfm|_self">Online Bids</option>'

					  + '<option value="../services/phone.html|_self">Phone Numbers</option>'

					  + '<option value="http://www.mcrealestate.org/Main/Home.aspx|_self">Real Estate Records</option>'

					  + '<option value="../government/clerkofcourts/search_public_record.html|_self">Search County Court Records</option>'

					  + '<option value="http://www.miamivalleycrimestoppers.com/|_self">Sheriffs Most Wanted</option>'

					  + '<option value="http://www.mctreas.org/|_self">Tax Information Record Search</option>'

					  + '<option value="../site_map/index.html|_self">Site Map</option>'

                      + '</select>';
//----- Bottom Nav table
var bottomRowHTML = '<table cellspacing="0" cellpadding="0" border="0" width="100%" class="lowernavlinks"><tr>';


bottomRowHTML += '<td align="center" height="30" class="lowernavlinks"> <a style="font-size: 8pt"'
			   + ' href="government/index.html"'
			   + ' target="_self">'
			   + 'Government</a></td>';

bottomRowHTML += '<td align="center" height="30" class="lowernavlinks"> <a style="font-size: 8pt"'
			   + ' href="services/index.html"'
			   + ' target="_self">'
			   + 'Services</a></td>';

bottomRowHTML += '<td align="center" height="30" class="lowernavlinks"> <a style="font-size: 8pt"'
			   + ' href="visiting/index.html"'
			   + ' target="_self">'
			   + 'Visiting</a></td>';

bottomRowHTML += '<td align="center" height="30" class="lowernavlinks"> <a style="font-size: 8pt"'
			   + ' href="business/index.html"'
			   + ' target="_self">'
			   + 'Business</a></td>';

bottomRowHTML += '<td align="center" height="30" class="lowernavlinks"> <a style="font-size: 8pt"'
			   + ' href="http://www.mcohio.org/meetings.html"'
			   + ' target="_self">'
			   + 'Meetings</a></td>';

bottomRowHTML += '<td align="center" height="30" class="lowernavlinks"> <a style="font-size: 8pt"'
			   + ' href="index.html"'
			   + ' target="_self">'
			   + 'Home</a></td>';



bottomRowHTML += '</table>';

//----- Left Tabs Table
var browseAsHTML =
				'<table id="browseastable" class="topleftlinks" width="100%" cellspacing="0" cellpadding="4" border="0">'
              + '<tr>'
              + '<td class="browseitalic"></td>';


var label = "6";

browseAsHTML += ''
			 + '<td valign="middle" class="browse" onmouseover="onLabel=true; dropChange('
			 + '\'' + label + '\''
			 + ', 1);" onmouseout="onLabel=false; setTimeout(\'revertDrop()\', 2000);"> '
			 + '<a class="browse" href="'
			 + 'government/index.html'	//remove ../
			 + '" target="'
			 + '_self'
			 + '">'
			 + 'Government</a>'
			 + '</td>'


var label = "7";

browseAsHTML += ''
			 + '<td valign="middle" class="browse" onmouseover="onLabel=true; dropChange('
			 + '\'' + label + '\''
			 + ', 1);" onmouseout="onLabel=false; setTimeout(\'revertDrop()\', 2000);"> '
			 + '<a class="browse" href="'
			 + 'services/index.html'	//remove ../
			 + '" target="'
			 + '_self'
			 + '">'
			 + 'Services</a>'
			 + '</td>'


var label = "8";

browseAsHTML += ''
			 + '<td valign="middle" class="browse" onmouseover="onLabel=true; dropChange('
			 + '\'' + label + '\''
			 + ', 1);" onmouseout="onLabel=false; setTimeout(\'revertDrop()\', 2000);"> '
			 + '<a class="browse" href="'
			 + 'visiting/index.html'	//remove ../
			 + '" target="'
			 + '_self'
			 + '">'
			 + 'Visiting</a>'
			 + '</td>'


var label = "10";

browseAsHTML += ''
			 + '<td valign="middle" class="browse" onmouseover="onLabel=true; dropChange('
			 + '\'' + label + '\''
			 + ', 1);" onmouseout="onLabel=false; setTimeout(\'revertDrop()\', 2000);"> '
			 + '<a class="browse" href="'
			 + 'business/index.html'	//remove ../
			 + '" target="'
			 + '_self'
			 + '">'
			 + 'Business</a>'
			 + '</td>'


var label = "43";

browseAsHTML += ''
			 + '<td valign="middle" class="browse" onmouseover="onLabel=true; dropChange('
			 + '\'' + label + '\''
			 + ', 1);" onmouseout="onLabel=false; setTimeout(\'revertDrop()\', 2000);"> '
			 + '<a class="browse" href="'
			 + 'http://www.mcohio.org/meetings.html'	//remove ../
			 + '" target="'
			 + '_self'
			 + '">'
			 + 'Meetings</a>'
			 + '</td>'


var label = "50";

browseAsHTML += ''
			 + '<td valign="middle" class="browse" onmouseover="onLabel=true; dropChange('
			 + '\'' + label + '\''
			 + ', 1);" onmouseout="onLabel=false; setTimeout(\'revertDrop()\', 2000);"> '
			 + '<a class="browse" href="'
			 + 'index.html'	//remove ../
			 + '" target="'
			 + '_self'
			 + '">'
			 + 'Home</a>'
			 + '</td>'

             + '</tr>'
             + '</table>';
//----- Right Tabs Table
var mainTabsHTML = '<table id="maintabstable"  align="center" width="100%" cellspacing="0" cellpadding="0" border="0">'
                 + '<tr>'

                    + '</tr>'
                 + ' </table>';
var topTabsHTML =

			
			
			
			
			
			
			
			
			'<span style="vertical-align: bottom;">'
                  + '<table id="toprighttable" class="toprighttable" border="0" cellspacing="0" cellpadding="0" align="right">'

					+ '<tr>'
					+ '<td class="toprightlabels">'
					
					+ '<a href="http://www.mcohio.org/RZ/search_results.cfm"><img src="http://www.mcohio.org/images/search.gif" alt="Search" width="100" height="15" border="0"></a>'
			+ '</td>'
			+ '</tr>'
			+ '</table>'
			+ '</span>';

var onTable = false;
var onLabel = false;
//----- Dropdown menu table
var tableHeader = '<table width="100%" height="100%" border="0" class="dropdown" cellpadding="0" cellspacing="0" onmouseover="onTable = true; " onmouseout="onTable = false; setTimeout(\'revertDrop()\', 2000);">';
var tableFooter = '</tr></table>';
var filteredList;
var dropdownList;
var color1;
var color2;
var color3;
var dropdownlist1 = new Array();
var dropdownlist2 = new Array();

function navigateWithQuickLinks(formElement) 
{
	var url = formElement.value;
	if (url == '') return;
	var targer = "";
	var pos = url.indexOf("|");
	if (pos != -1)
	{
		target = url.substring(pos+1);
		url = url.substring(0,pos);
	}
	url = replacesubstring(url,"../","");
	RZgoto(url, target);
}

function RZsubstring(str, startpos, endpos)
{
	if (typeof endpos == 'undefined') endpos = str.length + 1

	//----- Validate input string
	if (str == null || str.length == 0)	//if null or empty string
		return "";						//...return empty string

	//----- Validate end position
	if (endpos > str.length )			//greater than string length
		endpos = str.length;			//...set to length

	else if( endpos <= 0 )				//if end position before 1st character
		return "";						//...return empty string

	//----- Validate start position
	if( startpos >= endpos )  			//if start position greater than ending position
		return "";						//...return empty string

	else if (startpos < 0) 				//if start position less than 0
		startpos = 0;					//...assume 0

	//----- Return the substring
	return str.substring(startpos,endpos);
}
function replacesubstring( inStr, fromString, toString )
{
	var pos = 0
	if (inStr == null
	|| typeof inStr.length == 'undefined' //true or false
	|| inStr.length == 0) return '';

	var fromLen = fromString.length
	if (fromLen == 0) return inStr

	while (true)
	{
		pos = inStr.indexOf(fromString,pos)
		if (pos == -1) break
		inStr = RZsubstring( inStr, 0, pos )
		      + toString
		      + RZsubstring( inStr, pos + fromLen )
		pos += toString.length
	}
	return inStr
}


function setUpDropDowns() {

		dropdownlist1.length++;
		dropdownlist1[dropdownlist1.length - 1]
			= new DropdownItem( "1",
								"History",
								"http://www.mcohio.org/our_county/history/index.html",
								"_self");

		dropdownlist1.length++;
		dropdownlist1[dropdownlist1.length - 1]
			= new DropdownItem( "6",
								"Elected Officials, Courts and Government Agencies",
								"http://www.mcohio.org/government/index.html",
								"_self");

		dropdownlist1.length++;
		dropdownlist1[dropdownlist1.length - 1]
			= new DropdownItem( "8",
								"Events, Maps, Parking and Contact Information for County Facilities",
								"http://www.mcohio.org/visiting/index.html",
								"_self");

		dropdownlist1.length++;
		dropdownlist1[dropdownlist1.length - 1]
			= new DropdownItem( "7",
								"Listing of Services Provided by Montgomery County",
								"http://www.mcohio.org/services/index.html",
								"_self");

		dropdownlist1.length++;
		dropdownlist1[dropdownlist1.length - 1]
			= new DropdownItem( "10",
								"Information for New or Existing Businesses in Montgomery County",
								"http://www.mcohio.org/business/index.html",
								"_self");

		dropdownlist1.length++;
		dropdownlist1[dropdownlist1.length - 1]
			= new DropdownItem( "43",
								"Public Meeting Information",
								"http://www.mcohio.org/.html",
								"_self");



}

function addTabs() {
	if (document.getElementById("browseas")) {
		var browseascell = document.getElementById("browseas");
		browseascell.innerHTML = browseAsHTML;
		var maintabscell = document.getElementById("maintabs");
		maintabscell.innerHTML = mainTabsHTML;
		var toptabscell = document.getElementById("toptabs");
		toptabscell.innerHTML = topTabsHTML;
		var bottomnavcell = document.getElementById("lowerNavRow");
		bottomnavcell.innerHTML = bottomRowHTML;
	} else {
		document.all.browseas.innerHTML = browseAsHTML;
		document.all.maintabs.innerHTML = mainTabsHTML;
		document.all.toptabs.innerHTML = topTabsHTML;
		if (document.all.lowerNavRow) {
			document.all.lowerNavRow.innerHTML = bottomRowHTML;
		}
	}

	if (document.all && document.all != undefined) {
		document.all.quickLinksLayer.innerHTML = quickLinksHTML;
	} else if (document.getElementById("quickLinksLayer")) {
		var qL = document.getElementById("quickLinksLayer");
		qL.innerHTML = quickLinksHTML;
	}
	document.body.style.marginTop = "0px";
}

function getArrayForTabNumber(dropdownlist, tabNumber) {
	var resultArray = new Array();
	for (var i = 0; i < dropdownlist.length; i++) {
		if (dropdownlist[i].tabNumber == tabNumber) {
			resultArray.length++;
			resultArray[resultArray.length - 1] = dropdownlist[i];
		}
	}
	return resultArray;
}

function DropdownItem(tabNumber, label, link, target) {
	this.tabNumber = tabNumber;
	this.label = label;
	this.link = link;
	this.target = target;
}

function RZgoto(url, target)
{
	url = RZbaseurl(url)
	if (target != 'true' && target != '_new')
		location = url;
	else
		window.open(url)	//always new window, no features
//		RZpopupUrl( '', url )	//always new window, no features
}

function RZbaseurl(url)
{
	//----- Append baseurl to url (location does not honor html <link...> tag)
	//		TODO: validate all browsers ignore html <link...> tag
	//		(also may need to consider links starting with ../)
	if (url.substring(0,4) != "http" && url.substring(0,4) != "www.")
		url = RZ.baseurlprefix + url
	return url
}


function dropChange(tabLabel, listNumber) {
	dropdownlist = (listNumber == 1 ? dropdownlist1 : dropdownlist2);
	filteredList = getArrayForTabNumber(dropdownlist, tabLabel);

	color1 = (listNumber == 1 ? "#32597A" : "#32597A");
	
	color2 = (listNumber == 1 ? "#DDDDDD" : "#DDDDDD");
	
	color3 = (listNumber == 1 ? "#FFFFFF" : "#FFFFFF");
	var dropdownText = "";
	var cellWidth = 100 / (filteredList.length > 0 ? filteredList.length : 1) + 1;
	var dropdownrow = '<tr class="dropdownrow" style="color:' + color1 + '; background-color:' + color2 + ';">';
	for (i = 0; i < filteredList.length; i++) {
		if (i != 0) {
			//This is the border bar for the dropdowns.
			dropdownText += '<td width="1" bgcolor=' + color1 + '>'
			              + '<img style="visibility:hidden; width:1" /></td>';
		}
		dropdownText += '<td align="center" width="' + cellWidth + '%"'
		        	  + ' onclick="RZgoto('
		        	  + 	"'"
		        	  + 	filteredList[i].link
					  + 	"','"
					  + 	filteredList[i].target
		        	  + 	"'"
					  + 	')"'
					  + ' style="color:' + color1 + '"'
					  + ' onmouseover="dropdownColorSwap(this, true);"'
					  + ' onmouseout="dropdownColorSwap(this, false);">'
					  + filteredList[i].label
					  + '</td>';
	}
	if (document.all && document.all != undefined) {
		document.all["horizdrop"].innerHTML = tableHeader + dropdownrow + dropdownText + tableFooter;
	} else if (document.getElementById("horizdrop")) {
		var horizdrop = document.getElementById("horizdrop");
		horizdrop.innerHTML = tableHeader + dropdownrow + dropdownText + tableFooter;
	}
}

function revertDrop(tabNumber) {
	if (!onTable && !onLabel) {
		if (document.all && document.all != undefined) {
			document.all["horizdrop"].innerHTML = tableHeader + "<td></td>" + tableFooter;
		} else {
			var horizdrop = document.getElementById("horizdrop");
			horizdrop.innerHTML = tableHeader + "<td></td>" + tableFooter;
		}
	}
}

function dropdownColorSwap(cell, over) {
	if (over) {
		cell.style.backgroundColor = color1;
		cell.style.color = color3;
	} else {
		cell.style.backgroundColor = color2;
		cell.style.color = color1;
	}
}

 function clearSearch(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }
