/* Commonly used functions *//* krudd - emlab, UoW - 18/2/05 *//* Useful info */var isMacIE5 = /MSIE 5[\S\s]+Mac/i.test( navigator.userAgent );var isIE = /MSIE/i.test( navigator.userAgent );var isOpera = /OPERA/i.test( navigator.userAgent );var isSafari = /SAFARI/i.test( navigator.userAgent );/* Strip spaces, etc from string to make it suitable for useing as an id, etc */function stripNonAlphaNumericChars( str ){	return str.replace( /[^a-z0-9]+/gi, '' );}/* Remove multiple spaces and trim whitespace from both ends */function compact( str ){	return str.replace( /\s+/, ' ' ).replace( /^\s*|\s*$/g, '' );}/* hide/show content. */function hideElement( elem ){	if ( elem && elem.style.display != 'none' )		elem.style.display = 'none';}function showElement( elem ){	if ( elem && elem.style.display == 'none' )		elem.style.display = '';}/* Part of an accessible way of "hiding" content. */function concealElement( elem ){	if ( elem && elem.className.indexOf( 'concealed' ) < 0 )		elem.className = compact( elem.className + ' concealed' );}function unconcealElement( elem ){	if ( elem && elem.className.indexOf( 'concealed' ) > -1 )		elem.className = compact( elem.className.replace( /\bconcealed\b/, ' ' ) );}/* Base cookie functions */function setCookie( name, value, hours ){	var expire = '';	if( hours !== null ) {		expire = new Date(); expire.setTime( expire.getTime() + ( hours * 36e5 ) );		expire = '; expires=' + expire.toGMTString();	}	document.cookie = name + '=' + escape( value ) + expire + '; path=/'; }function getCookie( name ){	var cv = ( new RegExp( name + '=([^;]+)' ) ).exec( document.cookie );	return ( cv !== null ) ? unescape( cv[ 1 ] ) : null;}function killCookie( name ){	document.cookie = name + '=; expires=Wed, 13-Apr-1977 00:00:00 GMT; path=/';}/* Persistant flags - for 'foldingdefs.js' and 'tabbeddivs.js' */function storeFlagState( flagSetName, flagName, state ){	var flagSet = getCookie( flagSetName );	if ( flagSet == null ) flagSet = '';	var curState = flagSet.indexOf( flagName ) != -1;	if ( state != curState ) {		if ( state == true )			flagSet += flagName + '+';		else			flagSet = flagSet.replace( flagName + '+', '' );		setCookie( flagSetName, flagSet, 1 );	}}function getFlagState( flagSetName, flagName ){	var flagSet = getCookie( flagSetName );	return flagSet ? flagSet.indexOf( flagName ) != -1 : null;}/* Make a 5 character "flag" from a string for use with store/getFlagState functions */function makeFlagID( text ){	function charAtT( str, t ) { return str.charAt( Math.floor( ( str.length - 1 ) * t ) ) }; 	return charAtT(text,0) + charAtT(text,0.25) + charAtT(text,0.5) + charAtT(text,0.75) + charAtT(text,1.0);}/* Add function to the list of "onload" fired functions */function addLoadEvent( newOnLoad ){	var oldOnLoad = window.onload;	if ( typeof( window.onload ) != 'function' )		window.onload = newOnLoad;	else		window.onload = function() { oldOnLoad(); newOnLoad(); }}/* Create a link node (DOM methods) */function createLink( url, text ){	var linkNode = document.createElement( 'A' );	linkNode.href = url;	if ( text && text.length > 0 )		linkNode.appendChild( document.createTextNode( text ) );	return linkNode;}/* Create a generic DOM node, with optional text node content */function createDOMNode( tag, text ){	var node = document.createElement( tag );	if ( text && text.length > 0 )		node.appendChild( document.createTextNode( text ) );	return node;}/* Add a style */function addStyle( rule ){	if ( isIE && !isOpera && !isMacIE5 ) {		var elem = document.createStyleSheet().cssText = rule;	}	else {		var elem = document.createElement( 'LINK' );		elem.rel = 'stylesheet';		elem.type = 'text/css';		elem.href = 'data:text/css,' + escape( rule );		document.getElementsByTagName( 'HEAD' )[ 0 ].appendChild( elem );	}}/* Switch header image on main pages */function switchHeaderImage(){	if ( document.body.className.indexOf( 'mainPage' ) != -1 ) {		var pageHeading = document.getElementById( 'pageHeading' );		if ( pageHeading )			pageHeading.className = "pageHeading" + Math.round( Math.random() * 13 );	}}function changeWidth(theElement){	if(isIE)	{		theElement.className = 'expandBox';	}}function changeWidthBack(theElement){	if(isIE)	{		theElement.className = 'normalBox';	}}function checkForMacIE(){	if( isMacIE5 )	{		alert('Internet Explorer for Macintosh is not supported on this site please use FireFox or Safari');	}}addLoadEvent( switchHeaderImage );