//--------------------------------------------------------------------------------------



// background.js
var randnum = Math.random();
var inum = 20;
var rand1 = Math.round(randnum * (inum-1)) + 1;
images = new Array
images[1] = "./images/backs/1.jpg"
images[2] = "./images/backs/2.jpg"
images[3] = "./images/backs/3.jpg"
images[4] = "./images/backs/4.jpg"
images[5] = "./images/backs/5.jpg"
images[6] = "./images/backs/6.jpg"
images[7] = "./images/backs/7.jpg"
images[8] = "./images/backs/8.jpg"
images[9] = "./images/backs/9.jpg"
images[10] = "./images/backs/10.jpg"
images[11] = "./images/backs/11.jpg"
images[12] = "./images/backs/12.jpg"
images[13] = "./images/backs/13.jpg"
images[14] = "./images/backs/14.jpg"
images[15] = "./images/backs/15.jpg"
images[16] = "./images/backs/16.jpg"
images[17] = "./images/backs/17.jpg"
images[18] = "./images/backs/18.jpg"
images[19] = "./images/backs/19.jpg"
images[20] = "./images/backs/20.jpg"

var image = images[rand1]

// End of background.js



//--------------------------------------------------------------------------------------



// js_combined.js

/*

COMBINED JAVASCRIPT LIBRARIES FOR andrewcavers.com TO MINIMISE HTTP REQUESTS 

ALSO SOME UNUNSED FUNCTIONS STRIPPED OUT

#############COMPRISING###############

Prototype JavaScript framework

(c) 2005 Sam Stephenson <sam@conio.net>

Prototype is freely distributable under the terms of an MIT-style license.

For details, see the Prototype web site: http://prototype.conio.net/

note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).

 

moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).

by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.

for more info (http://moofx.mad4milk.net).

Sunday, March 05, 2006

v 1.2.3



moo.fx pack, effects extensions for moo.fx.

by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE

for more info visit (http://moofx.mad4milk.net).

Friday, April 14, 2006

v 1.2.4



moo.ajax

based on prototype's ajax class



fx.Color, simple effect for fading between two colors.

by Tom Jensen (http://neuemusic.com) MIT-style LICENSE.

Wednesday, March 08, 2006

v 1.0.0



dom-drag.js

09.25.2001

www.youngpup.net



########################################

*/



var Class = {

	create: function() {

		return function() {

			this.initialize.apply(this, arguments);

		}

	}

}



Object.extend = function(destination, source) {

	for (property in source) destination[property] = source[property];

	return destination;

}



Function.prototype.bind = function(object) {

	var __method = this;

	return function() {

		return __method.apply(object, arguments);

	}

}



Function.prototype.bindAsEventListener = function(object) {

var __method = this;

	return function(event) {

		__method.call(object, event || window.event);

	}

}



function $() {

	if (arguments.length == 1) return get$(arguments[0]);

	var elements = [];

	$c(arguments).each(function(el){

		elements.push(get$(el));

	});

	return elements;



	function get$(el){

		if (typeof el == 'string') el = document.getElementById(el);

		return el;

	}

}



if (!window.Element) var Element = new Object();



Object.extend(Element, {

	remove: function(element) {

		element = $(element);

		element.parentNode.removeChild(element);

	},



	hasClassName: function(element, className) {

		element = $(element);

		if (!element) return;

		var hasClass = false;

		element.className.split(' ').each(function(cn){

			if (cn == className) hasClass = true;

		});

		return hasClass;

	},



	addClassName: function(element, className) {

		element = $(element);

		Element.removeClassName(element, className);

		element.className += ' ' + className;

	},

  

	removeClassName: function(element, className) {

		element = $(element);

		if (!element) return;

		var newClassName = '';

		element.className.split(' ').each(function(cn, i){

			if (cn != className){

				if (i > 0) newClassName += ' ';

				newClassName += cn;

			}

		});

		element.className = newClassName;

	},



	cleanWhitespace: function(element) {

		element = $(element);

		$c(element.childNodes).each(function(node){

			if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);

		});

	},



	find: function(element, what) {

		element = $(element)[what];

		while (element.nodeType != 1) element = element[what];

		return element;

	}

});



var Position = {

	cumulativeOffset: function(element) {

		var valueT = 0, valueL = 0;

		do {

			valueT += element.offsetTop  || 0;

			valueL += element.offsetLeft || 0;

			element = element.offsetParent;

		} while (element);

		return [valueL, valueT];

	}

};



document.getElementsByClassName = function(className) {

	var children = document.getElementsByTagName('*') || document.all;

	var elements = [];

	$c(children).each(function(child){

		if (Element.hasClassName(child, className)) elements.push(child);

	});  

	return elements;

}



//useful array functions

Array.prototype.iterate = function(func){

	for(var i=0;i<this.length;i++) func(this[i], i);

}

if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;



function $c(array){

	var nArray = [];

	for (var i=0;i<array.length;i++) nArray.push(array[i]);

	return nArray;

}



var fx = new Object();

fx.Base = function(){};

