/*
--------------------------------------------------------------------------- 
Default Javascript File
(c) 2006 Select Performers

Version:	1.00
Date:		06/01/2007
Author:		Ian Anderson Gray
Website:	http://selectperformers.com/
---------------------------------------------------------------------------
Notes:	
		
---------------------------------------------------------------------------
To Do

---------------------------------------------------------------------------
Change Log

---------------------------------------------------------------------------
*/




Array.prototype.count = function() {
	return this.length;
};

var ap_instances = new Array();

function ap_stopAll(playerID)
	{
		for(var i = 0;i<ap_instances.length;i++)
			{
				try
					{
						if(ap_instances[i] != playerID)
							{
								document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
							}
						else
							{
								document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
							}
					}
				catch( errorObject )
					{
						// stop any errors
					}
			}

	}



function ap_registerPlayers()
	{
		var objectID;
		var objectTags = document.getElementsByTagName("object");
		for(var i=0;i<objectTags.length;i++)
			{
				objectID = objectTags[i].id;
				if(objectID.indexOf("audioplayer") == 0)
					{
						ap_instances[i] = objectID.substring(11, objectID.length);
					}
			}
	}




/*-----------------------------------------------------------------------------*/
// Start of window.onload fix (by Dean Edwards/Matthias Miller/John Resig)
/*-----------------------------------------------------------------------------*/
	function init()
		{
   			// quit if this function has already been called
  	 		if (arguments.callee.done) return;

    		// flag this function so we don't do the same thing twice
    		arguments.callee.done = true;

    		// kill the timer
    		if (_timer) clearInterval(_timer);
			
			
			/*-----------------------------------------------------------------------------*/
			/*-----------------------------------------------------------------------------*/
    		// Start of Javascript to initialise when page loads...
					
			doExternalLink();
			Fat.fade_all();
			geo();
			// Start of Flash files to load
			
			// 1
			var fmp = {movie:"media/swf/beethovencd.swf", width:"475", height:"25", majorversion:"6", build:"40", quality:"high", wmode:"transparent", menu:"false",  idy:"beethovenCD" };
			UFO.create(fmp, "beethovencd");
			
			// 2
			var fmp = {movie:"media/swf/helicopter.swf", width:"490", height:"346", majorversion:"6", build:"40", quality:"high", wmode:"transparent", menu:"false",  idy:"heli" };
			UFO.create(fmp, "helicopter");
			
			// Audio Files
			audios = new Array(	"beethoven-sonatas/sonata-in-a-major-adagio-sostenuto-presto.mp3",
							   	"beethoven-sonatas/sonata-in-a-major-andante-con-variazioni.mp3",
								"beethoven-sonatas/sonata-in-a-major-finale-presto.mp3",
								"beethoven-sonatas/sonata-in-c-minor-allegro-con-brio.mp3",
								"beethoven-sonatas/sonata-in-c-minor-adagio-cantabile.mp3",
								"beethoven-sonatas/sonata-in-c-minor-scherzo-allegro.mp3",
								"beethoven-sonatas/sonata-in-c-minor-finale-allegro.mp3",
								"strauss-and-franck/allegro-ma-non-troppo.mp3",
								"strauss-and-franck/improvisation-andante-cantabile.mp3",
								"strauss-and-franck/recitativo-fantasia.mp3",
								"strauss-and-franck/allegretto-poco-mosso.mp3",
								"richard-bakers-favourite/salut-damour.mp3",
								"richard-bakers-favourite/caprice-viennois.mp3",
								"richard-bakers-favourite/polonaise-in-d.mp3",
								"richard-bakers-favourite/bess-in-my-woman-now.mp3",
								"richard-bakers-favourite/canto-popolare.mp3",
								"richard-bakers-favourite/banjo-and-fiddle.mp3",
								"elgar-bruch-concertos/elgar-violin-concerto-first-movement.mp3",
								"elgar-bruch-concertos/elgar-violin-concerto-second-movement.mp3",
								"elgar-bruch-concertos/elgar-violin-concerto-third-movement.mp3",
								"elgar-bruch-concertos/bruch-violin-concerto-1-first-movement.mp3",
								"elgar-bruch-concertos/bruch-violin-concerto-1-second-movement.mp3",
								"elgar-bruch-concertos/bruch-violin-concerto-1-third-movement.mp3",
								"ave-maria/Hubay-Der-Zephir.mp3",
								"ave-maria/Schubert-Wilhelmj-Ave-Maria.mp3",
								"ave-maria/Drigo-Valse-Bluette.mp3",
								"ave-maria/Debussy-La-Fille-aux-Cheveux-de-Lin.mp3",
								"ave-maria/Sarasate-Zapateado.mp3"
								);
			
			arrayCount = audios.count();
			for(ii=0;ii<=arrayCount;ii=ii+1)
				{
					var FOa ={movie:"/media/swf/playerNew.swf",width:"290", height:"24", majorversion:"6", build:"40", flashvars:"playerID="+ii+"&bg=0xF8F8F8&leftbg=0xababab&rightbg=0xdedede&rightbghover=0x999999&lefticon=0x666666&righticon=0x666666&righticonhover=0xFFFFFF&text=0x913D18&slider=0x913D18&track=0x333333&loader=0xBBCAE1&border=0x666666&autostart=false&soundFile=http://lelandchen.com/media/audio/"+audios[ii], quality:"high", wmode:"transparent", menu:"false",  idy:"audioplayer"+ii};
					UFO.create(FOa, "audio"+ii);
				}
			
			
			// End of Flash Files to load
			
			if(document.getElementById('printPage')) {document.getElementById('printPage').innerHTML = '<a href="javascript:window.print()" title="Print this Page" class="print">Print this Page</a>';}
			if(document.getElementById('favorites')) {document.getElementById('favorites').innerHTML = "<a href=\"javascript:bookmarksite('"+document.title+"', '"+location.href+"')\" title=\"Add this page to your favourites\" class=\"favorites\">Add to Favourites</a>";}
			
			
			var ap_clearID = setInterval( ap_registerPlayers, 100 );
			
			// End of Javascript to initialise when page loads
			/*-----------------------------------------------------------------------------*/
			/*-----------------------------------------------------------------------------*/
		};

	/* for Mozilla/Opera9 */
	if (document.addEventListener)
		{
   			document.addEventListener("DOMContentLoaded", init, false);
		}

	/* for Internet Explorer */
	/*@cc_on @*/
	/*@if (@_win32)
   	 	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
   	 	var script = document.getElementById("__ie_onload");
    	script.onreadystatechange = function()
			{
        		if (this.readyState == "complete")
					{
            			init(); // call the onload handler
        			}
    		};
		/*@end @*/

	/* for Safari */
		if (/WebKit/i.test(navigator.userAgent))
			{ // sniff
    			var _timer = setInterval(function()
					{
        				if (/loaded|complete/.test(document.readyState))
							{
            					init(); // call the onload handler
        					}
    				}, 10);
			}

	/* for other browsers */
		window.onload = init;

