﻿	/* 	(BEGIN DOCUMENTATION)
		Author: 		Dynamic Drive
		Modifications:	Sean Harcar
		Last Modified:	04/26/2007
		Note: 			This (open) source code has been modified from the original source code (by Sean Harcar). If you wish to view the original
						source code from this tutorial example please visit "http://www.dynamicdrive.com/dynamicindex1/dropmenuindex_dev.htm"
						
						Simply copy and paste the original source code into some text file and save it with a .html extention. Then view it in your
						preferred web browser. From here you can modify this file to more precisely fit your needs. Please attempt to support open
						source either through donations, or advertisement. Remember they are helping you right now, just as they are helping me.
		(END DOCUMENTATION)
	*/	


/******************************************************************************************************************************************************/
/***** BEGIN LEGAL STUFF ******************************************************************************************************************************/
/******************************************************************************************************************************************************/
	/* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com) 																			      */
	/* This notice MUST stay intact for legal use 																									  */
	/* Visit http://www.dynamicdrive.com/ for full source code 																						  */
/******************************************************************************************************************************************************/
/***** END LEGAL STUFF ********************************************************************************************************************************/
/******************************************************************************************************************************************************/


//Contents for menu 1
//Note: This array is not currently used, due to the fact that there is no content to create a drop down menu currently underneath of the home tab.
var menu1=new Array()
	menu1[0]='<a href="">Link1</a>'
	menu1[1]='<a href="">Link2</a>'
	menu1[2]='<a href="">Link3</a>'
	menu1[3]='<a href="">Link4</a>'

//Contents for menu 2, and so on
var menu2=new Array()
	menu2[0]='<a href="http://www.co.butler.pa.us/butler/cwp/view.asp?a=1494&q=608548&butlerNav=|33534|33544|">Deeds and Mortgages</a>'
	menu2[1]='<a href="http://www.co.butler.pa.us/butler/cwp/view.asp?a=1494&q=608555&butlerNav=|33534|33544|">UCC</a>'
	menu2[2]='<a href="http://www.co.butler.pa.us/butler/cwp/view.asp?a=1494&q=608562&butlerNav=|33534|33544|">Other Real Estate</a>'
	menu2[3]='<a href="http://www.co.butler.pa.us/butler/cwp/view.asp?a=1494&q=608569&butlerNav=|33534|33544|">Miscellaneous</a>'


//Note: This array is not currently used, due to the fact that there is no content to create a drop down menu currently underneath of the schedule/hours tab.	
var menu3=new Array()
	menu3[0]='<a href="">Link1</a>'
	menu3[1]='<a href="">Link2</a>'
	menu3[2]='<a href="">Link3</a>'
	menu3[3]='<a href="">Link4</a>'

//Note: This array is not currently used, due to the fact that there is no content to create a drop down menu currently underneath of the access deeds tab.		
var menu4=new Array()
	menu4[0]='<a href="">Link1</a>'
	menu4[1]='<a href="">Link2</a>'
	menu4[2]='<a href="">Link3</a>'
	menu4[3]='<a href="">Link4</a>'	







var menuwidth='250px' //default menu width
var menubgcolor='lightyellow' //menu bgcolor
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
	document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')



/******************************************************************************************************************************************************/
/***** FUNCTION getposOffset **************************************************************************************************************************/
/******************************************************************************************************************************************************/
function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
		}//END While
	
	return totaloffset;
}//END FUNCTION



/******************************************************************************************************************************************************/
/***** FUNCTION showhide ******************************************************************************************************************************/
/******************************************************************************************************************************************************/
function showhide(obj, e, visible, hidden, menuwidth,tab){
  tab.className='highlighted';
  
	if (ie4||ns6)
		dropmenuobj.style.left=dropmenuobj.style.top="-500px"

	if (menuwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=menuwidth
		}//END if
		
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
		obj.visibility=visible
	else if (e.type=="click")
		obj.visibility=hidden
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION iecompattest **************************************************************************************************************************/
/******************************************************************************************************************************************************/
function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION clearbrowseredge **********************************************************************************************************************/
/******************************************************************************************************************************************************/
function clearbrowseredge(obj, whichedge){
	var edgeoffset=0
	
	// BEGIN LEVEL 1 if
	if (whichedge=="rightedge"){
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth

			// BEGIN LEVEL 2 if
			if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
				edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
				//END LEVEL 2 if
		}//END LEVEL 1 if
	
	//BEGIN LEVEL 1 else
	else{
		var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
			
			//BEGIN LEVEL 2 if
			if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
				edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
				
					//BEGIN LEVEL 3 if
					if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
						edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
						//END LEVEL 3 if
			}//END LEVEL 2 if
		}//END LEVEL 1 else
		
	return edgeoffset
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION populatemenu **************************************************************************************************************************/
/******************************************************************************************************************************************************/
function populatemenu(what){
	if (ie4||ns6)
		dropmenuobj.innerHTML=what.join("")
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION dropdownmenu **************************************************************************************************************************/
/******************************************************************************************************************************************************/
function dropdownmenu(obj, e, menucontents, menuwidth){
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
		clearhidemenu()

	dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
	populatemenu(menucontents)
	
	if(obj.id === 'current')
		(dropmenuobj).className = 'currentTabMenu';
	else
		(dropmenuobj).className = undefined;
	
	if (ie4||ns6){
		showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth,obj)
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
	}//END if

	return clickreturnvalue()
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION clickreturnvalue **********************************************************************************************************************/
/******************************************************************************************************************************************************/
function clickreturnvalue(){
	if (ie4||ns6) return false
	else return true
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION contains_ns6 **************************************************************************************************************************/
/******************************************************************************************************************************************************/
function contains_ns6(a, b) {
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
	
	return false;
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION dynamichide **************************************************************************************************************************/
/******************************************************************************************************************************************************/
function dynamichide(e){
	if (ie4&&!dropmenuobj.contains(e.toElement))
		delayhidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
		delayhidemenu()
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION hidemenu ******************************************************************************************************************************/
/******************************************************************************************************************************************************/
function hidemenu(e){
    if(e!='li1')
		changeTab();
	//BEGIN LEVEL 1 if
	if (typeof dropmenuobj!="undefined"){
		//BEGIN LEVEL 2 if
		if (ie4||ns6)
			dropmenuobj.style.visibility="hidden"
			//END LEVEL 2 if
	}//END LEVEL 1 if
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION delayhidemenu *************************************************************************************************************************/
/******************************************************************************************************************************************************/
function delayhidemenu(){
	if (ie4||ns6)
		delayhide=setTimeout("hidemenu()",disappeardelay)
}//END FUNCTION




/******************************************************************************************************************************************************/
/***** FUNCTION clearhidemenu *************************************************************************************************************************/
/******************************************************************************************************************************************************/
function clearhidemenu(){
	if (typeof delayhide!="undefined")
		clearTimeout(delayhide)
}//END FUNCTION





if (hidemenu_onclick=="yes")
	document.onclick=hidemenu
