// Funky Menu - Javascript structure
//There is no guarantee that this code will work, this is not freeware or anything it is just some ideas.
//If you use any of this code and you manage to destroy the entire internet with it then you are on your own.
//If you are not happy with this statement then DO NOT USE THIS CODE! See, didnt have to spend a fortune on 
//solicitors to make that statement.

//Written by : míkéyb0y
//Spring 2006


//Ok, you wanted to do the funky menu thing ... well here it is
//You should only really need to change the menu item labels and links, possibly you may need to add
//additional items to the popup menu or menu bar. If you do then you may need to play with some sizes and
//positions of containers and things. If you get stuck call me or mail me ... what you dont have my mobile? D'oh!

//USE:
//Call the renderStyleSheet() and renderMainMenu() functions at the top of each page
//Call the render sub menu function at the bottom of the webpage

//change the colours as you want - replace the build grey calls with rgb(255,255,255) or whatever you want
//or maybe you fancy a different colour for text or highlights - i tried red, it looked shite
var cYellow = "rgb(234,234,0)";
//var cWhite = "rgb(255,255,255)";
var cWhite = "E6E6FA";
var cvDark = "70ABFF"
//var cvDark = "5D478B";
//"rgb(171,130,255)";
//buildGrey(70);
var cDarkBlue = "000093"
var cDark = buildGrey(100);
var cMid = buildGrey(182);
var cPale = buildGrey(225);
var cvPale = buildGrey(248);
var sbrowser = navigator.appName;
var sSite = "http://www.landside-morgans.co.uk/";
function buildGrey(nValue)
//This function builds a shade of grey based on the passed parameter integer value
 {
	return ("rgb("+nValue+","+nValue+","+nValue+")");
 }
 
function renderMainMenuStyleSheet()
//Renders the style sheet for you - no beneift over a seperate css file as such, but I like doing it this way as you
//can change the colour variable values and not have to hunt through the style sheet and edit each class


//Get the resolution of the screen to decide on hte font size for the menu
//var nResWidth=screen.width;
//var nResHeight=screen.height;
//nResWidth 
//nResHeight

//if (nResWidth > 801) 
//{
//	nFont == 20;
//}
//else
//{
//	nFont = 8;
//}

 {
	 
	 var nResWidth=screen.width;
	 var nResHeight=screen.height;
	 var nFont;
	if (nResWidth > 801) 
{
	nFont=8;
}
else
{
	nFont=7;
}
	document.write ("<style type=\"text/css\">");
	document.write ("	.shadowMenu {position: absolute; background-color: " + cDarkBlue + "; border-style: none;}");
	document.write ("	.mainMenu {position: absolute; background-color: " + cDarkBlue + "; border-style: none; font-family: verdana; font-size: 10pt; font-weight: bold; color: " + cWhite + "; text-align: left; padding-left: 5px;}");
	document.write ("	.mainMenuItem {position: absolute;  border-style: none; font-family: verdana; font-size: " + nFont + "pt; font-weight: bold; color: " + cWhite + "; text-align: center; cursor: pointer;}");
	document.write ("	.mainMenuItemFirst {position: absolute;  border-style: none; font-family: verdana; font-size: " + nFont + "pt; font-weight: bold; color: " + cWhite + "; text-align: left; cursor: pointer;}");
	document.write ("	.subMenu {position: absolute; background-color: " + cPale + "; border-style: solid; border-width: 1px; border-color: " + cDark + "; font-family: verdana; font-size: 10pt; color: " + cDark + "; text-align: left;}");
	document.write ("	.subMenuItem {position: absolute; background-color: transparent; border-style: none; font-family: verdana; font-size: 8pt; color: "+cDark+"; text-align: left; cursor: pointer;}");
	document.write ("	.wiperMenuItem {position: absolute; background-color: transparent; border-style: none; font-family: verdana; font-size: 8pt; color: "+cDarkBlue+"; text-align: left; cursor: pointer;}");
	document.write ("</style>");
 }