/*-----------------------------------------------------------------------------*/
// End of window.onload fix
/*-----------------------------------------------------------------------------*/









/*-----------------------------------------------------------------------------*/
// Start of dropdown menu Function
/*-----------------------------------------------------------------------------*/
/*		This fixes the dropdown menu to work in IE */
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
/*-----------------------------------------------------------------------------*/
// End of dropdown menu fix
/*-----------------------------------------------------------------------------*/







/*-----------------------------------------------------------------------------*/
// Start of Bookmark Site function
/*-----------------------------------------------------------------------------*/
function bookmarksite(title,url)
	{
		if (window.sidebar) 
			{// firefox
				window.sidebar.addPanel(title, url, "");
			}
		else if(window.opera && window.print)
			{ // opera
				var elem = document.createElement('a');
				elem.setAttribute('href',url);
				elem.setAttribute('title',title);
				elem.setAttribute('rel','sidebar');
				elem.click();
			} 
		else if(document.all)
			{// ie
				window.external.AddFavorite(url, title);
			}
	}
/*-----------------------------------------------------------------------------*/
// End of Bookmark Site function
/*-----------------------------------------------------------------------------*/
 












/*-----------------------------------------------------------------------------*/
// Start of clearInputs Function
/*-----------------------------------------------------------------------------*/
/*		This function loops through all the text inputs on a page and stores their default values.
		When a text input is brought into focus, its current value is checked against its default value.
		If they are the same, the value is cleared.
		This allows you to add placeholder text to inputs (recommended for accessibility) but users don't have to manually delete the placeholder text.
		This function is triggered when the page loads. */

