<!--
// Menu rollovers 

function preLoadImages () {
	var list = new Array (
		"bg_menu_f02.gif",
		"bg_menu_f03.gif",
		"mmm_home_f2.gif",
		"mm_support_f2.gif",
		"mm_about_f2.gif",
		"mm_downloads_f2.gif",
		"mm_events_f2.gif",
		"mm_links_f2.gif",
		"mm_contact_f2.gif"

	);

	if (document.images) {
		noImages = list.length;
		preloadedImages = new Array (noImages);
		for (x = 0; x < noImages; x++) {
			preloadedImages[x] = new Image;
			preloadedImages[x].src = '/images/' + list[x];
		}
	}
}

function swapImage(imageName, newImage) {
    if (document.images) {
      document.images[imageName].src = newImage;
  }
}

preLoadImages();

// Auto-menu highlighter. Copyright Cayenne Web Development 2003 - www.cayenne.co.uk


	function getPathPositions(url) {
		var pos = 0;
		positions = new Array();
		pathParts = url.split("/");
		count = pathParts.length;
		for (x = 0; x < count; x++) {
			pos = pos + pathParts[x].length + 1;
			positions[x] = pos;
		}
		return positions;
	}


	function urlsMatch(url, testUrl, level, positions) {
		if (testUrl.substr(0,1) == "/") {
			testUrl = testUrl.substr( 1 );
		}
		if(level == 0) {
			return (url.substr(1) == testUrl);
		} else {
			return (url.substr(1, positions[level]-1) == testUrl.substr(0, positions[level]-1))
		}
	}


// set highlight styles for menus

function linkHighlight() {
	var positions = getPathPositions(location.pathname);
	var count = document.links.length;
	for (i = 0; i < count; i++) {
		thisLink = document.links[i];
		if (urlsMatch(location.pathname, thisLink.pathname, 1, positions) && thisLink.className == "nav2") {
			thisLink.style.fontWeight = "bold";
			continue;
		} 
		if (urlsMatch(location.pathname, thisLink.pathname, 0, positions) && thisLink.className == "nav3") {
			thisLink.style.background = "url('/images/bg_menu_f03.gif')";
			continue;
		}
	}
}

// Open page in new window

function newWindow(object) {
	window.open(object.href, "");
	return false;
}

// Make "pie" graphic transparent
function makeTransparent() {
	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
		var newdiv = document.createElement( 'span' );
		var oldimg = document.getElementById( 'pie' );
		var oldimg_integrated = document.getElementById( 'pie_integrated' );
		if (oldimg) {
			newdiv.style.height   = oldimg.height;
			newdiv.style.width    = oldimg.width;
			newdiv.style.top      = "22";
			newdiv.style.right    = "0";
			newdiv.style.position = "absolute";
			newdiv.style.filter   = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + oldimg.src + "')";
			oldimg.parentNode.replaceChild( newdiv, oldimg );
		}
		if (oldimg_integrated) {
			newdiv.style.height   = oldimg_integrated.height;
			newdiv.style.width    = oldimg_integrated.width;
			newdiv.style.top      = "5";
			newdiv.style.right    = "0";
			newdiv.style.position = "absolute";
			newdiv.style.filter   = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + oldimg_integrated.src + "')";
			oldimg_integrated.parentNode.replaceChild( newdiv, oldimg_integrated );
		}
	}
}

function mainNavMouseover( link ) {
	if (link.childNodes[0].src.indexOf("_f2.gif") == -1 && link.childNodes[0].src.indexOf("_f3.gif") == -1) {
		link.childNodes[0].src = link.childNodes[0].src.replace( new RegExp('\.gif','g'), '_f2.gif' );
		link.style.background = "#666";
	}
}

function mainNavMouseout( link ) {
	link.childNodes[0].src = link.childNodes[0].src.replace( new RegExp('_f2\.gif','g'), '.gif' );
	link.style.background = "#333";
}

// Initialise a page
function init() {
	makeTransparent();
	linkHighlight();
}

// Check to see if an entry is numeric
function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function openterms(){ 
window.open('../data/terms.html','jav','width=600,height=620,resizable=no,scrollbars=yes');
}

function openhelp(){ 
window.open('../data/help.html','jav','width=600,height=620,resizable=no,scrollbars=yes');
}

//-->
