// JavaScript Document

/* --------------------------------------------------------------------------------------------- */

// Preload images

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];}}
}

/* --------------------------------------------------------------------------------------------- */

// Swap images

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_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];}
}

/* --------------------------------------------------------------------------------------------- */

// Jump menu

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/* --------------------------------------------------------------------------------------------- */

// Change property

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}

/* --------------------------------------------------------------------------------------------- */

// Flash activation code

function commitFlashObject(_obj, _container){
	_output=""
	_paramoutput=""
	_src=""
	_ver=""
	for(_cO in _obj){
		_output+=_cO+"=\""+_obj[_cO]+"\" "
		_paramoutput+="<param name="+_cO+" value=\""+_obj[_cO]+"\">";
		if(_cO=="movie")_src="src=\""+_obj[_cO]+"\"";
		if(_cO=="version")_ver=_obj[_cO];
	}
	if(_ver=="")_ver="8,0,0,0"
	ihtm="<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+_ver+" "+_output+">\n"
	ihtm+=_paramoutput+"\n"
	ihtm+="<embed "+_src+" pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash "+_output+">\n";
	ihtm+="</embed>\n";
	ihtm+="</object>\n";
	document.getElementById(_container).innerHTML=ihtm	
}

/* --------------------------------------------------------------------------------------------- */

/* This is the freely available Browser Detect script */

/* BrowserDetect.browser is the browser name */
/* BrowserDetect.version is the browser version */
/* BrowserDetect.OS is the client OS */

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

/* --------------------------------------------------------------------------------------------- */

// Display the slideshow, or random image for those with less than FP 6

function frontpageImage() {

fpv = DetectFlashVer(6, 0);

	if(fpv == true) {
		myFlashObject=new Object
		myFlashObject.movie="/flash/slideshow.swf"
		myFlashObject.quality="high"
		myFlashObject.wmode="transparent"
		myFlashObject.width=340
		myFlashObject.height=270
		myFlashObject.version="5,0,0,0"
		commitFlashObject(myFlashObject, "fp_show")
	}
	
	else {
		document.write("<img src='/siteimages/fpmask.gif' >");
		img = Math.round(Math.random()*9)+1;
		MM_changeProp('fp_show','','background','url(/images/fp_images/fp'+img+'.jpg)','DIV')
	}
}

/* --------------------------------------------------------------------------------------------- */

<!-- Type out the image based titles -->

function title(tit,margintop,marginbottom) {
	for(k=0; k < tit.length; k++) {
		result = tit.slice(k,k+1);
			if(result == " ") { result = "space" }
			else if(result == ".") { result = "stop" }
			else if(result == ":") { result = "colon" }
			else if(result == "?") { result = "question" }
			else if(result == "&") { result = "and" }

	document.write("<img src='/siteimages/alphabet/"+result+".gif' style='margin-right: 3px; margin-top: "+margintop+"px; margin-bottom: "+marginbottom+"px;' alt=' ' />");
	if (result == "colon") { document.write("<br>"); }
	}
}

/* --------------------------------------------------------------------------------------------- */

// Show video on page

function video(fn) {

nine = DetectFlashVer(9, 0);
seven = DetectFlashVer(7, 0);

	if(nine == true) {
		MM_changeProp('video','','display','block','DIV')
		file = "&fn="+fn;
		myFlashObject=new Object
		myFlashObject.movie="/flash/videoplayer.swf"
		myFlashObject.quality="high"
		myFlashObject.width=265
		myFlashObject.height=223
		myFlashObject.version="5,0,0,0"
		myFlashObject.salign="lt"
		myFlashObject.FlashVars=file
		commitFlashObject(myFlashObject, "video")
	}
	
	else if(seven == true && nine == false) {
		MM_changeProp('video','','display','block','DIV')
		MM_changeProp('video','','background','url(/siteimages/back_video.gif)','DIV')
		MM_changeProp('video','','width','255','DIV')
		MM_changeProp('video','','height','209','DIV')
		MM_changeProp('video','','padding','14 0 0 10','DIV')

		myFlashObject=new Object
		myFlashObject.movie="/flash/FLVPlayer_Progressive.swf"
		myFlashObject.quality="high"
		myFlashObject.width=245
		myFlashObject.height=194
		myFlashObject.version="5,0,0,0"
		myFlashObject.flashvars="&MM_ComponentVersion=1&skinName=/flash/Clear_Skin_1&streamName=/video/"+fn+"&autoPlay=false&autoRewind=true"
		commitFlashObject(myFlashObject, "video")
	}

	else { MM_changeProp('video','','display','none','DIV') }

}