function clearInputs()
	{
		if (!document.getElementsByTagName)
			{
				return false;
			}
 		var all_inputs = document.getElementsByTagName('input');
 		for (var i=0;i<all_inputs.length;i++)
			{
  				var current_input = all_inputs[i];
  				if (current_input.getAttribute('type') == 'text' && current_input.getAttribute('value') != '')
					{
   						current_input.default_text = current_input.getAttribute('value');
   						current_input.onfocus = function()
							{
    							if (this.getAttribute('value') == this.default_text)
									{
     									this.setAttribute('value','');
									};
							}
					}
			}
	}
/*-----------------------------------------------------------------------------*/
// End of clearInputs Function
/*-----------------------------------------------------------------------------*/






/*-----------------------------------------------------------------------------*/
// Start of externalLink function
// Opens a link in a new window when class = externalLink
/*-----------------------------------------------------------------------------*/
function doExternalLink()
	{
		if (!document.getElementsByTagName)
			{
				return false;
			}
  		var links = document.getElementsByTagName("a");
  		for (var i=0; i < links.length; i++)
			{
    			if (links[i].className.match("externalLink"))
					{
						links[i].className = links[i].className + " newWinStyle";
							if (links[i].title == "")
								{
									links[i].title = "(opens in new window)";
								}
							else
								{
									links[i].title = links[i].title + " (opens in new window)";	
								}
	 						links[i].onclick = function(e)
								{
									if(!e)e=window.event;
									if(e.shiftKey || e.ctrlKey || e.altKey) return;
									window.open(this.href);
									return false;
								}
      				}
    		}
	}
/*-----------------------------------------------------------------------------*/
// End of externalLink Function
/*-----------------------------------------------------------------------------*/






/*-----------------------------------------------------------------------------*/
// Start of Array Shorthand
/*-----------------------------------------------------------------------------*/
// Shorthand for seeing if something is in an array

Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
};
/*-----------------------------------------------------------------------------*/
// End of Array Shorthand
/*-----------------------------------------------------------------------------*/





/*-----------------------------------------------------------------------------*/
// Start of Easy Add Event
/*-----------------------------------------------------------------------------*/
// Easy way of adding an event
function addEventy( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
		EventCache.add(obj, type, fn);
	}
	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}
/*-----------------------------------------------------------------------------*/
// End of Easy Add Event
/*-----------------------------------------------------------------------------*/







/*-----------------------------------------------------------------------------*/
// Start of IE Cache Fix
/*-----------------------------------------------------------------------------*/
// Solves an IE caching problem
var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
			listEvents.push(arguments);
		},
		flush : function(){
			var i, item;
			for(i = listEvents.length - 1; i >= 0; i = i - 1){
				item = listEvents[i];
				if(item[0].removeEventListener){
					item[0].removeEventListener(item[1], item[2], item[3]);
				};
				if(item[1].substring(0, 2) != "on"){
					item[1] = "on" + item[1];
				};
				if(item[0].detachEvent){
					item[0].detachEvent(item[1], item[2]);
				};
				item[0][item[1]] = null;
			};
		}
	};
}();
addEventy(window,'unload',EventCache.flush);
/*-----------------------------------------------------------------------------*/
// End of IE Cache Fix
/*-----------------------------------------------------------------------------*/









/*-----------------------------------------------------------------------------*/
//		Start of Unobtrusive Flash Objects (UFO) v3.21
/*-----------------------------------------------------------------------------*/
/*	Unobtrusive Flash Objects (UFO) v3.22 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005-2007 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
			
	This function inserts the flash objects into the page if the visitor has flash enabled. */


var UFO = {
	req: ["movie", "width", "height", "majorversion", "build","idy"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing", "allowfullscreen", "allownetworking"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 250);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				_obj.setAttribute("id", _fo.idy);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0" id="' + _fo.idy + '"><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks);
}
// End of UFO Function
/*-----------------------------------------------------------------------------*/








