function get_window_height()
{
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number')
	{
		windowHeight=window.innerHeight;
	}
	else
	{
		if (document.documentElement && document.documentElement.clientHeight)
		{
			windowHeight=document.documentElement.clientHeight;
		}
		else
		{
			if (document.body && document.body.clientHeight)
			{
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function ensure_navigation_sidebar()
{
	//
	// This should only be done if the
	// browser is not IE. It ensures that
	// the navigation sidebar will scroll
	// if the viewport is too small for it.
	// For IE, it is set to scroll, because
	// IE does not support CSS properly.
	//
	var window_height=get_window_height();
	oNavigation=document.getElementById("navigation");
	if (window_height<750)
	{
		oNavigation.style.position="absolute";
	}
	else
	{
		oNavigation.style.position="fixed";
	}
}

function do_navigation_sidebar(incgi)
{
	//
	// This function creates the navigation sidebar,
	// which appears on every page but one of the site.
	//
	// The argument "incgi" should be true when this
	// function is called from within a cgi script and
	// false otherwise; if true, the function prepends
	// a "/" to local uris so that they reflect the
	// path as seen from the cgi-bin subdirectory.
	//
	// This function avoids having to go and change
	// every page (plus server-side scripts that need
	// to generate and display inline some part or all
	// of a page) when the list of links must change;
	// it removes the typing error possibility that can
	// occur therein; it allows the page url to be
	// pasted explicitly into the hyperlinks in the W3C
	// validation logos - the ?uri=referer construct is
	// badly supported at the moment by many systems.
	//
	var slash="";
	if (incgi)
	{
		slash="/";
	}
	document.write('						<div class="navigationbuttons">');
	document.write('							<a href="'+slash+'home.html">Who are We?</a>');
	document.write('							<div class="navbarspace">&nbsp;</div>');
	document.write('							<a href="'+slash+'profile.htm">Profile of the Bombay</a>');
	document.write('							<a href="'+slash+'history1.htm">History (Simple)</a>');
	document.write('							<a href="'+slash+'history2.htm">History (Detailed)</a>');
	document.write('							<a href="'+slash+'genetics.htm">Genetics of the Bombay</a>');
	document.write('							<a href="'+slash+'official.htm">Official Documents</a>');
	document.write('							<div class="navbarspace">&nbsp;</div>');
	document.write('							<a href="'+slash+'showlast.htm"><strong>Our Show</strong></a>');
	document.write('							<a href="'+slash+'shownext.htm"><strong>Next Show</strong></a>');
	document.write('							<a href="'+slash+'clubnews.htm">Club News</a>');
	document.write('							<a href="'+slash+'clubhistory.htm">Club History</a>');
	document.write('							<a href="'+slash+'shownews.htm">Show News</a>');
	document.write('							<a href="'+slash+'gallery.htm">Photo Gallery</a>');
	document.write('							<a href="'+slash+'socialise.htm">Get a Life!!</a>');
//	document.write('							<a href="'+slash+'officers.htm">Officers &amp; Committee</a>');
	document.write('							<a href="'+slash+'membership.htm">Membership Form</a>');
	document.write('							<div class="navbarspace">&nbsp;</div>');
	document.write('							<a href="'+slash+'studs.htm">List of Studs</a>');
	document.write('							<a href="'+slash+'breeders.htm">List of Breeders</a>');
	document.write('							<a href="'+slash+'kittens.htm">Available Kittens</a>');
	document.write('							<a href="'+slash+'maintenance.htm">Care and Grooming</a>');
	document.write('							<a href="'+slash+'welfare.htm">Welfare and Rescue</a>');
	document.write('							<div class="navbarspace">&nbsp;</div>');
	document.write('							<a href="'+slash+'sevenblackcats.htm">Seven Black Cats</a>');
//	document.write('							<a href="'+slash+'bubble.htm">Bubble Bubble</a>');
	document.write('							<a href="'+slash+'howecats.htm">The Moggies who Made Us</a>');
	document.write('							<a href="'+slash+'trotkatz.htm">Trotting Onwards</a>');
	document.write('							<a href="'+slash+'paintbox.htm">Paintbox Bombays</a>');
	document.write('							<a href="'+slash+'piptlb.htm">Trotkatz Lunar Boy</a>');
	document.write('							<a href="'+slash+'pipphb.htm">Snap That Cat!</a>');
	document.write('							<div class="navbarspace">&nbsp;</div>');
	document.write('							<a href="'+slash+'links.htm">Interesting Sites</a>');
	document.write('							<a href="'+slash+'guestbook.html">View Guest Book</a>');
	document.write('							<a href="'+slash+'guestnewg.html">Sign Guest Book</a>');
	document.write('							<a href="'+slash+'contact.htm">Contact Us</a>');
	document.write('						</div>');
	//
	document.write('<div class="navbarspace">&nbsp;</div>');
	//
	// The compliance logos had to have their
	// borders cleaned up to get them to display
	// properly on the aqua background in both
	// Mozilla and IE but are otherwise unchanged.
	//
	// The originals can be found as:
	//
	// http://www.w3.org/Icons/valid-html401
	// http://jigsaw.w3.org/css-validator/images/vcss
	//
	document.write('						<div class="compliance center">');
	if (incgi)
	{
		document.write('							<img width="88" height="31" src="/images/validhtml.png" alt="Valid HTML 4.01 Strict"><br>');
		document.write('							<img width="88" height="31" src="/images/validcss.png" alt="Valid CSS">');
	}
	else
	{
		document.write('							<a href="http://validator.w3.org/check?uri='+document.location.toString()+'"><img width="88" height="31" src="'+slash+'images/validhtml.png" alt="Valid HTML 4.01 Strict"></a>');
		document.write('							<a href="http://jigsaw.w3.org/css-validator/validator?uri='+document.location.toString()+'"><img width="88" height="31" src="'+slash+'images/validcss.png" alt="Valid CSS"></a>');
	}
	document.write('						</div>');
}

function body_onload()
{
	//
	// This should only be done if the
	// browser is not IE. It ensures that
	// the navigation sidebar will scroll
	// if the viewport is too small for it.
	// For IE, it is set to scroll, because
	// IE does not support CSS properly.
	//
	if (is_ie)
	{
		return;
	}
	ensure_navigation_sidebar();
	window.onresize=ensure_navigation_sidebar;
}