/* --------------------------------------------------------------------------------------------- */

// THE STUFF BELOW IS ALL NEEDED FOR FLASH VERSION DETECTION

<!-- // Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
      // NS/Opera version >= 3 check for Flash plugin in plugin array
      if (navigator.plugins != null && navigator.plugins.length > 0) {
            if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
                  var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                        var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
                        descArray = flashDescription.split(" ");
                        tempArrayMajor = descArray[2].split(".");
                        versionMajor = tempArrayMajor[0];
                  if ( descArray[3] != "" ) {
                        tempArrayMinor = descArray[3].split("r");
                  } else {
                        tempArrayMinor = descArray[4].split("r");
                  }
                        versionMinor = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
                        flashVer = parseFloat(versionMajor + "." + versionMinor);
            } else {
                  flashVer = -1;
            }
      }
      // MSN/WebTV 2.6 supports Flash 4
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
      // WebTV 2.5 supports Flash 3
      else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
      // older WebTV supports Flash 2
      else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
      // Can't detect in all other cases
      else {
            
            flashVer = -1;
      }
      return flashVer;
}

// If called with no parameters this function returns a floating point value 
// which should be the version of the Flash Player or 0.0 
// ex: Flash Player 6r65 returns 6.65
// If called with reqMajorVer, reqMinorVer returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer) 
{
reqVer = parseFloat(reqMajorVer + "." + reqMinorVer);

// loop backwards through the versions until we find the newest version      
      for (i=25;i>0;i--) {      
            if (isIE && isWin && !isOpera) {
                  versionStr = VBGetSwfVer(i);
            } else {
                  versionStr = JSGetSwfVer(i);
            }
            if (versionStr == -1) {
		return false;
		} else if (versionStr != 0) {
                  if(isIE && isWin && !isOpera) {
                        tempArray = versionStr.split(" ");
                        tempString = tempArray[1];
                        versionArray = tempString .split(",");
                        
                        versionMajor = versionArray[0];
                        versionMinor   = versionArray[2];
                        
                        versionString = versionMajor + "." + versionMinor;
                        versionNum = parseFloat(versionString);
                  } else {
                         versionNum = versionStr;
                   }
                  return (versionNum >= reqVer ? true : false );            
            }
      }
      
      return (reqVer ? false : 0.0);
}

// END OF FLASH VERSION DETECTION

/* --------------------------------------------------------------------------------------------- */

// SHOW FLASH PIE CHART FOR STATS

function pie(employment,further,training,other,unknown) {

	myFlashObject=new Object
	myFlashObject.movie="/flash/pie.swf"
	myFlashObject.quality="high"
	myFlashObject.wmode="transparent"
	myFlashObject.width=120
	myFlashObject.height=120
	myFlashObject.version="5,0,0,0"
	myFlashObject.flashvars="employment="+employment+"&further="+further+"&training="+training+"&other="+other+"&unknown="+unknown
	commitFlashObject(myFlashObject, "pie")

}

/*
 *	Timeline
 */




function commitFlashObject(_obj, _container){
	_output=""
	_paramoutput=""
	_src=""
	_ver=""
	for(_cO in _obj){
		_output+=_cO+"=\""+_obj[_cO]+"\" "
		_paramoutput+="<param name="+_cO+" value=\""+_obj[_cO]+"\">";
		if(_cO=="movie")_src="src=\""+_obj[_cO]+"\"";
		if(_cO=="version")_ver=_obj[_cO];
	}
	if(_ver=="")_ver="8,0,0,0"
	ihtm="<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+_ver+" "+_output+">\n"
	ihtm+=_paramoutput+"\n"
	ihtm+="<embed "+_src+" pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash "+_output+">\n";
	ihtm+="</embed>\n";
	ihtm+="</object>\n";
	document.getElementById(_container).innerHTML=ihtm	
}

// Insert timeline

function timeline(vars) {
	document.write("<div id='timeline' style='margin-top: -30px; margin-left: 10px;'>")
	myFlashObject=new Object
	myFlashObject.movie="/flash/timeline.swf"
	myFlashObject.quality="high"
	myFlashObject.wmode="transparent"
	myFlashObject.width=650
	myFlashObject.height=400
	myFlashObject.version="5,0,0,0"
	myFlashObject.flashvars="incoming="+vars
	commitFlashObject(myFlashObject, "timeline")
	document.write("</div>")
}