/*-----------------------------------------------------------------------------*/
// Start of Sweet Titles
/*-----------------------------------------------------------------------------*/
/*
Sweet Titles (c) Creative Commons 2005
http://creativecommons.org/licenses/by-sa/2.5/
Author: Dustin Diaz | http://www.dustindiaz.com
*/
var sweetTitles = { 
	xCord : 0,				// @Number: x pixel value of current cursor position
	yCord : 0,				// @Number: y pixel value of current cursor position
	tipElements : ['a','abbr','acronym'],	// @Array: Allowable elements that can have the toolTip
	obj : Object,			// @Element: That of which you're hovering over
	tip : Object,			// @Element: The actual toolTip itself
	active : 0,				// @Number: 0: Not Active || 1: Active
	init : function() {
		if ( !document.getElementById ||
			!document.createElement ||
			!document.getElementsByTagName ) {
			return;
		}
		var i,j;
		this.tip = document.createElement('div');
		this.tip.id = 'toolTip';
		document.getElementsByTagName('body')[0].appendChild(this.tip);
		this.tip.style.top = '0';
		this.tip.style.visibility = 'hidden';
		addEventy(document,'mousemove',this.updateXY);
		if ( document.captureEvents ) {
				document.captureEvents(Event.MOUSEMOVE);
		}
		var tipLen = this.tipElements.length;
		for ( i=0; i<tipLen; i++ ) {
			var current = document.getElementsByTagName(this.tipElements[i]);
			var curLen = current.length;
			for ( j=0; j<curLen; j++ ) {
				if ( current[j].title != "") {
					addEventy(current[j],'mouseover',this.tipOver);
					addEventy(current[j],'mouseout',this.tipOut);
					current[j].setAttribute('tip',current[j].title);
					current[j].removeAttribute('title');
				}
			}
		}
	},
	updateXY : function(e) {
		if ( document.captureEvents ) {
			sweetTitles.xCord = e.pageX;
			sweetTitles.yCord = e.pageY;
		} else if ( window.event.clientX ) {
			sweetTitles.xCord = window.event.clientX+document.documentElement.scrollLeft;
			sweetTitles.yCord = window.event.clientY+document.documentElement.scrollTop;
		}
	},
	tipOut: function() {
		if ( window.tID ) {
			clearTimeout(tID);
		}
		if ( window.opacityID ) {
			clearTimeout(opacityID);
		}
		sweetTitles.tip.style.visibility = 'hidden';
	},
	checkNode : function() {
		var trueObj = this.obj;
		if ( this.tipElements.inArray(trueObj.nodeName.toLowerCase()) ) {
			return trueObj;
		} else {
			return trueObj.parentNode;
		}
	},
	tipOver : function() {
		sweetTitles.obj = this;
		tID = window.setTimeout("sweetTitles.tipShow()",500)
	},
	tipShow : function() {		
		var scrX = Number(this.xCord);
		var scrY = Number(this.yCord);
		var tp = parseInt(scrY+15);
		var lt = parseInt(scrX+10);
		var anch = this.checkNode();
		var addy = '';
		var access = '';
		if ( anch.nodeName.toLowerCase() == 'a' ) {
			addy = (anch.href.length > 42 ? anch.href.toString().substring(0,42)+"..." : anch.href);
			var access = ( anch.accessKey ? ' <span>Access key: ['+anch.accessKey+']</span> ' : '' );
		} else {
			addy = anch.firstChild.nodeValue;
		}
		if (addy.indexOf(window.location.hostname) == -1) {
		this.tip.innerHTML = "<p>"+anch.getAttribute('tip')+"<em>"+access+addy+"</em></p>";
		}
		else {
			this.tip.innerHTML = "<p>"+anch.getAttribute('tip')+"<em>"+access+"</em></p>";
		}
		if ( parseInt(document.documentElement.clientWidth+document.documentElement.scrollLeft) < parseInt(this.tip.offsetWidth+lt) ) {
			this.tip.style.left = parseInt(lt-(this.tip.offsetWidth+10))+'px';
		} else {
			this.tip.style.left = lt+'px';
		}
		if ( parseInt(document.documentElement.clientHeight+document.documentElement.scrollTop) < parseInt(this.tip.offsetHeight+tp) ) {
			this.tip.style.top = parseInt(tp-(this.tip.offsetHeight+10))+'px';
		} else {
			this.tip.style.top = tp+'px';
		}
		if (((anch.getAttribute('tip') || access) != "") || (addy.indexOf(window.location.hostname) == -1)) {
			this.tip.style.visibility = 'visible';
			this.tip.style.opacity = '.1';
			this.tipFade(10);	
		}
	},
	tipFade: function(opac) {
		var passed = parseInt(opac);
		var newOpac = parseInt(passed+10);
		if ( newOpac < 80 ) {
			this.tip.style.opacity = '.'+newOpac;
			this.tip.filter = "alpha(opacity:"+newOpac+")";
			opacityID = window.setTimeout("sweetTitles.tipFade('"+newOpac+"')",20);
		}
		else { 
			this.tip.style.opacity = '.80';
			this.tip.style.filter = "alpha(opacity:80)";
		}
	}
};
function pageLoader() {
	sweetTitles.init();
}

