/* ************************************************************************** ****      $(String)                                                             ****      Description: Extension of getElementById method                       ****      Arguments: String(required) - eg. 'myId'                              **** ************************************************************************** */function $() {	var aElems = [];	for (var i=0; i<arguments.length; i++) {		var soElem = arguments[i];		if (typeof soElem == 'string') soElem = document.getElementById(soElem);		if (arguments.length == 1) return soElem;		aElems.push(soElem);	}	return aElems;}/* ************************************************************************** ****      $t(String,Object)                                                     ****      Description: Reduction of getElementByTagName method                  ****      Arguments: sTag(required) - String - eg. 'myTagName'                  ****                 oObj(optional) - Object - eg. myHTMLElement                **** ************************************************************************** */function $t(sTag,oObj) {	oObj = oObj || document;	return oObj.getElementsByTagName(sTag);}/* ************************************************************************** ****      $c(String,Object,String)                                              ****      Description: GetElementsByClassName                                   ****      Arguments: sClass(required) - String - eg. 'myClassName'              ****                 oObj(optional) - Object - eg. myHTMLElement                ****                 sTag(optional) - String - eg. 'myTagName'                  **** ************************************************************************** */function $c(sClass,oObj,sTag) {	oObj = oObj || document;	if (!oObj.length) { oObj = [oObj]; }	var aElements = [];	for(var i = 0; i<oObj.length; i++) {		oEl = oObj[i];		if(oEl.getElementsByTagName) {			oObj.children = oEl.getElementsByTagName(sTag || '*');			for (var j = 0; j<oObj.children.length; j++) {				oObj.child = oObj.children[j];				if(oObj.child.className&&(new RegExp('\\b'+sClass+'\\b').test(oObj.child.className))) {					aElements.push(oObj.child);				}			}		}	}	return aElements;}/* ************************************************************************** ****      new HTMLObject(Object)                                                ****      Description: Creates an HTMLObject object                             ****      Arguments: oEl(required) - Object - eg. myHTMLElement                 **** ************************************************************************** */HTMLObject = function(oEl) {	//if(!window.attachEvent) {return oEl;}	for(property in HTMLObject) { oEl[property] = HTMLObject[property]; }	return oEl;}/* ************************************************************************** ****      Object.extend(HTMLObject,WhizBang.prototype)                          ****      Description: Extends an HTMLObject with WhizBang properties           ****      Arguments: none                                                       **** ************************************************************************** */WhizBang = function() { };/* ************************************************************************** ****      Object.extend(Object,Object)                                          ****      Description: Extends objects with properties from other objects       ****      Arguments: oDestination(required) - Object - eg. myHTMLObject         ****                 oSource(required) - Object - eg. WhizBang.prototype        **** ************************************************************************** */Object.extend = function(oDestination,oSource) {	for(property in oSource) { oDestination[property] = oSource[property]; }	return oDestination;}/* ************************************************************************** ****      new Class(String)                                                     ****      Description: Creates a Class object                                   ****      Arguments: String(required) - eg. 'myClassName'                       **** ************************************************************************** */var Class = function() {	return function() { this.initialize.apply(this,arguments); }}/* ************************************************************************** ****      addEventToObject(Object,String,Function)                              ****      Description: Event addition                                           ****      Arguments: oObj(required) - Object - eg. myHTMLObject                 ****                 sEvt(required) - String - eg. 'onclick'                    ****                 fFunc(required) - Function - eg. functionName              ****                                                                            ****      removeEventFromObject(Object,String)                                  ****      Description: Event removal                                            ****      Arguments: oObj(required) - Object - eg. myHTMLObject                 ****                 sEvt(required) - String - eg. 'onclick'                    **** ************************************************************************** */function addEventToObject(oObj,sEvt,fFunc) {	var oldhandler = oObj[sEvt];	oObj[sEvt] = (typeof oObj[sEvt] != 'function') ? fFunc : function(){ oldhandler(); fFunc(); };}function removeEventFromObject(oObj,sEvt) {	var oldhandler = oObj[sEvt];	oObj[sEvt] = null;}/* ************************************************************************** ****      isQTInstalled()                                                       ****      Description: Checks to see if Quicktime is installed; returns true    ****                   or false.                                                ****      Arguments: none                                                       **** ************************************************************************** */function isQTInstalled() {	var qtInstalled = false;	qtObj = false;	if(navigator.plugins && navigator.plugins.length) {		for(var i=0; i < navigator.plugins.length; i++ ) {         var plugin = navigator.plugins[i];         if(plugin.name.indexOf("QuickTime") > -1) { qtInstalled = true; }        }	} else {		execScript('on error resume next: qtObj = IsObject(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1"))','VBScript');		qtInstalled = qtObj;	}	return qtInstalled;}/* ************************************************************************** ****      Array.push(Object)                                                    ****      Description: Adds method for older unsupported browsers               ****      Arguments: oElem(required) - Object - eg. 'myString'                  ****                                                                            ****      Array.shift()                                                         ****      Description: Adds method for older unsupported browsers               ****      Arguments: none                                                       **** ************************************************************************** */if (!Array.prototype.push) {	Array.prototype.push = function(oElem) {		this[this.length] = oElem;		return this.length;	}}if (!Array.prototype.shift) {	Array.prototype.shift = function() {		var response = this[0];		for (var i=0; i < this.length-1; i++) { this[i] = this[i + 1]; }		this.length--;		return response;	}}/* ************************************************************************** ****      ajaxRequest(String,Function)                                          ****      Description: Ajax                                                     ****      Arguments: sUrl(required) - String - eg. '/myXMLFile.xml'             ****                 fFunc(optional) - Function - eg. function() { myFunctions }**** ************************************************************************** */function ajaxRequest(sUrl,fFunc) {	if (window.XMLHttpRequest) {		var req = new XMLHttpRequest();		if (fFunc) { req.onreadystatechange = function() { fFunc(req); } }		req.open("GET", sUrl, true);		if (req.setRequestHeader) {req.setRequestHeader('If-Modified-Since','Wed, 15 Nov 1995 00:00:00 GMT');}		req.send(null);	} else if (window.ActiveXObject) {		isIE = true;		try {var req = new ActiveXObject("Msxml2.XMLHTTP");}		catch(e) {req = new ActiveXObject("Microsoft.XMLHTTP");}		if (req) {			if (fFunc) { req.onreadystatechange = function() { fFunc(req); } }			req.open("GET", sUrl, true);			req.send();		}	}}/* ************************************************************************** ****      ahah(String,String,Function)                                          ****      Description: Puts an XHTML page into an HTML page                     ****      Arguments: sUrl(required) - String - eg. '/myXHTMLpage.html'          ****                 sTarget(required) - String - eg. 'myElementId'             ****                 fFunc(optional) - Function - eg. function() { myFunctions }****                                                                            ****      ahahDone(String,Function)                                             ****      Description: See above                                                ****      Arguments: sTarget(required) - String - eg. 'myElementId'             ****                 fFunc(optional) - Function - eg. function() { myFunctions }**** ************************************************************************** */function ahah(sUrl,sTarget,fFunc) {	document.getElementById(sTarget).innerHTML = '<img src="http://images.apple.com/ilife/images/waitanimation.gif" alt="wait" width="20" height="20" border="0" id="wait">';	if (window.XMLHttpRequest) {		req = new XMLHttpRequest();		req.onreadystatechange = 			(fFunc) ? function(){ ahahDone(sTarget,fFunc); } : function() { ahahDone(sTarget); };		req.open("GET", sUrl, true);		req.send(null);	} else if (window.ActiveXObject) {		req = new ActiveXObject("Microsoft.XMLHTTP");		if (req) {			req.onreadystatechange = 				(fFunc) ? function(){ ahahDone(sTarget,fFunc); } : function() { ahahDone(sTarget); };			req.open("GET", sUrl, true);			req.send();		}	}}function ahahDone(sTarget,fFunc) {	if (req.readyState == 4) {		if (req.status == 200 || req.status == 304) {			results = req.responseText;			document.getElementById(sTarget).innerHTML = results;			if (fFunc) { fFunc(); }		} else {			document.getElementById(sTarget).innerHTML="ahah error:\n" + req.statusText;		}	}}/* ************************************************************************** ****      bind(Object)                                                          ****      Description: binds a function to a function or object                 ****                   support for legacy bindWithArguments                     ****      Arguments: oObj(required) - Object - eg. myObject                     **** ************************************************************************** */Function.prototype.bind = Function.prototype.bindWithArguments = function(oObj) {	var __method = this;	var args = [];	for (var i=0,len=arguments.length-1; i<len; i++) { args[i] = arguments[i+1]; }	return function() { __method.apply(oObj,args); };};/* ************************************************************************** ****      ensureElementFromObject(Object,Boolean)                               ****      Description: A simple IE fix                                          ****      Arguments: oEl(required) - Object - eg. myHTMLElement                 ****                 bAgain(optional) - Boolean - eg. true                      **** ************************************************************************** */function ensureElementFromObject(oEl,bAgain){	if(!window.attachEvent) { return; } // if not IE6, return	if(oEl.getAttribute('elementFromObject') != 'true' || bAgain === true) {		for(property in Object) { oEl[property] = Object[property]; }		oEl.setAttribute('elementFromObject','true');	}}/* ************************************************************************** ****      stopDefaultAction(Event)                                              ****      Description: Stops default action of an event                         ****      Arguments: ev(required) - Event - eg. ev                              **** ************************************************************************** */function stopDefaultAction(ev) {	if(!ev) { ev = window.event; }	(ev.stopPropagation) ? ev.stopPropagation() : ev.cancelBubble = true;	(ev.preventDefault) ? ev.preventDefault() : ev.returnValue = false;	return false;}/* ************************************************************************** ****      getClickedLink(Event)                                                 ****      Description: Gets the clicked anchor tag                              ****      Arguments: ev(required) - Event - eg. ev                              **** ************************************************************************** */function getClickedLink(ev) {	if(!ev) { ev = window.event; }	var clickedLink = (window.event) ? window.event.srcElement : ev.target;	while (!clickedLink.tagName || clickedLink.tagName.toLowerCase() != "a") clickedLink = clickedLink.parentNode;	return clickedLink;}/* ************************************************************************** ****      Object.getHeight()                                                    ****      Description: Gets the height of an HTMLObject                         ****      Arguments: none                                                       ****                                                                            ****      Object.getWidth()                                                     ****      Description: Gets the width of an HTMLObject                          ****      Arguments: none                                                       ****                                                                            ****      Object.getTop()                                                       ****      Description: Gets the top value of an HTMLObject                      ****      Arguments: none                                                       ****                                                                            ****      Object.getLeft()                                                      ****      Description: Gets the left value of an HTMLObject                     ****      Arguments: none                                                       ****                                                                            ****      Object.getInfo(String)                                                ****      Description: Gets the style value of the passed string from the       ****                   HTMLObject                                               ****      Arguments: selector(required) - String - eg. 'top'                    ****                                                                            ****      Object.addClass(String)                                               ****      Description: Adds a class to an HTMLObject                            ****      Arguments: class_name(required) - String - eg. 'myClassName'          ****                                                                            ****      Object.removeClass(String)                                            ****      Description: Removes a class from an HTMLObject                       ****      Arguments: class_name(required) - String - eg. 'myClassName'          ****                                                                            ****      Object.hasClass(String)                                               ****      Description: Checks to see if an HTMLObject has a certain class       ****      Arguments: class_name(required) - String - eg. 'myClassName'          ****                                                                            ****      Object.addEvent(String,Function)                                      ****      Description: Adds an event to an HTMLObject                           ****      Arguments: evt(required) - String - eg. 'onclick'                     ****                 func(required) - Function - eg. myFunctionName             ****                                                                            ****      Object.removeEvent(String)                                            ****      Description: Removes an event from an HTMLObject                      ****      Arguments: evt(required) - String - eg. 'onclick'                     **** ************************************************************************** */Object.extend(HTMLObject, {	getHeight: function() { return this.offsetHeight; },	getWidth: function() { return this.offsetWidth; },	getTop: function() {		var styleValue = 0;		var obj = this;		if(obj.offsetParent) {			while(obj.offsetParent) {				styleValue += obj.offsetTop;				obj = obj.offsetParent;			}		} else if(obj.x) { styleValue += obj.y; }		return styleValue;	},	getLeft: function() {		var styleValue = 0;		var obj = this;		if(obj.offsetParent) {			while(obj.offsetParent) {				styleValue += obj.offsetLeft;				obj = obj.offsetParent;			}		} else if(obj.x) { styleValue += obj.x; }		return styleValue;	},	getInfo: function(selector) {		var viewCSS = (typeof document.defaultView == 'function') ? document.defaultView() : document.defaultView;		if(viewCSS && viewCSS.getComputedStyle) {			var s = viewCSS.getComputedStyle(this,null);			return s && s.getPropertyValue(selector);		}		return this.currentStyle && (this.currentStyle[selector] || null) || null;	},	addClass: function(class_name) {		if(this.className !== '') { this.className += ' ' + class_name; }		else { this.className = class_name; }	},	removeClass: function(class_name) {		var oldClass = this.className;		var re = new RegExp('\\s?'+class_name+'\\b');		if(oldClass.indexOf(class_name) != -1) { this.className = oldClass.replace(re,''); }	},	hasClass: function(class_name) {		var re = new RegExp('(^|\\s+)'+class_name+'(\\s+|$)');		if(this.getAttributeNode("class") !== null) { return re.test(this.getAttributeNode("class").value); }		else if(this.className) { return re.test(this.className); }		else { return false; }	},	addEvent: function(evt,func) { addEventToObject(this,evt,func); },	removeEvent: function(evt) { removeEventFromObject(this,evt); }});/* ************************************************************************** ****      new AppleJAX()                                                        ****                                                                            ****      AppleJAX.ahah(String,String,Function)                                 ****      Description: Puts XHTML page into an XHTML page                       ****      Arguments: url(required) - String - eg. '/myXHTMLpage.html'           ****                 target(required) - String - eg. 'myHTMLElementId'          ****                 func(optional) - Function - eg. function() { myFunctions } ****                                                                            ****      AppleJAX.ahahdone(String,Function)                                    ****      Description: Used with ahah. See above.                               ****      Arguments: target(required) - String - eg. 'myHTMLElementId'          ****                 func(optional) - Function - eg. function() { myFunctions } ****                                                                            ****      AppleJAX.getXML(String,Function)                                      ****                                                                            ****      AppleJAX.getXML2(String,Function)                                     ****                                                                            ****      AppleJAX.getXMLdone(Function)                                         ****                                                                            ****      AppleJAX.getXMLwithResults(String,Function)                           ****                                                                            ****      AppleJAX.getXMLdoneWithResults(XMLHttpRequest,Function)               ****                                                                            **** ************************************************************************** */var AppleJAX = new Object();Object.extend(AppleJAX, {	ahah: function(url,target,func) {		if(window.XMLHttpRequest) {			req = new XMLHttpRequest();			req.onreadystatechange =				(func) ? function() { AppleJAX.ahahdone(target,func); } : function() { ahahDone(target); };			req.open("GET", url, true);			req.send(null);		} else if(window.ActiveXObject) {			req = new ActiveXObject("Microsoft.XMLHTTP");			if(req) {				req.onreadystatechange =					(func) ? function() { AppleJAX.ahahdone(target,func) ;} : function() { ahahDone(target); };				req.open("GET", url, true);				req.send();			}		}	},	ahahdone: function(target,func) {		if(req.readyState == 4) {			if(req.status == 200 || req.status == 304) {				results = req.responseText;				$(target).innerHTML = results;				if(func) { func(); }			} else { $(target).innerHTML = 'ahah error:\n' + req.statusText; }		}	},	getXML: function(url,func) {		if(window.XMLHttpRequest) {			req = new XMLHttpRequest();			req.onreadystatechange = function() { AppleJAX.getXMLdone(func); };			req.open("GET", url, true);			req.send(null);		} else if (window.ActiveXObject) {			req = new ActiveXObject("Microsoft.XMLHTTP");			if(req) {				req.onreadystatechange = function() { AppleJAX.getXMLdone(func); };				req.open("GET", url, true);				req.send();			}		}	},	getXML2: function(url,func) {		if(window.XMLHttpRequest) {			req = new XMLHttpRequest();			if(func) { req.onreadystatechange = function() { AppleJAX.getXMLdone(func); }; };			req.open("GET", url, true);			req.send(null);		} else if(window.ActiveXObject) {			req = new ActiveXObject("Microsoft.XMLHTTP");			if(req) {				if(func) { req.onreadystatechange = function() { AppleJAX.getXMLdone(func); }; };				req.open("GET", url, true);				req.send();			}		}	},	getXMLdone: function(func) {		if(req.readyState == 4) {			results = req.responseXML;			if(func) { func(); }		}	},	getXMLwithResults: function(url,func) {		if(window.XMLHttpRequest) {			req = new XMLHttpRequest();			req.onreadystatechange = function() { AppleJAX.getXMLdoneWithResults(req,func); };			req.open("GET", url, true);			req.send(null);		} else if(window.ActiveXObject) {			var req = new ActiveXObject("Microsoft.XMLHTTP");			if(req) {				req.onreadystatechange = function() { AppleJAX.getXMLdoneWithResults(req,func); };				req.open("GET", url, true);				req.send();			}		}	},	getXMLdoneWithResults: function(req,func) {		if(req.readyState == 4) {			var results = req.responseXML;			if(func) { func(results); }		}	}});/* ************************************************************************** ****      Fade                                                                  **** ************************************************************************** */WhizBang.prototype.Fade = function(duration,startOpacity,endOpacity,interval,step,curve,func) {	this.interval = interval;	this.duration = duration;	this.step = step;	this.setOpacity = function(o) {		this.style.opacity = (o / 101);		this.style.MozOpacity = (o / 100);		this.style.KhtmlOpacity = (o / 100);		this.style.filter = "alpha(opacity=" + o + ")";	};	this.setOpacity(startOpacity);	if(startOpacity == 0) { this.style.visibility = 'visible'; }	if(Browser.isIE()) {		if(this.id == 'newfeatureinfo') {			this.style.zIndex = '100';			var movieframe = document.getElementById('movieframe');			movieframe.style.height = this.offsetHeight + 'px';		} else if(!(this.id == 'sharebug')&&!(this.id == 'newfeatureinfo')&&!(this.id == 'gallery')) {			this.style.height = this.offsetHeight+'px';		}		this.style.zoom = '1';	}	var delta = startOpacity;	var newOpacity = startOpacity;	this.changeOpacity = function(newOpacity,endOpacity) {		var changeOpacityST = null;		var stepDuration = Math.round(this.duration/this.step);		this.duration -= stepDuration;		this.step--;		if(newOpacity < endOpacity) {			if(newOpacity <= endOpacity) {				delta = (this.step > 0) ? (endOpacity - newOpacity)/this.step : 0;				newOpacity = Math.max(startOpacity, Math.min(newOpacity+delta, endOpacity));				this.setOpacity(newOpacity);				changeOpacityST = window.setTimeout(this.changeOpacity.bindWithArguments(this,newOpacity,endOpacity),stepDuration);			}		}else if(newOpacity > endOpacity) {			if(newOpacity >= endOpacity) {				delta = (this.step > 0) ? (newOpacity - endOpacity)/this.step : 0;				newOpacity = Math.min(startOpacity, Math.max(newOpacity-delta, endOpacity));				this.setOpacity(newOpacity);				changeOpacityST = window.setTimeout(this.changeOpacity.bindWithArguments(this,newOpacity,endOpacity),stepDuration);			}		}else if (newOpacity == endOpacity) {			this.setOpacity(newOpacity);			clearTimeout(changeOpacityST);			if(func) { func(); }		}	};	this.changeOpacity(newOpacity,endOpacity);	return true;};/* ************************************************************************** ****      Searchbox                                                             **** ************************************************************************** */var Searchbox = {	init: function() {		var boxes = document.getElementsByClassName('searchbox','','input');		for(var i = 0, box; box = boxes[i]; i++) {			if(!Browser.isSafari2()) {				var str = Searchbox.getAttrValue(box,'placeholder');				//Searchbox.setStyles(box);				Searchbox.setBoxHeightWidth(box);				Searchbox.setValue(box, str);			}		}	},		getAttrValue: function(b, a) {		return b.getAttribute(a);	},		setValue: function(b, str) {		b.value = str;		b.onfocus = function(){b.value="";b.style.color="#000";};	}			}/* ************************************************************************** ****      Browser                                                               **** ************************************************************************** */var Browser = {	isSafari1: function() {		var agent = navigator.userAgent.toLowerCase();		if(agent.indexOf('safari') != -1 && !Browser.isSafari2()) {return true;}	},	isSafari2: function() {		var agent = navigator.userAgent.toLowerCase();		if(agent.indexOf('safari') != -1 && (parseFloat(agent.substring(agent.indexOf("applewebkit/")+"applewebkit/".length,agent.length).substring(0,agent.substring(agent.indexOf("applewebkit/")+"applewebkit/".length,agent.length).indexOf(' '))) >=  300)) {return true;}	},	isIE7: function() {		var agent = navigator.userAgent.toLowerCase();		if(agent.indexOf('msie 7.0') != -1) {return true;}	},	isIE: function() {		var agent = navigator.userAgent.toLowerCase();		if(agent.indexOf('msie') != -1) {return true;}	}};/* ************************************************************************** ****      Browser stuff                                                         **** ************************************************************************** */function detect() {	// simplify things	var agent 	= navigator.userAgent.toLowerCase();		// detect platform	this.isMac		= (agent.indexOf('mac') != -1);	this.isWin		= (agent.indexOf('win') != -1);	this.isWin2k	= (this.isWin && (			agent.indexOf('nt 5') != -1));	this.isWinSP2	= (this.isWin && (			agent.indexOf('xp') != -1 || 			agent.indexOf('sv1') != -1));	this.isOther	= (			agent.indexOf('unix') != -1 || 			agent.indexOf('sunos') != -1 || 			agent.indexOf('bsd') != -1 ||			agent.indexOf('x11') != -1 || 			agent.indexOf('linux') != -1);		// detect browser	this.isSafari	= (agent.indexOf('safari') != -1);	this.isSafari2 = (this.isSafari && (parseFloat(agent.substring(agent.indexOf("applewebkit/")+"applewebkit/".length,agent.length).substring(0,agent.substring(agent.indexOf("applewebkit/")+"applewebkit/".length,agent.length).indexOf(' '))) >=  300));	this.isOpera	= (agent.indexOf('opera') != -1);	this.isNN		= (agent.indexOf('netscape') != -1);	this.isIE		= (agent.indexOf('msie') != -1);		// itunes compabibility	this.isiTunesOK	= this.isMac || this.isWin2k;}var browser = new detect();