fx.Base.prototype = {

	setOptions: function(options) {

	this.options = {

		duration: 500,

		onComplete: '',

		transition: fx.sinoidal

	}

	Object.extend(this.options, options || {});

	},



	step: function() {

		var time  = (new Date).getTime();

		if (time >= this.options.duration+this.startTime) {

			this.now = this.to;

			clearInterval (this.timer);

			this.timer = null;

			if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);

		}

		else {

			var Tpos = (time - this.startTime) / (this.options.duration);

			this.now = this.options.transition(Tpos) * (this.to-this.from) + this.from;

		}

		this.increase();

	},



	custom: function(from, to) {

		if (this.timer != null) return;

		this.from = from;

		this.to = to;

		this.startTime = (new Date).getTime();

		this.timer = setInterval (this.step.bind(this), 13);

	},



	hide: function() {

		this.now = 0;

		this.increase();

	},



	clearTimer: function() {

		clearInterval(this.timer);

		this.timer = null;

	}

}



fx.Layout = Class.create();

fx.Layout.prototype = Object.extend(new fx.Base(), {

	initialize: function(el, options) {

		this.el = $(el);

		this.el.style.overflow = "hidden";

		this.iniWidth = this.el.offsetWidth;

		this.iniHeight = this.el.offsetHeight;

		this.setOptions(options);

	}

});



fx.Height = Class.create();

Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {	

	increase: function() {

		this.el.style.height = this.now + "px";

	},



	toggle: function() {

		if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);

		else this.custom(0, this.el.scrollHeight);

	}

});



fx.Width = Class.create();

Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {	

	increase: function() {

		this.el.style.width = this.now + "px";

	},



	toggle: function(){

		if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);

		else this.custom(0, this.iniWidth);

	}

});



//fader

fx.Opacity = Class.create();

fx.Opacity.prototype = Object.extend(new fx.Base(), {

	initialize: function(el, options) {

		this.el = $(el);

		this.now = 1;

		this.increase();

		this.setOptions(options);

	},



	increase: function() {

		if (this.now == 1 && (/Firefox/.test(navigator.userAgent))) this.now = 0.9999;

		this.setOpacity(this.now);

	},

	

	setOpacity: function(opacity) {

		if (opacity == 0 && this.el.style.visibility != "hidden") this.el.style.visibility = "hidden";

		else if (this.el.style.visibility != "visible") this.el.style.visibility = "visible";

		if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + opacity*100 + ")";

		this.el.style.opacity = opacity;

	},



	toggle: function() {

		if (this.now > 0) this.custom(1, 0);

		else this.custom(0, 1);

	}

});



//transitions

fx.sinoidal = function(pos){

	return ((-Math.cos(pos*Math.PI)/2) + 0.5);

	//this transition is from script.aculo.us

}



//composition effect: widht/height/opacity

fx.Combo = Class.create();

fx.Combo.prototype = {

	setOptions: function(options) {

		this.options = {

			opacity: true,

			height: true,

			width: false

		}

		Object.extend(this.options, options || {});

	},



	initialize: function(el, options) {

		this.el = $(el);

		this.setOptions(options);

		if (this.options.opacity) {

			this.o = new fx.Opacity(el, options);

			options.onComplete = null;

		}

		if (this.options.height) {

			this.h = new fx.Height(el, options);

			options.onComplete = null;

		}

		if (this.options.width) this.w = new fx.Width(el, options);

	},

	

	toggle: function() { this.checkExec('toggle'); },



	hide: function(){ this.checkExec('hide'); },

	

	clearTimer: function(){ this.checkExec('clearTimer'); },

	

	checkExec: function(func){

		if (this.o) this.o[func]();

		if (this.h) this.h[func]();

		if (this.w) this.w[func]();

	},

	

	//only if width+height

	resizeTo: function(hto, wto) {

		if (this.h && this.w) {

			this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto);

			this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto);

		}

	},



	customSize: function(hto, wto) {

		if (this.h && this.w) {

			this.h.custom(this.el.offsetHeight, hto);

			this.w.custom(this.el.offsetWidth, wto);

		}

	}

}



fx.Accordion = Class.create();

fx.Accordion.prototype = {

	setOptions: function(options) {

		this.options = {

			delay: 100,

			opacity: false

		}

		Object.extend(this.options, options || {});

	},



	initialize: function(togglers, elements, options) {

		this.elements = elements;

		this.setOptions(options);

		var options = options || '';

		this.fxa = [];

		if (options && options.onComplete) options.onFinish = options.onComplete;

		elements.each(function(el, i){

			options.onComplete = function(){

				if (el.offsetHeight > 0) el.style.height = '1%';

				if (options.onFinish) options.onFinish(el);

			}

			this.fxa[i] = new fx.Combo(el, options);

			this.fxa[i].hide();

		}.bind(this));



		togglers.each(function(tog, i){

			if (typeof tog.onclick == 'function') var exClick = tog.onclick;

			tog.onclick = function(){

				if (exClick) exClick();

				this.showThisHideOpen(elements[i]);

			}.bind(this);

		}.bind(this));

	},



	showThisHideOpen: function(toShow){

		this.elements.each(function(el, j){

			if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el, j);

			if (el == toShow && toShow.offsetHeight == 0) setTimeout(function(){this.clearAndToggle(toShow, j);}.bind(this), this.options.delay);

		}.bind(this));

	},



	clearAndToggle: function(el, i){

		this.fxa[i].clearTimer();

		this.fxa[i].toggle();

	}

}



//useful for-replacement

Array.prototype.iterate = function(func){

	for(var i=0;i<this.length;i++) func(this[i], i);

}

if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;



//Easing Equations (c) 2003 Robert Penner, all rights reserved.

//This work is subject to the terms in http://www.robertpenner.com/easing_terms_of_use.html.