window.onload=function(){
pageLoader();
}
/*-----------------------------------------------------------------------------*/
// End of Sweet Titles
/*-----------------------------------------------------------------------------*/






/*-----------------------------------------------------------------------------*/
// Start of F.A.T.
/*-----------------------------------------------------------------------------*/
// @name      The Fade Anything Technique
// @namespace http://www.axentric.com/aside/fat/
// @version   1.0-RC1
// @author    Adam Michela

var Fat = {
	make_hex : function (r,g,b) 
	{
		r = r.toString(16); if (r.length == 1) r = '0' + r;
		g = g.toString(16); if (g.length == 1) g = '0' + g;
		b = b.toString(16); if (b.length == 1) b = '0' + b;
		return "#" + r + g + b;
	},
	fade_all : function ()
	{
		var a = document.getElementsByTagName("*");
		for (var i = 0; i < a.length; i++) 
		{
			var o = a[i];
			var r = /fade-?(\w{3,6})?/.exec(o.className);
			if (r)
			{
				if (!r[1]) r[1] = "";
				if (o.id) Fat.fade_element(o.id,null,null,"#"+r[1]);
			}
		}
	},
	fade_element : function (id, fps, duration, from, to) 
	{
		if (!fps) fps = 30;
		if (!duration) duration = 3000;
		if (!from || from=="#") from = "#FFFF33";
		if (!to) to = this.get_bgcolor(id);
		
		var frames = Math.round(fps * (duration / 1000));
		var interval = duration / frames;
		var delay = interval;
		var frame = 0;
		
		if (from.length < 7) from += from.substr(1,3);
		if (to.length < 7) to += to.substr(1,3);
		
		var rf = parseInt(from.substr(1,2),16);
		var gf = parseInt(from.substr(3,2),16);
		var bf = parseInt(from.substr(5,2),16);
		var rt = parseInt(to.substr(1,2),16);
		var gt = parseInt(to.substr(3,2),16);
		var bt = parseInt(to.substr(5,2),16);
		
		var r,g,b,h;
		while (frame < frames)
		{
			r = Math.floor(rf * ((frames-frame)/frames) + rt * (frame/frames));
			g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
			b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
			h = this.make_hex(r,g,b);
		
			setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);

			frame++;
			delay = interval * frame; 
		}
		setTimeout("Fat.set_bgcolor('"+id+"','"+to+"')", delay);
	},
	set_bgcolor : function (id, c)
	{
		var o = document.getElementById(id);
		o.style.backgroundColor = c;
	},
	get_bgcolor : function (id)
	{
		var o = document.getElementById(id);
		while(o)
		{
			var c;
			if (window.getComputedStyle) c = window.getComputedStyle(o,null).getPropertyValue("background-color");
			if (o.currentStyle) c = o.currentStyle.backgroundColor;
			if ((c != "" && c != "transparent") || o.tagName == "BODY") { break; }
			o = o.parentNode;
		}
		if (c == undefined || c == "" || c == "transparent") c = "#FFFFFF";
		var rgb = c.match(/rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/);
		if (rgb) c = this.make_hex(parseInt(rgb[1]),parseInt(rgb[2]),parseInt(rgb[3]));
		return c;
	}
}
/*-----------------------------------------------------------------------------*/
// End of F.A.T.
/*-----------------------------------------------------------------------------*/



/*--------------------------------------------------------------------------
 *  Smooth Scroller Script, version 1.0.1
 *  (c) 2007 Dezinerfolio Inc. <midart@gmail.com>
 *
 *  For details, please check the website : http://dezinerfolio.com/
 *
/*--------------------------------------------------------------------------*/

