<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}



//declare
var submenu = new Array();
var tmr = new Array();
var adj = new Array();
var last_zIndex = 10000;

// EXAMPLE CONFIG
var menuWidth 		= 160;			//width of submenu in pixels
var alignSubmenu 	= 'bottom';		//bottom or right side of the main button.
var useLastItemCSS	= true;			//generate last menu item too
									//if false, it will behave as a normal item
									//and the css menuItemLast class will not be used
//Programme Info
submenu['menu1'] = new Array();
submenu['menu1'][0] = menuItem('Academy Coaching Staff','http://www.trebleconeraceacademy.com/ProgrammeInfo/coaches.asp');
submenu['menu1'][1] = menuItem('School Holiday Race Camp','http://www.trebleconeraceacademy.com/ProgrammeInfo/school-holiday-race-camp.asp');
submenu['menu1'][2] = menuItem('FIS ENL Camp','http://www.trebleconeraceacademy.com/ProgrammeInfo/fis-enl-camp.asp');
submenu['menu1'][3] = menuItem('FIS Elite Camp','http://www.trebleconeraceacademy.com/ProgrammeInfo/fis-elite-camp.asp');
submenu['menu1'][4] = menuItem('Pre FIS Camp','http://www.trebleconeraceacademy.com/ProgrammeInfo/pre-fis-camp.asp');
submenu['menu1'][5] = menuItem('Pre FIS Elite Camp','http://www.trebleconeraceacademy.com/ProgrammeInfo/pre-fis-elite-camp.asp');
submenu['menu1'][6] = menuItem('E/K Full Time Programme','http://www.trebleconeraceacademy.com/ProgrammeInfo/full-time-ek-programme.asp');
submenu['menu1'][7] = menuItem('FIS Full Time Programme','http://www.trebleconeraceacademy.com/ProgrammeInfo/full-time-race-programme.asp');
submenu['menu1'][8] = menuItem('Masters Race Programme','http://www.trebleconeraceacademy.com/ProgrammeInfo/masters-race-programme.asp');
submenu['menu1'][9] = menuItem('Academic Programmes','http://www.trebleconeraceacademy.com/ProgrammeInfo/academic-programmes.asp');

//Mountain Info
submenu['menu2'] = new Array();
submenu['menu2'][0] = menuItem('Mountain Race Information','http://www.trebleconeraceacademy.com/mountain-info.asp');
submenu['menu2'][1] = menuItem('Treble Cone Information','http://www.treblecone.com');
submenu['menu2'][2] = menuItem('Useful Links','http://www.trebleconeraceacademy.com/links.asp');

//Photo & Video
submenu['menu3'] = new Array();
submenu['menu3'][0] = menuItem('Photo Galleries','http://www.trebleconeraceacademy.com/Gallery/gallery.asp');
submenu['menu3'][1] = menuItem('Video Footage','http://www.trebleconeraceacademy.com/Gallery/video.asp');

//Contact
submenu['menu4'] = new Array();
submenu['menu4'][0] = menuItem('Contact Details','http://www.trebleconeraceacademy.com/contact.asp');
submenu['menu4'][1] = menuItem('About The Academy','http://www.trebleconeraceacademy.com/about.asp');

//Accommodation
submenu['menu6'] = new Array();
submenu['menu6'][0] = menuItem('Te Awa Lodge','http://www.trebleconeraceacademy.com/Accommodation/te-awa-lodge.asp');
submenu['menu6'][1] = menuItem('The Lookout Lodge','http://www.trebleconeraceacademy.com/Accommodation/lookout-lodge.asp');
submenu['menu6'][2] = menuItem('Homestay Accommodation','http://www.trebleconeraceacademy.com/Accommodation/homestay-accommodation.asp');

// END OF EXAMPLE CONFIG

