// LHYC Menu frame script
//
// JavaScript to handle the menu frame.
//


function imageChange(imageID, gif)
{
// This function amends the gif displayed when the user's mouse passes over and off the associated image

	imageID.src = gif;
}


function showHome()
{
// Display the home page within the main frame

	var homeScreen = parent.frames["leftFrame"].document.getElementById("HS");
	homeScreen.value = "Y";

	document.menuForm.action = "LHYCMainFrame.htm";
	document.menuForm.submit();
}


function showEvents()
{
// Display the events information within the main frame

	document.menuForm.action = "Events.htm";
	document.menuForm.submit();
}


function showCommittee()
{
// Display the committee information within the main frame

	document.menuForm.action = "Committee.htm";
	document.menuForm.submit();
}


function showCrewList()
{
// Display the crew list information within the main frame

	document.menuForm.action = "CrewList.htm";
	document.menuForm.submit();
}


function showGallery()
{
// Display the latest gallery selection within the main frame

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	var howDeep = (screen.availHeight * 90)/100;
	var howWide = (screen.availWidth * 90)/100;
	var leftPos = (screen.availWidth * 5)/100;
	var topPos  = (screen.availHeight * 5)/100;

   	var viewWindow = window.open("http://photobucket.com/lhyc", "galleryScreen", "resizable=no,scrollbars=yes,left=" + leftPos + ",top=" + topPos + ",height=" + howDeep + ",width=" + howWide);
	viewWindow.focus();
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//	document.menuForm.action = "Gallery.htm";
//	document.menuForm.submit();
}


function showMarketPlace()
{
// Display the current sales and wants in the club market place

	var homeScreen = parent.frames["leftFrame"].document.getElementById("HS");
	homeScreen.value = "N";

	document.menuForm.action = "MarketPlace.htm";
	document.menuForm.submit();
}


function showLinks()
{
// Display the links to other sites within the main frame

	document.menuForm.action = "Links.htm";
	document.menuForm.submit();
}


function showMMSI()
{
// Display the mmsi directory within the main frame

	document.menuForm.action = "MMSI.htm";
	document.menuForm.submit();
}


function showDocuments()
{
// Display the club documents library within the main frame

	document.menuForm.action = "Documents.htm";
	document.menuForm.submit();
}


function showContact()
{
// Display the contact information within the main frame

	document.menuForm.action = "Contact.htm";
	document.menuForm.submit();
}


function memberLogin()
{
// This function handles the membership login to the full web site.
// Login is handled through a seperate frame.

	var howDeep = (screen.availHeight * 50)/100;
	var howWide = (screen.availWidth * 75)/100;
	var leftPos = (screen.availWidth * 12)/100;
	var topPos  = (screen.availHeight * 25)/100;

   	var viewWindow = window.open("Login.htm", "loginScreen", "resizable=no,left=" + leftPos + ",top=" + topPos + ",height=" + howDeep + ",width=" + howWide);
	viewWindow.focus();
}

function memberMenu()
{
// Amend the menu frame to show the full members menu.

    var fullOptions = "<table width=100% border=0>";
	fullOptions += memberMenuOption("Home.gif", "HomeOver.gif", "showHome()", "37", "11", false);
	fullOptions += memberMenuOption("Events.gif", "EventsOver.gif", "showEvents()", "43", "11", false);
	fullOptions += memberMenuOption("Committee.gif", "CommitteeOver.gif", "showCommittee()", "72", "11", false);
	fullOptions += memberMenuOption("Gallery.gif", "GalleryOver.gif", "showGallery()", "47", "13", false);
	fullOptions += memberMenuOption("MarketPlace.gif", "MarketPlaceOver.gif", "showMarketPlace()", "88", "13", false);
	fullOptions += memberMenuOption("CrewList.gif", "CrewListOver.gif", "showCrewList()", "68", "11", false);
	fullOptions += memberMenuOption("UsefulLinks.gif", "UsefulLinksOver.gif", "showLinks()", "79", "11", false);
	fullOptions += memberMenuOption("MMSI.gif", "MMSIOver.gif", "showMMSI()", "64", "11", false);
	fullOptions += memberMenuOption("Documents.gif", "DocumentsOver.gif", "showDocuments()", "80", "11", false);
	fullOptions += memberMenuOption("ContactUs.gif", "ContactUsOver.gif", "showContact()", "71", "11", true);
	fullOptions += "</table> </td>";

	var fullMenu = parent.frames["leftFrame"].document.getElementById("menuOptions");
	fullMenu.innerHTML = fullOptions;

	var LOokay = parent.frames["leftFrame"].document.getElementById("LO");
	LOokay.value = "Y";

	var homeScreenShown = "N";
	var homeScreen = parent.frames["leftFrame"].document.getElementById("HS");
	if (homeScreen != null)
		homeScreenShown = homeScreen.value;

	if (homeScreenShown == "Y")
	{
		parent.frames["topFrame"].newsItem();
		parent.frames["topFrame"].nextEvent();
	}
}


function memberMenuOption(image, imageOver, clickFunction, width, height, lastOption)
{
// Create code to show a menu option. A horizontal line does not follow the last option

	var thisOption = "<tr>";
    thisOption += "<td bordercolor=\"#666666\"><img src=\"images/" + image + "\" onMouseOver=\"imageChange(this, 'images/" + imageOver + "');\" onMouseOut=\"imageChange(this,'images/" + image + "');\" onClick=\"" + clickFunction + ";\" width=\"" + width + "\" height=\"" + height + "\"></td>";
    thisOption += "</tr>";

	if (!lastOption)
	{
	    thisOption += "<tr>"; 
    	thisOption += "<td bordercolor=\"#666666\"><hr></td>";
	    thisOption += "</tr>";
	}

	return thisOption;
}
