function notAvailable(x)
{
	// Stub out a menu function in admin.
}

function imgOn(imgName) 
{
    if(document.getElementById(imgName))
    {
        document.getElementById(imgName).src = "GUI/"+ imgName + "_over.gif";
    }
}
function imgOff(imgName) 
{
    if(document.getElementById(imgName))
    {
        document.getElementById(imgName).src = "GUI/"+ imgName + ".gif"; 
    }
}

function imgOnAdmin(imgName) 
{
    if(document.getElementById(imgName))
    {
        document.getElementById(imgName).src = "../GUI/"+ imgName + "_over.gif";
    }
}
function imgOffAdmin(imgName) 
{
    if(document.getElementById(imgName))
    {
        document.getElementById(imgName).src = "../GUI/"+ imgName + ".gif"; 
    }
}

function imgOnVirtual(imgName, rootVirtualPath) 
{
    if(document.getElementById(imgName))
    {
        document.getElementById(imgName).src = rootVirtualPath + "GUI/"+ imgName + "_over.gif";
    }
}

function imgOffVirtual(imgName, rootVirtualPath) 
{
    if(document.getElementById(imgName))
    {
        document.getElementById(imgName).src = rootVirtualPath + "GUI/"+ imgName + ".gif"; 
    }
}

function imgOnOrOffFullPath(imgName, imgLocaltion) 
{
    if(document.getElementById(imgName))
    {
        document.getElementById(imgName).src = imgLocaltion;
    }
}

function imgOnM(img, ID, bEdit)
{
	var sPrefix = "";
	if (bEdit)
	{
		sPrefix = "../";
	}
	document.getElementById(img + ID).src = sPrefix + "gui/" + img + "_i.gif";
}


function imgOffM(img, ID, bEdit)
{
	var sPrefix = "";
	if (bEdit)
	{
		sPrefix = "../";
	}
	document.getElementById(img + ID).src = sPrefix + "gui/" + img + "_o.gif";
}


// Cross-browser function to add a function to the onload event.
function AddOnload(myfunc)
{
	if(window.addEventListener)	// FireFox
	{
		window.addEventListener('load', myfunc, false);
	}
	else if(window.attachEvent)	// IE
	{
		window.attachEvent('onload', myfunc);
	}
	else if (window.onload)
	{
		var func = window.onload; 
		window.onload = function()
		{
			func();
			myfunc();
		}
	}
	else
	{
		window.onload = myfunc();
	}
}


// The hover function:
//  If there is a child sub-menu, show it on mouseover, hide it on mouseout!
var sfHover = function()
{
	var menu = document.getElementById("menu");
	if (!menu)
	{
		return;
	}
	var listItems = menu.getElementsByTagName("LI");
	for (var i = 0; i < listItems.length; i++)
	{
		listItems[i].onmouseover = function()
		{
			if (this.getElementsByTagName("UL").length > 0)
			{
				// Show the sub-menu
				this.getElementsByTagName("UL").item(0).style.display = "block";
			}
		}
		listItems[i].onmouseout = function()
		{
			if (this.getElementsByTagName("UL").length > 0)
			{
				// Hide the sub-menu
				this.getElementsByTagName("UL").item(0).style.display = "none";
			}
		}
	}
}

AddOnload(sfHover);	// Activate the menus when the page loads...

//NavHome, NavStore, NavBookings, NavNews, NavInfo, NavAbout, NavContact
function syncNav(sRootURL, sActivePageID)
{

	if(sActivePageID == "")
	{
		sActivePageID = GetQuery("Nav");
	}
		
	if (!sActivePageID)
	{
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		
		/***At root page(http://www.freedommachine.com.au)***/
		if(sPage == "")
		{
			var sLocationHref = window.location.href ;
			sLocationHref = RemoveLastSlice(sLocationHref)
			sRootURL = RemoveLastSlice(sLocationHref)
			if (sLocationHref == sRootURL) sPage = "index.shtml"
		}
		else
		{
				switch(sPage)
				{
					case "index.shtml":
						sActivePageID = "NavHome";
						break;
					case "store.shtml":
						sActivePageID = "NavStore";
						break;
					case "bookings.shtml":
						sActivePageID = "NavBookings";
						break;
					case "news.shtml":
						sActivePageID = "NavNews";
						break;
					case "info.shtml":
						sActivePageID = "NavInfo";
						break;
					case "profile.shtml":
						sActivePageID = "NavAbout";
						break;
					case "contact-us.shtml":
						sActivePageID = "NavContact";
						break;
					default:
						sActivePageID = "";
						break;
				}
		}
	}
	
	if(sActivePageID && (sActivePageID != ""))
	{
		document.getElementById(sActivePageID).style.color = "#70AD68";
		document.getElementById(sActivePageID).style.background = "#535456";
	}
}