//build or unhide submenu div...
function buildSubmenu(obj){
	//get common part of div id
	menuPath = obj.id.split('_');

	//unset mousout of parent menus and make sure they are visible...
	x = "div";
	for(i=0;i<menuPath.length;i++){
		x+= '_' + menuPath[i];
		if(document.getElementById(x)){
			if(tmr[x])
				window.clearTimeout(tmr[x]);
			document.getElementById(x).style.visibility = 'visible';
		}
	}

	//check if we have a submenu of the obj...
	if(submenu[obj.id]){
		//check if allready build...
		c = document.getElementById('div_' + obj.id);
		if(c){
			//unhide...
			c.style.visibility = 'visible';
			c.style.zIndex = last_zIndex++;
		}else{
			//calc position of mouseover
			d = obj;
			if(d){
				L_pos = d.offsetLeft + d.offsetWidth - 1;
				T_pos = d.offsetTop - 1;
				while(d.offsetParent){
					d = d.offsetParent;
					L_pos+= d.offsetLeft;
					T_pos+= d.offsetTop;
				}
			}

			//patch first submenu to go right below the main buttons...
			if(obj.className.indexOf('menuItem') < 0 && alignSubmenu == 'bottom'){
				L_pos-= obj.offsetWidth;
				T_pos+= obj.offsetHeight;
			}

			//build new div
			subObj = document.createElement('div');
			subObj.id = 'div_' + obj.id;
			subObj.className = 'submenu';
			subObj.style.position = 'absolute';
			subObj.style.zIndex = last_zIndex++;
			subObj.style.width = menuWidth;
			subObj.style.top = T_pos;
			subObj.style.left = L_pos;

			//write div to the body...
			document.getElementsByTagName('body')[0].appendChild(subObj);

			//build html for submenu
			content = "";
			m = submenu[obj.id];
			for(i=0;i<m.length;i++){

				//determin target for onclick...
				//	(sorry, I should rewrite this routine...)
				if(!m[i][2] || m[i][2] == '_self'){
					act = "self.location.href='" + m[i][1] + "';";
				}else if(m[i][2] == '_top'){
					act = "top.location.href='" + m[i][1] + "';";
				}else if(m[i][2] == '_blank'){
                    act = "window.open('" + m[i][1] + "');";
				}else if(m[i][2] == '_webcam'){
					act = "window.open('" + m[i][1] + "','','width=800,height=1000');";
				}else{
					//get javascript target (not tested yet)
					//TODO: check how to do this cleanly
					act = "window.frames['"+m[i][2]+"'].location.href='" + m[i][1] + "';";
				}

				//make item
				content+= "<div onmouseout=\"hideSubmenu(this)\" onmouseover=\"buildSubmenu(this)\" "+ (m[i][1] ? "onclick=\""+ act + "\" " : "") +"class=menuItem" + (i==0 ? 'First' : (i==(m.length -1) && useLastItemCSS ? 'Last' : '')) + " id=\"" + obj.id + "_" + i +"\">" + m[i][0] + "</div>";
				adj[i] = obj.id + "_" + i;
			}

			//insert new menu
			subObj.innerHTML = content;

			//make all just made div's the same width...
			for(i=0;i<adj.length;i++)
				document.getElementById(adj[i]).style.width = subObj.style.width;
		}
	}
}

//hide a submebu div
function hideSubmenu(obj){
	//get common part of div id
	closePath = obj.id.split('_');

	//hide path
	x = "div";
	for(i=0;i<closePath.length;i++){
		x+= '_' + closePath[i];
		if(document.getElementById(x))
			tmr[x] = window.setTimeout("document.getElementById('"+x+"').style.visibility = 'hidden';",1);
		//The timeout above is needed for MSIE browsers... Or else the menu's will disapear on EVERY mousout!!!
		//Please get a normal browser like Firefox, Mozilla or Opera!!
	}
}

//add an menu item to the config array (called in the config lines)
function menuItem(txt,url,tar){
	return new Array(txt,url,tar);
}

//*** Now a patch for MSIE lag of CSS2 compliance!!
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')==-1){
	document.onmouseover = function(){
		obj = event.srcElement;
		if(obj.className == 'menuItemFirst' || obj.className == 'menuItem' || obj.className == 'menuItemLast')
			obj.className+='Over';
	}
	document.onmouseout = function(){
		obj = event.srcElement;
		if(obj.className == 'menuItemFirstOver' || obj.className == 'menuItemOver' || obj.className == 'menuItemLastOver')
			obj.className = obj.className.substring(0,(obj.className.length - 4));
	}
}
//*** End of msie patch
/**
 * SWFObject v1.4.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
	if (!document.createElement || !document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', useExpressInstall);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			for (var i=3; axo!=null; i++) {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				PlayerVersion = new deconcept.PlayerVersion([i,0,0]);
			}
		}catch(e){}
		if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
		// this only does the minor rev lookup if the user's major version 
		// is not 6 or we are checking for a specific minor or revision number
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
			try{
				PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
			}catch(e){}
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) != null ? parseInt(arrVersion[0]) : 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param){
		var q = document.location.search || document.location.hash;
		if(q){
			var startIndex = q.indexOf(param +"=");
			var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
			if (q.length > 1 && startIndex > -1) {
				return q.substring(q.indexOf("=", startIndex)+1, endIndex);
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = null;
			}
		}
	}
}
if (typeof window.onunload == 'function') {
	var oldunload = window.onunload;
		window.onunload = function() {
		deconcept.SWFObjectUtil.cleanupSWFs();
		oldunload();
	}
} else {
	window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;