//expo

fx.expoIn = function(pos){

	return Math.pow(2, 10 * (pos - 1));

}

fx.expoOut = function(pos){

	return (-Math.pow(2, -10 * pos) + 1);

}



//quad

fx.quadIn = function(pos){

	return Math.pow(pos, 2);

}

fx.quadOut = function(pos){

	return -(pos)*(pos-2);

}



//circ

fx.circOut = function(pos){

	return Math.sqrt(1 - Math.pow(pos-1,2));

}

fx.circIn = function(pos){

	return -(Math.sqrt(1 - Math.pow(pos, 2)) - 1);

}



//back

fx.backIn = function(pos){

	return (pos)*pos*((2.7)*pos - 1.7);

}

fx.backOut = function(pos){

	return ((pos-1)*(pos-1)*((2.7)*(pos-1) + 1.7) + 1);

}



//sine

fx.sineOut = function(pos){

	return Math.sin(pos * (Math.PI/2));

}

fx.sineIn = function(pos){

	return -Math.cos(pos * (Math.PI/2)) + 1;

}

fx.sineInOut = function(pos){

	return -(Math.cos(Math.PI*pos) - 1)/2;

}



ajax = Class.create();

ajax.prototype = {

	initialize: function(url, options){

		this.transport = this.getTransport();

		this.postBody = options.postBody || '';

		this.method = options.method || 'post';

		this.onComplete = options.onComplete || null;

		this.update = $(options.update) || null;

		this.request(url);

	},



	request: function(url){

		this.transport.open(this.method, url, true);

		this.transport.onreadystatechange = this.onStateChange.bind(this);

		if (this.method == 'post') {

			this.transport.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

			if (this.transport.overrideMimeType) this.transport.setRequestHeader('Connection', 'close');

		}

		this.transport.send(this.postBody);

	},



	onStateChange: function(){

		if (this.transport.readyState == 4 && this.transport.status == 200) {

			if (this.onComplete) 

				setTimeout(function(){this.onComplete(this.transport);}.bind(this), 10);

			if (this.update)

				setTimeout(function(){this.update.innerHTML = this.transport.responseText;}.bind(this), 10);

			this.transport.onreadystatechange = function(){};

		}

	},



	getTransport: function() {

		if (window.ActiveXObject) return new ActiveXObject('Microsoft.XMLHTTP');

		else if (window.XMLHttpRequest) return new XMLHttpRequest();

		else return false;

	}

};



fx.Color = Class.create();

fx.Color.prototype = Object.extend(new fx.Base(), {

	initialize: function(el, options) {

		this.el = $(el);

		this.setOptions(options);

		this.now = 0;

		this.regex = new RegExp("#?(..)(..)(..)");

		if (!this.options.property) this.props = "backgroundColor";

		else this.props = this.options.property;

	},

	

	increase: function() {

		var hex = "rgb(" + (Math.round(this.cs[0] + (this.ce[0]-this.cs[0])*this.now))+","+(Math.round(this.cs[1] + (this.ce[1]-this.cs[1])*this.now))+","+ (Math.round(this.cs[2] + (this.ce[2]-this.cs[2])*this.now))+")";

		if (this.props == "backgroundColor") this.el.style.backgroundColor = hex;

		else if (this.props == "color") this.el.style.color = hex;

	},

	

	customColor: function(from, to) {

		this.cs = this.regex.exec(from);

		this.ce = this.regex.exec(to);

		for (i=1; i < this.cs.length; i++) {

			this.cs[i-1] = parseInt(this.cs[i], 16);

			this.ce[i-1] = parseInt(this.ce[i], 16);

		}

		this.custom(0, 1);

	}

});



var Drag = {



	obj : null,



	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)

	{

		o.onmousedown	= Drag.start;



		o.hmode			= bSwapHorzRef ? false : true ;

		o.vmode			= bSwapVertRef ? false : true ;



		o.root = oRoot && oRoot != null ? oRoot : o ;



		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";

		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";

		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";

		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";



		o.minX	= typeof minX != 'undefined' ? minX : null;

		o.minY	= typeof minY != 'undefined' ? minY : null;

		o.maxX	= typeof maxX != 'undefined' ? maxX : null;

		o.maxY	= typeof maxY != 'undefined' ? maxY : null;



		o.xMapper = fXMapper ? fXMapper : null;

		o.yMapper = fYMapper ? fYMapper : null;



		o.root.onDragStart	= new Function();

		o.root.onDragEnd	= new Function();

		o.root.onDrag		= new Function();

	},



	start : function(e)

	{

		var o = Drag.obj = this;

		e = Drag.fixE(e);

		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);

		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );

		o.root.onDragStart(x, y);



		o.lastMouseX	= e.clientX;

		o.lastMouseY	= e.clientY;



		if (o.hmode) {

			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;

			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;

		} else {

			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;

			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;

		}



		if (o.vmode) {

			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;

			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;

		} else {

			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;

			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;

		}



		document.onmousemove	= Drag.drag;

		document.onmouseup		= Drag.end;



		return false;

	},



	drag : function(e)

	{

		e = Drag.fixE(e);

		var o = Drag.obj;



		var ey	= e.clientY;

		var ex	= e.clientX;

		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);

		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );

		var nx, ny;



		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);

		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);

		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);

		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);



		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));

		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));



		if (o.xMapper)		nx = o.xMapper(y)

		else if (o.yMapper)	ny = o.yMapper(x)



		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";

		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";

		Drag.obj.lastMouseX	= ex;

		Drag.obj.lastMouseY	= ey;



		Drag.obj.root.onDrag(nx, ny);

		return false;

	},



	end : function()

	{

		document.onmousemove = null;

		document.onmouseup   = null;

		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 

									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));

		Drag.obj = null;

	},



	fixE : function(e)

	{

		if (typeof e == 'undefined') e = window.event;

		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;

		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;

		return e;

	}

};

