//////////////////////////////
// PRINT PAGE FUNCTION
//////////////////////////////

function printpage() {
	window.print();
}

//////////////////////////////
// HIGHLIGHT FUNCTION
//////////////////////////////

/* Fragment Highlight version 0.1 */
//*** This JavaScript highlight code is copyright 2003 by David Dorward; http://dorward.me.uk

//Adds a new class to an object, preserving existing classes
function AddClass(obj,cName){ KillClass(obj,cName); return obj.className+=(obj.className.length>0?' ':'')+cName; }

//Removes a particular class from an object, preserving other existing classes.
function KillClass(obj,cName){ return obj.className=obj.className.replace(new RegExp("^"+cName+"\\b\\s*|\\s*\\b"+cName+"\\b",'g'),''); }

/* Fragment Highlight */

var fragHLed = '';
var fragExclude = ('header');

Array.prototype.search = function(myVariable) { for(x in this) if(x == myVariable) return true; return false; }

/* Highlight link target if the visitor arrives at the page with a # */

function fragHLload() {
    fragHL(location.hash.substring(1));
}

/* Highlight link target from an onclick event after unhighlighting the old one */

function fragHL(frag) {
    if (fragHLed.length > 0 && document.getElementById(fragHLed)) {
	KillClass(document.getElementById(fragHLed),'fragment');
    }
    if (frag.length > 0 && document.getElementById(frag)) {
	fragHLed = frag;
	AddClass (document.getElementById(frag),'fragment');
    }
}

/* Add onclick events to all <a> with hrefs that include a "#"  */

function fragHLlink() {
    if (document.getElementsByTagName) {
	var an = document.getElementsByTagName('a');
	for (i=0; i<an.length; i++) {
	    if (an.item(i).getAttribute('href').indexOf('#') >= 0) {
		var fragment = an.item(i).getAttribute('href').substring(an.item(i).getAttribute('href').indexOf('#') + 1);
		if (fragExclude.search(fragment)) {
		    var evn = "fragHL('" + fragment + "')";
		    var fun = new Function('e',evn);
		    an.item(i).onclick = fun;
		}
	    } 
	}
    }
}

/* Adds :hover to IE5 css  */

function startList() { 
	if (document.all&&document.getElementById) { 
		var navRoot = document.getElementById("fuie"); 
		if(navRoot) { 
			for (i=0; i<navRoot.childNodes.length; i++) { 
				var node = navRoot.childNodes[i]; 
				if (node.nodeName=="LI") { 
					node.onmouseover=function() { 
						this.className+=" over"; 
					} 
					node.onmouseout=function() { 
						this.className=this.className.replace(" over", ""); 
					} 
				} 
			} 
		}
	} 
}

/* Init the script */

window.onload = function(){
    fragHLload();
    fragHLlink();
	startList();
	window.defaultStatus='Slater & Crabtree Ltd. Precision Engineers.';
};
