// A set of JavaScripts for site-wide use. Last update 20090325



// Top-of-pag:  Applied to item jumps to top of page
//  For use in either or both side margins of a page

function goTop()
	{
	window.scrollTo(0,0);
	return true;
	}

	// next declaration and function are for netscape navigator
	// they are not needed for internet explorer or icab

	document.onClick=nnGoTop;

function nnGoTop(evnt)
	{
	if (evnt.pageX < 32)
	window.scrollTo(0,0);
	return true;
	}

// end of Top-of-page



// E-mail masking:  "who" = email name   "site" = domain name   "ext" = domain designator
//  "handle" is optional, if supplied it appears as the link text instead of the address
//    Make "handle" and "who" the same to display a (clickable) name without an address
// The array avoids the give-away here-is-an-address domain sequence in the HTML page.

var dot_ = new Array()
	dot_[0] = "";
	dot_[1] = ".org.uk";
	dot_[2] = ".org";
	dot_[3] = ".ac.uk";
	dot_[4] = ".co.uk";
	dot_[5] = ".com";
	dot_[6] = ".nl";

function contact(who,site,ext,handle)
	{
	if (handle != null)
		document.write("<a href=" + "mail" + "to:" + who + "@" + site + dot_[ext]+ ">" + handle + "<\/a>" )
	else
		document.write("<a href=" + "mail" + "to:" + who + "@" + site + dot_[ext]+ ">" + who + "@" + site + dot_[ext] + "<\/a>" )
	}

// end of E-mail masking



// Small platform detection: added to allow detection of e.g. the iPod Touch and iPhone platforms. The browsers
//  on these have a small viewport and therefore ignore the inappropriate "position: fixed" declaration in CSS.
//	 i.e. if either an Phone or an iPod (not equal to "not found") load the overriding stylesheet 

function palmTop()
	{	
	if ((navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1))
		document.write("<link rel='stylesheet' type='text/css' href='styles/bmsPalmTop.css'>");
	}

//			To find other platforms, put this in an HTML doc and show in its browser
//
//			<script type="text/javascript">
//			var deviceString = document.platform;
//			document.write("<br><br>Platform string is:  " + deviceString + "<br><br>");
//			</script>


// End of small platform detection


// End of scripts