// End of js_combined.js



//--------------------------------------------------------------------------------------





//--------------------------------------------------------------------------------------



// fancytooltips.js



/*

Name: FancyTooltips

Version: 1.2.1

URI: http://www.victr.lm85.com/FancyTooltips/

Description: FancyTooltips creates dynamic tooltips from anchors (links), acronyms, inserts, deletions, and images.

Author: Victor Kulinski

Author URI: http://www.victr.lm85.com/



Current: Copyright (c) 2005 - Victor Kulinski



Re-released: Copyright (c) 2003 - Dunstan Orchard, Ethan Marcotte, Mark Wubben

Original: Copyright (c) 2003 - Stuart Langridge, Paul McLanahan, Peter Janes, Brad Choate



As originally released by Stuart Langridge, this script is licensed under MIT - http://www.opensource.org/licenses/mit-license.php



"THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,

INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY,

WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."

*/



	// Display FancyTooltips in a specific ID.

	// - Disabled by default, to turn it on, enter the specified ID within ''.

	// - by Chris Beaven and Bretty Taylor - http://www.webfroot.co.nz/



var sOnlyInThisID = '';



function FancyTooltips(sTemplate, nDelay, nStringMaxLength, nMarginX, nMarginY, sContainerID, sClassName){

	var oTimer;

	var isActive = false;

	var sNameSpaceURI = "http://www.w3.org/1999/xhtml";

	

	if(!sTemplate){ sTemplate = "attr(fancytooltip)";}

	if(!nDelay || nDelay <= 0){ nDelay = false;}

	if(!nStringMaxLength){ nStringMaxLength = 80; }

	if(!nMarginX){ nMarginX = 10; }

	if(!nMarginY){ nMarginY = 15; }

	if(!sContainerID){ sContainerID = "fancytooltipcontainer";}

	if(!sClassName){ sClassName = "fancytooltip";}



	var oContainer = document.getElementById(sContainerID);

	if(!oContainer){

		oContainer = document.createElementNS ? document.createElementNS(sNameSpaceURI, "div") : document.createElement("div");

		oContainer.setAttribute("id", sContainerID);

		oContainer.className = sClassName;

		oContainer.style.display = "none";

		document.getElementsByTagName("body").item(0).appendChild(oContainer);

	}

	

	// Method addElements (Public)

	// by Dunstan Orchard - http://www.1976design.com/

	

	this.addElements = function addElements(collNodes, sAttribute){

		var currentNode, sTitle;

		

		for(var i = 0; i < collNodes.length; i++){

			currentNode = collNodes[i];

		

			sTitle = currentNode.getAttribute(sAttribute);

			if(sTitle){

				currentNode.setAttribute("fancytooltip", sTitle);

				currentNode.removeAttribute(sAttribute);

				addEvent(currentNode, 'mouseover', show);

				addEvent(currentNode, 'mouseout', hide);

				addEvent(currentNode, 'focus', show);

				addEvent(currentNode, 'blur', hide);

			}

		}



	}

	

	// Other Methods (All Private)

	// by Dunstan Orchard - http://www.1976design.com/

	

	function show(e){

		if(isActive){ hide(); }



		var oNode = window.event ? window.event.srcElement : e.currentTarget;

		if(!oNode.getAttribute("fancytooltip")){ 

			while(oNode.parentNode){

				oNode = oNode.parentNode; // immediately goes to the parent, thus we can only have element nodes

				if(oNode.getAttribute("fancytooltip")){ break;	}

			}

		}



		var sOutput = parseTemplate(oNode);

		setContainerContent(sOutput);

		var oPosition = getPosition(e, oNode);

		oContainer.style.left = oPosition.x;

		oContainer.style.top = oPosition.y;



		if(nDelay){	

			oTimer = setTimeout(function(){oContainer.style.display = "block";}, nDelay);

		} else {

			oContainer.style.display = "block";

		}



		isActive = true;		

		// Let's put this event to a halt before it starts messing things up.

		window.event ? window.event.cancelBubble = true : e.stopPropagation();

	}

	

	function hide(){

		clearTimeout(oTimer);

		oContainer.style.display = "none";

		removeContainerContent();

		isActive = false;

	}



	function setContainerContent(sOutput){

		sOutput = sOutput.replace(/&/g, "&amp;");

		if(document.createElementNS && window.DOMParser){

			var oXMLDoc = (new DOMParser()).parseFromString("<root xmlns=\""+sNameSpaceURI+"\">"+sOutput+"</root>", "text/xml");

			var oOutputNode = document.importNode(oXMLDoc.documentElement, true);

			var oChild = oOutputNode.firstChild;

			var nextChild;

			while(oChild){

				nextChild = oChild.nextSibling; // One's the child is appended, the nextSibling reference is gone.

				oContainer.appendChild(oChild);

				oChild = nextChild;

			}

		} else {

			oContainer.innerHTML = sOutput;

		}

	}

	

	function removeContainerContent(){

		var oChild = oContainer.firstChild;

		var nextChild;



		if(!oChild){ return; }

		while(oChild){

			nextChild = oChild.nextSibling;

			oContainer.removeChild(oChild);

			oChild =  nextChild;

		}

	}

	

	function getPosition(e, oNode){

		var oViewport = getViewport();

		var oCoords;

		var commonEventInterface = window.event ? window.event : e;



		if(commonEventInterface.type == "focus"){

			oCoords = getNodePosition(oNode);	

			oCoords.x += nMarginX;

			oCoords.y += nMarginY;			

		} else {

			oCoords = { x : commonEventInterface.clientX + oViewport.x + nMarginX, y : commonEventInterface.clientY + oViewport.y + nMarginY};

		}



		oContainer.style.visiblity = "hidden"; // oContainer needs to be displayed before width and height can be retrieved.

		oContainer.style.display =  "block";

		var containerWidth = oContainer.offsetWidth;

		var containerHeight = oContainer.offsetHeight;

		oContainer.style.display = "none"; // And hide it again.

		oContainer.style.visiblity = "visible";



		if(oCoords.x + containerWidth + 10 >= oViewport.width + oViewport.x){

			oCoords.x = oViewport.width + oViewport.x - containerWidth - 10;

		}

		if(oCoords.y + containerHeight + 10 >= oViewport.height + oViewport.y){

			oCoords.y = oViewport.height + oViewport.y - containerHeight - oNode.offsetHeight - 10;

		}



		oCoords.x += "px";

		oCoords.y += "px";



		return oCoords;

	}



	function parseTemplate(oNode){

		var sAttribute, collOptionalAttributes;

		var oFound = {};

		var sResult = sTemplate;

		

		if(sResult.match(/content\(\)/)){

			sResult = sResult.replace(/content\(\)/g, getContentOfNode(oNode));

		}

		

		var collSearch = sResult.split(/attr\(/);

		for(var i = 1; i < collSearch.length; i++){

			sAttribute = collSearch[i].split(")")[0];

			oFound[sAttribute] = oNode.getAttribute(sAttribute);

			if(oFound[sAttribute] && oFound[sAttribute].length > nStringMaxLength){

				oFound[sAttribute] = oFound[sAttribute].substring(0, nStringMaxLength) + "...";

			}

		}

		

		var collOptional = sResult.split("?")

		for(var i = 1; i < collOptional.length; i += 2){

			collOptionalAttributes = collOptional[i].split("attr(");

			for(var j = 1; j < collOptionalAttributes.length; j++){

				sAttribute = collOptionalAttributes[j].split(")")[0];



				if(!oFound[sAttribute]){ sResult = sResult.replace(new RegExp("\\?[^\\?]*attr\\("+sAttribute+"\\)[^\\?]*\\?", "g"), "");	}

			}

		}

		sResult = sResult.replace(/\?/g, "");

		

		for(sAttribute in oFound){

			sResult = sResult.replace("attr\("+sAttribute+"\)", oFound[sAttribute]);

		}

		

		return sResult;

	}	

		

	function getContentOfNode(oNode){

		var sContent = "";

		var oSearch = oNode.firstChild;



		while(oSearch){

			if(oSearch.nodeType == 3){

				sContent += oSearch.nodeValue;

			} else if(oSearch.nodeType == 1 && oSearch.hasChildNodes){

				sContent += getContentOfNode(oSearch);

			}

			oSearch = oSearch.nextSibling

		}



		return sContent;

	}

	

	function getNodePosition(oNode){

		var x = 0;

		var y = 0;



		do {

			if(oNode.offsetLeft){ x += oNode.offsetLeft }

			if(oNode.offsetTop){ y += oNode.offsetTop }

		}	while((oNode = oNode.offsetParent) && !document.all) // IE gets the offset 'right' from the start



		return {x : x, y : y}

	}

	

	// Idea from 13thParallel: http://13thparallel.net/?issue=2002.06&title=viewport.

	

	function getViewport(){

		var width = 0;

		var height = 0;

		var x = 0;

		var y = 0;

		

		if(document.documentElement && document.documentElement.clientWidth){

			width = document.documentElement.clientWidth;

			height = document.documentElement.clientHeight;

			x = document.documentElement.scrollLeft;

			y = document.documentElement.scrollTop;

		} else if(document.body && document.body.clientWidth){

			width = document.body.clientWidth;

			height = document.body.clientHeight;

			x = document.body.scrollLeft;

			y = document.body.scrollTop;

		}

		// we don't use an else if here, since Opera 7 tends to get the height on the documentElement wrong

		if(window.innerWidth){ 

			width = window.innerWidth - 18;

			height = window.innerHeight - 18;

		}

		

		if(window.pageXOffset){

			x = window.pageXOffset;

			y = window.pageYOffset;

		} else if(window.scrollX){

			x = window.scrollX;

			y = window.scrollY;

		}

		

		return {width : width, height : height, x : x, y : y };		

	}

}



// Event Listener

// by Scott Andrew - http://scottandrew.com

// edited by Mark Wubben, <useCapture> is now set to false



function addEvent(obj, evType, fn){

	if(obj.addEventListener){

		obj.addEventListener(evType, fn, false); 

		return true;

	} else if (obj.attachEvent){

		var r = obj.attachEvent('on'+evType, fn);

		return r;

	} else {

		return false;

	}

}



// Time Since

// by Mark Wubben - http://neo.dzygn.com



Date.prototype.toTimeSinceString = function(nLimit, sBetween, sLastBetween){

	if(!nLimit){ nLimit = 2; }

	if(!sBetween){ sBetween = ", "; }

	if(!sLastBetween){ sLastBetween = " and "; }

	if(!Date.prototype.toTimeSinceString._collStructs){

		Date.prototype.toTimeSinceString._collStructs = new Array(

			{seconds: 60 * 60 * 24 * 365, name: "year"},

			{seconds: 60 * 60 * 24 * 30, name: "month"},

			{seconds: 60 * 60 * 24 * 7, name: "week"},

			{seconds: 60 * 60 * 24, name: "day"},

			{seconds: 60 * 60, name: "hour"},

			{seconds: 60, name: "minute"}

		);

	}



	var collStructs = Date.prototype.toTimeSinceString._collStructs;

	var nSecondsRemain = ((new Date).valueOf() - this.valueOf()) / 1000;

	var sReturn = "";

	var nCount = 0;

	var nFloored;



	for(var i = 0; i < collStructs.length && nCount < nLimit; i++){

		nFloored = Math.floor(nSecondsRemain / collStructs[i].seconds);

		if(nFloored > 0){

			if(sReturn.length > 0){

				if(nCount == nLimit - 1 || i == collStructs.length - 1){

					sReturn += sLastBetween;

				} else if(nCount < nLimit && i < collStructs.length){

					sReturn += sBetween;

				}

			}

			sReturn += nFloored + " " + collStructs[i].name;

			if(nFloored > 1){

				sReturn += "s";

			}

			nSecondsRemain -= nFloored * collStructs[i].seconds;

			nCount++;

		}

	}



	return sReturn;

}





// Here the default nice titles are created

// by Dunstan Orchard - http://www.1976design.com/

// Improved by Victor Kulinski - http://www.victr.lm85.com/



FancyTooltips.autoCreation = function(){

	if(!document.getElementsByTagName){ return; }



	function rewriteDateTime(collNodes){

		var nMonth, nDay, nHours, nMinutes, nSeconds, sDateTime, oDate;

		for(var i = 0; i < collNodes.length; i++){

			sDateTime = collNodes[i].getAttribute("datetime");

			if(sDateTime != null || sDateTime != ""){

				nYear = Number(sDateTime.substring(0,4));

				nMonth = Number(sDateTime.substring(5,7)) - 1;

				nDay = Number(sDateTime.substring(8,10));

				nHours = Number(sDateTime.substring(11, 13));

				nMinutes = Number(sDateTime.substring(14,16));

				nSeconds = Number(sDateTime.substring(17,19));

				oDate = new Date(nYear, nMonth, nDay, nHours, nMinutes, nSeconds);

				collNodes[i].setAttribute("nicetime", oDate.toTimeSinceString());

				collNodes[i].setAttribute("gmttime", oDate.toGMTString());

			}

		}



		return collNodes;

	}



	FancyTooltips.autoCreated = new Object();



	FancyTooltips.autoCreated.anchors = new FancyTooltips("<p class=\"titletext\">attr(fancytooltip)? <span class=\"accesskey\">[attr(accesskey)]</span>?</p><p class=\"destination\">attr(href)</p>", 600);

	FancyTooltips.autoCreated.inserts = new FancyTooltips("<p class=\"titletext\">Added attr(fancytooltip) ago</p><p class=\"destination\">Complete timestamp: attr(gmttime)</p>?<p class=\"destination\">Reason: attr(cite)</p>?", 600);

	FancyTooltips.autoCreated.deletions = new FancyTooltips("<p class=\"titletext\">Deleted attr(fancytooltip) ago</p><p class=\"destination\">Complete timestamp: attr(gmttime)</p>?<p class=\"destination\">Reason: attr(cite)</p>?", 600);

	FancyTooltips.autoCreated.acronyms = new FancyTooltips("<p class=\"titletext\">content(): attr(fancytooltip)</p>", 600);	

	FancyTooltips.autoCreated.abbreviations = new FancyTooltips("<p class=\"titletext\">content(): attr(fancytooltip)</p>", 600);	

	FancyTooltips.autoCreated.images = new FancyTooltips("<p class=\"titletext\">Caption: attr(fancytooltip)</p>", 600);





	// More of Restrict to ID

	// - by Chris Beaven and Brett Taylor - http://www.webfroot.co.nz/

	

	if (sOnlyInThisID) {

		oNode = document.getElementById(sOnlyInThisID);

	} else {

		oNode = null;

	}

	if (!oNode) {

		oNode = document;

	}

	

	FancyTooltips.autoCreated.anchors.addElements(oNode.getElementsByTagName("a"), "title");

	FancyTooltips.autoCreated.inserts.addElements(rewriteDateTime(oNode.getElementsByTagName("ins")), "nicetime");

	FancyTooltips.autoCreated.deletions.addElements(rewriteDateTime(oNode.getElementsByTagName("del")), "nicetime");

	FancyTooltips.autoCreated.acronyms.addElements(oNode.getElementsByTagName("acronym"), "title");

	FancyTooltips.autoCreated.acronyms.addElements(oNode.getElementsByTagName("abbr"), "title");

	

	// FancyTooltips img recognition.

	// - Turned off by default. To turn it on, remove /* */ around the

	// first line. This will display alt FancyTooltips. For title tooltips,

	// remove /* */ from the second line. This may, however, cause problems

	// in MSIE (Microsoft Internet Explorer.

	// - by Victor Kulinski - http://www.victr.lm85.com/

	

	/* FancyTooltips.autoCreated.images.addElements(oNode.getElementsByTagName("img"), "alt"); */

	/* FancyTooltips.autoCreated.images.addElements(document.getElementsByTagName("img"), "title"); */

	

}



addEvent(window, "load", FancyTooltips.autoCreation);










/* --------------ShadedBorder-----------------*/



/**
 * RUZEE.ShadedBorder 0.6.1
 * (c) 2006 Steffen Rusitschka
 *
 * RUZEE.ShadedBorder is freely distributable under the terms of an MIT-style license.
 * For details, see http://www.ruzee.com/
 */

var RUZEE = window.RUZEE || {};

RUZEE.ShadedBorder = {

create: function(opts) {
  var isie = /msie/i.test(navigator.userAgent) && !window.opera;
  var isie6 = isie && !window.XMLHttpRequest;
  function sty(el, h) {
    for(k in h) {
      if (/ie_/.test(k)) {
        if (isie) el.style[k.substr(3)]=h[k];
      } else el.style[k]=h[k];
    }
  }
  function crdiv(h) {
    var el=document.createElement("div");
    el.className = "sb-gen";
    sty(el, h);
    return el;
  }
  function op(v) {
    v = v<0 ? 0 : v;
    if (v>0.99999) return "";
    return isie ? " filter:alpha(opacity=" + (v*100) + ");" : " opacity:" + v + ';';
  }

  var sr = opts.shadow || 0;
  var r = opts.corner || 0;
  var bor = 0;
  var bow = opts.border || 0;
  var boo = opts.borderOpacity || 1;
  var shadow = sr != 0;
  var lw = r > sr ? r : sr;
  var rw = lw;
  var th = lw;
  var bh = lw;
  if (bow > 0) {
    bor = r;
    r = r - bow;
  }
  var cx = r != 0 && shadow ? Math.round(lw/3) : 0;
  var cy = cx;
  var cs = Math.round(cx/2);
  var iclass = r > 0 ? "sb-inner" : "sb-shadow";
  var sclass = "sb-shadow";
  var bclass = "sb-border";
  var edges = opts.edges || "trlb";
  if (!/t/i.test(edges)) th=0;
  if (!/b/i.test(edges)) bh=0;
  if (!/l/i.test(edges)) lw=0;
  if (!/r/i.test(edges)) rw=0;

  var p = { position:"absolute", left:"0", top:"0", width:lw + "px", height:th + "px", 
            ie_fontSize:"1px", overflow:"hidden", margin:"0", padding:"0" }; var tl = crdiv(p);
  delete p.left; p.right="0"; p.width=rw + "px"; var tr = crdiv(p);
  delete p.top; p.bottom="0"; p.height=bh + "px"; var br = crdiv(p);
  delete p.right; p.left="0"; p.width=lw + "px"; var bl = crdiv(p);

  var tw = crdiv({ position:"absolute", width:"100%", height:th + "px", ie_fontSize:"1px",
                   top:"0", left:"0", overflow:"hidden", margin:"0", padding:"0" });
  var t = crdiv({ position:"relative", height:th + "px", ie_fontSize:"1px",
                  margin:"0 "+ rw + "px 0 " + lw + "px", overflow:"hidden", padding:"0" });
  tw.appendChild(t);

  var bw = crdiv({ position:"absolute", left:"0", bottom:"0", width:"100%", height:bh + "px", 
                   ie_fontSize:"1px", overflow:"hidden", margin:"0", padding:"0" });
                   
  var b = crdiv({ position:"relative", height:bh + "px", ie_fontSize:"1px",
                  margin:"0 "+ rw + "px 0 " + lw + "px", overflow:"hidden", padding:"0" });
                  
  bw.appendChild(b);

  var mw = crdiv({ position:"absolute", top:(-bh)+"px", left:"0", width:"100%", height:"100%",
                   overflow:"hidden", ie_fontSize:"1px", padding:"0", margin:"0" });

  function corner(el,t,l) {
    var w = l ? lw : rw;
    var h = t ? th : bh;
    var s = t ? cs : -cs;
    var dsb = []; var dsi = []; var dss = [];
    
    var xp=0; var xd=1; if (l) { xp=w-1; xd=-1; }
    for (var x=0; x<w; ++x) {
      var yp=h-1; var yd=-1; if (t) { yp=0; yd=1; }
      var finished=false;
      for (var y=h-1; y>=0 && !finished; --y) {
        var div = '<div style="position:absolute; top:' + yp + 'px; left:' + xp + 'px; ' +
                  'width:1px; height:1px; overflow:hidden; margin:0; padding:0;';

        var xc = x - cx; var yc = y - cy - s;
        var d = Math.sqrt(xc*xc+yc*yc);
        var doShadow = false;

        if (r > 0) {
          // draw border
          if (xc < 0 && yc < bor && yc >= r || yc < 0 && xc < bor && xc >= r) {
            dsb.push(div + op(boo) + '" class="' + bclass + '"></div>');
          } else
          if (d<bor && d>=r-1 && xc>=0 && yc>=0) {
            var dd = div;
            if (d>=bor-1) {
              dd += op((bor-d)*boo);
              doShadow = true;
            } else dd += op(boo);
            dsb.push(dd + '" class="' + bclass + '"></div>');
          }
          
          // draw inner
          var dd = div + ' z-index:2;' + (t ? 'background-position:0 -' + (r-yc-1) + 'px;' : 'background-image:none;');
          var finish = function() {
            if (!t) dd = dd.replace(/top\:\d+px/, "top:0px");
            dd = dd.replace(/height\:1px/, "height:" + (y+1) + "px");
            dsi.push(dd + '" class="' + iclass + '"></div>');
            finished = true;
          };
          if (xc < 0 && yc < r || yc < 0 && xc < r) {
            finish();
          } else
          if (d<r && xc>=0 && yc>=0) {
            if (d>=r-1) {
              dd += op(r-d);
              doShadow = true;
              dsi.push(dd + '" class="' + iclass + '"></div>');
            } else {
              finish();
            }
          } else doShadow = true;
        } else doShadow = true;
        
        // draw shadow
        if (sr > 0 && doShadow) {
          d = Math.sqrt(x*x+y*y);
          if (d<sr) {
            dss.push(div + ' z-index:0; ' + op(1-(d/sr)) + '" class="' + sclass + '"></div>');
          }
        }
        yp += yd;
      }
      xp += xd;
    }
    el.innerHTML = dss.concat(dsb.concat(dsi)).join('');
  }
  
  function mid(mw) {
    var ds = [];

    ds.push('<div style="position:relative; top:' + (th+bh) + 'px; height:2048px; ' +
            ' margin:0 ' + (rw-r-cx) + 'px 0 ' + (lw-r-cx) + 'px; ' +
            ' padding:0; overflow:hidden;' +
            ' background-position:0 ' + (th > 0 ? -(r+cy+cs) : '0') + 'px;"' +
            ' class="' + iclass + '"></div>');

    var dd = '<div style="position:absolute; width:1px;' +
        ' top:' + (th+bh) + 'px; height:2048px; padding:0; margin:0;';
    if (sr>0) {
      for (var x=0; x<lw-r-cx; ++x) {
        ds.push(dd + ' left:' + x + 'px;' + op((x+1.0)/lw) + 
            '" class="' + sclass + '"></div>');
      }

      for (var x=0; x<rw-r-cx; ++x) {
        ds.push(dd + ' right:' + x + 'px;' + op((x+1.0)/rw) + 
            '" class="' + sclass + '"></div>');
      }
    }

    if (bow > 0) {
      var su = ' width:' + bow + 'px;' + op(boo) + '" class="' + bclass + '"></div>';
      ds.push(dd + ' left:' + (lw-bor-cx) + 'px;' + su);
      ds.push(dd + ' right:' + (rw-bor-cx) + 'px;' + su);
    }

    mw.innerHTML = ds.join('');
  }

  function tb(el, t) {
    var ds = [];
    var h = t ? th : bh;
    var dd = '<div style="height:1px; overflow:hidden; position:absolute; margin:0; padding:0;' +
        ' width:100%; left:0px; ';
    var s = t ? cs : -cs;
    for (var y=0; y<h-s-cy-r; ++y) {
      if (sr>0) ds.push(dd + (t ? 'top:' : 'bottom:') + y + 'px;' + op((y+1)*1.0/h) + 
          '" class="' + sclass + '"></div>');
    }
    if (y >= bow) {
      ds.push(dd + (t ? 'top:' : 'bottom:') + (y - bow) + 'px;' + op(boo) +
          ' height:' + bow + 'px;" class="' + bclass + '"></div>');
    }

    ds.push(dd + (t ? 'background-position-y:0; top:' : 
                      'background-image:none; bottom:') + y + 'px;' +
        ' height:' + (r+cy+s) + 'px;" class="' + iclass + '"></div>');

    el.innerHTML = ds.join('');
  }

  corner(tl, true, true); corner(tr, true, false);
  corner(bl, false, true); corner(br, false, false);
  mid(mw); tb(t, true); tb(b, false);

  return {
    render: function(el) {
      if (typeof el == 'string') el = document.getElementById(el);
      if (el.length != undefined) {
        for (var i=0; i<el.length; ++i) this.render(el[i]);
        return;
      }
      el.className += " sb";
      sty(el, { position:"relative", background:"transparent" });

      // remove generated children
      var node = el.firstChild;
      while (node) {
        var nextNode = node.nextSibling;
        if (node.nodeType == 1 && node.className == 'sb-gen')
          el.removeChild(node);
        node = nextNode;
      }

      var iel = el.firstChild;

      var twc = tw.cloneNode(true);
      var mwc = mw.cloneNode(true);
      var bwc = bw.cloneNode(true);
      
      el.insertBefore(tl.cloneNode(true), iel); el.insertBefore(tr.cloneNode(true), iel);
      el.insertBefore(bl.cloneNode(true), iel); el.insertBefore(br.cloneNode(true), iel);
      el.insertBefore(twc, iel); el.insertBefore(mwc, iel);
      el.insertBefore(bwc, iel);

      if (isie6) {
        el.onmouseover=function() { this.className+=" hover"; }
        el.onmouseout=function() { this.className=this.className.replace(/ hover/,""); }
      }
      if (isie) {
        function resize() {
          twc.style.width = bwc.style.width = mwc.style.width = el.offsetWidth + "px";
          mwc.firstChild.style.height = el.offsetHeight + "px";
        }
        el.onresize=resize;
        resize();
      }
    }
  };
}
}