//	OPEN EXTERNAL LINKS IN A NEW WINDOW
	function externalLinks() { 
		if (!document.getElementsByTagName) return; 
		var anchors = document.getElementsByTagName("a"); 
		for (var i=0; i<anchors.length; i++) { 
			var anchor = anchors[i]; 
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
			anchor.target = "_blank"; 
		} 
	} 

//	ACTIVATE THE SEARCH CRITERIA FIELD
	function search_focus() {
		var criteria = document.getElementById('q').value;
		if ( criteria == 'search...' ) {
			document.getElementById('q').value = '';
		} else {
			return true;
		}	
	}

//	DEACTIVATE THE SEARCH CRITERIA FIELD
	function search_blur() {
		var criteria = document.getElementById('q').value;
		if ( criteria == '' ) {
			document.getElementById('q').value = 'search...';
		} else {
			document.getElementById('q').value = criteria;
		}
	}

//	ADD PAGE TO FAVOURITES
	function setBookmark(url,str){
		if(str=='')str=url;
		if (document.all)window.external.AddFavorite(url,str);
		else alert('Sorry, this function only works in Internet Explorer.\n\nPlease press CTRL and D to add a bookmark to \n"'+str+'".');
	}

//	SHOW A GIVEN NAVIGATION
	function activate_nav() {
		var fullpath = location.pathname;
		var patharray = fullpath.split('/');
		var fileposition = patharray.length - 1;
		var filename = patharray[fileposition];
		
		var filebasearray = filename.split('.');
		var filebase = filebasearray[0];
		
		if ( filebase == '' ) filebase = 'index';
		
		if ( document.getElementById(filebase) != undefined ) {
			document.getElementById(filebase).className = 'selected';
		}
	}


//	PERFORM THE FOLLOWING FUNCTIONS WHEN THE PAGE LOADS
	window.onload = function(e) {
		externalLinks();
		activate_nav();
	}