Scroller = {
	// control the speed of the scroller.
	// dont change it here directly, please use Scroller.speed=50;
	speed:10,

	// returns the Y position of the div
	gy: function (d) {
		gy = d.offsetTop
		if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop
		return gy
	},

	// returns the current scroll position
	scrollTop: function (){
		body=document.body
	    d=document.documentElement
	    if (body && body.scrollTop) return body.scrollTop
	    if (d && d.scrollTop) return d.scrollTop
	    if (window.pageYOffset) return window.pageYOffset
	    return 0
	},

	// attach an event for an element
	// (element, type, function)
	add: function(event, body, d) {
	    if (event.addEventListener) return event.addEventListener(body, d,false)
	    if (event.attachEvent) return event.attachEvent('on'+body, d)
	},

	// kill an event of an element
	end: function(e){
		if (window.event) {
			window.event.cancelBubble = true
			window.event.returnValue = false
      		return;
    	}
	    if (e.preventDefault && e.stopPropagation) {
	      e.preventDefault()
	      e.stopPropagation()
	    }
	},
	
	// move the scroll bar to the particular div.
	scroll: function(d){
		i = window.innerHeight || document.documentElement.clientHeight;
		h=document.body.scrollHeight;
		a = Scroller.scrollTop()
		if(d>a)
			if(h-d>i)
				a+=Math.ceil((d-a)/Scroller.speed)
			else
				a+=Math.ceil((d-a-(h-d))/Scroller.speed)
		else
			a = a+(d-a)/Scroller.speed;
		window.scrollTo(0,a)
	  	if(a==d || Scroller.offsetTop==a)clearInterval(Scroller.interval)
	  	Scroller.offsetTop=a
	},
	// initializer that adds the renderer to the onload function of the window
	init: function(){
		Scroller.add(window,'load', Scroller.render)
	},

	// this method extracts all the anchors and validates then as # and attaches the events.
	render: function(){
		a = document.getElementsByTagName('a');
		Scroller.end(this);
		window.onscroll
	    for (i=0;i<a.length;i++) {
	      l = a[i];
	      if(l.href && l.href.indexOf('#top') != -1 && ((l.pathname==location.pathname) || ('/'+l.pathname==location.pathname)) ){
	      	Scroller.add(l,'click',Scroller.end)
	      		l.onclick = function(){
	      			Scroller.end(this);
		        	l=this.hash.substr(1);
		        	 a = document.getElementsByTagName('a');
				     for (i=0;i<a.length;i++) {
				     	if(a[i].name == l){
				     		clearInterval(Scroller.interval);
				     		Scroller.interval=setInterval('Scroller.scroll('+Scroller.gy(a[i])+')',10);
						}
					}
				}
	      	}
		}
	}
}
// invoke the initializer of the scroller
Scroller.init();


/*------------------------------------------------------------
 *						END OF CODE
/*-----------------------------------------------------------*/


function geo()
	{
		if (!document.getElementsByTagName) // Check for browser support
			{
				return false;
			}
		var map = rot13init(); 
		var tooltip_js_on = '';
		var tooltip_js_off = '';
		var links = document.getElementsByTagName('a'); // Get all anchors
		
		function geo_decode(anchor)
			{ // function to recompose the orginal address
				var href = anchor.getAttribute('href');
				var address = href.replace(/.*mail\/([a-z0-9._%-]+)\+([a-z0-9._%-]+)\+([a-z.]+)/i, '$1' + '@' + '$2' + '.' + '$3');
				var linktext = anchor.innerHTML; // IE Fix
				if (href != address)
					{
						var rot13 = 1;
						anchor.setAttribute('href','mailto:' + (rot13 ? str_rot13(address,map) : address)+"?subject=From the Leland Chen Web Site"); // Add mailto link	
						anchor.innerHTML = linktext; // IE Fix
					}
			}
	
		for (var l = 0 ; l < links.length ; l++)
			{ // Loop through the anchors
				
				if (links[l].href.search("/mail/") !== -1) {
					
				links[l].onclick = function()
					{ // Encode links when clicked
						geo_decode(this);
					}
				links[l].onmouseover = function()
					{ // Display tooltip when links are hovered
						geo_decode(this); // Encode links when hovered (so that the address appears correctly in the browser's status bar)
							
					}
				}
			}
	}


function rot13init() {
	var map = new Array();
	var s = "abcdefghijklmnopqrstuvwxyz";
	for (var i = 0 ; i < s.length ; i++)
		map[s.charAt(i)] = s.charAt((i+13)%26);
	for (var i = 0 ; i < s.length ; i++)
		map[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase();
	return map;
}

function str_rot13(a,map) {
	var s = "";
	for (var i = 0 ; i < a.length ; i++) {
		var b = a.charAt(i);
		s += (b>='A' && b<='Z' || b>='a' && b<='z' ? map[b] : b);
	}
	return s;
}

/*------------------------------------------------------------
 *						END OF CODE
/*-----------------------------------------------------------*/

document.write("<style>#miniBasket { filter:alpha(opacity=80);-moz-opacity:.80;opacity:.80;-moz-border-radius:5px;} #nav li ul { filter:alpha(opacity=95);-moz-opacity:.95;opacity:.95;} body div#toolTip { -moz-border-radius:5px; } html {overflow-y: scroll;}</style>");