
	/* myscript.js */

	/* Code for coolbar (on left of each page) */

	// Set some "constant" values for the script.
	// Makes playing with look and feel a lot easier.

	var sOffBackColor = "lavender";				/* "threedface"; */
	var sOffTextColor = "menutext";
	var sOffBorderColor = "lavender";				/* "threedface"; */
	var sOffPadding = "1px 1px 1px 1px";

	var sOverBackColor = "ghostwhite";				/* "threedface"; */
	var sOverTextColor = "menutext";
	var sOverBorderColor = "threedhighlight threedshadow threedshadow threedhighlight";
	var sOverPadding = "1px 1px 1px 1px";

	var sDownBackColor = "oldlace";				/* "window"; */
	var sDownTextColor = "menutext";
	var sDownBorderColor = "threedshadow threedhighlight threedhighlight threedshadow";
	var sDownPadding = "2px 0px 0px 2px";

	var sPaneName = "";
	var eActiveButton = null;

	// Two helper functions:
	//    one to set button padding and one to set button image

	function SetButtonPadding(eButton,sPaddingStyle)
	{
		eButton.rows[0].cells[0].style.padding = sPaddingStyle;
//		eButton.rows[0].cells[1].style.padding = sPaddingStyle;
	}
	
	function SetButtonImage(eButton,sState)
	{
//		var eImg = eButton.rows[0].cells[0].children[0];
//		if (eImg) 
//		{
//			var sImgSrc = eImg.src;
//			if (sImgSrc.match(/_(\w+)\.gif/)) 
//			{
//				eImg.src = sImgSrc.replace(RegExp.$1,sState);
//			}
//		}
	}
	
	// Four event-handler functions

	function button_over(eButton)
	{

		// If we're just mousing about within the button, then bail

		if (window.event && eButton.contains(window.event.fromElement)) return false;

		// Otherwise change button style

		eButton.style.backgroundColor = sOverBackColor;
		eButton.style.color = sOverTextColor;
		if (eActiveButton != eButton)
		{
			eButton.style.borderColor = sOverBorderColor;
		//	SetButtonImage(eButton,"over");
		}
	}


	function button_out(eButton)
	{
		// If we're just mousing about within the button, then bail
		
		if (window.event && eButton.contains(window.event.toElement)) return false;

		// Otherwise change button style

		if (eActiveButton != eButton)
		{
			eButton.style.backgroundColor = sOffBackColor;
			eButton.style.borderColor = sOffBorderColor;
			eButton.style.color = sOffTextColor;
			SetButtonPadding(eButton,sOffPadding);
		//	SetButtonImage(eButton,"off");
		}
		else
		{
			eButton.style.backgroundColor = sDownBackColor;
			eButton.style.borderColor = sDownBorderColor;
			eButton.style.color = sDownTextColor;
		}
	}

	function button_down(eButton)
	{
		eButton.style.borderColor = sDownBorderColor;
		SetButtonPadding(eButton,sDownPadding);
	}

	function button_up(eButton)
	{
		var sURL;

		// If another button is active, reset it

		if (null != eActiveButton && eButton != eActiveButton)
		{
			eActiveButton.style.backgroundColor = sOffBackColor;
			eActiveButton.style.borderColor = sOffBorderColor;
			eActiveButton.style.color = sOffTextColor;
		//	SetButtonImage(eActiveButton,"off");
			SetButtonPadding(eActiveButton,sOffPadding);
			eActiveButton = null; 

			// insert code here for button hiding 
			//window.status = window.defaultStatus;
		}

		// If the button we clicked is not the active button, make it active

		if (eButton != eActiveButton)  
		{
			eActiveButton = eButton;
			eActiveButton.style.borderColor = sDownBorderColor;
			eActiveButton.style.color = sDownTextColor;
			SetButtonPadding(eActiveButton,sDownPadding);
			sPaneName = eActiveButton.id.replace(/tbl(.*)Button/,"$1");

			// insert code here for button showing 
			//window.status = "Now showing: " + sPaneName;
		}

		// Otherwise, reset it

		else  
		{
			eActiveButton.style.backgroundColor = sOverBackColor;
			eActiveButton.style.borderColor = sOverBorderColor;
			eActiveButton.style.color = sOverTextColor;
			SetButtonPadding(eActiveButton,sOverPadding);
			eActiveButton = null;

			// insert code here for button hiding 
			//window.status = window.defaultStatus;
		}

		// msgbox "button clicked: " & z_eButton.id
		
		if ( g_bCoolbarInit ) return;
		
		//objRe.Pattern = "tbl(.*)Button";
		var sButtonName = eActiveButton.id.replace(/tbl(.*)Button/,"$1");
		switch (sButtonName)
		{
			case "Home"	:
				sURL = "index5";
				break;
			case "Contact"	:
				sURL = "contact5";
				break;
			case "Events"	:
				sURL = "events5";
				break;
			case "Location"	:
				sURL = "location5";
				break;
			case "Links"	:
				sURL = "links5";
				break;
			case "Extras"	:
				sURL = "extras5";
				break;
			case "Rates"	:
				sURL = "rates5";
				break;
			case "Accommodation"	:
				sURL = "accom5";
				break;
			case "Photos"	:
				sURL = "photos5";
				break;
			case "Gallery"	:
				sURL = "gallery5";
				break;


		}
		
		self.location.href = sURL + ".htm";

	}
	/*	End code for coolbar */
