﻿{

	var highlightedloc= "";
	var targetWin="_self";
	var targetURL="#";
	
	onhome=new Image;
	onhome.src= "images/on-home.gif";
	onfacilities=new Image;
	onfacilities.src= "images/on-facilities.gif";
	onpeople=new Image;
	onpeople.src= "images/on-people.gif";
	oncustomers=new Image;
	oncustomers.src= "images/on-customers.gif";
	onquality=new Image;
	onquality.src= "images/on-quality.gif";
	ontruth=new Image;
	ontruth.src= "images/on-truth.gif";
	onlink=new Image;
	onlink.src= "images/on-link.gif";
	oncontact=new Image;
	oncontact.src= "images/on-contact.gif";
	onads=new Image;
	onads.src= "images/on-ads.gif";
	
	function over(x,y)
	{
		if(document.images){
			document.images[x].src="images/"+y+"-"+x+".gif";
		}
	}
	
	function unde(x,y)
	{
		if(document.images){
			document.images[y].src="images/"+x+".gif";
		}
	}
	
	function jumploc()
	{
		document.location.target=targetWin;
		document.location.href=targetURL;
	}
	function loc(name,x,y){
		var objLayer;
		var locatorLayer;
		var xadjust=0;
		var yadjust=28;
		//get locator's x coordinates andset adjustment value
		locatorLayer=document.getElementById("locator");
	 	xadjust=xadjust+findPosX(locatorLayer);
		//yadjust=yadjust+findPosY(locatorLayer);
		
		//get pin, and set pin
		document.getElementById("loclabel").innerHTML=name;
			
		objLayer=document.getElementById("pin");
		objLayer.style.visibility="visible";
		objLayer.style.left=(xadjust+x)+"px";
		objLayer.style.top=(yadjust+y)+"px";
		//objLayer.style.top=y+"px";
		}
		
	function findPosX(obj)
	{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	function findPosY(obj)
	{
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	}
	
	function switchClass(p_obj){
			var obj1;
			
			//clear all
			if(highlightedloc!="")
			{
				obj1=document.getElementById(highlightedloc);
				obj1.className="l";
			}
			
			//record
			highlightedloc=p_obj;
			
			obj1=document.getElementById(p_obj);
			obj1.className="lselected";
			
			targetWin="_self";
			
			//set URL
			if(p_obj=="athena")
			{
				targetURL="athenajl.php";
			}else if(p_obj=="mmloc" || p_obj=="mbloc"){
				targetURL="ma-hm.php";
			}else if(p_obj=="wmmloc" || p_obj=="wmbloc"){
				targetURL="ma-hwm.php";
			}else if(p_obj=="gwloc"){
				targetURL="http://www.thegardensofwilbraham.com/";
				targetWin="_blank";
			}else{
				targetURL=p_obj;
				targetURL=targetURL.replace("loc","");
				targetURL=targetURL+".htm";
			}
			
			
		}
		
}