function renderMainMenu(nLeft, nTop, sPage)
//This function renders the main menu 
//You might have to fiddle with the precise positioning of the menu items to get the colours to switch the way you want
 //{if nleft == 0 {nleft=20};

 { 
 	//Script for alternative menu if not using iexplore
 	 
	if (sbrowser != "Microsoft Internet Explorer")
	{
	
	document.write('<script type="text/javascript" src="milonic_src.js"></script>');
	document.write('<noscript><a href="http://www.milonic.com/">JavaScript DHTML Menu Powered by Milonic</a></noscript>');
	document.write('<script type="text/javascript">');
	document.write('if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");');
    document.write('else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");');
	document.write('</script>');
	

	
	
	document.write('<script type="text/javascript" src="menu_data.js"></script>');

	//---------------
	
	//---------------
	
	
	
    return
	};
	//alert(sbrowser);
	document.write ("<div id=\"menuMain\" class=\"mainMenu\" style=\"{left: "+nLeft+"40px; top: "+nTop+"px; width: 960px; height: 22px;}\">");
	
	document.write ("<div class=\"mainMenuItemFirst\" id=\"menuMainFirst\"  style=\"{vertical-align: middle; left: 840px; top: 2px; height: 16px; width: 160px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'The famous homepage of Landside Morgans\'); changeAttribute(\'menuMainFirst\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper(); changeAttribute(\'menuMainFirst\', \'color\', \'"+cWhite+"', true, true);\" onclick=\"window.location.href=\'Default.htm\';\"><i>|</i></div>");
	
	//document.write ("<div id=\"menuMain1\" class=\"mainMenuItem\" title=\"Homepage of Landside Morgans\" style=\"{left: 90px; top: 2px; height: 15px; width: 60px;}\" onmouseover=\" changeAttribute(\'menuMain1\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" changeAttribute(\'menuMain1\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href='Default.htm';\" >Home</div>");
	
	//document.write ("	<div id=\"menuMain2\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 15px; width: 90px;}\" onmouseover=\" hideWiper(); showMenu(\'studMenu\', \'menuMain2\', true, 0, 0); slideWiper(\'menuWiper\',\'Our Stud Service - Landside iece and Landside Music Lord\'); changeAttribute(\'menuMain2\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper(); changeAttribute(\'menuMain2\', \'color\', \'"+cWhite+"\', true, true);\" >|</div>");

//Stud Service Original...
document.write ("	<div id=\"menuMain2\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 16px; width: 90px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Our Stud Service - Landside Music Lord \'); changeAttribute(\'menuMain2\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper(); changeAttribute(\'menuMain2\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" showMenu(\'studMenu\', \'menuMain2\', true, 0, 0);\" >|</div>");

	document.write ("	<div id=\"menuMain3\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 16px; width: 90px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'See pictures and breeding info for all of our horses\'); changeAttribute(\'menuMain3\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper();  changeAttribute(\'menuMain3\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href=\'OurHorses.htm';\" >|</div>");
	
	document.write ("	<div id=\"menuMain4\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 16px; width: 130px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Information about the beautiful Morgan Breed\'); changeAttribute(\'menuMain4\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper();  changeAttribute(\'menuMain4\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href=\'BreedInformation.htm';\" >|</div>");
	
	document.write ("	<div id=\"menuMain5\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 16px; width: 90px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Horses and accessories for Sale\'); changeAttribute(\'menuMain5\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper(); changeAttribute(\'menuMain5\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href=\'SalesPage.htm';\" >|</div>");
	
	//document.write ("	<div id=\"menuMain6\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 16px; width: 100px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Read existing and post new topics and messages in the Morgan Horse Youth Forum\'); changeAttribute(\'menuMain6\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper(); changeAttribute(\'menuMain6\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href=\'Forum.htm';\" >|</div>");
	
	document.write ("	<div id=\"menuMain7\" class=\"mainMenuItem\"  style=\"{left: 840px; top: 2px; height: 16px; width: 40px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Find out what has been happening at Landside Morgans\'); changeAttribute(\'menuMain7\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper();  changeAttribute(\'menuMain7\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href=\'News.htm';\" >|</div>");	
	
	document.write ("	<div id=\"menuMain8\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 16px; width: 40px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Fun stuff, Art, Games, and non-Morgan Horse related topics\'); changeAttribute(\'menuMain8\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper(); changeAttribute(\'menuMain8\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" showMenu(\'miscMenu\', \'menuMain8\', true, 0, 0);\" >|</div>");
	
	document.write ("	<div id=\"menuMain9\" class=\"mainMenuItem\" style=\"{left: 840px; top: 2px; height: 16px; width: 50px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Links to other great Morgan and non-Morgan related websites\'); changeAttribute(\'menuMain9\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper();  changeAttribute(\'menuMain9\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href=\'Links.htm';\" >|</div>");	
	
	document.write ("	<div id=\"menuMain10\" class=\"mainMenuItem\"  style=\"{left: 840px; top: 2px; height: 16px; width: 70px;}\" onmouseover=\" hideWiper(); slideWiper(\'menuWiper\',\'Contact information for Landside Morgans\'); changeAttribute(\'menuMain10\', \'color\', \'"+cYellow+"\', true, true);\" onmouseout=\" hideWiper(); changeAttribute(\'menuMain10\', \'color\', \'"+cWhite+"\', true, true);\" onclick=\" document.location.href=\'ContactUs.htm';\" >|</div>");	

	document.write ("</div>");
	
	if ( sPage == 'SAVEDSTUFF') { highlightMenuItem('menuMain1'); }
	if ( sPage == 'HOME') { highlightMenuItem('menuMainFirst'); }
	if ( sPage == 'STUDSERVICE') { highlightMenuItem('menuMain2'); }
	if ( sPage == 'OURHORSES') { highlightMenuItem('menuMain3'); }
	if ( sPage == 'BREEDINFORMATION') { highlightMenuItem('menuMain4'); }
	if ( sPage == 'SALESPAGE') { highlightMenuItem('menuMain5'); }
	//if ( sPage == 'YOUTHFORUM') { highlightMenuItem('menuMain6'); }
	if ( sPage == 'NEWS') { highlightMenuItem('menuMain7'); }	
	if ( sPage == 'MISC') { highlightMenuItem('menuMain8'); }
	if ( sPage == 'LINKS') { highlightMenuItem('menuMain9'); }
	if ( sPage == 'CONTACTUS') { highlightMenuItem('menuMain10'); }
	
	renderMenuWiper();
	slideMenu();
 }

function highlightMenuItem(sPage)
{
	document.getElementById(sPage).style.borderWidth = '1px';
	document.getElementById(sPage).style.borderStyle = 'solid';
	document.getElementById(sPage).style.borderColor = "rgb(204,204,0)";
	document.getElementById(sPage).style.backgroundColor = "A566FF";
	//document.getElementById(sPage).style.color = 'black';
}
 
function renderSubMenus()
//This function renders the required sub menu (misc)
 {
	if (sbrowser != "Microsoft Internet Explorer") {return};
	renderMiscMenu();
	renderStudMenu();
//this is is it's own function to let you add additional pop up if you so wish
 }

function changeAttribute(sElementName, sAttribute, sValue, bStyle, bQuote)
//Pass this function the ID of the element on the page, the attribute you want to change (color, border-width etc...), the value you want it to 
//become, 'true' if the style attribute is required before the attribute you want to change and 'true' if the new value requires quotes around it
//phew!
 {
	var sStyle = "";
	var sQuote = "";
	if (bStyle == true)  sStyle = "style.";
	if (bQuote == true)  sQuote = "'";	
	eval("document.getElementById(\'" + sElementName + "\')." + sStyle + sAttribute + " = " + sQuote + sValue + sQuote);
 }
 
function showMenu(sMenuName, sParent, bAutoPosition, xPos, yPos)
//ok this is where the real fun starts...
//pass this function the name of the menu pop up you want to show and it's parent menu (i know you only have the one, but I wrote this for multiples)
//If the bAutoPosition parameter is set to 'True' then it works out the position dynamically, if this is set to false it uses the 
//xpos and ypos paramteres passed - the choise is yours! Lets be honest tho, dynamic is always better
 {
	var sMenuShadow = sMenuName + "Shadow";
//if the menu is to be positioned relative to a higher menu then work out position
	if (bAutoPosition == true)
	 {
		xPos = parseInt(document.getElementById(sParent).style.left, 10);
		yPos = parseInt(document.getElementById(sParent).style.top , 10) + parseInt(document.getElementById('menuMain').style.height,10);
		changeAttribute(sMenuName, 'left', xPos + 'px', true, true);
		changeAttribute(sMenuName, 'top', yPos + 'px', true, true);
		xPos = parseInt(document.getElementById(sParent).style.left, 10) + 4;
		yPos = parseInt(document.getElementById(sParent).style.top, 10) + parseInt(document.getElementById('menuMain').style.height,10) + 4;
		changeAttribute(sMenuShadow, 'left', xPos + 'px', true, true);
		changeAttribute(sMenuShadow, 'top', yPos + 'px', true, true);
	 }
	else
	 {
//if you are not using auto positioning then the x and y positions passed as integers are used to position the menu
		changeAttribute(sMenuName, 'left', xPos + 'px', true, true);
		changeAttribute(sMenuName, 'top', yPos + 'px', true, true);
		changeAttribute(sMenuShadow, 'left', xPos + 'px', true, true);
		changeAttribute(sMenuShadow, 'top', yPos + 'px', true, true);
	 }
//Display the sub menu layer passsed as a string prarameter
	changeAttribute(sMenuName, 'visibility', 'visible', true, true);
	changeAttribute(sMenuName + 'Shadow', 'visibility', 'visible', true, true);
 }

function renderMiscMenu()
//This renders the pop up menu - dont worry about the position if you use the dynamic way of displaying the menu cos it will work out it's own position
 {
	document.write ("<div id=\"miscMenuShadow\" class=\"shadowMenu\" style=\"{left: 4px; top: 26px; height: 130px; width: 260px; visibility: hidden; z-index: 995}\"></div>");
	document.write ("<div id=\"miscMenu\" class=\"subMenu\" style=\"{z-index: 996; left: 0px; top: 22px; height: 130px; width: 260px; visibility: hidden;}\">");
	document.write ("	<div id=\"iMenu1\" class=\"subMenuItem\" style=\"{z-index: 997; left: 5px; width: 150px; height: 15px; top: 10px;}\" " + buildMenuAction('iMenu1', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href=\'Art.htm';\">Art</div>");
	
	//document.write ("	<div id=\"iMenu2\" class=\"subMenuItem\" style=\"{z-index: 998; left: 5px; width: 150px; height: 20px; top: 30px;}\" " + buildMenuAction('iMenu2', 'fontWeight', 'bold', 'normal', 'true', 
//'true') + " onclick=\" document.location.href=\'chat.htm';\">Chat</div>");
	
	document.write ("	<div id=\"iMenu3\" class=\"subMenuItem\" style=\"{z-index: 999; left: 5px; width: 150px; height: 20px; top: 30px;}\" " + buildMenuAction('iMenu3', 'fontWeight', 'bold', 'normal', 'true', 
'true') + " onclick=\" document.location.href=\'funstuff.htm';\">Funstuff</div>");
	
	document.write ("	<div id=\"iMenu4\" class=\"subMenuItem\" style=\"{z-index: 1000; left: 5px; width: 150px; height: 20px; top: 50px;}\" " + buildMenuAction('iMenu4', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href=\'games.html';\">Games</div>");
	
	document.write ("	<div id=\"iMenu5\" class=\"subMenuItem\" style=\"{z-index: 1000; left: 5px; width: 150px; height: 20px; top: 70px;}\" " + buildMenuAction('iMenu5', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href=\'ethanalan_15.htm';\">Ethan Northcott</div>");
	
	document.write ("	<div id=\"iMenu6\" class=\"subMenuItem\" style=\"{z-index: 1000; left: 5px; width: 150px; height: 20px; top: 90px;}\" " + buildMenuAction('iMenu6', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href=\'ben_0.htm';\">Ben Connolly</div>");
	
	document.write ("	<div id=\"iMenu7\" class=\"subMenuItem\" style=\"{z-index: 1000; left: 5px; width: 150px; height: 20px; top: 110px;}\" " + buildMenuAction('iMenu7', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href=\'our_pups_0.htm';\">Our Pups</div>");
	//document.write ("	<div id=\"iMenu3\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 40px;}\" " + buildMenuAction('iMenu3', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='www.hotmail.co.uk';\">More stuff</div>");
	//document.write ("	<div id=\"iMenu4\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 55px;}\" " + buildMenuAction('iMenu4', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='www.hotmail.co.uk';\">More stuff again</div>");
	drawCloseMenu('miscMenu');
	document.write ("</div>");
 }
 function hideMenu(sMenu)
//Does what it says on the tin. When you call this function, the pop up menu name you pass it will close. Wow!
 {
	changeAttribute(sMenu + 'Shadow', 'visibility', 'hidden', true, true);
	changeAttribute(sMenu, 'visibility', 'hidden', true, true);
 }
 function renderStudMenu()
//This renders the pop up menu - dont worry about the position if you use the dynamic way of displaying the menu cos it will work out it's own position
 {
	document.write ("<div id=\"studMenuShadow\" class=\"shadowMenu\" style=\"{left: 4px; top: 26px; height: 50px; width: 260px; visibility: hidden; z-index: 995}\"></div>");
	document.write ("<div id=\"studMenu\" class=\"subMenu\" style=\"{z-index: 996; left: 0px; top: 22px; height: 50px; width: 260px; visibility: hidden;}\">");
	
	//document.write ("	<div id=\"iMenu10\" class=\"subMenuItem\" style=\"{z-index: 997; left: 5px; width: 150px; height: 15px; top: 25px;}\" " + buildMenuAction('iMenu10', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href=\'herrick.htm';\">Monnington Herrick</div>");
	
	document.write ("	<div id=\"iMenu11\" class=\"subMenuItem\" style=\"{z-index: 998; left: 5px; width: 150px; height: 15px; top: 10px;}\" " + buildMenuAction('iMenu11', 'fontWeight', 'bold', 'normal', 'true', 
'true') + " onclick=\" document.location.href=\'Lord.htm';\">Landside Music Lord</div>");
	
		document.write ("	<div id=\"iMenu12\" class=\"subMenuItem\" style=\"{z-index: 998; left: 5px; width: 150px; height: 15px; top: 30px;}\" " + buildMenuAction('iMenu12', 'fontWeight', 'bold', 'normal', 'true', 
'true') + " onclick=\" document.location.href=\'Elijah.htm';\">BFM Elijah</div>");
	
	//document.write ("	<div id=\"iMenu3\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 40px;}\" " + buildMenuAction('iMenu3', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='www.hotmail.co.uk';\">More stuff</div>");
	//document.write ("	<div id=\"iMenu4\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 55px;}\" " + buildMenuAction('iMenu4', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='www.hotmail.co.uk';\">More stuff again</div>");
	drawCloseMenu('studMenu');
	document.write ("</div>");
 }
 //function renderMiscMenu1()
//This renders the pop up menu - dont worry about the position if you use the dynamic way of displaying the menu cos it will work out it's own position
// {
	//document.write ("<div id=\"miscMenuShadow\" class=\"shadowMenu\" style=\"{left: 4px; top: 26px; height: 60px; width: 260px; visibility: hidden;}\"></div>");
	//document.write ("<div id=\"miscMenu\" class=\"subMenu\" style=\"{left: 0px; top: 22px; height: 60px; width: 260px; visibility: hidden;}\">");
	//document.write ("	<div id=\"iMenu1\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 10px;}\" " + buildMenuAction('iMenu1', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='Annie.htm';\">Annie</div>");
	//document.write ("	<div id=\"iMenu2\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 25px;}\" " + buildMenuAction('iMenu2', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='Aspire.htm';\">Aspire</div>");
	//document.write ("	<div id=\"iMenu3\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 40px;}\" " + buildMenuAction('iMenu3', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='www.hotmail.co.uk';\">More stuff</div>");
	//document.write ("	<div id=\"iMenu4\" class=\"subMenuItem\" style=\"{left: 5px; width: 150px; height: 15px; top: 55px;}\" " + buildMenuAction('iMenu4', 'fontWeight', 'bold', 'normal', 'true', 'true') + " onclick=\" document.location.href='www.hotmail.co.uk';\">More stuff again</div>");
	//drawCloseMenu('miscMenu');
	//document.write ("</div>");
 //}
function buildMenuAction(sMenuItem, sAttribute, sValueOn, sValueOff, sStyle, sQuote)
//This is just another way of doing the whole attribute change thing
 {
	return ("onmouseover=\" changeAttribute(\'" + sMenuItem + "\', \'" + sAttribute + "\', \'" + sValueOn + "\', " + sStyle + ", " + sQuote + ");\" onmouseout=\" changeAttribute(\'" + sMenuItem + "\', \'" + sAttribute + "\', \'" + sValueOff + "\', true, true);\"");
 }
 
function drawCloseMenu(sParent)
//Nice and easy now ... this bit positions the close link (never got the menu to work properly when you move mouse away, plus to be honest I 
// can't be arsed mucking about with the maths) so that when you click it the menu currently open closes. The best bit is again this is 
//dynamic. If you change the overall dimensions of your pop up menu this code will reposition the close link. Nifty!
 {
	var xPos = parseInt(document.getElementById(sParent).style.width,10) - 50;
	var yPos = parseInt(document.getElementById(sParent).style.height,10) - 20;
	document.write ("<p id=\"" + sParent + "Close\" class=\"subMenuItem\" style=\"{height: 16px; width: 40px; left: " + xPos + "px; top: " + yPos + "px; font-size: 7pt;}\" " + buildMenuAction(sParent + 'Close', 'fontWeight', 'bold', 'normal', true, true) + " onclick=\" hideMenu(\'" + sParent + "\');\" >Close");
	document.write ("<\p>");
 }
 

 
function hideWiper() { clearTimeout(t2); document.getElementById('menuWiper').style.visibility = 'hidden'; document.getElementById('menuWiper').innerText = ''; }
function renderMenuWiper() {  document.write ("<div id=\"menuWiper\" class=\"wiperMenuItem\" style=\"{left: 40px; width: 800px; top: 26px; height: 15px; z-index: 999;}\"></div>"); }
var t2;
function slideWiper(sElement, sText) { 
 document.getElementById(sElement).style.visibility = 'visible';
 if (parseInt(document.getElementById(sElement).innerText.length, 10) < parseInt(sText.length ,10)) { 
  document.getElementById(sElement).innerText = sText.substr(0, parseInt(document.getElementById(sElement).innerText.length, 10)+1); 
  t2=setTimeout("slideWiper(\'"+sElement+"\',\'"+sText+"\')",50);} 
 else { clearTimeout(t2);}
}
var t; 
function slideMenu() {         
        var nTimers = 0; 
        var nAdd=10;
		nTimers = slideRoutine('menuMainFirst',10,10 + nAdd,nTimers,'Landside Morgans Home'); 
		nTimers = slideRoutine('menuMain2',10,180 + nAdd,nTimers,'Stud Service'); 
		nTimers = slideRoutine('menuMain3',10,270 + nAdd,nTimers,'Our Horses'); 
		nTimers = slideRoutine('menuMain4',10,360 + nAdd,nTimers,'Breed Information'); 
		nTimers = slideRoutine('menuMain5',10,490 + nAdd,nTimers,'Sales Page');
		//nTimers = slideRoutine('menuMain6',10,58000 + nAdd,nTimers,'Youth Forum');
		nTimers = slideRoutine('menuMain7',10,580 + nAdd,nTimers,'News'); 
		nTimers = slideRoutine('menuMain8',10,620 + nAdd,nTimers,'Misc');
		nTimers = slideRoutine('menuMain9',10,660 + nAdd,nTimers,'Links');
		nTimers = slideRoutine('menuMain10',10,720 + nAdd,nTimers,'Contact Us');
		
        if (nTimers == 0) { clearTimeout(t);} else { t=setTimeout("slideMenu()",10); } 
} 

function slideRoutine(sElement,nGap,nTarget,nTimers,sTitle) { 
        if (parseInt(document.getElementById(sElement).style.left.replace("px",""),10) > nTarget) { document.getElementById(sElement).style.left = parseInt(parseInt(document.getElementById(sElement).style.left.replace("px",""),10) - nGap,10) + "px"; nTimers = nTimers + 1;} 
        else { document.getElementById(sElement).innerText = sTitle; } 
        return nTimers; 
} 


function writeAnnieLinks(sLinkName,sDivName)

{
	var iTo = 7;	
	var sText = "";
	
	for (var i = iTo; i >= 0; i--)
	{
		if (i==7)
		{sText += '<a href=\"AnnieFoal_7.htm\">2 years</a> | ';}
		if (i!=2 && i!=4  && i!=7 )
		{sText += '<a href=\"' + sLinkName + i + '.htm\">' + i + ' week</a> | ';}			
		
	}	
	//alert(sText);
	document.getElementById(sDivName).innerHTML = sText;
}

function writeDakotaLinks(sLinkName,sDivName)

{
	var iTo = 5;	
	var sText = "";
	
	for (var i = iTo; i >= 0; i--)
	{
		
		{sText += '<a href=\"' + sLinkName + i + '.htm\">' + i + ' week</a> | ';}			
	}	
		sText += '<a href=\"Molly_11M.htm\">11 months</a> | ';
		sText += '<a href=\"Molly_18M.htm\">18 months</a> | ';
	//alert(sText);
	document.getElementById(sDivName).innerHTML = sText;
}

function writeDancerLinks(sLinkName,sDivName)

{
	var iTo = 48;	
	var sText = "";
	sText += "<a href=\"Martini_yearling.htm\">Yearling</a> | ";
	for (var i = iTo; i >= 0; i--)
	{
		if (i==0 | i==2 | i==4 | i==14 | i==48)
		{sText += '<a href=\"' + sLinkName + i + '.htm\">' + i + ' week</a> | ';
		
		}	
		
	}	
	//alert(sText);
	
	document.getElementById(sDivName).innerHTML = sText;	
}

function writeEmmieFoal2Links(sLinkName,sDivName)

{
	var iTo = 9;	
	var sText = "";
	sText += '<a href=\"EmmieFoal2_yearling.htm\">Yearling</a> | '
	for (var i = iTo; i >= 0; i--)
	{
		if (i==0 | i==1 | i==3 | i==9)
		{sText += '<a href=\"' + sLinkName + i + '.htm\">' + i + ' week</a> | ';}			
	}	
	
	//alert(sText);
	document.getElementById(sDivName).innerHTML = sText;
}

function ageyear(yob)
{
	
	var age;
	var now = new Date();
	
	var byr=parseInt(yob);	
	var tyr = now.getFullYear();
	
	
	if (tyr <= byr)	
		{age=0}
	else
		{age = tyr - byr}	
	
	document.write(age);

}


function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
	
	
	//if(opacity==0){object.visbility='hidden';object.display='none';};
	
    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
	
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	if(opacity==0 && id=='Lord'){object.visbility='hidden';object.display='none';};
} 

function showdeadcenterdiv(Xwidth,Yheight,divid) { 
// First, determine how much the visitor has scrolled 

var scrolledX, scrolledY; 
if( self.pageYOffset ) { 
scrolledX = self.pageXOffset; 
scrolledY = self.pageYOffset; 
} else if( document.documentElement && document.documentElement.scrollTop ) { 
scrolledX = document.documentElement.scrollLeft; 
scrolledY = document.documentElement.scrollTop; 
} else if( document.body ) { 
scrolledX = document.body.scrollLeft; 
scrolledY = document.body.scrollTop; 
} 

// Next, determine the coordinates of the center of browser's window 

var centerX, centerY; 
if( self.innerHeight ) { 
centerX = self.innerWidth; 
centerY = self.innerHeight; 
} else if( document.documentElement && document.documentElement.clientHeight ) { 
centerX = document.documentElement.clientWidth; 
centerY = document.documentElement.clientHeight; 
} else if( document.body ) { 
centerX = document.body.clientWidth; 
centerY = document.body.clientHeight; 
} 

// Xwidth is the width of the div, Yheight is the height of the 
// div passed as arguments to the function: 
var leftOffset = scrolledX + (centerX - Xwidth) / 2; 
var topOffset = 25 + scrolledY + (centerY - Yheight) / 2; 
// The initial width and height of the div can be set in the 
// style sheet with display:none; divid is passed as an argument to // the function 
var o=document.getElementById(divid); 
var r=o.style; 
r.position='absolute'; 
r.top = topOffset + 'px'; 
r.left = leftOffset + 'px'; 
r.display = "block"; 
} 

