/* File: /includes/js/prototype.js (Modified: 3. september 2010 12:30:55) */

/*  Prototype JavaScript framework, version 1.6.1
*  (c) 2005-2009 Sam Stephenson
*
*  Prototype is freely distributable under the terms of an MIT-style license.
*  For details, see the Prototype web site: http://www.prototypejs.org/
*
*--------------------------------------------------------------------------*/

var Prototype = {
	Version: '1.6.1',

	Browser: (function() {
		var ua = navigator.userAgent;
		var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
		return {
			IE: !!window.attachEvent && !isOpera,
			Opera: isOpera,
			WebKit: ua.indexOf('AppleWebKit/') > -1,
			Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
			MobileSafari: /Apple.*Mobile.*Safari/.test(ua)
		}
	})(),

	BrowserFeatures: {
		XPath: !!document.evaluate,
		SelectorsAPI: !!document.querySelector,
		ElementExtensions: (function() {
			var constructor = window.Element || window.HTMLElement;
			return !!(constructor && constructor.prototype);
		})(),
		SpecificElementExtensions: (function() {
			if (typeof window.HTMLDivElement !== 'undefined')
				return true;

			var div = document.createElement('div');
			var form = document.createElement('form');
			var isSupported = false;

			if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) {
				isSupported = true;
			}

			div = form = null;

			return isSupported;
		})()
	},

	ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
	JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,

	emptyFunction: function() { },
	K: function(x) { return x }
};

if (Prototype.Browser.MobileSafari)
	Prototype.BrowserFeatures.SpecificElementExtensions = false;


var Abstract = {};


var Try = {
	these: function() {
		var returnValue;

		for (var i = 0, length = arguments.length; i < length; i++) {
			var lambda = arguments[i];
			try {
				returnValue = lambda();
				break;
			} catch (e) { }
		}

		return returnValue;
	}
};

/* Based on Alex Arnell's inheritance implementation. */

var Class = (function() {
	function subclass() { };
	function create() {
		var parent = null, properties = $A(arguments);
		if (Object.isFunction(properties[0]))
			parent = properties.shift();

		function klass() {
			this.initialize.apply(this, arguments);
		}

		Object.extend(klass, Class.Methods);
		klass.superclass = parent;
		klass.subclasses = [];

		if (parent) {
			subclass.prototype = parent.prototype;
			klass.prototype = new subclass;
			parent.subclasses.push(klass);
		}

		for (var i = 0; i < properties.length; i++)
			klass.addMethods(properties[i]);

		if (!klass.prototype.initialize)
			klass.prototype.initialize = Prototype.emptyFunction;

		klass.prototype.constructor = klass;
		return klass;
	}

	function addMethods(source) {
		var ancestor = this.superclass && this.superclass.prototype;
		var properties = Object.keys(source);

		if (!Object.keys({ toString: true }).length) {
			if (source.toString != Object.prototype.toString)
				properties.push("toString");
			if (source.valueOf != Object.prototype.valueOf)
				properties.push("valueOf");
		}

		for (var i = 0, length = properties.length; i < length; i++) {
			var property = properties[i], value = source[property];
			if (ancestor && Object.isFunction(value) &&
          value.argumentNames().first() == "$super") {
				var method = value;
				value = (function(m) {
					return function() { return ancestor[m].apply(this, arguments); };
				})(property).wrap(method);

				value.valueOf = method.valueOf.bind(method);
				value.toString = method.toString.bind(method);
			}
			this.prototype[property] = value;
		}

		return this;
	}

	return {
		create: create,
		Methods: {
			addMethods: addMethods
		}
	};
})();
(function() {

	var _toString = Object.prototype.toString;

	function extend(destination, source) {
		for (var property in source)
			destination[property] = source[property];
		return destination;
	}

	function inspect(object) {
		try {
			if (isUndefined(object)) return 'undefined';
			if (object === null) return 'null';
			return object.inspect ? object.inspect() : String(object);
		} catch (e) {
			if (e instanceof RangeError) return '...';
			throw e;
		}
	}

	function toJSON(object) {
		var type = typeof object;
		switch (type) {
			case 'undefined':
			case 'function':
			case 'unknown': return;
			case 'boolean': return object.toString();
		}

		if (object === null) return 'null';
		if (object.toJSON) return object.toJSON();
		if (isElement(object)) return;

		var results = [];
		for (var property in object) {
			var value = toJSON(object[property]);
			if (!isUndefined(value))
				results.push(property.toJSON() + ': ' + value);
		}

		return '{' + results.join(', ') + '}';
	}

	function toQueryString(object) {
		return $H(object).toQueryString();
	}

	function toHTML(object) {
		return object && object.toHTML ? object.toHTML() : String.interpret(object);
	}

	function keys(object) {
		var results = [];
		for (var property in object)
			results.push(property);
		return results;
	}

	function values(object) {
		var results = [];
		for (var property in object)
			results.push(object[property]);
		return results;
	}

	function clone(object) {
		return extend({}, object);
	}

	function isElement(object) {
		return !!(object && object.nodeType == 1);
	}

	function isArray(object) {
		return _toString.call(object) == "[object Array]";
	}


	function isHash(object) {
		return object instanceof Hash;
	}

	function isFunction(object) {
		return typeof object === "function";
	}

	function isString(object) {
		return _toString.call(object) == "[object String]";
	}

	function isNumber(object) {
		return _toString.call(object) == "[object Number]";
	}

	function isUndefined(object) {
		return typeof object === "undefined";
	}

	extend(Object, {
		extend: extend,
		inspect: inspect,
		toJSON: toJSON,
		toQueryString: toQueryString,
		toHTML: toHTML,
		keys: keys,
		values: values,
		clone: clone,
		isElement: isElement,
		isArray: isArray,
		isHash: isHash,
		isFunction: isFunction,
		isString: isString,
		isNumber: isNumber,
		isUndefined: isUndefined
	});
})();
Object.extend(Function.prototype, (function() {
	var slice = Array.prototype.slice;

	function update(array, args) {
		var arrayLength = array.length, length = args.length;
		while (length--) array[arrayLength + length] = args[length];
		return array;
	}

	function merge(array, args) {
		array = slice.call(array, 0);
		return update(array, args);
	}

	function argumentNames() {
		var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]
      .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '')
      .replace(/\s+/g, '').split(',');
		return names.length == 1 && !names[0] ? [] : names;
	}

	function bind(context) {
		if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
		var __method = this, args = slice.call(arguments, 1);
		return function() {
			var a = merge(args, arguments);
			return __method.apply(context, a);
		}
	}

	function bindAsEventListener(context) {
		var __method = this, args = slice.call(arguments, 1);
		return function(event) {
			var a = update([event || window.event], args);
			return __method.apply(context, a);
		}
	}

	function curry() {
		if (!arguments.length) return this;
		var __method = this, args = slice.call(arguments, 0);
		return function() {
			var a = merge(args, arguments);
			return __method.apply(this, a);
		}
	}

	function delay(timeout) {
		var __method = this, args = slice.call(arguments, 1);
		timeout = timeout * 1000
		return window.setTimeout(function() {
			return __method.apply(__method, args);
		}, timeout);
	}

	function defer() {
		var args = update([0.01], arguments);
		return this.delay.apply(this, args);
	}

	function wrap(wrapper) {
		var __method = this;
		return function() {
			var a = update([__method.bind(this)], arguments);
			return wrapper.apply(this, a);
		}
	}

	function methodize() {
		if (this._methodized) return this._methodized;
		var __method = this;
		return this._methodized = function() {
			var a = update([this], arguments);
			return __method.apply(null, a);
		};
	}

	return {
		argumentNames: argumentNames,
		bind: bind,
		bindAsEventListener: bindAsEventListener,
		curry: curry,
		delay: delay,
		defer: defer,
		wrap: wrap,
		methodize: methodize
	}
})());


Date.prototype.toJSON = function() {
	return '"' + this.getUTCFullYear() + '-' +
    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
    this.getUTCDate().toPaddedString(2) + 'T' +
    this.getUTCHours().toPaddedString(2) + ':' +
    this.getUTCMinutes().toPaddedString(2) + ':' +
    this.getUTCSeconds().toPaddedString(2) + 'Z"';
};


RegExp.prototype.match = RegExp.prototype.test;

RegExp.escape = function(str) {
	return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
};
var PeriodicalExecuter = Class.create({
	initialize: function(callback, frequency) {
		this.callback = callback;
		this.frequency = frequency;
		this.currentlyExecuting = false;

		this.registerCallback();
	},

	registerCallback: function() {
		this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
	},

	execute: function() {
		this.callback(this);
	},

	stop: function() {
		if (!this.timer) return;
		clearInterval(this.timer);
		this.timer = null;
	},

	onTimerEvent: function() {
		if (!this.currentlyExecuting) {
			try {
				this.currentlyExecuting = true;
				this.execute();
				this.currentlyExecuting = false;
			} catch (e) {
				this.currentlyExecuting = false;
				throw e;
			}
		}
	}
});
Object.extend(String, {
	interpret: function(value) {
		return value == null ? '' : String(value);
	},
	specialChar: {
		'\b': '\\b',
		'\t': '\\t',
		'\n': '\\n',
		'\f': '\\f',
		'\r': '\\r',
		'\\': '\\\\'
	}
});

Object.extend(String.prototype, (function() {

	function prepareReplacement(replacement) {
		if (Object.isFunction(replacement)) return replacement;
		var template = new Template(replacement);
		return function(match) { return template.evaluate(match) };
	}

	function gsub(pattern, replacement) {
		var result = '', source = this, match;
		replacement = prepareReplacement(replacement);

		if (Object.isString(pattern))
			pattern = RegExp.escape(pattern);

		if (!(pattern.length || pattern.source)) {
			replacement = replacement('');
			return replacement + source.split('').join(replacement) + replacement;
		}

		while (source.length > 0) {
			if (match = source.match(pattern)) {
				result += source.slice(0, match.index);
				result += String.interpret(replacement(match));
				source = source.slice(match.index + match[0].length);
			} else {
				result += source, source = '';
			}
		}
		return result;
	}

	function sub(pattern, replacement, count) {
		replacement = prepareReplacement(replacement);
		count = Object.isUndefined(count) ? 1 : count;

		return this.gsub(pattern, function(match) {
			if (--count < 0) return match[0];
			return replacement(match);
		});
	}

	function scan(pattern, iterator) {
		this.gsub(pattern, iterator);
		return String(this);
	}

	function truncate(length, truncation) {
		length = length || 30;
		truncation = Object.isUndefined(truncation) ? '...' : truncation;
		return this.length > length ?
      this.slice(0, length - truncation.length) + truncation : String(this);
	}

	function strip() {
		return this.replace(/^\s+/, '').replace(/\s+$/, '');
	}

	function stripTags() {
		return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, '');
	}

	function stripScripts() {
		return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
	}

	function extractScripts() {
		var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
		var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
		return (this.match(matchAll) || []).map(function(scriptTag) {
			return (scriptTag.match(matchOne) || ['', ''])[1];
		});
	}

	function evalScripts() {
		return this.extractScripts().map(function(script) { return eval(script) });
	}

	function escapeHTML() {
		return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
	}

	function unescapeHTML() {
		return this.stripTags().replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
	}


	function toQueryParams(separator) {
		var match = this.strip().match(/([^?#]*)(#.*)?$/);
		if (!match) return {};

		return match[1].split(separator || '&').inject({}, function(hash, pair) {
			if ((pair = pair.split('='))[0]) {
				var key = decodeURIComponent(pair.shift());
				var value = pair.length > 1 ? pair.join('=') : pair[0];
				if (value != undefined) value = decodeURIComponent(value);

				if (key in hash) {
					if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
					hash[key].push(value);
				}
				else hash[key] = value;
			}
			return hash;
		});
	}

	function toArray() {
		return this.split('');
	}

	function succ() {
		return this.slice(0, this.length - 1) +
      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
	}

	function times(count) {
		return count < 1 ? '' : new Array(count + 1).join(this);
	}

	function camelize() {
		var parts = this.split('-'), len = parts.length;
		if (len == 1) return parts[0];

		var camelized = this.charAt(0) == '-'
      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
      : parts[0];

		for (var i = 1; i < len; i++)
			camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);

		return camelized;
	}

	function capitalize() {
		return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
	}

	function underscore() {
		return this.replace(/::/g, '/')
               .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
               .replace(/([a-z\d])([A-Z])/g, '$1_$2')
               .replace(/-/g, '_')
               .toLowerCase();
	}

	function dasherize() {
		return this.replace(/_/g, '-');
	}

	function inspect(useDoubleQuotes) {
		var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
			if (character in String.specialChar) {
				return String.specialChar[character];
			}
			return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
		});
		if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
		return "'" + escapedString.replace(/'/g, '\\\'') + "'";
	}

	function toJSON() {
		return this.inspect(true);
	}

	function unfilterJSON(filter) {
		return this.replace(filter || Prototype.JSONFilter, '$1');
	}

	function isJSON() {
		var str = this;
		if (str.blank()) return false;
		str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
		return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
	}

	function evalJSON(sanitize) {
		var json = this.unfilterJSON();
		try {
			if (!sanitize || json.isJSON()) return eval('(' + json + ')');
		} catch (e) { }
		throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
	}

	function include(pattern) {
		return this.indexOf(pattern) > -1;
	}

	function startsWith(pattern) {
		return this.indexOf(pattern) === 0;
	}

	function endsWith(pattern) {
		var d = this.length - pattern.length;
		return d >= 0 && this.lastIndexOf(pattern) === d;
	}

	function empty() {
		return this == '';
	}

	function blank() {
		return /^\s*$/.test(this);
	}

	function interpolate(object, pattern) {
		return new Template(this, pattern).evaluate(object);
	}

	return {
		gsub: gsub,
		sub: sub,
		scan: scan,
		truncate: truncate,
		strip: String.prototype.trim ? String.prototype.trim : strip,
		stripTags: stripTags,
		stripScripts: stripScripts,
		extractScripts: extractScripts,
		evalScripts: evalScripts,
		escapeHTML: escapeHTML,
		unescapeHTML: unescapeHTML,
		toQueryParams: toQueryParams,
		parseQuery: toQueryParams,
		toArray: toArray,
		succ: succ,
		times: times,
		camelize: camelize,
		capitalize: capitalize,
		underscore: underscore,
		dasherize: dasherize,
		inspect: inspect,
		toJSON: toJSON,
		unfilterJSON: unfilterJSON,
		isJSON: isJSON,
		evalJSON: evalJSON,
		include: include,
		startsWith: startsWith,
		endsWith: endsWith,
		empty: empty,
		blank: blank,
		interpolate: interpolate
	};
})());

var Template = Class.create({
	initialize: function(template, pattern) {
		this.template = template.toString();
		this.pattern = pattern || Template.Pattern;
	},

	evaluate: function(object) {
		if (object && Object.isFunction(object.toTemplateReplacements))
			object = object.toTemplateReplacements();

		return this.template.gsub(this.pattern, function(match) {
			if (object == null) return (match[1] + '');

			var before = match[1] || '';
			if (before == '\\') return match[2];

			var ctx = object, expr = match[3];
			var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
			match = pattern.exec(expr);
			if (match == null) return before;

			while (match != null) {
				var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1];
				ctx = ctx[comp];
				if (null == ctx || '' == match[3]) break;
				expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
				match = pattern.exec(expr);
			}

			return before + String.interpret(ctx);
		});
	}
});
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;

var $break = {};

var Enumerable = (function() {
	function each(iterator, context) {
		var index = 0;
		try {
			this._each(function(value) {
				iterator.call(context, value, index++);
			});
		} catch (e) {
			if (e != $break) throw e;
		}
		return this;
	}

	function eachSlice(number, iterator, context) {
		var index = -number, slices = [], array = this.toArray();
		if (number < 1) return array;
		while ((index += number) < array.length)
			slices.push(array.slice(index, index + number));
		return slices.collect(iterator, context);
	}

	function all(iterator, context) {
		iterator = iterator || Prototype.K;
		var result = true;
		this.each(function(value, index) {
			result = result && !!iterator.call(context, value, index);
			if (!result) throw $break;
		});
		return result;
	}

	function any(iterator, context) {
		iterator = iterator || Prototype.K;
		var result = false;
		this.each(function(value, index) {
			if (result = !!iterator.call(context, value, index))
				throw $break;
		});
		return result;
	}

	function collect(iterator, context) {
		iterator = iterator || Prototype.K;
		var results = [];
		this.each(function(value, index) {
			results.push(iterator.call(context, value, index));
		});
		return results;
	}

	function detect(iterator, context) {
		var result;
		this.each(function(value, index) {
			if (iterator.call(context, value, index)) {
				result = value;
				throw $break;
			}
		});
		return result;
	}

	function findAll(iterator, context) {
		var results = [];
		this.each(function(value, index) {
			if (iterator.call(context, value, index))
				results.push(value);
		});
		return results;
	}

	function grep(filter, iterator, context) {
		iterator = iterator || Prototype.K;
		var results = [];

		if (Object.isString(filter))
			filter = new RegExp(RegExp.escape(filter));

		this.each(function(value, index) {
			if (filter.match(value))
				results.push(iterator.call(context, value, index));
		});
		return results;
	}

	function include(object) {
		if (Object.isFunction(this.indexOf))
			if (this.indexOf(object) != -1) return true;

		var found = false;
		this.each(function(value) {
			if (value == object) {
				found = true;
				throw $break;
			}
		});
		return found;
	}

	function inGroupsOf(number, fillWith) {
		fillWith = Object.isUndefined(fillWith) ? null : fillWith;
		return this.eachSlice(number, function(slice) {
			while (slice.length < number) slice.push(fillWith);
			return slice;
		});
	}

	function inject(memo, iterator, context) {
		this.each(function(value, index) {
			memo = iterator.call(context, memo, value, index);
		});
		return memo;
	}

	function invoke(method) {
		var args = $A(arguments).slice(1);
		return this.map(function(value) {
			return value[method].apply(value, args);
		});
	}

	function max(iterator, context) {
		iterator = iterator || Prototype.K;
		var result;
		this.each(function(value, index) {
			value = iterator.call(context, value, index);
			if (result == null || value >= result)
				result = value;
		});
		return result;
	}

	function min(iterator, context) {
		iterator = iterator || Prototype.K;
		var result;
		this.each(function(value, index) {
			value = iterator.call(context, value, index);
			if (result == null || value < result)
				result = value;
		});
		return result;
	}

	function partition(iterator, context) {
		iterator = iterator || Prototype.K;
		var trues = [], falses = [];
		this.each(function(value, index) {
			(iterator.call(context, value, index) ?
        trues : falses).push(value);
		});
		return [trues, falses];
	}

	function pluck(property) {
		var results = [];
		this.each(function(value) {
			results.push(value[property]);
		});
		return results;
	}

	function reject(iterator, context) {
		var results = [];
		this.each(function(value, index) {
			if (!iterator.call(context, value, index))
				results.push(value);
		});
		return results;
	}

	function sortBy(iterator, context) {
		return this.map(function(value, index) {
			return {
				value: value,
				criteria: iterator.call(context, value, index)
			};
		}).sort(function(left, right) {
			var a = left.criteria, b = right.criteria;
			return a < b ? -1 : a > b ? 1 : 0;
		}).pluck('value');
	}

	function toArray() {
		return this.map();
	}

	function zip() {
		var iterator = Prototype.K, args = $A(arguments);
		if (Object.isFunction(args.last()))
			iterator = args.pop();

		var collections = [this].concat(args).map($A);
		return this.map(function(value, index) {
			return iterator(collections.pluck(index));
		});
	}

	function size() {
		return this.toArray().length;
	}

	function inspect() {
		return '#<Enumerable:' + this.toArray().inspect() + '>';
	}









	return {
		each: each,
		eachSlice: eachSlice,
		all: all,
		every: all,
		any: any,
		some: any,
		collect: collect,
		map: collect,
		detect: detect,
		findAll: findAll,
		select: findAll,
		filter: findAll,
		grep: grep,
		include: include,
		member: include,
		inGroupsOf: inGroupsOf,
		inject: inject,
		invoke: invoke,
		max: max,
		min: min,
		partition: partition,
		pluck: pluck,
		reject: reject,
		sortBy: sortBy,
		toArray: toArray,
		entries: toArray,
		zip: zip,
		size: size,
		inspect: inspect,
		find: detect
	};
})();
function $A(iterable) {
	if (!iterable) return [];
	if ('toArray' in Object(iterable)) return iterable.toArray();
	var length = iterable.length || 0, results = new Array(length);
	while (length--) results[length] = iterable[length];
	return results;
}

function $w(string) {
	if (!Object.isString(string)) return [];
	string = string.strip();
	return string ? string.split(/\s+/) : [];
}

Array.from = $A;


(function() {
	var arrayProto = Array.prototype,
      slice = arrayProto.slice,
      _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available

	function each(iterator) {
		for (var i = 0, length = this.length; i < length; i++)
			iterator(this[i]);
	}
	if (!_each) _each = each;

	function clear() {
		this.length = 0;
		return this;
	}

	function first() {
		return this[0];
	}

	function last() {
		return this[this.length - 1];
	}

	function compact() {
		return this.select(function(value) {
			return value != null;
		});
	}

	function flatten() {
		return this.inject([], function(array, value) {
			if (Object.isArray(value))
				return array.concat(value.flatten());
			array.push(value);
			return array;
		});
	}

	function without() {
		var values = slice.call(arguments, 0);
		return this.select(function(value) {
			return !values.include(value);
		});
	}

	function reverse(inline) {
		return (inline !== false ? this : this.toArray())._reverse();
	}

	function uniq(sorted) {
		return this.inject([], function(array, value, index) {
			if (0 == index || (sorted ? array.last() != value : !array.include(value)))
				array.push(value);
			return array;
		});
	}

	function intersect(array) {
		return this.uniq().findAll(function(item) {
			return array.detect(function(value) { return item === value });
		});
	}


	function clone() {
		return slice.call(this, 0);
	}

	function size() {
		return this.length;
	}

	function inspect() {
		return '[' + this.map(Object.inspect).join(', ') + ']';
	}

	function toJSON() {
		var results = [];
		this.each(function(object) {
			var value = Object.toJSON(object);
			if (!Object.isUndefined(value)) results.push(value);
		});
		return '[' + results.join(', ') + ']';
	}

	function indexOf(item, i) {
		i || (i = 0);
		var length = this.length;
		if (i < 0) i = length + i;
		for (; i < length; i++)
			if (this[i] === item) return i;
		return -1;
	}

	function lastIndexOf(item, i) {
		i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
		var n = this.slice(0, i).reverse().indexOf(item);
		return (n < 0) ? n : i - n - 1;
	}

	function concat() {
		var array = slice.call(this, 0), item;
		for (var i = 0, length = arguments.length; i < length; i++) {
			item = arguments[i];
			if (Object.isArray(item) && !('callee' in item)) {
				for (var j = 0, arrayLength = item.length; j < arrayLength; j++)
					array.push(item[j]);
			} else {
				array.push(item);
			}
		}
		return array;
	}

	Object.extend(arrayProto, Enumerable);

	if (!arrayProto._reverse)
		arrayProto._reverse = arrayProto.reverse;

	Object.extend(arrayProto, {
		_each: _each,
		clear: clear,
		first: first,
		last: last,
		compact: compact,
		flatten: flatten,
		without: without,
		reverse: reverse,
		uniq: uniq,
		intersect: intersect,
		clone: clone,
		toArray: clone,
		size: size,
		inspect: inspect,
		toJSON: toJSON
	});

	var CONCAT_ARGUMENTS_BUGGY = (function() {
		return [].concat(arguments)[0][0] !== 1;
	})(1, 2)

	if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat;

	if (!arrayProto.indexOf) arrayProto.indexOf = indexOf;
	if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf;
})();
function $H(object) {
	return new Hash(object);
};

var Hash = Class.create(Enumerable, (function() {
	function initialize(object) {
		this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
	}

	function _each(iterator) {
		for (var key in this._object) {
			var value = this._object[key], pair = [key, value];
			pair.key = key;
			pair.value = value;
			iterator(pair);
		}
	}

	function set(key, value) {
		return this._object[key] = value;
	}

	function get(key) {
		if (this._object[key] !== Object.prototype[key])
			return this._object[key];
	}

	function unset(key) {
		var value = this._object[key];
		delete this._object[key];
		return value;
	}

	function toObject() {
		return Object.clone(this._object);
	}

	function keys() {
		return this.pluck('key');
	}

	function values() {
		return this.pluck('value');
	}

	function index(value) {
		var match = this.detect(function(pair) {
			return pair.value === value;
		});
		return match && match.key;
	}

	function merge(object) {
		return this.clone().update(object);
	}

	function update(object) {
		return new Hash(object).inject(this, function(result, pair) {
			result.set(pair.key, pair.value);
			return result;
		});
	}

	function toQueryPair(key, value) {
		if (Object.isUndefined(value)) return key;
		return key + '=' + encodeURIComponent(String.interpret(value));
	}

	function toQueryString() {
		return this.inject([], function(results, pair) {
			var key = encodeURIComponent(pair.key), values = pair.value;

			if (values && typeof values == 'object') {
				if (Object.isArray(values))
					return results.concat(values.map(toQueryPair.curry(key)));
			} else results.push(toQueryPair(key, values));
			return results;
		}).join('&');
	}

	function inspect() {
		return '#<Hash:{' + this.map(function(pair) {
			return pair.map(Object.inspect).join(': ');
		}).join(', ') + '}>';
	}

	function toJSON() {
		return Object.toJSON(this.toObject());
	}

	function clone() {
		return new Hash(this);
	}

	return {
		initialize: initialize,
		_each: _each,
		set: set,
		get: get,
		unset: unset,
		toObject: toObject,
		toTemplateReplacements: toObject,
		keys: keys,
		values: values,
		index: index,
		merge: merge,
		update: update,
		toQueryString: toQueryString,
		inspect: inspect,
		toJSON: toJSON,
		clone: clone
	};
})());

Hash.from = $H;
Object.extend(Number.prototype, (function() {
	function toColorPart() {
		return this.toPaddedString(2, 16);
	}

	function succ() {
		return this + 1;
	}

	function times(iterator, context) {
		$R(0, this, true).each(iterator, context);
		return this;
	}

	function toPaddedString(length, radix) {
		var string = this.toString(radix || 10);
		return '0'.times(length - string.length) + string;
	}

	function toJSON() {
		return isFinite(this) ? this.toString() : 'null';
	}

	function abs() {
		return Math.abs(this);
	}

	function round() {
		return Math.round(this);
	}

	function ceil() {
		return Math.ceil(this);
	}

	function floor() {
		return Math.floor(this);
	}

	return {
		toColorPart: toColorPart,
		succ: succ,
		times: times,
		toPaddedString: toPaddedString,
		toJSON: toJSON,
		abs: abs,
		round: round,
		ceil: ceil,
		floor: floor
	};
})());

function $R(start, end, exclusive) {
	return new ObjectRange(start, end, exclusive);
}

var ObjectRange = Class.create(Enumerable, (function() {
	function initialize(start, end, exclusive) {
		this.start = start;
		this.end = end;
		this.exclusive = exclusive;
	}

	function _each(iterator) {
		var value = this.start;
		while (this.include(value)) {
			iterator(value);
			value = value.succ();
		}
	}

	function include(value) {
		if (value < this.start)
			return false;
		if (this.exclusive)
			return value < this.end;
		return value <= this.end;
	}

	return {
		initialize: initialize,
		_each: _each,
		include: include
	};
})());



var Ajax = {
	getTransport: function() {
		return Try.these(
      function() { return new XMLHttpRequest() },
      function() { return new ActiveXObject('Msxml2.XMLHTTP') },
      function() { return new ActiveXObject('Microsoft.XMLHTTP') }
    ) || false;
	},

	activeRequestCount: 0
};

Ajax.Responders = {
	responders: [],

	_each: function(iterator) {
		this.responders._each(iterator);
	},

	register: function(responder) {
		if (!this.include(responder))
			this.responders.push(responder);
	},

	unregister: function(responder) {
		this.responders = this.responders.without(responder);
	},

	dispatch: function(callback, request, transport, json) {
		this.each(function(responder) {
			if (Object.isFunction(responder[callback])) {
				try {
					responder[callback].apply(responder, [request, transport, json]);
				} catch (e) { }
			}
		});
	}
};

Object.extend(Ajax.Responders, Enumerable);

Ajax.Responders.register({
	onCreate: function() { Ajax.activeRequestCount++ },
	onComplete: function() { Ajax.activeRequestCount-- }
});
Ajax.Base = Class.create({
	initialize: function(options) {
		this.options = {
			method: 'post',
			asynchronous: true,
			contentType: 'application/x-www-form-urlencoded',
			encoding: 'UTF-8',
			parameters: '',
			evalJSON: true,
			evalJS: true
		};
		Object.extend(this.options, options || {});

		this.options.method = this.options.method.toLowerCase();

		if (Object.isString(this.options.parameters))
			this.options.parameters = this.options.parameters.toQueryParams();
		else if (Object.isHash(this.options.parameters))
			this.options.parameters = this.options.parameters.toObject();
	}
});
Ajax.Request = Class.create(Ajax.Base, {
	_complete: false,

	initialize: function($super, url, options) {
		$super(options);
		this.transport = Ajax.getTransport();
		this.request(url);
	},

	request: function(url) {
		this.url = url;
		this.method = this.options.method;
		var params = Object.clone(this.options.parameters);

		if (!['get', 'post'].include(this.method)) {
			params['_method'] = this.method;
			this.method = 'post';
		}

		this.parameters = params;

		if (params = Object.toQueryString(params)) {
			if (this.method == 'get')
				this.url += (this.url.include('?') ? '&' : '?') + params;
			else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
				params += '&_=';
		}

		try {
			var response = new Ajax.Response(this);
			if (this.options.onCreate) this.options.onCreate(response);
			Ajax.Responders.dispatch('onCreate', this, response);

			this.transport.open(this.method.toUpperCase(), this.url,
        this.options.asynchronous);

			if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);

			this.transport.onreadystatechange = this.onStateChange.bind(this);
			this.setRequestHeaders();

			this.body = this.method == 'post' ? (this.options.postBody || params) : null;
			this.transport.send(this.body);

			/* Force Firefox to handle ready state 4 for synchronous requests */
			if (!this.options.asynchronous && this.transport.overrideMimeType)
				this.onStateChange();

		}
		catch (e) {
			this.dispatchException(e);
		}
	},

	onStateChange: function() {
		var readyState = this.transport.readyState;
		if (readyState > 1 && !((readyState == 4) && this._complete))
			this.respondToReadyState(this.transport.readyState);
	},

	setRequestHeaders: function() {
		var headers = {
			'X-Requested-With': 'XMLHttpRequest',
			'X-Prototype-Version': Prototype.Version,
			'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
		};

		if (this.method == 'post') {
			headers['Content-type'] = this.options.contentType +
        (this.options.encoding ? '; charset=' + this.options.encoding : '');

			/* Force "Connection: close" for older Mozilla browsers to work
			* around a bug where XMLHttpRequest sends an incorrect
			* Content-length header. See Mozilla Bugzilla #246651.
			*/
			if (this.transport.overrideMimeType &&
          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0, 2005])[1] < 2005)
				headers['Connection'] = 'close';
		}

		if (typeof this.options.requestHeaders == 'object') {
			var extras = this.options.requestHeaders;

			if (Object.isFunction(extras.push))
				for (var i = 0, length = extras.length; i < length; i += 2)
				headers[extras[i]] = extras[i + 1];
			else
				$H(extras).each(function(pair) { headers[pair.key] = pair.value });
		}

		for (var name in headers)
			this.transport.setRequestHeader(name, headers[name]);
	},

	success: function() {
		var status = this.getStatus();
		return !status || (status >= 200 && status < 300);
	},

	getStatus: function() {
		try {
			return this.transport.status || 0;
		} catch (e) { return 0 }
	},

	respondToReadyState: function(readyState) {
		var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);

		if (state == 'Complete') {
			try {
				this._complete = true;
				(this.options['on' + response.status]
         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
         || Prototype.emptyFunction)(response, response.headerJSON);
			} catch (e) {
				this.dispatchException(e);
			}

			var contentType = response.getHeader('Content-type');
			if (this.options.evalJS == 'force'
          || (this.options.evalJS && this.isSameOrigin() && contentType
          && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
				this.evalResponse();
		}

		try {
			(this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
			Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
		} catch (e) {
			this.dispatchException(e);
		}

		if (state == 'Complete') {
			this.transport.onreadystatechange = Prototype.emptyFunction;
		}
	},

	isSameOrigin: function() {
		var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
		return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
			protocol: location.protocol,
			domain: document.domain,
			port: location.port ? ':' + location.port : ''
		}));
	},

	getHeader: function(name) {
		try {
			return this.transport.getResponseHeader(name) || null;
		} catch (e) { return null; }
	},

	evalResponse: function() {
		try {
			return eval((this.transport.responseText || '').unfilterJSON());
		} catch (e) {
			this.dispatchException(e);
		}
	},

	dispatchException: function(exception) {
		(this.options.onException || Prototype.emptyFunction)(this, exception);
		Ajax.Responders.dispatch('onException', this, exception);
	}
});

Ajax.Request.Events =
  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];








Ajax.Response = Class.create({
	initialize: function(request) {
		this.request = request;
		var transport = this.transport = request.transport,
        readyState = this.readyState = transport.readyState;

		if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
			this.status = this.getStatus();
			this.statusText = this.getStatusText();
			this.responseText = String.interpret(transport.responseText);
			this.headerJSON = this._getHeaderJSON();
		}

		if (readyState == 4) {
			var xml = transport.responseXML;
			this.responseXML = Object.isUndefined(xml) ? null : xml;
			this.responseJSON = this._getResponseJSON();
		}
	},

	status: 0,

	statusText: '',

	getStatus: Ajax.Request.prototype.getStatus,

	getStatusText: function() {
		try {
			return this.transport.statusText || '';
		} catch (e) { return '' }
	},

	getHeader: Ajax.Request.prototype.getHeader,

	getAllHeaders: function() {
		try {
			return this.getAllResponseHeaders();
		} catch (e) { return null }
	},

	getResponseHeader: function(name) {
		return this.transport.getResponseHeader(name);
	},

	getAllResponseHeaders: function() {
		return this.transport.getAllResponseHeaders();
	},

	_getHeaderJSON: function() {
		var json = this.getHeader('X-JSON');
		if (!json) return null;
		json = decodeURIComponent(escape(json));
		try {
			return json.evalJSON(this.request.options.sanitizeJSON ||
        !this.request.isSameOrigin());
		} catch (e) {
			this.request.dispatchException(e);
		}
	},

	_getResponseJSON: function() {
		var options = this.request.options;
		if (!options.evalJSON || (options.evalJSON != 'force' &&
      !(this.getHeader('Content-type') || '').include('application/json')) ||
        this.responseText.blank())
			return null;
		try {
			return this.responseText.evalJSON(options.sanitizeJSON ||
        !this.request.isSameOrigin());
		} catch (e) {
			this.request.dispatchException(e);
		}
	}
});

Ajax.Updater = Class.create(Ajax.Request, {
	initialize: function($super, container, url, options) {
		this.container = {
			success: (container.success || container),
			failure: (container.failure || (container.success ? null : container))
		};

		options = Object.clone(options);
		var onComplete = options.onComplete;
		options.onComplete = (function(response, json) {
			this.updateContent(response.responseText);
			if (Object.isFunction(onComplete)) onComplete(response, json);
		}).bind(this);

		$super(url, options);
	},

	updateContent: function(responseText) {
		var receiver = this.container[this.success() ? 'success' : 'failure'],
        options = this.options;

		if (!options.evalScripts) responseText = responseText.stripScripts();

		if (receiver = $(receiver)) {
			if (options.insertion) {
				if (Object.isString(options.insertion)) {
					var insertion = {}; insertion[options.insertion] = responseText;
					receiver.insert(insertion);
				}
				else options.insertion(receiver, responseText);
			}
			else receiver.update(responseText);
		}
	}
});

Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
	initialize: function($super, container, url, options) {
		$super(options);
		this.onComplete = this.options.onComplete;

		this.frequency = (this.options.frequency || 2);
		this.decay = (this.options.decay || 1);

		this.updater = {};
		this.container = container;
		this.url = url;

		this.start();
	},

	start: function() {
		this.options.onComplete = this.updateComplete.bind(this);
		this.onTimerEvent();
	},

	stop: function() {
		this.updater.options.onComplete = undefined;
		clearTimeout(this.timer);
		(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
	},

	updateComplete: function(response) {
		if (this.options.decay) {
			this.decay = (response.responseText == this.lastText ?
        this.decay * this.options.decay : 1);

			this.lastText = response.responseText;
		}
		this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
	},

	onTimerEvent: function() {
		this.updater = new Ajax.Updater(this.container, this.url, this.options);
	}
});



function $(element) {
	if (arguments.length > 1) {
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
			elements.push($(arguments[i]));
		return elements;
	}
	if (Object.isString(element))
		element = document.getElementById(element);
	return Element.extend(element);
}

if (Prototype.BrowserFeatures.XPath) {
	document._getElementsByXPath = function(expression, parentElement) {
		var results = [];
		var query = document.evaluate(expression, $(parentElement) || document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
		for (var i = 0, length = query.snapshotLength; i < length; i++)
			results.push(Element.extend(query.snapshotItem(i)));
		return results;
	};
}

/*--------------------------------------------------------------------------*/

if (!window.Node) var Node = {};

if (!Node.ELEMENT_NODE) {
	Object.extend(Node, {
		ELEMENT_NODE: 1,
		ATTRIBUTE_NODE: 2,
		TEXT_NODE: 3,
		CDATA_SECTION_NODE: 4,
		ENTITY_REFERENCE_NODE: 5,
		ENTITY_NODE: 6,
		PROCESSING_INSTRUCTION_NODE: 7,
		COMMENT_NODE: 8,
		DOCUMENT_NODE: 9,
		DOCUMENT_TYPE_NODE: 10,
		DOCUMENT_FRAGMENT_NODE: 11,
		NOTATION_NODE: 12
	});
}


(function(global) {

	var SETATTRIBUTE_IGNORES_NAME = (function() {
		var elForm = document.createElement("form");
		var elInput = document.createElement("input");
		var root = document.documentElement;
		elInput.setAttribute("name", "test");
		elForm.appendChild(elInput);
		root.appendChild(elForm);
		var isBuggy = elForm.elements
      ? (typeof elForm.elements.test == "undefined")
      : null;
		root.removeChild(elForm);
		elForm = elInput = null;
		return isBuggy;
	})();

	var element = global.Element;
	global.Element = function(tagName, attributes) {
		attributes = attributes || {};
		tagName = tagName.toLowerCase();
		var cache = Element.cache;
		if (SETATTRIBUTE_IGNORES_NAME && attributes.name) {
			tagName = '<' + tagName + ' name="' + attributes.name + '">';
			delete attributes.name;
			return Element.writeAttribute(document.createElement(tagName), attributes);
		}
		if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
		return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
	};
	Object.extend(global.Element, element || {});
	if (element) global.Element.prototype = element.prototype;
})(this);

Element.cache = {};
Element.idCounter = 1;

Element.Methods = {
	visible: function(element) {
		return $(element).style.display != 'none';
	},

	toggle: function(element) {
		element = $(element);
		Element[Element.visible(element) ? 'hide' : 'show'](element);
		return element;
	},


	hide: function(element) {
		element = $(element);
		element.style.display = 'none';
		return element;
	},

	show: function(element) {
		element = $(element);
		element.style.display = '';
		return element;
	},

	remove: function(element) {
		element = $(element);
		element.parentNode.removeChild(element);
		return element;
	},

	update: (function() {

		var SELECT_ELEMENT_INNERHTML_BUGGY = (function() {
			var el = document.createElement("select"),
          isBuggy = true;
			el.innerHTML = "<option value=\"test\">test</option>";
			if (el.options && el.options[0]) {
				isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION";
			}
			el = null;
			return isBuggy;
		})();

		var TABLE_ELEMENT_INNERHTML_BUGGY = (function() {
			try {
				var el = document.createElement("table");
				if (el && el.tBodies) {
					el.innerHTML = "<tbody><tr><td>test</td></tr></tbody>";
					var isBuggy = typeof el.tBodies[0] == "undefined";
					el = null;
					return isBuggy;
				}
			} catch (e) {
				return true;
			}
		})();

		var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function() {
			var s = document.createElement("script"),
          isBuggy = false;
			try {
				s.appendChild(document.createTextNode(""));
				isBuggy = !s.firstChild ||
          s.firstChild && s.firstChild.nodeType !== 3;
			} catch (e) {
				isBuggy = true;
			}
			s = null;
			return isBuggy;
		})();

		function update(element, content) {
			element = $(element);

			if (content && content.toElement)
				content = content.toElement();

			if (Object.isElement(content))
				return element.update().insert(content);

			content = Object.toHTML(content);

			var tagName = element.tagName.toUpperCase();

			if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) {
				element.text = content;
				return element;
			}

			if (SELECT_ELEMENT_INNERHTML_BUGGY || TABLE_ELEMENT_INNERHTML_BUGGY) {
				if (tagName in Element._insertionTranslations.tags) {
					while (element.firstChild) {
						element.removeChild(element.firstChild);
					}
					Element._getContentFromAnonymousElement(tagName, content.stripScripts())
            .each(function(node) {
            	element.appendChild(node)
            });
				}
				else {
					element.innerHTML = content.stripScripts();
				}
			}
			else {
				element.innerHTML = content.stripScripts();
			}

			content.evalScripts.bind(content).defer();
			return element;
		}

		return update;
	})(),

	replace: function(element, content) {
		element = $(element);
		if (content && content.toElement) content = content.toElement();
		else if (!Object.isElement(content)) {
			content = Object.toHTML(content);
			var range = element.ownerDocument.createRange();
			range.selectNode(element);
			content.evalScripts.bind(content).defer();
			content = range.createContextualFragment(content.stripScripts());
		}
		element.parentNode.replaceChild(content, element);
		return element;
	},

	insert: function(element, insertions) {
		element = $(element);

		if (Object.isString(insertions) || Object.isNumber(insertions) ||
        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
			insertions = { bottom: insertions };

		var content, insert, tagName, childNodes;

		for (var position in insertions) {
			content = insertions[position];
			position = position.toLowerCase();
			insert = Element._insertionTranslations[position];

			if (content && content.toElement) content = content.toElement();
			if (Object.isElement(content)) {
				insert(element, content);
				continue;
			}

			content = Object.toHTML(content);

			tagName = ((position == 'before' || position == 'after')
        ? element.parentNode : element).tagName.toUpperCase();

			childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());

			if (position == 'top' || position == 'after') childNodes.reverse();
			childNodes.each(insert.curry(element));

			content.evalScripts.bind(content).defer();
		}

		return element;
	},

	wrap: function(element, wrapper, attributes) {
		element = $(element);
		if (Object.isElement(wrapper))
			$(wrapper).writeAttribute(attributes || {});
		else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
		else wrapper = new Element('div', wrapper);
		if (element.parentNode)
			element.parentNode.replaceChild(wrapper, element);
		wrapper.appendChild(element);
		return wrapper;
	},

	inspect: function(element) {
		element = $(element);
		var result = '<' + element.tagName.toLowerCase();
		$H({ 'id': 'id', 'className': 'class' }).each(function(pair) {
			var property = pair.first(), attribute = pair.last();
			var value = (element[property] || '').toString();
			if (value) result += ' ' + attribute + '=' + value.inspect(true);
		});
		return result + '>';
	},

	recursivelyCollect: function(element, property) {
		element = $(element);
		var elements = [];
		while (element = element[property])
			if (element.nodeType == 1)
			elements.push(Element.extend(element));
		return elements;
	},

	ancestors: function(element) {
		return Element.recursivelyCollect(element, 'parentNode');
	},

	descendants: function(element) {
		return Element.select(element, "*");
	},

	firstDescendant: function(element) {
		element = $(element).firstChild;
		while (element && element.nodeType != 1) element = element.nextSibling;
		return $(element);
	},

	immediateDescendants: function(element) {
		if (!(element = $(element).firstChild)) return [];
		while (element && element.nodeType != 1) element = element.nextSibling;
		if (element) return [element].concat($(element).nextSiblings());
		return [];
	},

	previousSiblings: function(element) {
		return Element.recursivelyCollect(element, 'previousSibling');
	},

	nextSiblings: function(element) {
		return Element.recursivelyCollect(element, 'nextSibling');
	},

	siblings: function(element) {
		element = $(element);
		return Element.previousSiblings(element).reverse()
      .concat(Element.nextSiblings(element));
	},

	match: function(element, selector) {
		if (Object.isString(selector))
			selector = new Selector(selector);
		return selector.match($(element));
	},

	up: function(element, expression, index) {
		element = $(element);
		if (arguments.length == 1) return $(element.parentNode);
		var ancestors = Element.ancestors(element);
		return Object.isNumber(expression) ? ancestors[expression] :
      Selector.findElement(ancestors, expression, index);
	},

	down: function(element, expression, index) {
		element = $(element);
		if (arguments.length == 1) return Element.firstDescendant(element);
		return Object.isNumber(expression) ? Element.descendants(element)[expression] :
      Element.select(element, expression)[index || 0];
	},

	previous: function(element, expression, index) {
		element = $(element);
		if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
		var previousSiblings = Element.previousSiblings(element);
		return Object.isNumber(expression) ? previousSiblings[expression] :
      Selector.findElement(previousSiblings, expression, index);
	},

	next: function(element, expression, index) {
		element = $(element);
		if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
		var nextSiblings = Element.nextSiblings(element);
		return Object.isNumber(expression) ? nextSiblings[expression] :
      Selector.findElement(nextSiblings, expression, index);
	},


	select: function(element) {
		var args = Array.prototype.slice.call(arguments, 1);
		return Selector.findChildElements(element, args);
	},

	adjacent: function(element) {
		var args = Array.prototype.slice.call(arguments, 1);
		return Selector.findChildElements(element.parentNode, args).without(element);
	},

	identify: function(element) {
		element = $(element);
		var id = Element.readAttribute(element, 'id');
		if (id) return id;
		do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
		Element.writeAttribute(element, 'id', id);
		return id;
	},

	readAttribute: function(element, name) {
		element = $(element);
		if (Prototype.Browser.IE) {
			var t = Element._attributeTranslations.read;
			if (t.values[name]) return t.values[name](element, name);
			if (t.names[name]) name = t.names[name];
			if (name.include(':')) {
				return (!element.attributes || !element.attributes[name]) ? null :
         element.attributes[name].value;
			}
		}
		return element.getAttribute(name);
	},

	writeAttribute: function(element, name, value) {
		element = $(element);
		var attributes = {}, t = Element._attributeTranslations.write;

		if (typeof name == 'object') attributes = name;
		else attributes[name] = Object.isUndefined(value) ? true : value;

		for (var attr in attributes) {
			name = t.names[attr] || attr;
			value = attributes[attr];
			if (t.values[attr]) name = t.values[attr](element, value);
			if (value === false || value === null)
				element.removeAttribute(name);
			else if (value === true)
				element.setAttribute(name, name);
			else element.setAttribute(name, value);
		}
		return element;
	},

	getHeight: function(element) {
		return Element.getDimensions(element).height;
	},

	getWidth: function(element) {
		return Element.getDimensions(element).width;
	},

	classNames: function(element) {
		return new Element.ClassNames(element);
	},

	hasClassName: function(element, className) {
		if (!(element = $(element))) return;
		var elementClassName = element.className;
		return (elementClassName.length > 0 && (elementClassName == className ||
      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
	},

	addClassName: function(element, className) {
		if (!(element = $(element))) return;
		if (!Element.hasClassName(element, className))
			element.className += (element.className ? ' ' : '') + className;
		return element;
	},

	removeClassName: function(element, className) {
		if (!(element = $(element))) return;
		element.className = element.className.replace(
      new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
		return element;
	},

	toggleClassName: function(element, className) {
		if (!(element = $(element))) return;
		return Element[Element.hasClassName(element, className) ?
      'removeClassName' : 'addClassName'](element, className);
	},

	cleanWhitespace: function(element) {
		element = $(element);
		var node = element.firstChild;
		while (node) {
			var nextNode = node.nextSibling;
			if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
				element.removeChild(node);
			node = nextNode;
		}
		return element;
	},

	empty: function(element) {
		return $(element).innerHTML.blank();
	},

	descendantOf: function(element, ancestor) {
		element = $(element), ancestor = $(ancestor);

		if (element.compareDocumentPosition)
			return (element.compareDocumentPosition(ancestor) & 8) === 8;

		if (ancestor.contains)
			return ancestor.contains(element) && ancestor !== element;

		while (element = element.parentNode)
			if (element == ancestor) return true;

		return false;
	},

	scrollTo: function(element) {
		element = $(element);
		var pos = Element.cumulativeOffset(element);
		window.scrollTo(pos[0], pos[1]);
		return element;
	},

	getStyle: function(element, style) {
		element = $(element);
		style = style == 'float' ? 'cssFloat' : style.camelize();
		var value = element.style[style];
		if (!value || value == 'auto') {
			var css = document.defaultView.getComputedStyle(element, null);
			value = css ? css[style] : null;
		}
		if (style == 'opacity') return value ? parseFloat(value) : 1.0;
		return value == 'auto' ? null : value;
	},

	getOpacity: function(element) {
		return $(element).getStyle('opacity');
	},

	setStyle: function(element, styles) {
		element = $(element);
		var elementStyle = element.style, match;
		if (Object.isString(styles)) {
			element.style.cssText += ';' + styles;
			return styles.include('opacity') ?
        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
		}
		for (var property in styles)
			if (property == 'opacity') element.setOpacity(styles[property]);
		else
			elementStyle[(property == 'float' || property == 'cssFloat') ?
          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
            property] = styles[property];

		return element;
	},

	setOpacity: function(element, value) {
		element = $(element);
		element.style.opacity = (value == 1 || value === '') ? '' :
      (value < 0.00001) ? 0 : value;
		return element;
	},

	getDimensions: function(element) {
		element = $(element);
		var display = Element.getStyle(element, 'display');
		if (display != 'none' && display != null) // Safari bug
			return { width: element.offsetWidth, height: element.offsetHeight };

		var els = element.style;
		var originalVisibility = els.visibility;
		var originalPosition = els.position;
		var originalDisplay = els.display;
		els.visibility = 'hidden';
		if (originalPosition != 'fixed') // Switching fixed to absolute causes issues in Safari
			els.position = 'absolute';
		els.display = 'block';
		var originalWidth = element.clientWidth;
		var originalHeight = element.clientHeight;
		els.display = originalDisplay;
		els.position = originalPosition;
		els.visibility = originalVisibility;
		return { width: originalWidth, height: originalHeight };
	},

	makePositioned: function(element) {
		element = $(element);
		var pos = Element.getStyle(element, 'position');
		if (pos == 'static' || !pos) {
			element._madePositioned = true;
			element.style.position = 'relative';
			if (Prototype.Browser.Opera) {
				element.style.top = 0;
				element.style.left = 0;
			}
		}
		return element;
	},

	undoPositioned: function(element) {
		element = $(element);
		if (element._madePositioned) {
			element._madePositioned = undefined;
			element.style.position =
        element.style.top =
        element.style.left =
        element.style.bottom =
        element.style.right = '';
		}
		return element;
	},

	makeClipping: function(element) {
		element = $(element);
		if (element._overflow) return element;
		element._overflow = Element.getStyle(element, 'overflow') || 'auto';
		if (element._overflow !== 'hidden')
			element.style.overflow = 'hidden';
		return element;
	},

	undoClipping: function(element) {
		element = $(element);
		if (!element._overflow) return element;
		element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
		element._overflow = null;
		return element;
	},

	cumulativeOffset: function(element) {
		var valueT = 0, valueL = 0;
		do {
			valueT += element.offsetTop || 0;
			valueL += element.offsetLeft || 0;
			element = element.offsetParent;
		} while (element);
		return Element._returnOffset(valueL, valueT);
	},

	positionedOffset: function(element) {
		var valueT = 0, valueL = 0;
		do {
			valueT += element.offsetTop || 0;
			valueL += element.offsetLeft || 0;
			element = element.offsetParent;
			if (element) {
				if (element.tagName.toUpperCase() == 'BODY') break;
				var p = Element.getStyle(element, 'position');
				if (p !== 'static') break;
			}
		} while (element);
		return Element._returnOffset(valueL, valueT);
	},

	absolutize: function(element) {
		element = $(element);
		if (Element.getStyle(element, 'position') == 'absolute') return element;

		var offsets = Element.positionedOffset(element);
		var top = offsets[1];
		var left = offsets[0];
		var width = element.clientWidth;
		var height = element.clientHeight;

		element._originalLeft = left - parseFloat(element.style.left || 0);
		element._originalTop = top - parseFloat(element.style.top || 0);
		element._originalWidth = element.style.width;
		element._originalHeight = element.style.height;

		element.style.position = 'absolute';
		element.style.top = top + 'px';
		element.style.left = left + 'px';
		element.style.width = width + 'px';
		element.style.height = height + 'px';
		return element;
	},

	relativize: function(element) {
		element = $(element);
		if (Element.getStyle(element, 'position') == 'relative') return element;

		element.style.position = 'relative';
		var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
		var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);

		element.style.top = top + 'px';
		element.style.left = left + 'px';
		element.style.height = element._originalHeight;
		element.style.width = element._originalWidth;
		return element;
	},

	cumulativeScrollOffset: function(element) {
		var valueT = 0, valueL = 0;
		do {
			valueT += element.scrollTop || 0;
			valueL += element.scrollLeft || 0;
			element = element.parentNode;
		} while (element);
		return Element._returnOffset(valueL, valueT);
	},

	getOffsetParent: function(element) {
		if (element.offsetParent) return $(element.offsetParent);
		if (element == document.body) return $(element);

		while ((element = element.parentNode) && element != document.body)
			if (Element.getStyle(element, 'position') != 'static')
			return $(element);

		return $(document.body);
	},

	viewportOffset: function(forElement) {
		var valueT = 0, valueL = 0;

		var element = forElement;
		do {
			valueT += element.offsetTop || 0;
			valueL += element.offsetLeft || 0;

			if (element.offsetParent == document.body &&
        Element.getStyle(element, 'position') == 'absolute') break;

		} while (element = element.offsetParent);

		element = forElement;
		do {
			if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
				valueT -= element.scrollTop || 0;
				valueL -= element.scrollLeft || 0;
			}
		} while (element = element.parentNode);

		return Element._returnOffset(valueL, valueT);
	},

	clonePosition: function(element, source) {
		var options = Object.extend({
			setLeft: true,
			setTop: true,
			setWidth: true,
			setHeight: true,
			offsetTop: 0,
			offsetLeft: 0
		}, arguments[2] || {});

		source = $(source);
		var p = Element.viewportOffset(source);

		element = $(element);
		var delta = [0, 0];
		var parent = null;
		if (Element.getStyle(element, 'position') == 'absolute') {
			parent = Element.getOffsetParent(element);
			delta = Element.viewportOffset(parent);
		}

		if (parent == document.body) {
			delta[0] -= document.body.offsetLeft;
			delta[1] -= document.body.offsetTop;
		}

		if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
		if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
		if (options.setWidth) element.style.width = source.offsetWidth + 'px';
		if (options.setHeight) element.style.height = source.offsetHeight + 'px';
		return element;
	}
};

Object.extend(Element.Methods, {
	getElementsBySelector: Element.Methods.select,

	childElements: Element.Methods.immediateDescendants
});

Element._attributeTranslations = {
	write: {
		names: {
			className: 'class',
			htmlFor: 'for'
		},
		values: {}
	}
};

if (Prototype.Browser.Opera) {
	Element.Methods.getStyle = Element.Methods.getStyle.wrap(
    function(proceed, element, style) {
    	switch (style) {
    		case 'left': case 'top': case 'right': case 'bottom':
    			if (proceed(element, 'position') === 'static') return null;
    		case 'height': case 'width':
    			if (!Element.visible(element)) return null;

    			var dim = parseInt(proceed(element, style), 10);

    			if (dim !== element['offset' + style.capitalize()])
    				return dim + 'px';

    			var properties;
    			if (style === 'height') {
    				properties = ['border-top-width', 'padding-top',
             'padding-bottom', 'border-bottom-width'];
    			}
    			else {
    				properties = ['border-left-width', 'padding-left',
             'padding-right', 'border-right-width'];
    			}
    			return properties.inject(dim, function(memo, property) {
    				var val = proceed(element, property);
    				return val === null ? memo : memo - parseInt(val, 10);
    			}) + 'px';
    		default: return proceed(element, style);
    	}
    }
  );

	Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
    function(proceed, element, attribute) {
    	if (attribute === 'title') return element.title;
    	return proceed(element, attribute);
    }
  );
}

else if (Prototype.Browser.IE) {
	Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
    function(proceed, element) {
    	element = $(element);
    	try { element.offsetParent }
    	catch (e) { return $(document.body) }
    	var position = element.getStyle('position');
    	if (position !== 'static') return proceed(element);
    	element.setStyle({ position: 'relative' });
    	var value = proceed(element);
    	element.setStyle({ position: position });
    	return value;
    }
  );

	$w('positionedOffset viewportOffset').each(function(method) {
		Element.Methods[method] = Element.Methods[method].wrap(
      function(proceed, element) {
      	element = $(element);
      	try { element.offsetParent }
      	catch (e) { return Element._returnOffset(0, 0) }
      	var position = element.getStyle('position');
      	if (position !== 'static') return proceed(element);
      	var offsetParent = element.getOffsetParent();
      	if (offsetParent && offsetParent.getStyle('position') === 'fixed')
      		offsetParent.setStyle({ zoom: 1 });
      	element.setStyle({ position: 'relative' });
      	var value = proceed(element);
      	element.setStyle({ position: position });
      	return value;
      }
    );
	});

	Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
    function(proceed, element) {
    	try { element.offsetParent }
    	catch (e) { return Element._returnOffset(0, 0) }
    	return proceed(element);
    }
  );

	Element.Methods.getStyle = function(element, style) {
		element = $(element);
		style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
		var value = element.style[style];
		if (!value && element.currentStyle) value = element.currentStyle[style];

		if (style == 'opacity') {
			if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
				if (value[1]) return parseFloat(value[1]) / 100;
			return 1.0;
		}

		if (value == 'auto') {
			if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
				return element['offset' + style.capitalize()] + 'px';
			return null;
		}
		return value;
	};

	Element.Methods.setOpacity = function(element, value) {
		function stripAlpha(filter) {
			return filter.replace(/alpha\([^\)]*\)/gi, '');
		}
		element = $(element);
		var currentStyle = element.currentStyle;
		if ((currentStyle && !currentStyle.hasLayout) ||
      (!currentStyle && element.style.zoom == 'normal'))
			element.style.zoom = 1;

		var filter = element.getStyle('filter'), style = element.style;
		if (value == 1 || value === '') {
			(filter = stripAlpha(filter)) ?
        style.filter = filter : style.removeAttribute('filter');
			return element;
		} else if (value < 0.00001) value = 0;
		style.filter = stripAlpha(filter) +
      'alpha(opacity=' + (value * 100) + ')';
		return element;
	};

	Element._attributeTranslations = (function() {

		var classProp = 'className';
		var forProp = 'for';

		var el = document.createElement('div');

		el.setAttribute(classProp, 'x');

		if (el.className !== 'x') {
			el.setAttribute('class', 'x');
			if (el.className === 'x') {
				classProp = 'class';
			}
		}
		el = null;

		el = document.createElement('label');
		el.setAttribute(forProp, 'x');
		if (el.htmlFor !== 'x') {
			el.setAttribute('htmlFor', 'x');
			if (el.htmlFor === 'x') {
				forProp = 'htmlFor';
			}
		}
		el = null;

		return {
			read: {
				names: {
					'class': classProp,
					'className': classProp,
					'for': forProp,
					'htmlFor': forProp
				},
				values: {
					_getAttr: function(element, attribute) {
						return element.getAttribute(attribute);
					},
					_getAttr2: function(element, attribute) {
						return element.getAttribute(attribute, 2);
					},
					_getAttrNode: function(element, attribute) {
						var node = element.getAttributeNode(attribute);
						return node ? node.value : "";
					},
					_getEv: (function() {

						var el = document.createElement('div');
						el.onclick = Prototype.emptyFunction;
						var value = el.getAttribute('onclick');
						var f;

						if (String(value).indexOf('{') > -1) {
							f = function(element, attribute) {
								attribute = element.getAttribute(attribute);
								if (!attribute) return null;
								attribute = attribute.toString();
								attribute = attribute.split('{')[1];
								attribute = attribute.split('}')[0];
								return attribute.strip();
							};
						}
						else if (value === '') {
							f = function(element, attribute) {
								attribute = element.getAttribute(attribute);
								if (!attribute) return null;
								return attribute.strip();
							};
						}
						el = null;
						return f;
					})(),
					_flag: function(element, attribute) {
						return $(element).hasAttribute(attribute) ? attribute : null;
					},
					style: function(element) {
						return element.style.cssText.toLowerCase();
					},
					title: function(element) {
						return element.title;
					}
				}
			}
		}
	})();

	Element._attributeTranslations.write = {
		names: Object.extend({
			cellpadding: 'cellPadding',
			cellspacing: 'cellSpacing'
		}, Element._attributeTranslations.read.names),
		values: {
			checked: function(element, value) {
				element.checked = !!value;
			},

			style: function(element, value) {
				element.style.cssText = value ? value : '';
			}
		}
	};

	Element._attributeTranslations.has = {};

	$w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
      	Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
      	Element._attributeTranslations.has[attr.toLowerCase()] = attr;
      });

	(function(v) {
		Object.extend(v, {
			href: v._getAttr2,
			src: v._getAttr2,
			type: v._getAttr,
			action: v._getAttrNode,
			disabled: v._flag,
			checked: v._flag,
			readonly: v._flag,
			multiple: v._flag,
			onload: v._getEv,
			onunload: v._getEv,
			onclick: v._getEv,
			ondblclick: v._getEv,
			onmousedown: v._getEv,
			onmouseup: v._getEv,
			onmouseover: v._getEv,
			onmousemove: v._getEv,
			onmouseout: v._getEv,
			onfocus: v._getEv,
			onblur: v._getEv,
			onkeypress: v._getEv,
			onkeydown: v._getEv,
			onkeyup: v._getEv,
			onsubmit: v._getEv,
			onreset: v._getEv,
			onselect: v._getEv,
			onchange: v._getEv
		});
	})(Element._attributeTranslations.read.values);

	if (Prototype.BrowserFeatures.ElementExtensions) {
		(function() {
			function _descendants(element) {
				var nodes = element.getElementsByTagName('*'), results = [];
				for (var i = 0, node; node = nodes[i]; i++)
					if (node.tagName !== "!") // Filter out comment nodes.
					results.push(node);
				return results;
			}

			Element.Methods.down = function(element, expression, index) {
				element = $(element);
				if (arguments.length == 1) return element.firstDescendant();
				return Object.isNumber(expression) ? _descendants(element)[expression] :
          Element.select(element, expression)[index || 0];
			}
		})();
	}

}

else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
	Element.Methods.setOpacity = function(element, value) {
		element = $(element);
		element.style.opacity = (value == 1) ? 0.999999 :
      (value === '') ? '' : (value < 0.00001) ? 0 : value;
		return element;
	};
}

else if (Prototype.Browser.WebKit) {
	Element.Methods.setOpacity = function(element, value) {
		element = $(element);
		element.style.opacity = (value == 1 || value === '') ? '' :
      (value < 0.00001) ? 0 : value;

		if (value == 1)
			if (element.tagName.toUpperCase() == 'IMG' && element.width) {
			element.width++; element.width--;
		} else try {
			var n = document.createTextNode(' ');
			element.appendChild(n);
			element.removeChild(n);
		} catch (e) { }

		return element;
	};

	Element.Methods.cumulativeOffset = function(element) {
		var valueT = 0, valueL = 0;
		do {
			valueT += element.offsetTop || 0;
			valueL += element.offsetLeft || 0;
			if (element.offsetParent == document.body)
				if (Element.getStyle(element, 'position') == 'absolute') break;

			element = element.offsetParent;
		} while (element);

		return Element._returnOffset(valueL, valueT);
	};
}

if ('outerHTML' in document.documentElement) {
	Element.Methods.replace = function(element, content) {
		element = $(element);

		if (content && content.toElement) content = content.toElement();
		if (Object.isElement(content)) {
			element.parentNode.replaceChild(content, element);
			return element;
		}

		content = Object.toHTML(content);
		var parent = element.parentNode, tagName = parent.tagName.toUpperCase();

		if (Element._insertionTranslations.tags[tagName]) {
			var nextSibling = element.next();
			var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
			parent.removeChild(element);
			if (nextSibling)
				fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
			else
				fragments.each(function(node) { parent.appendChild(node) });
		}
		else element.outerHTML = content.stripScripts();

		content.evalScripts.bind(content).defer();
		return element;
	};
}

Element._returnOffset = function(l, t) {
	var result = [l, t];
	result.left = l;
	result.top = t;
	return result;
};

Element._getContentFromAnonymousElement = function(tagName, html) {
	var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
	if (t) {
		div.innerHTML = t[0] + html + t[1];
		t[2].times(function() { div = div.firstChild });
	} else div.innerHTML = html;
	return $A(div.childNodes);
};

Element._insertionTranslations = {
	before: function(element, node) {
		element.parentNode.insertBefore(node, element);
	},
	top: function(element, node) {
		element.insertBefore(node, element.firstChild);
	},
	bottom: function(element, node) {
		element.appendChild(node);
	},
	after: function(element, node) {
		element.parentNode.insertBefore(node, element.nextSibling);
	},
	tags: {
		TABLE: ['<table>', '</table>', 1],
		TBODY: ['<table><tbody>', '</tbody></table>', 2],
		TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
		TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
		SELECT: ['<select>', '</select>', 1]
	}
};

(function() {
	var tags = Element._insertionTranslations.tags;
	Object.extend(tags, {
		THEAD: tags.TBODY,
		TFOOT: tags.TBODY,
		TH: tags.TD
	});
})();

Element.Methods.Simulated = {
	hasAttribute: function(element, attribute) {
		attribute = Element._attributeTranslations.has[attribute] || attribute;
		var node = $(element).getAttributeNode(attribute);
		return !!(node && node.specified);
	}
};

Element.Methods.ByTag = {};

Object.extend(Element, Element.Methods);

(function(div) {

	if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) {
		window.HTMLElement = {};
		window.HTMLElement.prototype = div['__proto__'];
		Prototype.BrowserFeatures.ElementExtensions = true;
	}

	div = null;

})(document.createElement('div'))

Element.extend = (function() {

	function checkDeficiency(tagName) {
		if (typeof window.Element != 'undefined') {
			var proto = window.Element.prototype;
			if (proto) {
				var id = '_' + (Math.random() + '').slice(2);
				var el = document.createElement(tagName);
				proto[id] = 'x';
				var isBuggy = (el[id] !== 'x');
				delete proto[id];
				el = null;
				return isBuggy;
			}
		}
		return false;
	}

	function extendElementWith(element, methods) {
		for (var property in methods) {
			var value = methods[property];
			if (Object.isFunction(value) && !(property in element))
				element[property] = value.methodize();
		}
	}

	var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object');

	if (Prototype.BrowserFeatures.SpecificElementExtensions) {
		if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
			return function(element) {
				if (element && typeof element._extendedByPrototype == 'undefined') {
					var t = element.tagName;
					if (t && (/^(?:object|applet|embed)$/i.test(t))) {
						extendElementWith(element, Element.Methods);
						extendElementWith(element, Element.Methods.Simulated);
						extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
					}
				}
				return element;
			}
		}
		return Prototype.K;
	}

	var Methods = {}, ByTag = Element.Methods.ByTag;

	var extend = Object.extend(function(element) {
		if (!element || typeof element._extendedByPrototype != 'undefined' ||
        element.nodeType != 1 || element == window) return element;

		var methods = Object.clone(Methods),
        tagName = element.tagName.toUpperCase();

		if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);

		extendElementWith(element, methods);

		element._extendedByPrototype = Prototype.emptyFunction;
		return element;

	}, {
		refresh: function() {
			if (!Prototype.BrowserFeatures.ElementExtensions) {
				Object.extend(Methods, Element.Methods);
				Object.extend(Methods, Element.Methods.Simulated);
			}
		}
	});

	extend.refresh();
	return extend;
})();

Element.hasAttribute = function(element, attribute) {
	if (element.hasAttribute) return element.hasAttribute(attribute);
	return Element.Methods.Simulated.hasAttribute(element, attribute);
};

Element.addMethods = function(methods) {
	var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;

	if (!methods) {
		Object.extend(Form, Form.Methods);
		Object.extend(Form.Element, Form.Element.Methods);
		Object.extend(Element.Methods.ByTag, {
			"FORM": Object.clone(Form.Methods),
			"INPUT": Object.clone(Form.Element.Methods),
			"SELECT": Object.clone(Form.Element.Methods),
			"TEXTAREA": Object.clone(Form.Element.Methods)
		});
	}

	if (arguments.length == 2) {
		var tagName = methods;
		methods = arguments[1];
	}

	if (!tagName) Object.extend(Element.Methods, methods || {});
	else {
		if (Object.isArray(tagName)) tagName.each(extend);
		else extend(tagName);
	}

	function extend(tagName) {
		tagName = tagName.toUpperCase();
		if (!Element.Methods.ByTag[tagName])
			Element.Methods.ByTag[tagName] = {};
		Object.extend(Element.Methods.ByTag[tagName], methods);
	}

	function copy(methods, destination, onlyIfAbsent) {
		onlyIfAbsent = onlyIfAbsent || false;
		for (var property in methods) {
			var value = methods[property];
			if (!Object.isFunction(value)) continue;
			if (!onlyIfAbsent || !(property in destination))
				destination[property] = value.methodize();
		}
	}

	function findDOMClass(tagName) {
		var klass;
		var trans = {
			"OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
			"FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
			"DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
			"H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
			"INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
      "FrameSet", "IFRAME": "IFrame"
		};
		if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
		if (window[klass]) return window[klass];
		klass = 'HTML' + tagName + 'Element';
		if (window[klass]) return window[klass];
		klass = 'HTML' + tagName.capitalize() + 'Element';
		if (window[klass]) return window[klass];

		var element = document.createElement(tagName);
		var proto = element['__proto__'] || element.constructor.prototype;
		element = null;
		return proto;
	}

	var elementPrototype = window.HTMLElement ? HTMLElement.prototype :
   Element.prototype;

	if (F.ElementExtensions) {
		copy(Element.Methods, elementPrototype);
		copy(Element.Methods.Simulated, elementPrototype, true);
	}

	if (F.SpecificElementExtensions) {
		for (var tag in Element.Methods.ByTag) {
			var klass = findDOMClass(tag);
			if (Object.isUndefined(klass)) continue;
			copy(T[tag], klass.prototype);
		}
	}

	Object.extend(Element, Element.Methods);
	delete Element.ByTag;

	if (Element.extend.refresh) Element.extend.refresh();
	Element.cache = {};
};


document.viewport = {

	getDimensions: function() {
		return { width: this.getWidth(), height: this.getHeight() };
	},

	getScrollOffsets: function() {
		return Element._returnOffset(
      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
	}
};

(function(viewport) {
	var B = Prototype.Browser, doc = document, element, property = {};

	function getRootElement() {
		if (B.WebKit && !doc.evaluate)
			return document;

		if (B.Opera && window.parseFloat(window.opera.version()) < 9.5)
			return document.body;

		return document.documentElement;
	}

	function define(D) {
		if (!element) element = getRootElement();

		property[D] = 'client' + D;

		viewport['get' + D] = function() { return element[property[D]] };
		return viewport['get' + D]();
	}

	viewport.getWidth = define.curry('Width');

	viewport.getHeight = define.curry('Height');
})(document.viewport);


Element.Storage = {
	UID: 1
};

Element.addMethods({
	getStorage: function(element) {
		if (!(element = $(element))) return;

		var uid;
		if (element === window) {
			uid = 0;
		} else {
			if (typeof element._prototypeUID === "undefined")
				element._prototypeUID = [Element.Storage.UID++];
			uid = element._prototypeUID[0];
		}

		if (!Element.Storage[uid])
			Element.Storage[uid] = $H();

		return Element.Storage[uid];
	},

	store: function(element, key, value) {
		if (!(element = $(element))) return;

		if (arguments.length === 2) {
			Element.getStorage(element).update(key);
		} else {
			Element.getStorage(element).set(key, value);
		}

		return element;
	},

	retrieve: function(element, key, defaultValue) {
		if (!(element = $(element))) return;
		var hash = Element.getStorage(element), value = hash.get(key);

		if (Object.isUndefined(value)) {
			hash.set(key, defaultValue);
			value = defaultValue;
		}

		return value;
	},

	clone: function(element, deep) {
		if (!(element = $(element))) return;
		var clone = element.cloneNode(deep);
		clone._prototypeUID = void 0;
		if (deep) {
			var descendants = Element.select(clone, '*'),
          i = descendants.length;
			while (i--) {
				descendants[i]._prototypeUID = void 0;
			}
		}
		return Element.extend(clone);
	}
});
/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
* license.  Please see http://www.yui-ext.com/ for more information. */

var Selector = Class.create({
	initialize: function(expression) {
		this.expression = expression.strip();

		if (this.shouldUseSelectorsAPI()) {
			this.mode = 'selectorsAPI';
		} else if (this.shouldUseXPath()) {
			this.mode = 'xpath';
			this.compileXPathMatcher();
		} else {
			this.mode = "normal";
			this.compileMatcher();
		}

	},

	shouldUseXPath: (function() {

		var IS_DESCENDANT_SELECTOR_BUGGY = (function() {
			var isBuggy = false;
			if (document.evaluate && window.XPathResult) {
				var el = document.createElement('div');
				el.innerHTML = '<ul><li></li></ul><div><ul><li></li></ul></div>';

				var xpath = ".//*[local-name()='ul' or local-name()='UL']" +
          "//*[local-name()='li' or local-name()='LI']";

				var result = document.evaluate(xpath, el, null,
          XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

				isBuggy = (result.snapshotLength !== 2);
				el = null;
			}
			return isBuggy;
		})();

		return function() {
			if (!Prototype.BrowserFeatures.XPath) return false;

			var e = this.expression;

			if (Prototype.Browser.WebKit &&
       (e.include("-of-type") || e.include(":empty")))
				return false;

			if ((/(\[[\w-]*?:|:checked)/).test(e))
				return false;

			if (IS_DESCENDANT_SELECTOR_BUGGY) return false;

			return true;
		}

	})(),

	shouldUseSelectorsAPI: function() {
		if (!Prototype.BrowserFeatures.SelectorsAPI) return false;

		if (Selector.CASE_INSENSITIVE_CLASS_NAMES) return false;

		if (!Selector._div) Selector._div = new Element('div');

		try {
			Selector._div.querySelector(this.expression);
		} catch (e) {
			return false;
		}

		return true;
	},

	compileMatcher: function() {
		var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
        c = Selector.criteria, le, p, m, len = ps.length, name;

		if (Selector._cache[e]) {
			this.matcher = Selector._cache[e];
			return;
		}

		this.matcher = ["this.matcher = function(root) {",
                    "var r = root, h = Selector.handlers, c = false, n;"];

		while (e && le != e && (/\S/).test(e)) {
			le = e;
			for (var i = 0; i < len; i++) {
				p = ps[i].re;
				name = ps[i].name;
				if (m = e.match(p)) {
					this.matcher.push(Object.isFunction(c[name]) ? c[name](m) :
            new Template(c[name]).evaluate(m));
					e = e.replace(m[0], '');
					break;
				}
			}
		}

		this.matcher.push("return h.unique(n);\n}");
		eval(this.matcher.join('\n'));
		Selector._cache[this.expression] = this.matcher;
	},

	compileXPathMatcher: function() {
		var e = this.expression, ps = Selector.patterns,
        x = Selector.xpath, le, m, len = ps.length, name;

		if (Selector._cache[e]) {
			this.xpath = Selector._cache[e]; return;
		}

		this.matcher = ['.//*'];
		while (e && le != e && (/\S/).test(e)) {
			le = e;
			for (var i = 0; i < len; i++) {
				name = ps[i].name;
				if (m = e.match(ps[i].re)) {
					this.matcher.push(Object.isFunction(x[name]) ? x[name](m) :
            new Template(x[name]).evaluate(m));
					e = e.replace(m[0], '');
					break;
				}
			}
		}

		this.xpath = this.matcher.join('');
		Selector._cache[this.expression] = this.xpath;
	},

	findElements: function(root) {
		root = root || document;
		var e = this.expression, results;

		switch (this.mode) {
			case 'selectorsAPI':
				if (root !== document) {
					var oldId = root.id, id = $(root).identify();
					id = id.replace(/([\.:])/g, "\\$1");
					e = "#" + id + " " + e;
				}

				results = $A(root.querySelectorAll(e)).map(Element.extend);
				root.id = oldId;

				return results;
			case 'xpath':
				return document._getElementsByXPath(this.xpath, root);
			default:
				return this.matcher(root);
		}
	},

	match: function(element) {
		this.tokens = [];

		var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
		var le, p, m, len = ps.length, name;

		while (e && le !== e && (/\S/).test(e)) {
			le = e;
			for (var i = 0; i < len; i++) {
				p = ps[i].re;
				name = ps[i].name;
				if (m = e.match(p)) {
					if (as[name]) {
						this.tokens.push([name, Object.clone(m)]);
						e = e.replace(m[0], '');
					} else {
						return this.findElements(document).include(element);
					}
				}
			}
		}

		var match = true, name, matches;
		for (var i = 0, token; token = this.tokens[i]; i++) {
			name = token[0], matches = token[1];
			if (!Selector.assertions[name](element, matches)) {
				match = false; break;
			}
		}

		return match;
	},

	toString: function() {
		return this.expression;
	},

	inspect: function() {
		return "#<Selector:" + this.expression.inspect() + ">";
	}
});

if (Prototype.BrowserFeatures.SelectorsAPI &&
 document.compatMode === 'BackCompat') {
	Selector.CASE_INSENSITIVE_CLASS_NAMES = (function() {
		var div = document.createElement('div'),
     span = document.createElement('span');

		div.id = "prototype_test_id";
		span.className = 'Test';
		div.appendChild(span);
		var isIgnored = (div.querySelector('#prototype_test_id .test') !== null);
		div = span = null;
		return isIgnored;
	})();
}

Object.extend(Selector, {
	_cache: {},

	xpath: {
		descendant: "//*",
		child: "/*",
		adjacent: "/following-sibling::*[1]",
		laterSibling: '/following-sibling::*',
		tagName: function(m) {
			if (m[1] == '*') return '';
			return "[local-name()='" + m[1].toLowerCase() +
             "' or local-name()='" + m[1].toUpperCase() + "']";
		},
		className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
		id: "[@id='#{1}']",
		attrPresence: function(m) {
			m[1] = m[1].toLowerCase();
			return new Template("[@#{1}]").evaluate(m);
		},
		attr: function(m) {
			m[1] = m[1].toLowerCase();
			m[3] = m[5] || m[6];
			return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
		},
		pseudo: function(m) {
			var h = Selector.xpath.pseudos[m[1]];
			if (!h) return '';
			if (Object.isFunction(h)) return h(m);
			return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
		},
		operators: {
			'=': "[@#{1}='#{3}']",
			'!=': "[@#{1}!='#{3}']",
			'^=': "[starts-with(@#{1}, '#{3}')]",
			'$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
			'*=': "[contains(@#{1}, '#{3}')]",
			'~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
			'|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
		},
		pseudos: {
			'first-child': '[not(preceding-sibling::*)]',
			'last-child': '[not(following-sibling::*)]',
			'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
			'empty': "[count(*) = 0 and (count(text()) = 0)]",
			'checked': "[@checked]",
			'disabled': "[(@disabled) and (@type!='hidden')]",
			'enabled': "[not(@disabled) and (@type!='hidden')]",
			'not': function(m) {
				var e = m[6], p = Selector.patterns,
            x = Selector.xpath, le, v, len = p.length, name;

				var exclusion = [];
				while (e && le != e && (/\S/).test(e)) {
					le = e;
					for (var i = 0; i < len; i++) {
						name = p[i].name
						if (m = e.match(p[i].re)) {
							v = Object.isFunction(x[name]) ? x[name](m) : new Template(x[name]).evaluate(m);
							exclusion.push("(" + v.substring(1, v.length - 1) + ")");
							e = e.replace(m[0], '');
							break;
						}
					}
				}
				return "[not(" + exclusion.join(" and ") + ")]";
			},
			'nth-child': function(m) {
				return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
			},
			'nth-last-child': function(m) {
				return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
			},
			'nth-of-type': function(m) {
				return Selector.xpath.pseudos.nth("position() ", m);
			},
			'nth-last-of-type': function(m) {
				return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
			},
			'first-of-type': function(m) {
				m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
			},
			'last-of-type': function(m) {
				m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
			},
			'only-of-type': function(m) {
				var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
			},
			nth: function(fragment, m) {
				var mm, formula = m[6], predicate;
				if (formula == 'even') formula = '2n+0';
				if (formula == 'odd') formula = '2n+1';
				if (mm = formula.match(/^(\d+)$/)) // digit only
					return '[' + fragment + "= " + mm[1] + ']';
				if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
					if (mm[1] == "-") mm[1] = -1;
					var a = mm[1] ? Number(mm[1]) : 1;
					var b = mm[2] ? Number(mm[2]) : 0;
					predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
          "((#{fragment} - #{b}) div #{a} >= 0)]";
					return new Template(predicate).evaluate({
						fragment: fragment, a: a, b: b
					});
				}
			}
		}
	},

	criteria: {
		tagName: 'n = h.tagName(n, r, "#{1}", c);      c = false;',
		className: 'n = h.className(n, r, "#{1}", c);    c = false;',
		id: 'n = h.id(n, r, "#{1}", c);           c = false;',
		attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
		attr: function(m) {
			m[3] = (m[5] || m[6]);
			return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
		},
		pseudo: function(m) {
			if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
			return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
		},
		descendant: 'c = "descendant";',
		child: 'c = "child";',
		adjacent: 'c = "adjacent";',
		laterSibling: 'c = "laterSibling";'
	},

	patterns: [
    { name: 'laterSibling', re: /^\s*~\s*/ },
    { name: 'child', re: /^\s*>\s*/ },
    { name: 'adjacent', re: /^\s*\+\s*/ },
    { name: 'descendant', re: /^\s/ },

    { name: 'tagName', re: /^\s*(\*|[\w\-]+)(\b|$)?/ },
    { name: 'id', re: /^#([\w\-\*]+)(\b|$)/ },
    { name: 'className', re: /^\.([\w\-\*]+)(\b|$)/ },
    { name: 'pseudo', re: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/ },
    { name: 'attrPresence', re: /^\[((?:[\w-]+:)?[\w-]+)\]/ },
    { name: 'attr', re: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }
  ],

	assertions: {
		tagName: function(element, matches) {
			return matches[1].toUpperCase() == element.tagName.toUpperCase();
		},

		className: function(element, matches) {
			return Element.hasClassName(element, matches[1]);
		},

		id: function(element, matches) {
			return element.id === matches[1];
		},

		attrPresence: function(element, matches) {
			return Element.hasAttribute(element, matches[1]);
		},

		attr: function(element, matches) {
			var nodeValue = Element.readAttribute(element, matches[1]);
			return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
		}
	},

	handlers: {
		concat: function(a, b) {
			for (var i = 0, node; node = b[i]; i++)
				a.push(node);
			return a;
		},

		mark: function(nodes) {
			var _true = Prototype.emptyFunction;
			for (var i = 0, node; node = nodes[i]; i++)
				node._countedByPrototype = _true;
			return nodes;
		},

		unmark: (function() {

			var PROPERTIES_ATTRIBUTES_MAP = (function() {
				var el = document.createElement('div'),
            isBuggy = false,
            propName = '_countedByPrototype',
            value = 'x'
				el[propName] = value;
				isBuggy = (el.getAttribute(propName) === value);
				el = null;
				return isBuggy;
			})();

			return PROPERTIES_ATTRIBUTES_MAP ?
        function(nodes) {
        	for (var i = 0, node; node = nodes[i]; i++)
        		node.removeAttribute('_countedByPrototype');
        	return nodes;
        } :
        function(nodes) {
        	for (var i = 0, node; node = nodes[i]; i++)
        		node._countedByPrototype = void 0;
        	return nodes;
        }
		})(),

		index: function(parentNode, reverse, ofType) {
			parentNode._countedByPrototype = Prototype.emptyFunction;
			if (reverse) {
				for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
					var node = nodes[i];
					if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
				}
			} else {
				for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
					if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
			}
		},

		unique: function(nodes) {
			if (nodes.length == 0) return nodes;
			var results = [], n;
			for (var i = 0, l = nodes.length; i < l; i++)
				if (typeof (n = nodes[i])._countedByPrototype == 'undefined') {
				n._countedByPrototype = Prototype.emptyFunction;
				results.push(Element.extend(n));
			}
			return Selector.handlers.unmark(results);
		},

		descendant: function(nodes) {
			var h = Selector.handlers;
			for (var i = 0, results = [], node; node = nodes[i]; i++)
				h.concat(results, node.getElementsByTagName('*'));
			return results;
		},

		child: function(nodes) {
			var h = Selector.handlers;
			for (var i = 0, results = [], node; node = nodes[i]; i++) {
				for (var j = 0, child; child = node.childNodes[j]; j++)
					if (child.nodeType == 1 && child.tagName != '!') results.push(child);
			}
			return results;
		},

		adjacent: function(nodes) {
			for (var i = 0, results = [], node; node = nodes[i]; i++) {
				var next = this.nextElementSibling(node);
				if (next) results.push(next);
			}
			return results;
		},

		laterSibling: function(nodes) {
			var h = Selector.handlers;
			for (var i = 0, results = [], node; node = nodes[i]; i++)
				h.concat(results, Element.nextSiblings(node));
			return results;
		},

		nextElementSibling: function(node) {
			while (node = node.nextSibling)
				if (node.nodeType == 1) return node;
			return null;
		},

		previousElementSibling: function(node) {
			while (node = node.previousSibling)
				if (node.nodeType == 1) return node;
			return null;
		},

		tagName: function(nodes, root, tagName, combinator) {
			var uTagName = tagName.toUpperCase();
			var results = [], h = Selector.handlers;
			if (nodes) {
				if (combinator) {
					if (combinator == "descendant") {
						for (var i = 0, node; node = nodes[i]; i++)
							h.concat(results, node.getElementsByTagName(tagName));
						return results;
					} else nodes = this[combinator](nodes);
					if (tagName == "*") return nodes;
				}
				for (var i = 0, node; node = nodes[i]; i++)
					if (node.tagName.toUpperCase() === uTagName) results.push(node);
				return results;
			} else return root.getElementsByTagName(tagName);
		},

		id: function(nodes, root, id, combinator) {
			var targetNode = $(id), h = Selector.handlers;

			if (root == document) {
				if (!targetNode) return [];
				if (!nodes) return [targetNode];
			} else {
				if (!root.sourceIndex || root.sourceIndex < 1) {
					var nodes = root.getElementsByTagName('*');
					for (var j = 0, node; node = nodes[j]; j++) {
						if (node.id === id) return [node];
					}
				}
			}

			if (nodes) {
				if (combinator) {
					if (combinator == 'child') {
						for (var i = 0, node; node = nodes[i]; i++)
							if (targetNode.parentNode == node) return [targetNode];
					} else if (combinator == 'descendant') {
						for (var i = 0, node; node = nodes[i]; i++)
							if (Element.descendantOf(targetNode, node)) return [targetNode];
					} else if (combinator == 'adjacent') {
						for (var i = 0, node; node = nodes[i]; i++)
							if (Selector.handlers.previousElementSibling(targetNode) == node)
							return [targetNode];
					} else nodes = h[combinator](nodes);
				}
				for (var i = 0, node; node = nodes[i]; i++)
					if (node == targetNode) return [targetNode];
				return [];
			}
			return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
		},

		className: function(nodes, root, className, combinator) {
			if (nodes && combinator) nodes = this[combinator](nodes);
			return Selector.handlers.byClassName(nodes, root, className);
		},

		byClassName: function(nodes, root, className) {
			if (!nodes) nodes = Selector.handlers.descendant([root]);
			var needle = ' ' + className + ' ';
			for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
				nodeClassName = node.className;
				if (nodeClassName.length == 0) continue;
				if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
					results.push(node);
			}
			return results;
		},

		attrPresence: function(nodes, root, attr, combinator) {
			if (!nodes) nodes = root.getElementsByTagName("*");
			if (nodes && combinator) nodes = this[combinator](nodes);
			var results = [];
			for (var i = 0, node; node = nodes[i]; i++)
				if (Element.hasAttribute(node, attr)) results.push(node);
			return results;
		},

		attr: function(nodes, root, attr, value, operator, combinator) {
			if (!nodes) nodes = root.getElementsByTagName("*");
			if (nodes && combinator) nodes = this[combinator](nodes);
			var handler = Selector.operators[operator], results = [];
			for (var i = 0, node; node = nodes[i]; i++) {
				var nodeValue = Element.readAttribute(node, attr);
				if (nodeValue === null) continue;
				if (handler(nodeValue, value)) results.push(node);
			}
			return results;
		},

		pseudo: function(nodes, name, value, root, combinator) {
			if (nodes && combinator) nodes = this[combinator](nodes);
			if (!nodes) nodes = root.getElementsByTagName("*");
			return Selector.pseudos[name](nodes, value, root);
		}
	},

	pseudos: {
		'first-child': function(nodes, value, root) {
			for (var i = 0, results = [], node; node = nodes[i]; i++) {
				if (Selector.handlers.previousElementSibling(node)) continue;
				results.push(node);
			}
			return results;
		},
		'last-child': function(nodes, value, root) {
			for (var i = 0, results = [], node; node = nodes[i]; i++) {
				if (Selector.handlers.nextElementSibling(node)) continue;
				results.push(node);
			}
			return results;
		},
		'only-child': function(nodes, value, root) {
			var h = Selector.handlers;
			for (var i = 0, results = [], node; node = nodes[i]; i++)
				if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
				results.push(node);
			return results;
		},
		'nth-child': function(nodes, formula, root) {
			return Selector.pseudos.nth(nodes, formula, root);
		},
		'nth-last-child': function(nodes, formula, root) {
			return Selector.pseudos.nth(nodes, formula, root, true);
		},
		'nth-of-type': function(nodes, formula, root) {
			return Selector.pseudos.nth(nodes, formula, root, false, true);
		},
		'nth-last-of-type': function(nodes, formula, root) {
			return Selector.pseudos.nth(nodes, formula, root, true, true);
		},
		'first-of-type': function(nodes, formula, root) {
			return Selector.pseudos.nth(nodes, "1", root, false, true);
		},
		'last-of-type': function(nodes, formula, root) {
			return Selector.pseudos.nth(nodes, "1", root, true, true);
		},
		'only-of-type': function(nodes, formula, root) {
			var p = Selector.pseudos;
			return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
		},

		getIndices: function(a, b, total) {
			if (a == 0) return b > 0 ? [b] : [];
			return $R(1, total).inject([], function(memo, i) {
				if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
				return memo;
			});
		},

		nth: function(nodes, formula, root, reverse, ofType) {
			if (nodes.length == 0) return [];
			if (formula == 'even') formula = '2n+0';
			if (formula == 'odd') formula = '2n+1';
			var h = Selector.handlers, results = [], indexed = [], m;
			h.mark(nodes);
			for (var i = 0, node; node = nodes[i]; i++) {
				if (!node.parentNode._countedByPrototype) {
					h.index(node.parentNode, reverse, ofType);
					indexed.push(node.parentNode);
				}
			}
			if (formula.match(/^\d+$/)) { // just a number
				formula = Number(formula);
				for (var i = 0, node; node = nodes[i]; i++)
					if (node.nodeIndex == formula) results.push(node);
			} else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
				if (m[1] == "-") m[1] = -1;
				var a = m[1] ? Number(m[1]) : 1;
				var b = m[2] ? Number(m[2]) : 0;
				var indices = Selector.pseudos.getIndices(a, b, nodes.length);
				for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
					for (var j = 0; j < l; j++)
						if (node.nodeIndex == indices[j]) results.push(node);
				}
			}
			h.unmark(nodes);
			h.unmark(indexed);
			return results;
		},

		'empty': function(nodes, value, root) {
			for (var i = 0, results = [], node; node = nodes[i]; i++) {
				if (node.tagName == '!' || node.firstChild) continue;
				results.push(node);
			}
			return results;
		},

		'not': function(nodes, selector, root) {
			var h = Selector.handlers, selectorType, m;
			var exclusions = new Selector(selector).findElements(root);
			h.mark(exclusions);
			for (var i = 0, results = [], node; node = nodes[i]; i++)
				if (!node._countedByPrototype) results.push(node);
			h.unmark(exclusions);
			return results;
		},

		'enabled': function(nodes, value, root) {
			for (var i = 0, results = [], node; node = nodes[i]; i++)
				if (!node.disabled && (!node.type || node.type !== 'hidden'))
				results.push(node);
			return results;
		},

		'disabled': function(nodes, value, root) {
			for (var i = 0, results = [], node; node = nodes[i]; i++)
				if (node.disabled) results.push(node);
			return results;
		},

		'checked': function(nodes, value, root) {
			for (var i = 0, results = [], node; node = nodes[i]; i++)
				if (node.checked) results.push(node);
			return results;
		}
	},

	operators: {
		'=': function(nv, v) { return nv == v; },
		'!=': function(nv, v) { return nv != v; },
		'^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
		'$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
		'*=': function(nv, v) { return nv == v || nv && nv.include(v); },
		'~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
		'|=': function(nv, v) {
			return ('-' + (nv || "").toUpperCase() +
     '-').include('-' + (v || "").toUpperCase() + '-');
		}
	},

	split: function(expression) {
		var expressions = [];
		expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
			expressions.push(m[1].strip());
		});
		return expressions;
	},

	matchElements: function(elements, expression) {
		var matches = $$(expression), h = Selector.handlers;
		h.mark(matches);
		for (var i = 0, results = [], element; element = elements[i]; i++)
			if (element._countedByPrototype) results.push(element);
		h.unmark(matches);
		return results;
	},

	findElement: function(elements, expression, index) {
		if (Object.isNumber(expression)) {
			index = expression; expression = false;
		}
		return Selector.matchElements(elements, expression || '*')[index || 0];
	},

	findChildElements: function(element, expressions) {
		expressions = Selector.split(expressions.join(','));
		var results = [], h = Selector.handlers;
		for (var i = 0, l = expressions.length, selector; i < l; i++) {
			selector = new Selector(expressions[i].strip());
			h.concat(results, selector.findElements(element));
		}
		return (l > 1) ? h.unique(results) : results;
	}
});

if (Prototype.Browser.IE) {
	Object.extend(Selector.handlers, {
		concat: function(a, b) {
			for (var i = 0, node; node = b[i]; i++)
				if (node.tagName !== "!") a.push(node);
			return a;
		}
	});
}

function $$() {
	return Selector.findChildElements(document, $A(arguments));
}

var Form = {
	reset: function(form) {
		form = $(form);
		form.reset();
		return form;
	},

	serializeElements: function(elements, options) {
		if (typeof options != 'object') options = { hash: !!options };
		else if (Object.isUndefined(options.hash)) options.hash = true;
		var key, value, submitted = false, submit = options.submit;

		var data = elements.inject({}, function(result, element) {
			if (!element.disabled && element.name) {
				key = element.name; value = $(element).getValue();
				if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
            submit !== false && (!submit || key == submit) && (submitted = true)))) {
					if (key in result) {
						if (!Object.isArray(result[key])) result[key] = [result[key]];
						result[key].push(value);
					}
					else result[key] = value;
				}
			}
			return result;
		});

		return options.hash ? data : Object.toQueryString(data);
	}
};

Form.Methods = {
	serialize: function(form, options) {
		return Form.serializeElements(Form.getElements(form), options);
	},

	getElements: function(form) {
		var elements = $(form).getElementsByTagName('*'),
        element,
        arr = [],
        serializers = Form.Element.Serializers;
		for (var i = 0; element = elements[i]; i++) {
			arr.push(element);
		}
		return arr.inject([], function(elements, child) {
			if (serializers[child.tagName.toLowerCase()])
				elements.push(Element.extend(child));
			return elements;
		})
	},

	getInputs: function(form, typeName, name) {
		form = $(form);
		var inputs = form.getElementsByTagName('input');

		if (!typeName && !name) return $A(inputs).map(Element.extend);

		for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
			var input = inputs[i];
			if ((typeName && input.type != typeName) || (name && input.name != name))
				continue;
			matchingInputs.push(Element.extend(input));
		}

		return matchingInputs;
	},

	disable: function(form) {
		form = $(form);
		Form.getElements(form).invoke('disable');
		return form;
	},

	enable: function(form) {
		form = $(form);
		Form.getElements(form).invoke('enable');
		return form;
	},

	findFirstElement: function(form) {
		var elements = $(form).getElements().findAll(function(element) {
			return 'hidden' != element.type && !element.disabled;
		});
		var firstByIndex = elements.findAll(function(element) {
			return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
		}).sortBy(function(element) { return element.tabIndex }).first();

		return firstByIndex ? firstByIndex : elements.find(function(element) {
			return /^(?:input|select|textarea)$/i.test(element.tagName);
		});
	},

	focusFirstElement: function(form) {
		form = $(form);
		form.findFirstElement().activate();
		return form;
	},

	request: function(form, options) {
		form = $(form), options = Object.clone(options || {});

		var params = options.parameters, action = form.readAttribute('action') || '';
		if (action.blank()) action = window.location.href;
		options.parameters = form.serialize(true);

		if (params) {
			if (Object.isString(params)) params = params.toQueryParams();
			Object.extend(options.parameters, params);
		}

		if (form.hasAttribute('method') && !options.method)
			options.method = form.method;

		return new Ajax.Request(action, options);
	}
};

/*--------------------------------------------------------------------------*/


Form.Element = {
	focus: function(element) {
		$(element).focus();
		return element;
	},

	select: function(element) {
		$(element).select();
		return element;
	}
};

Form.Element.Methods = {

	serialize: function(element) {
		element = $(element);
		if (!element.disabled && element.name) {
			var value = element.getValue();
			if (value != undefined) {
				var pair = {};
				pair[element.name] = value;
				return Object.toQueryString(pair);
			}
		}
		return '';
	},

	getValue: function(element) {
		element = $(element);
		var method = element.tagName.toLowerCase();
		return Form.Element.Serializers[method](element);
	},

	setValue: function(element, value) {
		element = $(element);
		var method = element.tagName.toLowerCase();
		Form.Element.Serializers[method](element, value);
		return element;
	},

	clear: function(element) {
		$(element).value = '';
		return element;
	},

	present: function(element) {
		return $(element).value != '';
	},

	activate: function(element) {
		element = $(element);
		try {
			element.focus();
			if (element.select && (element.tagName.toLowerCase() != 'input' ||
          !(/^(?:button|reset|submit)$/i.test(element.type))))
				element.select();
		} catch (e) { }
		return element;
	},

	disable: function(element) {
		element = $(element);
		element.disabled = true;
		return element;
	},

	enable: function(element) {
		element = $(element);
		element.disabled = false;
		return element;
	}
};

/*--------------------------------------------------------------------------*/

var Field = Form.Element;

var $F = Form.Element.Methods.getValue;

/*--------------------------------------------------------------------------*/

Form.Element.Serializers = {
	input: function(element, value) {
		switch (element.type.toLowerCase()) {
			case 'checkbox':
			case 'radio':
				return Form.Element.Serializers.inputSelector(element, value);
			default:
				return Form.Element.Serializers.textarea(element, value);
		}
	},

	inputSelector: function(element, value) {
		if (Object.isUndefined(value)) return element.checked ? element.value : null;
		else element.checked = !!value;
	},

	textarea: function(element, value) {
		if (Object.isUndefined(value)) return element.value;
		else element.value = value;
	},

	select: function(element, value) {
		if (Object.isUndefined(value))
			return this[element.type == 'select-one' ?
        'selectOne' : 'selectMany'](element);
		else {
			var opt, currentValue, single = !Object.isArray(value);
			for (var i = 0, length = element.length; i < length; i++) {
				opt = element.options[i];
				currentValue = this.optionValue(opt);
				if (single) {
					if (currentValue == value) {
						opt.selected = true;
						return;
					}
				}
				else opt.selected = value.include(currentValue);
			}
		}
	},

	selectOne: function(element) {
		var index = element.selectedIndex;
		return index >= 0 ? this.optionValue(element.options[index]) : null;
	},

	selectMany: function(element) {
		var values, length = element.length;
		if (!length) return null;

		for (var i = 0, values = []; i < length; i++) {
			var opt = element.options[i];
			if (opt.selected) values.push(this.optionValue(opt));
		}
		return values;
	},

	optionValue: function(opt) {
		return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
	}
};

/*--------------------------------------------------------------------------*/


Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
	initialize: function($super, element, frequency, callback) {
		$super(callback, frequency);
		this.element = $(element);
		this.lastValue = this.getValue();
	},

	execute: function() {
		var value = this.getValue();
		if (Object.isString(this.lastValue) && Object.isString(value) ?
        this.lastValue != value : String(this.lastValue) != String(value)) {
			this.callback(this.element, value);
			this.lastValue = value;
		}
	}
});

Form.Element.Observer = Class.create(Abstract.TimedObserver, {
	getValue: function() {
		return Form.Element.getValue(this.element);
	}
});

Form.Observer = Class.create(Abstract.TimedObserver, {
	getValue: function() {
		return Form.serialize(this.element);
	}
});

/*--------------------------------------------------------------------------*/

Abstract.EventObserver = Class.create({
	initialize: function(element, callback) {
		this.element = $(element);
		this.callback = callback;

		this.lastValue = this.getValue();
		if (this.element.tagName.toLowerCase() == 'form')
			this.registerFormCallbacks();
		else
			this.registerCallback(this.element);
	},

	onElementEvent: function() {
		var value = this.getValue();
		if (this.lastValue != value) {
			this.callback(this.element, value);
			this.lastValue = value;
		}
	},

	registerFormCallbacks: function() {
		Form.getElements(this.element).each(this.registerCallback, this);
	},

	registerCallback: function(element) {
		if (element.type) {
			switch (element.type.toLowerCase()) {
				case 'checkbox':
				case 'radio':
					Event.observe(element, 'click', this.onElementEvent.bind(this));
					break;
				default:
					Event.observe(element, 'change', this.onElementEvent.bind(this));
					break;
			}
		}
	}
});

Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
	getValue: function() {
		return Form.Element.getValue(this.element);
	}
});

Form.EventObserver = Class.create(Abstract.EventObserver, {
	getValue: function() {
		return Form.serialize(this.element);
	}
});
(function() {

	var Event = {
		KEY_BACKSPACE: 8,
		KEY_TAB: 9,
		KEY_RETURN: 13,
		KEY_ESC: 27,
		KEY_LEFT: 37,
		KEY_UP: 38,
		KEY_RIGHT: 39,
		KEY_DOWN: 40,
		KEY_DELETE: 46,
		KEY_HOME: 36,
		KEY_END: 35,
		KEY_PAGEUP: 33,
		KEY_PAGEDOWN: 34,
		KEY_INSERT: 45,

		cache: {}
	};

	var docEl = document.documentElement;
	var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
    && 'onmouseleave' in docEl;

	var _isButton;
	if (Prototype.Browser.IE) {
		var buttonMap = { 0: 1, 1: 4, 2: 2 };
		_isButton = function(event, code) {
			return event.button === buttonMap[code];
		};
	} else if (Prototype.Browser.WebKit) {
		_isButton = function(event, code) {
			switch (code) {
				case 0: return event.which == 1 && !event.metaKey;
				case 1: return event.which == 1 && event.metaKey;
				default: return false;
			}
		};
	} else {
		_isButton = function(event, code) {
			return event.which ? (event.which === code + 1) : (event.button === code);
		};
	}

	function isLeftClick(event) { return _isButton(event, 0) }

	function isMiddleClick(event) { return _isButton(event, 1) }

	function isRightClick(event) { return _isButton(event, 2) }

	function element(event) {
		event = Event.extend(event);

		var node = event.target, type = event.type,
     currentTarget = event.currentTarget;

		if (currentTarget && currentTarget.tagName) {
			if (type === 'load' || type === 'error' ||
        (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
          && currentTarget.type === 'radio'))
				node = currentTarget;
		}

		if (node.nodeType == Node.TEXT_NODE)
			node = node.parentNode;

		return Element.extend(node);
	}

	function findElement(event, expression) {
		var element = Event.element(event);
		if (!expression) return element;
		var elements = [element].concat(element.ancestors());
		return Selector.findElement(elements, expression, 0);
	}

	function pointer(event) {
		return { x: pointerX(event), y: pointerY(event) };
	}

	function pointerX(event) {
		var docElement = document.documentElement,
     body = document.body || { scrollLeft: 0 };

		return event.pageX || (event.clientX +
      (docElement.scrollLeft || body.scrollLeft) -
      (docElement.clientLeft || 0));
	}

	function pointerY(event) {
		var docElement = document.documentElement,
     body = document.body || { scrollTop: 0 };

		return event.pageY || (event.clientY +
       (docElement.scrollTop || body.scrollTop) -
       (docElement.clientTop || 0));
	}


	function stop(event) {
		Event.extend(event);
		event.preventDefault();
		event.stopPropagation();

		event.stopped = true;
	}

	Event.Methods = {
		isLeftClick: isLeftClick,
		isMiddleClick: isMiddleClick,
		isRightClick: isRightClick,

		element: element,
		findElement: findElement,

		pointer: pointer,
		pointerX: pointerX,
		pointerY: pointerY,

		stop: stop
	};


	var methods = Object.keys(Event.Methods).inject({}, function(m, name) {
		m[name] = Event.Methods[name].methodize();
		return m;
	});

	if (Prototype.Browser.IE) {
		function _relatedTarget(event) {
			var element;
			switch (event.type) {
				case 'mouseover': element = event.fromElement; break;
				case 'mouseout': element = event.toElement; break;
				default: return null;
			}
			return Element.extend(element);
		}

		Object.extend(methods, {
			stopPropagation: function() { this.cancelBubble = true },
			preventDefault: function() { this.returnValue = false },
			inspect: function() { return '[object Event]' }
		});

		Event.extend = function(event, element) {
			if (!event) return false;
			if (event._extendedByPrototype) return event;

			event._extendedByPrototype = Prototype.emptyFunction;
			var pointer = Event.pointer(event);

			Object.extend(event, {
				target: event.srcElement || element,
				relatedTarget: _relatedTarget(event),
				pageX: pointer.x,
				pageY: pointer.y
			});

			return Object.extend(event, methods);
		};
	} else {
		Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__;
		Object.extend(Event.prototype, methods);
		Event.extend = Prototype.K;
	}

	function _createResponder(element, eventName, handler) {
		var registry = Element.retrieve(element, 'prototype_event_registry');

		if (Object.isUndefined(registry)) {
			CACHE.push(element);
			registry = Element.retrieve(element, 'prototype_event_registry', $H());
		}

		var respondersForEvent = registry.get(eventName);
		if (Object.isUndefined(respondersForEvent)) {
			respondersForEvent = [];
			registry.set(eventName, respondersForEvent);
		}

		if (respondersForEvent.pluck('handler').include(handler)) return false;

		var responder;
		if (eventName.include(":")) {
			responder = function(event) {
				if (Object.isUndefined(event.eventName))
					return false;

				if (event.eventName !== eventName)
					return false;

				Event.extend(event, element);
				handler.call(element, event);
			};
		} else {
			if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &&
       (eventName === "mouseenter" || eventName === "mouseleave")) {
				if (eventName === "mouseenter" || eventName === "mouseleave") {
					responder = function(event) {
						Event.extend(event, element);

						var parent = event.relatedTarget;
						while (parent && parent !== element) {
							try { parent = parent.parentNode; }
							catch (e) { parent = element; }
						}

						if (parent === element) return;

						handler.call(element, event);
					};
				}
			} else {
				responder = function(event) {
					Event.extend(event, element);
					handler.call(element, event);
				};
			}
		}

		responder.handler = handler;
		respondersForEvent.push(responder);
		return responder;
	}

	function _destroyCache() {
		for (var i = 0, length = CACHE.length; i < length; i++) {
			Event.stopObserving(CACHE[i]);
			CACHE[i] = null;
		}
	}

	var CACHE = [];

	if (Prototype.Browser.IE)
		window.attachEvent('onunload', _destroyCache);

	if (Prototype.Browser.WebKit)
		window.addEventListener('unload', Prototype.emptyFunction, false);


	var _getDOMEventName = Prototype.K;

	if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
		_getDOMEventName = function(eventName) {
			var translations = { mouseenter: "mouseover", mouseleave: "mouseout" };
			return eventName in translations ? translations[eventName] : eventName;
		};
	}

	function observe(element, eventName, handler) {
		element = $(element);

		var responder = _createResponder(element, eventName, handler);

		if (!responder) return element;

		if (eventName.include(':')) {
			if (element.addEventListener)
				element.addEventListener("dataavailable", responder, false);
			else {
				element.attachEvent("ondataavailable", responder);
				element.attachEvent("onfilterchange", responder);
			}
		} else {
			var actualEventName = _getDOMEventName(eventName);

			if (element.addEventListener)
				element.addEventListener(actualEventName, responder, false);
			else
				element.attachEvent("on" + actualEventName, responder);
		}

		return element;
	}

	function stopObserving(element, eventName, handler) {
		element = $(element);

		var registry = Element.retrieve(element, 'prototype_event_registry');

		if (Object.isUndefined(registry)) return element;

		if (eventName && !handler) {
			var responders = registry.get(eventName);

			if (Object.isUndefined(responders)) return element;

			responders.each(function(r) {
				Element.stopObserving(element, eventName, r.handler);
			});
			return element;
		} else if (!eventName) {
			registry.each(function(pair) {
				var eventName = pair.key, responders = pair.value;

				responders.each(function(r) {
					Element.stopObserving(element, eventName, r.handler);
				});
			});
			return element;
		}

		var responders = registry.get(eventName);

		if (!responders) return;

		var responder = responders.find(function(r) { return r.handler === handler; });
		if (!responder) return element;

		var actualEventName = _getDOMEventName(eventName);

		if (eventName.include(':')) {
			if (element.removeEventListener)
				element.removeEventListener("dataavailable", responder, false);
			else {
				element.detachEvent("ondataavailable", responder);
				element.detachEvent("onfilterchange", responder);
			}
		} else {
			if (element.removeEventListener)
				element.removeEventListener(actualEventName, responder, false);
			else
				element.detachEvent('on' + actualEventName, responder);
		}

		registry.set(eventName, responders.without(responder));

		return element;
	}

	function fire(element, eventName, memo, bubble) {
		element = $(element);

		if (Object.isUndefined(bubble))
			bubble = true;

		if (element == document && document.createEvent && !element.dispatchEvent)
			element = document.documentElement;

		var event;
		if (document.createEvent) {
			event = document.createEvent('HTMLEvents');
			event.initEvent('dataavailable', true, true);
		} else {
			event = document.createEventObject();
			event.eventType = bubble ? 'ondataavailable' : 'onfilterchange';
		}

		event.eventName = eventName;
		event.memo = memo || {};

		if (document.createEvent)
			element.dispatchEvent(event);
		else
			element.fireEvent(event.eventType, event);

		return Event.extend(event);
	}


	Object.extend(Event, Event.Methods);

	Object.extend(Event, {
		fire: fire,
		observe: observe,
		stopObserving: stopObserving
	});

	Element.addMethods({
		fire: fire,

		observe: observe,

		stopObserving: stopObserving
	});

	Object.extend(document, {
		fire: fire.methodize(),

		observe: observe.methodize(),

		stopObserving: stopObserving.methodize(),

		loaded: false
	});

	if (window.Event) Object.extend(window.Event, Event);
	else window.Event = Event;
})();

(function() {
	/* Support for the DOMContentLoaded event is based on work by Dan Webb,
	Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */

	var timer;

	function fireContentLoadedEvent() {
		if (document.loaded) return;
		if (timer) window.clearTimeout(timer);
		document.loaded = true;
		document.fire('dom:loaded');
	}

	function checkReadyState() {
		if (document.readyState === 'complete') {
			document.stopObserving('readystatechange', checkReadyState);
			fireContentLoadedEvent();
		}
	}

	function pollDoScroll() {
		try { document.documentElement.doScroll('left'); }
		catch (e) {
			timer = pollDoScroll.defer();
			return;
		}
		fireContentLoadedEvent();
	}

	if (document.addEventListener) {
		document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
	} else {
		document.observe('readystatechange', checkReadyState);
		if (window == top)
			timer = pollDoScroll.defer();
	}

	Event.observe(window, 'load', fireContentLoadedEvent);
})();

Element.addMethods();

/*------------------------------- DEPRECATED -------------------------------*/

Hash.toQueryString = Object.toQueryString;

var Toggle = { display: Element.toggle };

Element.Methods.childOf = Element.Methods.descendantOf;

var Insertion = {
	Before: function(element, content) {
		return Element.insert(element, { before: content });
	},

	Top: function(element, content) {
		return Element.insert(element, { top: content });
	},

	Bottom: function(element, content) {
		return Element.insert(element, { bottom: content });
	},

	After: function(element, content) {
		return Element.insert(element, { after: content });
	}
};

var $continue = new Error('"throw $continue" is deprecated, use "return" instead');

var Position = {
	includeScrollOffsets: false,

	prepare: function() {
		this.deltaX = window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
		this.deltaY = window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
	},

	within: function(element, x, y) {
		if (this.includeScrollOffsets)
			return this.withinIncludingScrolloffsets(element, x, y);
		this.xcomp = x;
		this.ycomp = y;
		this.offset = Element.cumulativeOffset(element);

		return (y >= this.offset[1] &&
            y < this.offset[1] + element.offsetHeight &&
            x >= this.offset[0] &&
            x < this.offset[0] + element.offsetWidth);
	},

	withinIncludingScrolloffsets: function(element, x, y) {
		var offsetcache = Element.cumulativeScrollOffset(element);

		this.xcomp = x + offsetcache[0] - this.deltaX;
		this.ycomp = y + offsetcache[1] - this.deltaY;
		this.offset = Element.cumulativeOffset(element);

		return (this.ycomp >= this.offset[1] &&
            this.ycomp < this.offset[1] + element.offsetHeight &&
            this.xcomp >= this.offset[0] &&
            this.xcomp < this.offset[0] + element.offsetWidth);
	},

	overlap: function(mode, element) {
		if (!mode) return 0;
		if (mode == 'vertical')
			return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
        element.offsetHeight;
		if (mode == 'horizontal')
			return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
        element.offsetWidth;
	},


	cumulativeOffset: Element.Methods.cumulativeOffset,

	positionedOffset: Element.Methods.positionedOffset,

	absolutize: function(element) {
		Position.prepare();
		return Element.absolutize(element);
	},

	relativize: function(element) {
		Position.prepare();
		return Element.relativize(element);
	},

	realOffset: Element.Methods.cumulativeScrollOffset,

	offsetParent: Element.Methods.getOffsetParent,

	page: Element.Methods.viewportOffset,

	clone: function(source, target, options) {
		options = options || {};
		return Element.clonePosition(target, source, options);
	}
};

/*--------------------------------------------------------------------------*/

if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods) {
	function iter(name) {
		return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
	}

	instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
  function(element, className) {
  	className = className.toString().strip();
  	var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
  	return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
  } : function(element, className) {
  	className = className.toString().strip();
  	var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
  	if (!classNames && !className) return elements;

  	var nodes = $(element).getElementsByTagName('*');
  	className = ' ' + className + ' ';

  	for (var i = 0, child, cn; child = nodes[i]; i++) {
  		if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
          (classNames && classNames.all(function(name) {
          	return !name.toString().blank() && cn.include(' ' + name + ' ');
          }))))
  			elements.push(Element.extend(child));
  	}
  	return elements;
  };

	return function(className, parentElement) {
		return $(parentElement || document.body).getElementsByClassName(className);
	};
} (Element.Methods);

/*--------------------------------------------------------------------------*/

Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
	initialize: function(element) {
		this.element = $(element);
	},

	_each: function(iterator) {
		this.element.className.split(/\s+/).select(function(name) {
			return name.length > 0;
		})._each(iterator);
	},

	set: function(className) {
		this.element.className = className;
	},

	add: function(classNameToAdd) {
		if (this.include(classNameToAdd)) return;
		this.set($A(this).concat(classNameToAdd).join(' '));
	},

	remove: function(classNameToRemove) {
		if (!this.include(classNameToRemove)) return;
		this.set($A(this).without(classNameToRemove).join(' '));
	},

	toString: function() {
		return $A(this).join(' ');
	}
};

 Object.extend(Element.ClassNames.prototype, Enumerable);

/*--------------------------------------------------------------------------*/


/* File: /includes/js/swfObject.js (Modified: 16. marts 2007 12:13:55) */

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

/* File: /includes/js/swfObject2.js (Modified: 3. september 2010 12:30:56) */

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

/* File: /includes/js/overlibmws/overlibmws.js (Modified: 3. september 2010 12:30:56) */

/*
 Do not remove or change this notice.
 overlibmws.js core module - Copyright Foteos Macrides 2002-2008. All rights reserved.
   Initial: August 18, 2002 - Last Revised: January 16, 2008
 This module is subject to the same terms of usage as for Erik Bosrup's overLIB,
 though only a minority of the code and API now correspond with Erik's version.
 See the overlibmws Change History and Command Reference via:

	http://www.macridesweb.com/oltest/

 Published under an open source license: http://www.macridesweb.com/oltest/license.html
 Give credit on sites that use overlibmws and submit changes so others can use them as well.
 You can get Erik's version via: http://www.bosrup.com/web/overlib/
*/

// PRE-INIT -- Ignore these lines, configuration is below.
var OLloaded=0,OLbubblePI=0,OLcrossframePI=0,OLdebugPI=0,OLdraggablePI=0,OLexclusivePI=0,OLfilterPI=0,
OLfunctionPI=0,OLhidePI=0,OLiframePI=0,OLmodalPI=0,OLovertwoPI=0,OLscrollPI=0,OLshadowPI=0,OLprintPI=0,
pmCnt=1,pMtr=new Array(),OLcmdLine=new Array(),OLrunTime=new Array(),OLv,OLudf,OLrefXY,
OLpct=new Array("83%","67%","83%","100%","117%","150%","200%","267%");if(typeof OLgateOK=='undefined')var OLgateOK=1;
var OLp1or2c='inarray,caparray,caption,closetext,right,left,center,autostatuscap,padx,pady,below,above,vcenter,donothing',
OLp1or2co='nofollow,background,offsetx,offsety,fgcolor,bgcolor,cgcolor,textcolor,capcolor,width,wrap,wrapmax,height,border,'
+'base,status,autostatus,snapx,snapy,fixx,fixy,relx,rely,midx,midy,ref,refc,refp,refx,refy,fgbackground,bgbackground,'
+'cgbackground,fullhtml,capicon,textfont,captionfont,textsize,captionsize,timeout,delay,hauto,vauto,nojustx,nojusty,fgclass,'
+'bgclass,cgclass,capbelow,textpadding,textfontclass,captionpadding,captionfontclass,sticky,noclose,mouseoff,offdelay,'
+'closecolor,closefont,closesize,closeclick,closetitle,closefontclass,decode',OLp1or2o='text,cap,close,hpos,vpos,padxl,'
+'padxr,padyt,padyb',OLp1co='label',OLp1or2=OLp1or2co+','+OLp1or2o,OLp1=OLp1co+','+'frame';
OLregCmds(OLp1or2c+','+OLp1or2co+','+OLp1co);
function OLud(v){return eval('typeof ol_'+v+'=="undefined"')?1:0;}

// DEFAULT CONFIGURATION -- See overlibConfig.txt for descriptions
if(OLud('fgcolor'))var ol_fgcolor="#ccccff";
if(OLud('bgcolor'))var ol_bgcolor="#333399";
if(OLud('cgcolor'))var ol_cgcolor="#333399";
if(OLud('textcolor'))var ol_textcolor="#000000";
if(OLud('capcolor'))var ol_capcolor="#ffffff";
if(OLud('closecolor'))var ol_closecolor="#eeeeff";
if(OLud('textfont'))var ol_textfont="Verdana,Arial,Helvetica";
if(OLud('captionfont'))var ol_captionfont="Verdana,Arial,Helvetica";
if(OLud('closefont'))var ol_closefont="Verdana,Arial,Helvetica";
if(OLud('textsize'))var ol_textsize=1;
if(OLud('captionsize'))var ol_captionsize=1;
if(OLud('closesize'))var ol_closesize=1;
if(OLud('fgclass'))var ol_fgclass="";
if(OLud('bgclass'))var ol_bgclass="";
if(OLud('cgclass'))var ol_cgclass="";
if(OLud('textpadding'))var ol_textpadding=2;
if(OLud('textfontclass'))var ol_textfontclass="";
if(OLud('captionpadding'))var ol_captionpadding=2;
if(OLud('captionfontclass'))var ol_captionfontclass="";
if(OLud('closefontclass'))var ol_closefontclass="";
if(OLud('close'))var ol_close="Close";
if(OLud('closeclick'))var ol_closeclick=0;
if(OLud('closetitle'))var ol_closetitle="Click to Close";
if(OLud('text'))var ol_text="Default Text";
if(OLud('cap'))var ol_cap="";
if(OLud('capbelow'))var ol_capbelow=0;
if(OLud('background'))var ol_background="";
if(OLud('width'))var ol_width=200;
if(OLud('wrap'))var ol_wrap=0;
if(OLud('wrapmax'))var ol_wrapmax=0;
if(OLud('height'))var ol_height= -1;
if(OLud('border'))var ol_border=1;
if(OLud('base'))var ol_base=0;
if(OLud('offsetx'))var ol_offsetx=10;
if(OLud('offsety'))var ol_offsety=10;
if(OLud('sticky'))var ol_sticky=0;
if(OLud('nofollow'))var ol_nofollow=0;
if(OLud('noclose'))var ol_noclose=0;
if(OLud('mouseoff'))var ol_mouseoff=0;
if(OLud('offdelay'))var ol_offdelay=300;
if(OLud('hpos'))var ol_hpos=RIGHT;
if(OLud('vpos'))var ol_vpos=BELOW;
if(OLud('status'))var ol_status="";
if(OLud('autostatus'))var ol_autostatus=0;
if(OLud('snapx'))var ol_snapx=0;
if(OLud('snapy'))var ol_snapy=0;
if(OLud('fixx'))var ol_fixx= -1;
if(OLud('fixy'))var ol_fixy= -1;
if(OLud('relx'))var ol_relx=null;
if(OLud('rely'))var ol_rely=null;
if(OLud('midx'))var ol_midx=null;
if(OLud('midy'))var ol_midy=null;
if(OLud('ref'))var ol_ref="";
if(OLud('refc'))var ol_refc='UL';
if(OLud('refp'))var ol_refp='UL';
if(OLud('refx'))var ol_refx=0;
if(OLud('refy'))var ol_refy=0;
if(OLud('fgbackground'))var ol_fgbackground="";
if(OLud('bgbackground'))var ol_bgbackground="";
if(OLud('cgbackground'))var ol_cgbackground="";
if(OLud('padxl'))var ol_padxl=1;
if(OLud('padxr'))var ol_padxr=1;
if(OLud('padyt'))var ol_padyt=1;
if(OLud('padyb'))var ol_padyb=1;
if(OLud('fullhtml'))var ol_fullhtml=0;
if(OLud('capicon'))var ol_capicon="";
if(OLud('frame'))var ol_frame=self;
if(OLud('timeout'))var ol_timeout=0;
if(OLud('delay'))var ol_delay=0;
if(OLud('hauto'))var ol_hauto=0;
if(OLud('vauto'))var ol_vauto=0;
if(OLud('nojustx'))var ol_nojustx=0;
if(OLud('nojusty'))var ol_nojusty=0;
if(OLud('label'))var ol_label="";
if(OLud('decode'))var ol_decode=0;
// ARRAY CONFIGURATION - See overlibConfig.txt for descriptions.
if(OLud('texts'))var ol_texts=new Array("Text 0","Text 1");
if(OLud('caps'))var ol_caps=new Array("Caption 0","Caption 1");
// END CONFIGURATION -- Don't change anything below, all configuration is above.

// INIT -- Runtime variables.
var o3_text="",o3_cap="",o3_sticky=0,o3_nofollow=0,o3_background="",o3_noclose=0,o3_mouseoff=0,o3_offdelay=300,o3_hpos=RIGHT,
o3_offsetx=10,o3_offsety=10,o3_fgcolor="",o3_bgcolor="",o3_cgcolor="",o3_textcolor="",o3_capcolor="",o3_closecolor="",
o3_width=200,o3_wrap=0,o3_wrapmax=0,o3_height= -1,o3_border=1,o3_base=0,o3_status="",o3_autostatus=0,o3_snapx=0,o3_snapy=0,
o3_fixx= -1,o3_fixy= -1,o3_relx=null,o3_rely=null,o3_midx=null,o3_midy=null,o3_ref="",o3_refc='UL',o3_refp='UL',o3_refx=0,
o3_refy=0,o3_fgbackground="",o3_bgbackground="",o3_cgbackground="",o3_padxl=0,o3_padxr=0,o3_padyt=0,o3_padyb=0,o3_fullhtml=0,
o3_vpos=BELOW,o3_capicon="",o3_textfont="Verdana,Arial,Helvetica",o3_captionfont="",o3_closefont="",o3_textsize=1,OLcC=null,
o3_captionsize=1,o3_closesize=1,o3_frame=self,o3_timeout=0,o3_delay=0,o3_hauto=0,o3_vauto=0,o3_nojustx=0,o3_nojusty=0,
o3_close="",o3_closeclick=0,o3_closetitle="",o3_fgclass="",o3_bgclass="",o3_cgclass="",o3_textpadding=2,o3_textfontclass="",
o3_captionpadding=2,o3_captionfontclass="",o3_closefontclass="",o3_capbelow=0,o3_label="",o3_decode=0,
CSSOFF=DONOTHING,CSSCLASS=DONOTHING,over=null,OLdelayid=0,OLtimerid=0,OLshowid=0,OLndt=0,OLfnRef="",OLhover=0,OLx=0,OLy=0,
OLshowingsticky=0,OLallowmove=0,OLoverHTML="",OLover2HTML="",OLifRef="",OLo2Ref="",OLifX=0,OLifY=0,
OLua=(OLv=navigator.userAgent)?OLv.toLowerCase():'',
OLns4=(navigator.appName=='Netscape'&&parseInt(navigator.appVersion)==4)?1:0,
OLns6=(document.getElementById)?1:0,
OLie4=(document.all)?1:0,
OLgek=(OLv=OLua.match(/gecko\/(\d{8})/i))?parseInt(OLv[1]):0,
OLmac=(OLua.indexOf('mac')>=0)?1:0,
OLsaf=(OLua.indexOf('safari')>=0)?1:0,
OLkon=(OLua.indexOf('konqueror')>=0)?1:0,
OLkht=(OLsaf||OLkon)?1:0,
OLopr=(OLua.indexOf('opera')>=0)?1:0,
OLop7=(OLopr&&document.createTextNode)?1:0;
if(OLopr){OLns4=OLns6=OLgek=0;if(!OLop7)OLie4=0;}
var OLieM=((OLie4&&OLmac)&&!(OLkht||OLopr))?1:0,
OLie5=0,OLie55=0;OLie7=0;if(OLie4&&!OLop7){
if((OLv=OLua.match(/msie (\d\.\d+)\.*/i))&&(OLv=parseFloat(OLv[1]))>=5.0){
OLie5=1;OLns6=0;if(OLv>=5.5)OLie55=1;if(OLv>=7.0)OLie7=1;}if(OLns6)OLie4=0;}
if(OLns4)window.onresize=function(){location.reload();};var OLchkMh=1,OLdw;
if(OLns4||OLie4||OLns6){OLmh();if(window.addEventListener)window.addEventListener("unload",
OLulCl,false);}else{overlib=nd=cClick=OLpageDefaults=no_overlib;}
function OLulCl(){if(over)cClick();window.removeEventListener("unload",OLulCl,false);}

/*
 PUBLIC FUNCTIONS
*/
// Loads defaults then args into runtime variables.
function overlib(){
if(!(OLloaded&&OLgateOK))return;if((OLexclusivePI)&&OLisExclusive(arguments))return true;if(OLchkMh)OLmh();
if(OLndt&&!OLtimerid)OLndt=0;if(over)cClick();if(parent!=self){if(parent.OLo2Ref){parent.OLeval(parent.OLo2Ref);
parent.OLo2Ref="";}if(parent.OLifRef){parent.OLeval(parent.OLifRef);parent.OLifRef="";}}if(OLo2Ref){eval(OLo2Ref);
OLo2Ref="";}if(OLifRef){eval(OLifRef);OLifRef="";}OLload(OLp1or2);OLload(OLp1);OLfnRef="";OLifX=0;OLifY=0;OLhover=0;
OLsetRunTimeVar();OLparseTokens('o3_',arguments);if(!(over=OLmkLyr()))return false;if(o3_decode)OLdecode();if(OLprintPI)
OLchkPrint();if(OLbubblePI)OLchkForBubbleEffect();if(OLdebugPI)OLsetDebugCanShow();if(OLshadowPI)OLinitShadow();
if(OLiframePI)OLinitIfs();if(OLfilterPI)OLinitFilterLyr();if(OLexclusivePI&&o3_exclusive&&o3_exclusivestatus!="")
o3_status=o3_exclusivestatus;else if(o3_autostatus==2&&o3_cap!="")o3_status=o3_cap;else if(o3_autostatus==1&&o3_text!="")
o3_status=o3_text;if(!o3_delay){return OLmain();}else{OLdelayid=setTimeout("OLmain()",o3_delay);if(o3_status!=""){
self.status=o3_status;return true;}else if(!(OLop7&&event&&event.type=='mouseover'))return false;}
}
function OLeval(s){eval(s);}

// Clears popups if appropriate
function nd(time){
if(OLloaded&&OLgateOK){if(!((OLexclusivePI)&&OLisExclusive())){if(time&&over&&!o3_delay){
if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=(OLhover&&o3_frame==self&&!OLcursorOff())?0:
setTimeout("cClick()",(o3_timeout=OLndt=time));}else{if(!OLshowingsticky){OLallowmove=0;
if(over)OLhideObject(over);}}}}return false;
}

// Close function for stickies
function cClick(){
if(OLloaded&&OLgateOK){OLhover=0;if(over){if(OLo2Ref){eval(OLo2Ref);OLo2Ref="";}if(OLovertwoPI&&over==over2)cClick2();
OLhideObject(over);OLshowingsticky=0;OLallowmove=0;}if(OLmodalPI)OLclearModal();}return false;
}

// Sets page-specific defaults.
function OLpageDefaults(){
OLparseTokens('ol_',arguments);
}

// Gets object referenced by its id or name
function OLgetRef(l,d){var r=OLgetRefById(l,d);return (r)?r:OLgetRefByName(l,d);}

// For unsupported browsers.
function no_overlib(){return false;}

/*
 OVERLIB MAIN FUNCTION SET
*/
function OLmain(){
o3_delay=0;if(parent!=self&&o3_frame==parent&&parent.OLscrollPI&&parent.over)parent.OLclearScroll();if(o3_frame==self){
if(o3_noclose)OLoptMOUSEOFF(0);else if(o3_mouseoff)OLoptMOUSEOFF(1);}if(o3_sticky){OLshowingsticky=1;if(OLfnRef&&
parent!=self&&o3_frame==parent&&parent.overlib){parent.OLifRef=OLfnRef+'cClick()';}}OLdoLyr();OLallowmove=0;if(o3_timeout>0){
if(OLtimerid>0)clearTimeout(OLtimerid);OLtimerid=setTimeout("cClick()",o3_timeout);}OLchkRef();OLdisp(o3_status);
if(OLdraggablePI)OLcheckDrag();if(o3_status!="")return true;else if(!(OLop7&&event&&event.type=='mouseover'))return false;
}
function OLchkRef(){
if(o3_ref){OLrefXY=OLgetRefXY(o3_ref);if(OLrefXY[0]==null&&OLcrossframePI)OLchkIfRef();
if(OLrefXY[0]==null){o3_ref="";o3_midx=0;o3_midy=0;}}
}

// Loads o3_ variables
function OLload(c){var i,m=c.split(',');for(i=0;i<m.length;i++)eval('o3_'+m[i]+'=ol_'+m[i]);}

// Chooses LGF 
function OLdoLGF(){
return (o3_background!=''||o3_fullhtml)?OLcontentBackground(o3_text,o3_background,o3_fullhtml):(o3_cap=="")?
OLcontentSimple(o3_text):(o3_sticky)?OLcontentCaption(o3_text,o3_cap,o3_close):OLcontentCaption(o3_text,o3_cap,'');
}

// Makes Layer
function OLmkLyr(id,f,z){
id=(id||'overDiv');f=(f||o3_frame);z=(z||1000);var fd=f.document,d=OLgetRefById(id,fd);
if(!d){if(OLns4)d=fd.layers[id]=new Layer(1024,f);else if(OLie4&&!document.getElementById){
fd.body.insertAdjacentHTML('BeforeEnd','<div id="'+id+'"></div>');d=fd.all[id];}else{d=fd.createElement('div');
if(d){d.id=id;fd.body.appendChild(d);}}if(!d)return null;if(OLns4)d.zIndex=z;else{var o=d.style;o.position='absolute';
o.visibility='hidden';o.zIndex=z;}}return d;
}

// Creates and writes layer content
function OLdoLyr(){
if(o3_sticky&&OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}if(o3_background==''&&!o3_fullhtml){
if(o3_fgbackground!='')o3_fgbackground=' background="'+o3_fgbackground+'"';
if(o3_bgbackground!='')o3_bgbackground=' background="'+o3_bgbackground+'"';
if(o3_cgbackground!='')o3_cgbackground=' background="'+o3_cgbackground+'"';
if(o3_fgcolor!='')o3_fgcolor=' bgcolor="'+o3_fgcolor+'"';if(o3_bgcolor!='')o3_bgcolor=' bgcolor="'+o3_bgcolor+'"';
if(o3_cgcolor!='')o3_cgcolor=' bgcolor="'+o3_cgcolor+'"';if(o3_height>0)o3_height=' height="'+o3_height+'"';
else o3_height='';}if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);var lyrHtml=OLdoLGF();
if(o3_wrap&&!o3_fullhtml){OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);if(OLie4){
var w=OLfd().clientWidth;if(o3_width>=w){if(OLop7){if(OLovertwoPI&&over==over2){var z=over2.style.zIndex;
o3_frame.document.body.removeChild(over);over2=OLmkLyr('overDiv2',o3_frame,z);over=over2;}else{
o3_frame.document.body.removeChild(over);over=OLmkLyr();}}o3_width=w-20;}}
if(o3_wrapmax<1&&o3_frame.innerWidth)o3_wrapmax=o3_frame.innerWidth-40;
if(o3_wrapmax>0&&o3_width>o3_wrapmax)o3_width=o3_wrapmax;o3_wrap=0;lyrHtml=OLdoLGF();}OLlayerWrite(lyrHtml);
o3_width=(OLns4?over.clip.width:over.offsetWidth);if(OLbubblePI)OLgenerateBubble(lyrHtml);
}

/*
 LAYER GENERATION FUNCTIONS
*/
// Makes simple table without caption
function OLcontentSimple(txt){
var t=OLbgLGF()+OLfgLGF(txt)+OLbaseLGF();OLsetBackground('');return t;
}

// Makes table with caption and optional close link
function OLcontentCaption(txt,title,close){
var closing=(OLprintPI?OLprintCapLGF():''),closeevent='onmouseover',caption,t,cC='javascript:return '+OLfnRef
+(OLovertwoPI&&over==over2?'cClick2();':'cClick();');if(o3_closeclick)closeevent=(o3_closetitle?'title="'
+o3_closetitle+'" ':'')+'onclick';if(o3_capicon!=''&&o3_capicon.indexOf('<img')!=0)o3_capicon='<img src="'+o3_capicon
+'" /> ';if(close){closing+='<td align="right"><a href="'+cC+'" '+closeevent+'="'+cC+'"'+(o3_closefontclass?' class="'
+o3_closefontclass+'">':(OLns4?'><':'')+OLlgfUtil(0,1,'','a',o3_closecolor,o3_closefont,o3_closesize))+close+
(o3_closefontclass?'':(OLns4?OLlgfUtil(1,1,'','a'):''))+'</a></td>';}caption='<table id="overCap'
+(OLovertwoPI&&over==over2?'2':'')+'"'+OLwd(0)+' border="0" cellpadding="'+o3_captionpadding+'" cellspacing="0"'
+(o3_cgclass?' class="'+o3_cgclass+'"':o3_cgcolor+o3_cgbackground)+'><tr><td'+OLwd(0)+(o3_cgclass?' class="'
+o3_cgclass+'">':'>')+(o3_captionfontclass?'<div class="'+o3_captionfontclass+'">':OLlgfUtil(0,1,'','div',o3_capcolor,
o3_captionfont,o3_captionsize))+o3_capicon+title+OLlgfUtil(1,1,'','div')+'</td>'+closing+'</tr></table>';
t=OLbgLGF()+(o3_capbelow?OLfgLGF(txt)+caption:caption+OLfgLGF(txt))+OLbaseLGF();OLsetBackground('');return t;
}

// For BACKGROUND and FULLHTML commands
function OLcontentBackground(txt,image,hasfullhtml){
var t;if(hasfullhtml){t=txt;}else{t='<table'+OLwd(1)+' border="0" cellpadding="0" '+'cellspacing="0" '+'height="'
+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="top"'
+OLwd(2)+'>'+OLlgfUtil(0,0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+txt+OLlgfUtil(1,0,'','div')
+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';}
OLsetBackground(image);return t;
}

// LGF utilities
function OLbgLGF(){
return '<table'+OLwd(1)+o3_height+' border="0" cellpadding="'+o3_border+'" cellspacing="0"'+(o3_bgclass?' class="'
+o3_bgclass+'"':o3_bgcolor+o3_bgbackground)+'><tr><td>';
}
function OLfgLGF(t){
return '<table'+OLwd(0)+o3_height+' border="0" cellpadding="'+o3_textpadding+'" cellspacing="0"'+(o3_fgclass?' class="'
+o3_fgclass+'"':o3_fgcolor+o3_fgbackground)+'><tr><td valign="top"'+(o3_fgclass?' class="'+o3_fgclass+'"':'')+'>'
+OLlgfUtil(0,0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+t+(OLprintPI?OLprintFgLGF():'')
+OLlgfUtil(1,0,'','div')+'</td></tr></table>';
}
function OLlgfUtil(end,stg,tfc,ele,col,fac,siz){
if(end)return('</'+(OLns4?'font'+(stg?'></strong':''):ele)+'>');else return(tfc?'<div class="'+tfc+'">':((ele=='a'?'':'<')
+(OLns4?(stg?'strong><':'')+'font color="'+col+'" face="'+OLquoteMultiNameFonts(fac)+'" size="'+siz:(ele=='a'?'':ele)
+' style="color:'+col+(stg?';font-weight:bold':'')+';font-family:'+OLquoteMultiNameFonts(fac)+';font-size:'+siz+';'
+(ele=='span'?'text-decoration:underline;':''))+'">'));
}
function OLquoteMultiNameFonts(f){
var i,v,pM=f.split(',');for(i=0;i<pM.length;i++){v=pM[i];v=v.replace(/^\s+/,'').replace(/\s+$/,'');
if(/\s/.test(v) && !/['"]/.test(v)){v="\'"+v+"\'";pM[i]=v;}}return pM.join();
}
function OLbaseLGF(){
return ((o3_base>0&&!o3_wrap)?('<table width="100%" border="0" cellpadding="0" cellspacing="0"'+(o3_bgclass?' class="'
+o3_bgclass+'"':'')+'><tr><td height="'+o3_base+'"></td></tr></table>'):'')+'</td></tr></table>';
}
function OLwd(a){
return(o3_wrap?'':' width="'+(!a?'100%':(a==1?o3_width:(o3_width-o3_padxl-o3_padxr)))+'"');
}

// Loads image into the div.
function OLsetBackground(i){
if(i==''){if(OLns4)over.background.src=null;else{if(OLns6)over.style.width='';over.style.backgroundImage='none';}}
else{if(OLns4)over.background.src=i;else{if(OLns6)over.style.width=o3_width+'px';over.style.backgroundImage='url('+i+')';}}
}

/*
 HANDLING FUNCTIONS
*/
// Displays layer
function OLdisp(s){
if(OLmodalPI&&!o3_modalscroll)OLchkModal();if(!OLallowmove){if(OLshadowPI)OLdispShadow();if(OLiframePI)OLdispIfs();
OLplaceLayer();if(OLmodalPI&&o3_modalscroll)OLchkModal();if(OLndt)OLshowObject(over);
else OLshowid=setTimeout("OLshowObject(over)",1);OLallowmove=(o3_sticky||o3_nofollow)?0:1;}OLndt=0;if(s!="")self.status=s;
}

// Decides placement of layer.
function OLplaceLayer(){
var snp,X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0,o=OLfd(),
nsb=(OLgek>=20010505&&!o3_frame.scrollbars.visible)?1:0;
if(!OLkht&&o&&o.clientWidth)iWd=o.clientWidth;
else if(o3_frame.innerWidth){SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth));
if(SB>20)SB=20;iWd=o3_frame.innerWidth;}
pgLeft=(OLie4)?o.scrollLeft:o3_frame.pageXOffset;
if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow)SB=CX=5;else
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){SB+=((o3_shadowx>0)?o3_shadowx:0);
LM=((o3_shadowx<0)?Math.abs(o3_shadowx):0);CX=Math.abs(o3_shadowx);}
if(o3_ref!=""||o3_fixx> -1||o3_relx!=null||o3_midx!=null){
if(o3_ref!=""){X=OLrefXY[0];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){
if(o3_refp=='UR'||o3_refp=='LR')X-=5;}
else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){
if(o3_shadowx<0&&(o3_refp=='UL'||o3_refp=='LL'))X-=o3_shadowx;else
if(o3_shadowx>0&&(o3_refp=='UR'||o3_refp=='LR'))X-=o3_shadowx;}
}else{if(o3_midx!=null){
X=parseInt(pgLeft+((iWd-pWd-SB-LM)/2)+o3_midx);
}else{if(o3_relx!=null){
if(o3_relx>=0)X=pgLeft+o3_relx+LM;else X=pgLeft+o3_relx+iWd-pWd-SB;
}else{X=o3_fixx+LM;}}}
}else{
if(o3_hauto){
if(o3_hpos==LEFT&&OLx-pgLeft+OLifX<iWd/2&&OLx-pWd-o3_offsetx+OLifX<pgLeft+LM)o3_hpos=RIGHT;else
if(o3_hpos==RIGHT&&OLx-pgLeft+OLifX>iWd/2&&OLx+pWd+o3_offsetx+OLifX>pgLeft+iWd-SB)o3_hpos=LEFT;}
X=(o3_hpos==CENTER)?parseInt(OLx-((pWd+CX)/2)+o3_offsetx):
(o3_hpos==LEFT)?OLx-o3_offsetx-pWd:OLx+o3_offsetx;
if(o3_snapx>1){
snp=X % o3_snapx;
if(o3_hpos==LEFT){X=X-(o3_snapx+snp);}else{X=X+(o3_snapx-snp);}}X+=OLifX;}
if(!o3_nojustx&&X+pWd>pgLeft+iWd-SB)
X=iWd+pgLeft-pWd-SB;if(!o3_nojustx&&X-LM<pgLeft)X=pgLeft+LM;
pgTop=OLie4?o.scrollTop:o3_frame.pageYOffset;
if(!OLkht&&!nsb&&o&&o.clientHeight)iHt=o.clientHeight;
else if(o3_frame.innerHeight)iHt=o3_frame.innerHeight;
if(OLbubblePI&&o3_bubble)pHt=OLbubbleHt;else pHt=OLns4?over.clip.height:over.offsetHeight;
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){TM=(o3_shadowy<0)?Math.abs(o3_shadowy):0;
if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow)BM=CY=5;else
BM=(o3_shadowy>0)?o3_shadowy:0;CY=Math.abs(o3_shadowy);}
if(o3_ref!=""||o3_fixy> -1||o3_rely!=null||o3_midy!=null){
if(o3_ref!=""){Y=OLrefXY[1];if(OLie55&&OLfilterPI&&o3_filter&&o3_filtershadow){
if(o3_refp=='LL'||o3_refp=='LR')Y-=5;}else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){
if(o3_shadowy<0&&(o3_refp=='UL'||o3_refp=='UR'))Y-=o3_shadowy;else
if(o3_shadowy>0&&(o3_refp=='LL'||o3_refp=='LR'))Y-=o3_shadowy;}
}else{if(o3_midy!=null){
Y=parseInt(pgTop+((iHt-pHt-CY)/2)+o3_midy);
}else{if(o3_rely!=null){
if(o3_rely>=0)Y=pgTop+o3_rely+TM;else Y=pgTop+o3_rely+iHt-pHt-BM;}else{
Y=o3_fixy+TM;}}}
}else{
if(o3_vauto){
if(o3_vpos==ABOVE&&OLy-pgTop+OLifY<iHt/2&&OLy-pHt-o3_offsety+OLifY<pgTop)o3_vpos=BELOW;else
if(o3_vpos==BELOW&&OLy-pgTop+OLifY>iHt/2&&OLy+pHt+o3_offsety+((OLns4||OLkht)?17:0)+OLifY>pgTop+iHt-BM)
o3_vpos=ABOVE;}Y=(o3_vpos==VCENTER)?parseInt(OLy-((pHt+CY)/2)+o3_offsety):
(o3_vpos==ABOVE)?OLy-(pHt+o3_offsety+BM):OLy+o3_offsety+TM;
if(o3_snapy>1){
snp=Y % o3_snapy;
if(pHt>0&&o3_vpos==ABOVE){Y=Y-(o3_snapy+snp);}else{Y=Y+(o3_snapy-snp);}}Y+=OLifY;}
if(!o3_nojusty&&Y+pHt+BM>pgTop+iHt)Y=pgTop+iHt-pHt-BM;if(!o3_nojusty&&Y-TM<pgTop)Y=pgTop+TM;
OLrepositionTo(over,X,Y);
if(OLshadowPI)OLrepositionShadow(X,Y);if(OLiframePI)OLrepositionIfs(X,Y);
if(OLns6&&o3_frame.innerHeight){iHt=o3_frame.innerHeight;OLrepositionTo(over,X,Y);}
if(OLscrollPI)OLchkScroll(X-pgLeft,Y-pgTop);
}

// Chooses body or documentElement
function OLfd(f){
var fd=((f)?f:o3_frame).document,fdc=fd.compatMode,fdd=fd.documentElement;
return (!OLop7&&fdc&&fdc!='BackCompat'&&fdd&&fdd.clientWidth)?fd.documentElement:fd.body;
}

// Gets location of REFerence object
function OLgetRefXY(r,d){
var o=OLgetRef(r,d),ob=o,rXY=[o3_refx,o3_refy],of;if(!o)return [null,null];if(OLns4){
if(typeof o.length!='undefined'&&o.length>1){ob=o[0];rXY[0]+=o[0].x+o[1].pageX;rXY[1]+=o[0].y+o[1].pageY;}else{
if((o.toString().indexOf('Image')!= -1)||(o.toString().indexOf('Anchor')!= -1)){rXY[0]+=o.x;rXY[1]+=o.y;}
else{rXY[0]+=o.pageX;rXY[1]+=o.pageY;}}}else{rXY[0]+=OLpageLoc(o,'Left');rXY[1]+=OLpageLoc(o,'Top');}
of=OLgetRefOffsets(ob);rXY[0]+=of[0];rXY[1]+=of[1];return rXY;
}

// Seeks REFerence by id
function OLgetRefById(l,d){
l=(l||'overDiv');d=(d||o3_frame.document);var j,r;if(OLie4&&d.all)return d.all[l];
if(d.getElementById)return d.getElementById(l);if(d.layers&&d.layers.length>0){
if(d.layers[l])return d.layers[l];for(j=0;j<d.layers.length;j++){
r=OLgetRefById(l,d.layers[j].document);if(r)return r;}}return null;
}

// Seeks REFerence by name
function OLgetRefByName(l,d){
d=(d||o3_frame.document);var j,r,v=OLie4?d.all.tags('iframe'):OLns6?d.getElementsByTagName('iframe'):null;
if(typeof d.images!='undefined'&&d.images[l])return d.images[l];
if(typeof d.anchors!='undefined'&&d.anchors[l])return d.anchors[l];
if(v)for(j=0;j<v.length;j++)if(v[j].name==l)return v[j];if(d.layers&&d.layers.length>0)for(j=0;j<d.layers.length;j++){
r=OLgetRefByName(l,d.layers[j].document);if(r&&r.length>0)return r;else if(r)return [r,d.layers[j]];}return null;
}

// Gets layer vs REFerence offsets
function OLgetRefOffsets(o){
var c=o3_refc.toUpperCase(),p=o3_refp.toUpperCase(),W=0,H=0,pW=0,pH=0,of=[0,0];pW=(OLbubblePI&&o3_bubble)?
o3_width:OLns4?over.clip.width:over.offsetWidth;pH=(OLbubblePI&&o3_bubble)?OLbubbleHt:OLns4?
over.clip.height:over.offsetHeight;if((!OLop7)&&o.toString().indexOf('Image')!= -1){W=o.width;H=o.height;}
else if((!OLop7)&&o.toString().indexOf('Anchor')!= -1){c=o3_refc='UL';}else{W=(OLns4)?o.clip.width:o.offsetWidth;
H=(OLns4)?o.clip.height:o.offsetHeight;}if((OLns4||(OLns6&&OLgek))&&o.border){W+=2*parseInt(o.border);
H+=2*parseInt(o.border);}if(c=='UL'){of=(p=='UR')?[-pW,0]:(p=='LL')?[0,-pH]:(p=='LR')?[-pW,-pH]:[0,0];}else if(c=='UR'){
of=(p=='UR')?[W-pW,0]:(p=='LL')?[W,-pH]:(p=='LR')?[W-pW,-pH]:[W,0];}else if(c=='LL'){of=(p=='UR')?[-pW,H]:(p=='LL')?[0,H-pH]:
(p=='LR')?[-pW,H-pH]:[0,H];}else if(c=='LR'){of=(p=='UR')?[W-pW,H]:(p=='LL')?[W,H-pH]:(p=='LR')?[W-pW,H-pH]:[W,H];}return of;
}

// Gets x or y location of object
function OLpageLoc(o,t){
var l=0,s=o;while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){l+=o['offset'+t];o=o.offsetParent;}
l+=o['offset'+t];while(s=s.parentNode){if((s['scroll'+t]>0)&&s.tagName.toLowerCase()=='div')l-=s['scroll'+t];}return l;
}

// Moves layer
function OLmouseMove(e){
var e=(e||event);OLcC=(OLovertwoPI&&over2&&over==over2?cClick2:cClick);OLx=(e.pageX||e.clientX+OLfd().scrollLeft);
OLy=(e.pageY||e.clientY+OLfd().scrollTop);if((OLallowmove&&over)&&(o3_frame==self||over==OLgetRefById()||(OLovertwoPI&&
over2==over&&over==OLgetRefById('overDiv2')))){OLplaceLayer();if(OLhidePI)OLhideUtil(0,1,1,0,0,0);}if(OLhover&&over&&
o3_frame==self&&OLcursorOff())if(o3_offdelay<1)OLcC();else{if(OLtimerid>0)clearTimeout(OLtimerid);
OLtimerid=setTimeout("OLcC()",o3_offdelay);}
}

// Capture mouse and chain other scripts.
function OLmh(){
var fN,f,j,k,s,mh=OLmouseMove,w=(OLns4&&window.onmousemove),re=/function[ ]*(\w*)\(/;OLdw=document;if(document.onmousemove||
w){if(w)OLdw=window;f=OLdw.onmousemove.toString();fN=f.match(re);if(!fN||fN[1]=='anonymous'||fN[1]=='OLmouseMove'){OLchkMh=0;
return;}if(fN[1])s=fN[1]+'(e)';else{j=f.indexOf('{');k=f.lastIndexOf('}')+1;s=f.substring(j,k);}s+=';OLmouseMove(e);';
mh=new Function('e',s);}OLdw.onmousemove=mh;if(OLns4)OLdw.captureEvents(Event.MOUSEMOVE);
}

/*
 PARSING
*/
function OLparseTokens(pf,ar){
var i,v,md= -1,par=(pf!='ol_'),p=OLpar,q=OLparQuo,t=OLtoggle;OLudf=(par&&!ar.length?1:0);
for(i=0;i<ar.length;i++){if(md<0){if(typeof ar[i]=='number'){OLudf=(par?1:0);i--;}
else{switch(pf){case 'ol_':ol_text=ar[i];break;default:o3_text=ar[i];}}md=0;}else{
if(ar[i]==INARRAY){OLudf=0;eval(pf+'text=ol_texts['+ar[++i]+']');continue;}
if(ar[i]==CAPARRAY){eval(pf+'cap=ol_caps['+ar[++i]+']');continue;}
if(ar[i]==CAPTION){q(ar[++i],pf+'cap');continue;}
if(Math.abs(ar[i])==STICKY){t(ar[i],pf+'sticky');continue;}
if(Math.abs(ar[i])==NOFOLLOW){t(ar[i],pf+'nofollow');continue;}
if(ar[i]==BACKGROUND){q(ar[++i],pf+'background');continue;}
if(Math.abs(ar[i])==NOCLOSE){t(ar[i],pf+'noclose');continue;}
if(Math.abs(ar[i])==MOUSEOFF){t(ar[i],pf+'mouseoff');continue;}
if(ar[i]==OFFDELAY){p(ar[++i],pf+'offdelay');continue;}
if(ar[i]==RIGHT||ar[i]==LEFT||ar[i]==CENTER){p(ar[i],pf+'hpos');continue;}
if(ar[i]==OFFSETX){p(ar[++i],pf+'offsetx');continue;}
if(ar[i]==OFFSETY){p(ar[++i],pf+'offsety');continue;}
if(ar[i]==FGCOLOR){q(ar[++i],pf+'fgcolor');continue;}
if(ar[i]==BGCOLOR){q(ar[++i],pf+'bgcolor');continue;}
if(ar[i]==CGCOLOR){q(ar[++i],pf+'cgcolor');continue;}
if(ar[i]==TEXTCOLOR){q(ar[++i],pf+'textcolor');continue;}
if(ar[i]==CAPCOLOR){q(ar[++i],pf+'capcolor');continue;}
if(ar[i]==CLOSECOLOR){q(ar[++i],pf+'closecolor');continue;}
if(ar[i]==WIDTH){p(ar[++i],pf+'width');continue;}
if(Math.abs(ar[i])==WRAP){t(ar[i],pf+'wrap');continue;}
if(ar[i]==WRAPMAX){p(ar[++i],pf+'wrapmax');continue;}
if(ar[i]==HEIGHT){p(ar[++i],pf+'height');continue;}
if(ar[i]==BORDER){p(ar[++i],pf+'border');continue;}
if(ar[i]==BASE){p(ar[++i],pf+'base');continue;}
if(ar[i]==STATUS){q(ar[++i],pf+'status');continue;}
if(Math.abs(ar[i])==AUTOSTATUS){v=pf+'autostatus';
eval(v+'=('+ar[i]+'<0)?('+v+'==2?2:0):('+v+'==1?0:1)');continue;}
if(Math.abs(ar[i])==AUTOSTATUSCAP){v=pf+'autostatus';
eval(v+'=('+ar[i]+'<0)?('+v+'==1?1:0):('+v+'==2?0:2)');continue;}
if(ar[i]==CLOSETEXT){q(ar[++i],pf+'close');continue;}
if(ar[i]==SNAPX){p(ar[++i],pf+'snapx');continue;}
if(ar[i]==SNAPY){p(ar[++i],pf+'snapy');continue;}
if(ar[i]==FIXX){p(ar[++i],pf+'fixx');continue;}
if(ar[i]==FIXY){p(ar[++i],pf+'fixy');continue;}
if(ar[i]==RELX){p(ar[++i],pf+'relx');continue;}
if(ar[i]==RELY){p(ar[++i],pf+'rely');continue;}
if(ar[i]==MIDX){p(ar[++i],pf+'midx');continue;}
if(ar[i]==MIDY){p(ar[++i],pf+'midy');continue;}
if(ar[i]==REF){q(ar[++i],pf+'ref');continue;}
if(ar[i]==REFC){q(ar[++i],pf+'refc');continue;}
if(ar[i]==REFP){q(ar[++i],pf+'refp');continue;}
if(ar[i]==REFX){p(ar[++i],pf+'refx');continue;}
if(ar[i]==REFY){p(ar[++i],pf+'refy');continue;}
if(ar[i]==FGBACKGROUND){q(ar[++i],pf+'fgbackground');continue;}
if(ar[i]==BGBACKGROUND){q(ar[++i],pf+'bgbackground');continue;}
if(ar[i]==CGBACKGROUND){q(ar[++i],pf+'cgbackground');continue;}
if(ar[i]==PADX){p(ar[++i],pf+'padxl');p(ar[++i],pf+'padxr');continue;}
if(ar[i]==PADY){p(ar[++i],pf+'padyt');p(ar[++i],pf+'padyb');continue;}
if(Math.abs(ar[i])==FULLHTML){t(ar[i],pf+'fullhtml');continue;}
if(ar[i]==BELOW||ar[i]==ABOVE||ar[i]==VCENTER){p(ar[i],pf+'vpos');continue;}
if(ar[i]==CAPICON){q(ar[++i],pf+'capicon');continue;}
if(ar[i]==TEXTFONT){q(ar[++i],pf+'textfont');continue;}
if(ar[i]==CAPTIONFONT){q(ar[++i],pf+'captionfont');continue;}
if(ar[i]==CLOSEFONT){q(ar[++i],pf+'closefont');continue;}
if(ar[i]==TEXTSIZE){q(ar[++i],pf+'textsize');continue;}
if(ar[i]==CAPTIONSIZE){q(ar[++i],pf+'captionsize');continue;}
if(ar[i]==CLOSESIZE){q(ar[++i],pf+'closesize');continue;}
if(ar[i]==TIMEOUT){p(ar[++i],pf+'timeout');continue;}
if(ar[i]==DELAY){p(ar[++i],pf+'delay');continue;}
if(Math.abs(ar[i])==HAUTO){t(ar[i],pf+'hauto');continue;}
if(Math.abs(ar[i])==VAUTO){t(ar[i],pf+'vauto');continue;}
if(Math.abs(ar[i])==NOJUSTX){t(ar[i],pf+'nojustx');continue;}
if(Math.abs(ar[i])==NOJUSTY){t(ar[i],pf+'nojusty');continue;}
if(Math.abs(ar[i])==CLOSECLICK){t(ar[i],pf+'closeclick');continue;}
if(ar[i]==CLOSETITLE){q(ar[++i],pf+'closetitle');continue;}
if(ar[i]==FGCLASS){q(ar[++i],pf+'fgclass');continue;}
if(ar[i]==BGCLASS){q(ar[++i],pf+'bgclass');continue;}
if(ar[i]==CGCLASS){q(ar[++i],pf+'cgclass');continue;}
if(ar[i]==TEXTPADDING){p(ar[++i],pf+'textpadding');continue;}
if(ar[i]==TEXTFONTCLASS){q(ar[++i],pf+'textfontclass');continue;}
if(ar[i]==CAPTIONPADDING){p(ar[++i],pf+'captionpadding');continue;}
if(ar[i]==CAPTIONFONTCLASS){q(ar[++i],pf+'captionfontclass');continue;}
if(ar[i]==CLOSEFONTCLASS){q(ar[++i],pf+'closefontclass');continue;}
if(Math.abs(ar[i])==CAPBELOW){t(ar[i],pf+'capbelow');continue;}
if(ar[i]==LABEL){q(ar[++i],pf+'label');continue;}
if(Math.abs(ar[i])==DECODE){t(ar[i],pf+'decode');continue;}
if(ar[i]==DONOTHING){continue;}
i=OLparseCmdLine(pf,i,ar);}}
if((OLfunctionPI)&&OLudf&&o3_function)o3_text=o3_function();
if(pf=='o3_')OLfontSize();
}
function OLpar(a,v){eval(v+'='+a);}
function OLparQuo(a,v){eval(v+"='"+OLescSglQt(a)+"'");}
function OLescSglQt(s){return s.toString().replace(/\\/g,"\\\\").replace(/'/g,"\\'");}
function OLtoggle(a,v){eval(v+'=('+v+'==0&&'+a+'>=0)?1:0');}
function OLhasDims(s){return /[%\-a-z]+$/.test(s);}
function OLfontSize(){
var i;if(OLhasDims(o3_textsize)){if(OLns4)o3_textsize="2";}else
if(!OLns4){i=parseInt(o3_textsize);o3_textsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLhasDims(o3_captionsize)){if(OLns4)o3_captionsize="2";}else
if(!OLns4){i=parseInt(o3_captionsize);o3_captionsize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLhasDims(o3_closesize)){if(OLns4)o3_closesize="2";}else
if(!OLns4){i=parseInt(o3_closesize);o3_closesize=(i>0&&i<8)?OLpct[i]:OLpct[0];}
if(OLprintPI)OLprintDims();
}
function OLdecode(){
var re=/%[0-9A-Fa-f]{2,}/,t=o3_text,c=o3_cap,u=unescape,d=!OLns4&&(!OLgek||OLgek>=20020826)&&typeof decodeURIComponent?
decodeURIComponent:u;if(typeof(window.TypeError)=='function'){if(re.test(t)){eval(new Array('try{','o3_text=d(t);',
'}catch(e){','o3_text=u(t);','}').join('\n'))};if(c&&re.test(c)){eval(new Array('try{','o3_cap=d(c);','}catch(e){',
'o3_cap=u(c);','}').join('\n'))}}else{if(re.test(t))o3_text=u(t);if(c&&re.test(c))o3_cap=u(c);}
}

/*
 LAYER FUNCTIONS
*/
// Writes to layer
function OLlayerWrite(t){
t+="\n";if(OLns4){over.document.write(t);over.document.close();}else if(typeof over.innerHTML!='undefined'){
if(OLieM)over.innerHTML='';over.innerHTML=t;}else{var range=o3_frame.document.createRange();range.setStartAfter(over);
var domfrag=range.createContextualFragment(t);while(over.hasChildNodes()){over.removeChild(over.lastChild);}
over.appendChild(domfrag);}if(OLovertwoPI&&over==over2)OLover2HTML=t;else OLoverHTML=t;
if(OLprintPI)over.print=o3_print?t:null;
}

// Makes object visible
function OLshowObject(o){
OLshowid=0;o=(OLns4)?o:o.style;if(((OLfilterPI)&&!OLchkFilter(o))||!OLfilterPI)o.visibility="visible";
if(OLshadowPI)OLshowShadow();if(OLiframePI)OLshowIfs();if(OLhidePI)OLhideUtil(1,1,0);
}

// Hides object
function OLhideObject(o){
if(OLshowid>0){clearTimeout(OLshowid);OLshowid=0;}if(OLtimerid>0)clearTimeout(OLtimerid);
if(OLdelayid>0)clearTimeout(OLdelayid);OLtimerid=0;OLdelayid=0;self.status="";o3_label=ol_label;
if(o3_frame!=self)o=OLgetRefById();if(o){if(o.onmouseover)o.onmouseover=null;if(OLscrollPI&&o==over)OLclearScroll();
if(OLdraggablePI)OLclearDrag();if(OLfilterPI)OLcleanupFilter(o);if(OLshadowPI)OLhideShadow();var os=(OLns4)?o:o.style;
if(((OLfilterPI)&&!OLchkFadeOut(os))||!OLfilterPI){os.visibility="hidden";if(!OLie55||!OLfilterPI||!o3_filter||
o3_fadeout<0)o.innerHTML='';}if(OLhidePI&&o==over)OLhideUtil(0,0,1);if(OLiframePI)OLhideIfs(o);}
}

// Moves layer
function OLrepositionTo(o,xL,yL){
o=(OLns4)?o:o.style;o.left=(OLns4?xL:xL+'px');o.top=(OLns4?yL:yL+'px');
}

// Handle NOCLOSE-MOUSEOFF
function OLoptMOUSEOFF(c){
if(!c)o3_close="";
over.onmouseover=function(){OLhover=1;if(OLtimerid>0){clearTimeout(OLtimerid);OLtimerid=0;}}
}
function OLcursorOff(){
var o=(OLns4?over:over.style),pHt=OLns4?over.clip.height:over.offsetHeight,left=parseInt(o.left),top=parseInt(o.top),
right=left+o3_width,bottom=top+((OLbubblePI&&o3_bubble)?OLbubbleHt:pHt);
if(OLx<left||OLx>right||OLy<top||OLy>bottom)return true;return false;
}

/*
 REGISTRATION
*/
function OLsetRunTimeVar(){
if(OLrunTime.length)for(var k=0;k<OLrunTime.length;k++)OLrunTime[k]();
}
function OLparseCmdLine(pf,i,ar){
if(OLcmdLine.length){for(var k=0;k<OLcmdLine.length;k++){var j=OLcmdLine[k](pf,i,ar);if(j>-1){i=j;break;}}}return i;
}
function OLregCmds(c){
if(typeof c!='string')return;var pM=c.split(',');pMtr=pMtr.concat(pM);
for(var i=0;i<pM.length;i++)eval(pM[i].toUpperCase()+'='+pmCnt++);
}
function OLregRunTimeFunc(f){
if(typeof f=='object')OLrunTime=OLrunTime.concat(f);else OLrunTime[OLrunTime.length++]=f;
}
function OLregCmdLineFunc(f){
if(typeof f=='object')OLcmdLine=OLcmdLine.concat(f);else OLcmdLine[OLcmdLine.length++]=f;
}

OLloaded=1;


/* File: /includes/js/framework/prototype.modifications.js (Modified: 3. september 2010 12:30:56) */

/* Prototype.js modifications/addons */
Object.extend(Array.prototype, {
  add: function(item) {
    this[this.length] = item;
  },
  
  contains: function(item){
    return this.indexOf(item) >= 0;
  },
  
  remove: function(val){
    var result = null;
    for(var i = 0; i < this.length; i++){
      if( this[ i ] === val ){
        result = this[ i ];
        this.splice( i, 1 );
        break;
      }
    }
    return result;
  }
});

Object.extend(Hash.prototype, {
  add: function( key, value ){
    this.set(key, value);
  },
  
  contains: function( key ) {
    var obj = this.get(key);
    return obj != null && typeof obj != 'undefined';
  }
});

Object.extend(Ajax.Request.prototype, {
	setRequestHeaders: function() {
    var headers = {
      'X-Requested-With': 'XMLHttpRequest',
      'X-Prototype-Version': Prototype.Version,
      'X-User-Control-ID': userControlID,
      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
    };

    if (this.method == 'post') {
      headers['Content-type'] = this.options.contentType +
        (this.options.encoding ? '; charset=' + this.options.encoding : '');

      /* Force "Connection: close" for older Mozilla browsers to work
       * around a bug where XMLHttpRequest sends an incorrect
       * Content-length header. See Mozilla Bugzilla #246651.
       */
      if (this.transport.overrideMimeType &&
          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
            headers['Connection'] = 'close';
    }

    // user-defined headers
    if (typeof this.options.requestHeaders == 'object') {
      var extras = this.options.requestHeaders;

      if (Object.isFunction(extras.push))
        for (var i = 0, length = extras.length; i < length; i += 2)
          headers[extras[i]] = extras[i+1];
      else
        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
    }

    for (var name in headers)
      this.transport.setRequestHeader(name, headers[name]);
  }
});

/* Fix an issue with calling Event.pointer before the DOM is loaded in IE. */
Object.extend(Event, {
  pointer: function(event) {
    var docElement = document.documentElement, body = document.body || { scrollLeft: 0, scrollTop: 0 }
    return {
      x: event.pageX || (event.clientX +
        (docElement.scrollLeft || body.scrollLeft)),
      y: event.pageY || (event.clientY +
        (docElement.scrollTop || body.scrollTop))
    };
  }
});

Prototype.Browser.IE6 = (Prototype.Browser.IE && (typeof window.XMLHttpRequest == 'undefined'));

Date.prototype.toJSON = function() {
  return '"' + this.getUTCFullYear(4) + '-' +
    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
    this.getUTCDate().toPaddedString(2) + 'T' +
    this.getUTCHours().toPaddedString(2) + ':' +
    this.getUTCMinutes().toPaddedString(2) + ':' +
    this.getUTCSeconds().toPaddedString(2) + 'Z"';
};

/* File: /includes/js/framework/cookiemanager.js (Modified: 3. september 2010 12:30:56) */

var CookieManager = {
	getObject: function(cookie, key){
		var value = CookieManager.getValue(cookie, key);
		return value ? value.evalJSON(false) : null;
	},
	
	getValue: function(cookie, key){
		var match = document.cookie.match(cookie + '=[^;]*' + key + '=(.*?)(?:&|$|;)');
		return match ? unescape(match[1]) : null;
	},
	
	removeCookie: function(cookie, opt){
		var options = CookieManager._getOptions(opt);
		var cookieStr = cookie + '=';
		var expireDate = new Date();
		expireDate.setTime(expireDate.getTime() - 1);
		options = Object.extend(options, {expires: expireDate});
		cookieStr += CookieManager._getOptionsString(options);
		document.cookie = cookieStr;
	},
	
	removeValue: function(cookie, key, opt){
		var options = CookieManager._getOptions(opt);
		var values = CookieManager._getCookieValues(cookie);
		values.unset(key);
		if(values.keys().length == 0){
			CookieManager.removeCookie(cookie, opt);
		}
		else{
			CookieManager._setCookie(cookie, values, options);
		}
	},
	
	setObject: function(cookie, key, obj, options){
		CookieManager.setValue(cookie, key, Object.toJSON(obj), options);
	},
	
	setValue: function(cookie, key, value, opt){
		//alert('setValue: ' + cookie);
		var options = CookieManager._getOptions(opt);
		var values = CookieManager._getCookieValues(cookie);
		values.set(key, escape(value));
		CookieManager._setCookie(cookie, values, options);
	},
	
	_getCookieValues: function(cookie){
		var values = new Hash();
		var match = document.cookie.match(cookie + '=(.*?)(?:$|;)');
		if(match){
			var cookieStr = match[1];
			var pairs = cookieStr.split('&');			
			for(var i = 0; i < pairs.length; i++){
				var pair = pairs[i].split('=');
				values.set(pair[0], pair[1]);
			}
		}
		return values;
	},
	
	_getOptions: function(options){
		return Object.extend({
			expires: null,
			path: '/',
			domain: document.domain,
			secure: null
		}, options);
	},
	
	_getOptionsString: function(options){
		var cookieStr = '';
		if(options.expires){
			cookieStr += ';expires=' + options.expires.toGMTString();
		}
		if(options.path){
			cookieStr += ';path=' + options.path;
		}
		if(options.domain){
			cookieStr += ';domain=' + options.domain;
		}
		if(options.secure){
			cookieStr += ';secure=' + options.secure;
		}
		return cookieStr;
	},
	
	_setCookie: function(cookie, values, options){
		var cookieStr = cookie + '=';
		values.each(function(pair){
			cookieStr += pair.key + '=' + pair.value + '&';
		});
		cookieStr = cookieStr.substr(0, cookieStr.length - 1);
		cookieStr += CookieManager._getOptionsString(options);
		document.cookie = cookieStr;
	}
};

/* File: /includes/js/framework/observable.js (Modified: 3. september 2010 12:30:56) */

var Observable = Class.create({
	fire: function(eventName){
		if(this.obs_handlers){
			var eventHandlers = this.obs_handlers.get(eventName);
			var args = $A(arguments);
			args.shift();
			if(eventHandlers){
				eventHandlers.invoke('apply', this, args);
			}
		}
	},
	
	observe: function(eventName, handler){
		if(!this.obs_handlers){
			this.obs_handlers = new Hash();
		}
		var eventHandlers = this.obs_handlers.get(eventName);
		if(!eventHandlers){
			eventHandlers = new Array();
		}
		eventHandlers[eventHandlers.length] = handler;
		this.obs_handlers.set(eventName, eventHandlers);
	}
});

/* File: /includes/js/framework/artobutton.js (Modified: 3. september 2010 12:30:56) */

var ArtoButton = Class.create({
	initialize: function (text, options) {
		this.text = text;
		this.options = Object.extend({
			linkTarget: null,
			cssStyle: null,
			url: 'javascript:void(0);',
			buttonClass: '',
			onClick: Prototype.emptyFunction,
			width: null,
			title: null,
			linkID: null,
			onKeyDown: Prototype.emptyFunction
		}, options);
		this.classPrefix = 'headerButton' + this.options.buttonClass;
	},

	toElement: function () {
		var element = new Element('table', { 'class': 'headerButtonTable' });
		if (this.options.cssStyle) {
			element.style = this.options.cssStyle;
		}
		if (this.options.width) {
			element.setStyle({ width: this.options.width });
		}
		element.insert(
			new Element('tbody').insert(
				new Element('tr').insert(
					new Element('td', { 'class': this.classPrefix + 'Left' }).update(
						new Element('img', { src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/spacer.gif' }).setStyle({
							width: '7px',
							height: '1px',
							borderWidth: '0px'
						})
					)
				).insert(
					this._getContentCell()
				).insert(
					new Element('td', { 'class': this.classPrefix + 'Right' }).update(
						new Element('img', { src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/spacer.gif' }).setStyle({
							width: '7px',
							height: '1px',
							borderWidth: '0px'
						})
					)
				)
			)
		);
		return element;
	},

	_getContentCell: function () {
		this.cell = null;
		var onClickAction = null;
		if (this.options.url != 'javascript:void(0);') {
			if (this.options.linkTarget && this.options.linkTarget == '_blank') {
				onClickAction = function () { window.open(this.options.url) } .bind(this);
			} else {
				onClickAction = function () { location.href = this.options.url; } .bind(this);
			}
		} else {
			if (this.options.onClick != Prototype.emptyFunction) {
				onClickAction = this.options.onClick;
			}
		}
		if (onClickAction) {
			this.cell = new Element('td', { 'class': this.classPrefix + 'Middle ' + this.classPrefix + 'Link' }).setStyle({
				textAlign: 'center',
				whiteSpace: 'nowrap',
				cursor: 'pointer'
			});
			if (this.options.width != null) {
				this.cell.style.width = '100%';
			}
			this.cell.observe('click', onClickAction);
		} else {
			this.cell = new Element('td', { 'class': this.classPrefix + 'Middle' }).setStyle({
				textAlign: 'center',
				whiteSpace: 'nowrap'
			});
			if (this.options.width != null) {
				this.cell.style.width = '100%';
			}
		}
		if (this.options.title) {
			this.cell.title = this.options.title;
		}
		if (this.options.linkID) {
			this.cell.id = this.options.linkID;
		}

		if (this.options.onKeyDown != Prototype.emptyFunction) {
			this.cell.observe('keydown', this.options.onKeyDown);
		}
		if (this.options.tabIndex != null) {
			this.cell.tabindex = this.options.tabIndex;
		}
		/*if (this.options.width) {
		cell.setStyle({  });
		}*/

		/*var link = new Element('a', { href: this.options.url, 'class': this.classPrefix + 'Link' });
		if (this.options.linkID) {
		link.id = this.options.linkID;
		}
		if (this.options.linkTarget) {
		link.target = this.options.linkTarget;
		}
		if (this.options.title) {
		link.title = this.options.title;
		}
		link.observe('click', this.linkClicked.bind(this));
		link.update(this.text);*/

		this.cell.update(this.text);
		return this.cell;
	},

	focus: function () {
		this.cell.focus();
		this.cell.style.textDecoration = 'underline';
		this.cell.observe('blur', this.blur.bind(this));
	},

	blur: function () {
		this.cell.style.textDecoration = '';
	},

	linkClicked: function () {
		this.options.onClick();
	}
});

/* File: /includes/js/framework/panel/panel.basepanel.js (Modified: 3. september 2010 12:30:56) */

var Panel = {};

//Abstract
Panel.BasePanel = Class.create({
	initialize: function (body, containerElement) {
		//this.element = new Element('div', { 'class': 'panelBasePanel' }).setStyle({ display: 'none' });
		this.setElement();
		this.updateBody(body);
		if (containerElement) {
			$(containerElement).insert(this.containerElement);
		} else {
			document.body.appendChild(this.containerElement);
		}
		this.clickhandler = this.close.bindAsEventListener(this);
		this.visible = false;
		this.sticky = false;
		this.timeoutSeconds = 2;
		this.enableTimeout = false;
		this.hAlign = 'right';
		this.setEventListeners();
		this.onClose = Prototype.emptyFunction;
	},

	setSize: function (width, height) {
		this.width = width || (this.width || this.element.getWidth());
		this.height = height || (this.height || this.element.getHeight());
		if (this.width > 0) {
			this.containerElement.setStyle({ width: this.width + 'px' });
			this.iframe.setStyle({ width: this.width + 'px' });
			this.element.setStyle({ width: this.width + 'px' });
		}
		if (this.height > 0) {
			this.containerElement.setStyle({ height: this.height + 'px' });
			this.iframe.setStyle({ height: this.height + 'px' });
			this.element.setStyle({ height: this.height + 'px' });
		}
	},

	showAtCursor: function (e) {
		if (this.bodyIsEmpty()) {
			this.updateBody();
		}
		var pos = this.getPosition(Event.pointerX(e), Event.pointerY(e));
		this.containerElement.setStyle({ position: 'absolute', left: pos.left + 'px', top: pos.top + 'px', display: '' });
		this.setSize();

		if (this.visible == false) {
			this.visible = true;
			if (!this.sticky) {
				setTimeout(function () {
					document.observe("click", this.clickhandler);
				} .bind(this), 10);
			}
		}
		this.startTimeout(e);
	},

	getPosition: function (left, top) {
		var result = { top: top, left: left };
		switch (this.hAlign.toLowerCase()) {
			case 'right':
				result.left = left + 10;
				result.top = top + 10;
				break;
			case 'center':
				var width = this.element.getWidth();
				result.top = top + 10;
				result.left = left - (width / 2);
				break;
			case 'left':
				var width = this.element.getWidth();
				result.top = top + 10;
				result.left = left - width;
				break;
		}
		return result;
	},

	showAtPosition: function (e, x, y) {
		if (this.bodyIsEmpty()) {
			this.updateBody();
		}
		this.containerElement.setStyle({ position: 'absolute', left: x + 'px', top: y + 'px', display: '', zIndex: 9997 });

		this.setSize();
		if (this.visible == false) {
			this.visible = true;
			if (!this.sticky) {
				setTimeout(function () {
					document.observe("click", this.clickhandler)
				} .bind(this), 10);
			}
		}
		if (e) {
			this.startTimeout(e);
		}
	},

	bodyIsEmpty: function () {
		return (this.body == null || typeof (this.body) == 'undefined' || this.body == '');
	},

	close: function () {
		this.visible = false;
		this.containerElement.hide();
		document.stopObserving("click", this.clickhandler);
		this.onClose();
	},

	updateBody: function (body) {
		this.body = body;
		this.element.update(body);
	},

	startTimeout: function (e) {
		e = e || event;
		if (!Position.within(this.containerElement, Event.pointerX(e), Event.pointerY(e))) {
			if (this.enableTimeout) {
				this.stopTimeout();
				this.timeout = setTimeout(this.close.bind(this), this.timeoutSeconds * 1000);
			}
		}
	},

	stopTimeout: function () {
		if (this.timeout != null) {
			clearTimeout(this.timeout);
			this.timeout = null;
		}
	},

	stopOnClickEvent: function (e) {
		e = e || event;
		Event.stop(e);
	},

	setEventListeners: function () {
		Event.observe(this.element, 'mouseout', this.startTimeout.bindAsEventListener(this));
		Event.observe(this.element, 'mouseover', this.stopTimeout.bindAsEventListener(this));
		Event.observe(this.element, 'click', this.stopOnClickEvent.bindAsEventListener(this));
	},

	moveElement: function (left, top) {
		this.containerElement.setStyle({ left: left + 'px', top: top + 'px' });
	},

	setElement: function () {
		this.containerElement = new Element('div').setStyle({ display: 'none', position: 'absolute', width: 'auto' });
		this.iframe = new Element('iframe', { scrolling: 'no', frameborder: '0', src: 'javascript:void(0);' }).setStyle({ position: 'absolute', top: '0px', left: '0px', zIndex: '9998' });
		this.element = new Element('div', { 'class': 'panelBasePanel' }).setStyle({ width: 'auto', padding: '0px', margin: '0px', position: 'absolute', top: '0px', left: '0px', zIndex: '9999' });
		this.containerElement.insert(this.iframe);
		this.containerElement.insert(this.element);
	}
});

/* File: /includes/js/framework/panel/panel.menu.js (Modified: 3. september 2010 12:30:56) */

Panel.Menu = Class.create({
	initialize: function(closeListener) {
		this.closeListener = closeListener;
		this.items = new Array();
		this.element = null;
	},

	render: function() {
		if (this.element == null) {
			this.element = new Element('table', { cellPadding: '2', cellSpacing: '0', className: 'panelMenuBase' }).setStyle({ width: '100%' });
			var elm = new Element('tbody');
			for (var i = 0; i < this.items.length; i++) {
				if (i > 0 && this.items[i - 1].type == 'menuItem') {
					this.items[i].options.addBorder = true;
				}
				elm.appendChild(this.items[i].render());
			}
			this.element.appendChild(elm);
		}
		return this.element;
	},

	add: function(item) {
		if (this.closeListener) {
			item.setCloseListener(this.closeListener);
		}
		this.items.add(item);
	}
});

/* File: /includes/js/framework/panel/panel.menuelement.js (Modified: 3. september 2010 12:30:56) */

Panel.MenuElement = Class.create({
	initialize: function() {
		this.menuElement = null;
		this.type = '';
		this.baseOptions = {
			iconPath: null,
			mouseOverCssClass: 'panelMouseOver cursorHand',
			cssClass: '',
			selected: false,
			closeable: true,
			closeListener: Prototype.emptyFunction,
			addBorder: false
		};
	},

	setCloseListener: function(listener) {
		this.baseOptions.closeListener = listener;
	},

	stopOnClickEvent: function(e) {
		Event.stop(e);
	}
});

/* File: /includes/js/framework/panel/panel.menuitem.js (Modified: 3. september 2010 12:30:56) */

Panel.MenuItem = Class.create(Panel.MenuElement, {
	initialize: function($super, title, options) {
		$super();
		this.type = 'menuItem';
		this.title = title;
		this.options = Object.extend(this.baseOptions, Object.extend({
			href: '',
			onClick: ''
		}, options));
	},

	render: function() {
		if (this.menuElement == null) {
			this.menuElement = new Element('tr', { className: this.cssClass });
			var iconTd = new Element('td');
			var titleTd = new Element('td').setStyle({ whiteSpace:'nowrap', width: '100%' });
			if (this.options.addBorder) {
				titleTd.className = 'borderTop';
				iconTd.className = 'borderTop';
			}
			if (this.options.iconPath != null) {
				iconTd.appendChild(this.getIconElement());
			} else {
				iconTd.appendChild(document.createTextNode(' '));
			}
			titleTd.appendChild(this.getTitleElement());
			this.menuElement.appendChild(iconTd);
			this.menuElement.appendChild(titleTd);
			this.setEventObservers();
		}
		return this.menuElement;
	},

	setEventObservers: function() {
		Event.observe(this.menuElement, 'mouseover', this.mouseOver.bindAsEventListener(this));
		Event.observe(this.menuElement, 'mouseout', this.mouseOut.bindAsEventListener(this));
		Event.observe(this.menuElement, 'click', this.onClick.bindAsEventListener(this));
	},

	getIconElement: function() {
		var iconElement = new Element('img', { src: this.options.iconPath }).setStyle({ border: '0px', paddingRight: '2px' });
		return iconElement;
	},

	getTitleElement: function() {
		var titleElement = new Element('span');
		if (this.options.selected) {
			titleElement.setStyle({ fontWeight: 'bold' });
		}
		titleElement.update(this.title);

		return titleElement;
	},

	mouseOver: function() {
		if (this.mouseOverCssClass != '') {
			this.menuElement.className = this.options.mouseOverCssClass;
		}
	},

	mouseOut: function() {
		this.menuElement.className = this.options.cssClass;
	},

	onClick: function() {
		if (this.options.href != '') {
			location.href = this.options.href;
		} else if (this.options.onClick != '') {
			this.options.onClick();
		}
		if (this.options.closeable) {
			this.options.closeListener();
		}
	}
});

/* File: /includes/js/framework/panel/panel.menuheader.js (Modified: 3. september 2010 12:30:56) */

Panel.MenuHeader = Class.create(Panel.MenuElement, {
	initialize: function($super, title, options) {
		$super();
		this.type = 'menuHeader';
		this.title = title;
		this.options = Object.extend(this.baseOptions, Object.extend({
			cssClass: 'panelMenuHeader',
			closeable: false
		}, options));
	},

	render: function() {
		if (this.menuElement == null) {
			this.menuElement = new Element('tr', { className: this.options.cssClass });
			var titleTd = new Element('td', {colspan: '2' }).setStyle({ whiteSpace:'nowrap', width: '100%' }).update(this.title);
			this.menuElement.appendChild(titleTd);
			if (!this.options.closeable) {
				Event.observe(this.menuElement, 'click', this.stopOnClickEvent.bindAsEventListener(this));
			}
		}
		return this.menuElement;
	}
});

/* File: /includes/js/framework/panel/panel.menuseperator.js (Modified: 3. september 2010 12:30:56) */

Panel.MenuSeperator = Class.create(Panel.MenuElement, {
	initialize: function($super, options) {
		$super();
		this.type = 'menuSeperator';
		this.options = Object.extend(this.baseOptions, Object.extend({
			cssClass: 'panelMenuSeperator',
			closeable: false
		}, options));
	},

	render: function() {
		if (this.menuElement == null) {
			this.menuElement = new Element('tr', { className: this.options.cssClass });
			var titleTd = new Element('td', { colspan: '2' }).setStyle({ width: '100%' });
			var spacer = new Element('hr');
			titleTd.appendChild(spacer);
			this.menuElement.appendChild(titleTd);
			if (!this.options.closeable) {
				Event.observe(this.menuElement, 'click', this.stopOnClickEvent.bindAsEventListener(this));
			}
		}
		return this.menuElement;
	}
});

/* File: /includes/js/framework/panel/panel.tooltip.js (Modified: 3. september 2010 12:30:56) */

Panel.ToolTip = Class.create(Panel.BasePanel, {
	initialize: function($super, elm, body) {
		$super(body);
		this.observeElement = elm;
		this.moveHandler = this.moveToolTip.bindAsEventListener(this);
		this.mouseOutHandler = this.closeToolTip.bind(this);
		this.mouseOverHandler = this.clearTimeOut.bind(this);
		this.timeoutStarted = false;
	},

	showAtCursor: function(e) {
		this.clearTimeOut();
		if (this.bodyIsEmpty()) {
			this.updateBody();
		}
		this.containerElement.setStyle({
			position: 'absolute',
			left: (Event.pointerX(e) + 10) + 'px',
			top: (Event.pointerY(e) + 15) + 'px',
			display: ''
		});
		this.setSize();
		if (this.visible == false) {
			this.visible = true;
			setTimeout(function() {
				document.observe("click", this.clickhandler);
			} .bind(this), 10);
			this.setObservers();
		}
	},

	setObservers: function() {
		Event.observe(this.observeElement, 'mousemove', this.moveHandler);
		Event.observe(this.observeElement, 'mouseout', this.mouseOutHandler);
		Event.observe(this.observeElement, 'mouseover', this.mouseOverHandler);
	},

	stopObservers: function() {
		Event.stopObserving(this.observeElement, 'mousemove', this.moveHandler);
		Event.stopObserving(this.observeElement, 'mouseout', this.mouseOutHandler);
		Event.stopObserving(this.observeElement, 'mouseover', this.mouseOverHandler);
	},

	moveToolTip: function(e) {
		e = e || event;
		this.moveElement(Event.pointerX(e) + 15, Event.pointerY(e) + 10);
	},

	clearTimeOut: function() {
		if (this.timeoutStarted) {
			clearTimeout(this.closeTimeOut);
			this.timeoutStarted = false;
		}
	},

	closeToolTip: function() {
		if (!this.timeoutStarted) {
			this.closeTimeOut = setTimeout(function() {
				this.close();
				this.stopObservers();
			} .bind(this), 0);
			this.timeoutStarted = true;
		}
	}
});

/* File: /includes/js/framework/panel/panel.contextmenu.js (Modified: 3. september 2010 12:30:56) */

Panel.ContextMenu = Class.create(Panel.BasePanel, {
	initialize: function($super, element, body) {
		this.menu = new Panel.Menu();
		$super(body);
		this.observeElement = element || document;
		Event.observe(this.observeElement, 'contextmenu', this.showContextMenu.bindAsEventListener(this));
	},

	updateBody: function(body) {
		this.body = body;
		if (this.bodyIsEmpty()) {
			if (this.menu.items.length > 0) {
				this.body = this.menu.render();
				this.element.update(this.body);
			}
		} else {
			this.element.update(body);
		}
	},

	showContextMenu: function(e) {
		e = e || event;
		Event.stop(e);
		this.showAtCursor(e);
	}
});

/* File: /includes/js/framework/panel/panel.dropdownmenu.js (Modified: 3. september 2010 12:30:56) */

Panel.DropDownMenu = Class.create(Panel.BasePanel, {
	initialize: function($super, body, closeListener, containerElement) {
		this.menu = new Panel.Menu(this.close.bind(this));
		$super(body, containerElement);
		this.enableTimeout = true;
		this.onClose = closeListener || Prototype.emptyFunction;
	},

	updateBody: function(body) {
		this.body = body;
		if (this.bodyIsEmpty()) {
			if (this.menu.items.length > 0) {
				this.body = this.menu.render();
				this.element.update(this.body);
			}
		} else {
			this.element.update(body);
		}
	}
});

/* File: /includes/js/framework/insertimagebox.js (Modified: 3. september 2010 12:30:56) */

var InsertImageBox = Class.create({
	initialize: function(elementID) {
		this.textboxElement = $(elementID);
		this.imageList = new Array();
		this.currentPage = 0;
		this.createBox();
	},

	createBox: function() {
		var dim = document.viewport.getDimensions();
		var offsets = document.viewport.getScrollOffsets();
		var positions = { left: (dim.width < 970 ? 36 : ((dim.width - 970) / 2) + 36), top: (dim.height > 600 ? offsets.top + 150 : offsets.top + 50) };

		this.mainElement = new Element('div', { align: 'center' }).setStyle({ zIndex: 9990, width: '578px', position: 'absolute', left: positions.left + 'px', top: positions.top + 'px' });
		var placeholderDiv = new Element('div').setStyle({ padding: '5px' });
		var topRow = new Element('div', { align: 'center' }).insert("<b>Folder:</b> ").insert(this.getAlbumDropDown());
		this.infoboxContent = new Element('div').setStyle({ width: '100%' }).update("<span class=\"padding:10px;\">Your pictures are being retrieved, please wait.</span>");

		placeholderDiv.insert(topRow);
		placeholderDiv.insert(this.infoboxContent);

		var bottomRow = new Element('div', { align: 'left' });
		this.pageBarDiv = new Element('div');
		bottomRow.insert(this.pageBarDiv);
		placeholderDiv.insert(bottomRow);

		var infobox = new InfoBox('Insert pictures', placeholderDiv, { className: 'shadowBox', width: 578, altContent: this.getCloseButton(), useAltHeader: true });
		this.mainElement.insert(infobox.getInfoBox());
		document.body.appendChild(this.mainElement);

		this.getAlbums();
		this.createPageBar();
		this.getImages();
	},

	getAlbumDropDown: function() {
		this.albumDropDown = new Element('select').insert(new Element('option', { value: -1 }).update('Newest'));
		Event.observe(this.albumDropDown, 'change', this.getImages.bind(this, this.albumDropDown.value));
		return this.albumDropDown;
	},

	getImages: function() {
		var params = {
			m: 'getimages',
			cat: this.albumDropDown.value
		};
		new Ajax.Request('/controls/insertimagebox/insertimageboxajax.ashx', { parameters: params, onComplete: this.addImagesToList.bind(this) });
	},

	addImagesToList: function(response) {
		var list = new Array();
		this.imageList = new Array();
		this.currentPage = 0;
		list = eval('(' + response.responseText + ')');
		for (var i = 0; i < list.length; i++) {
			var imageElement = new ImageBoxImage(list[i].ID, list[i].ImagePath);
			this.imageList.add(imageElement);
		}
		this.appendImagesElement();
		this.setPageBarVisibility();
	},

	appendImagesElement: function() {
		var breakLoop = false;

		var content = new Element('table', { cellpadding: 0, cellspacing: 1 });
		var contentTBody = new Element('tbody');
		var rows = 3;
		var cols = 4;
		var i = this.currentPage * 12;
		if (this.imageList.length > 0) {
			for (var r = 0; r < rows; r++) {
				var row = new Element('tr');
				for (var u = 0; u < cols; u++) {
					var cell = new Element('td');
					if (this.imageList[i]) {
						cell = this.imageList[i].getElement();
					} else {
						cell.insert(this.getDummyImage());
						breakLoop = true;
					}
					//Prevent empty row
					if (i == (this.imageList.length - 1)) {
						breakLoop = true;
					}
					row.insert(cell);
					i++;
				}
				contentTBody.insert(row);
				if (breakLoop) {
					break;
				}
			}
		} else {
			contentTBody.insert(new Element('tr').insert(new Element('td', { align: 'center' }).setStyle({ padding: '10px' }).update('No pictures was found in this category')));
		}
		content.insert(contentTBody);
		this.infoboxContent.update(content);
	},

	getDummyImage: function() {
		return new Element('img', { src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/spacer.gif', alt: '' }).setStyle({ padding: '5px', width: '120px', height: '90px' });
	},

	getAlbums: function() {
		var params = {
			m: 'getalbums'
		}
		new Ajax.Request('/controls/insertimagebox/insertimageboxajax.ashx', { parameters: params, onComplete: this.fillAlbumDropDown.bind(this) });
	},

	fillAlbumDropDown: function(response) {
		var list = new Array();
		list = eval('(' + response.responseText + ')');
		for (var i = 0; i < list.length; i++) {
			this.albumDropDown.options.add(new Option(list[i].Name, list[i].ID));
		}
	},

	insertImages: function() {
		for (var i = 0; i < this.imageList.length; i++) {
			var currentImage = this.imageList[i];
			if (currentImage.selected) {
				if (this.textboxElement.value == '') {
					this.textboxElement.value += '[img:' + currentImage.id + ']';
				} else {
					this.textboxElement.value += ' [img:' + currentImage.id + ']';
				}
			}
		}
		this.close();
	},

	close: function() {
		this.mainElement.remove();
	},

	getCloseButton: function() {
		return new Element('img', {
			src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/kvikchat/window_close.png',
			'class': 'cursorHand'
		}).setStyle({
			width: '15px',
			height: '15px',
			borderWidth: '0px'
		}).observe('click', this.close.bind(this));
	},

	createPageBar: function() {
		var pageBarTable = new Element('table', { cellpadding: 0, cellspacing: 0 }).setStyle({ width: '100%' });
		var tbody = new Element('tbody');
		this.previousLink = new Element('div').setStyle({ display: 'none' }).update(new ArtoButton('Previous', { onClick: this.showPreviousPage.bind(this) }));
		this.nextLink = new Element('div').setStyle({ display: 'none' }).update(new ArtoButton('Next', { onClick: this.showNextPage.bind(this) }));
		tbody.insert(
			new Element('tr').insert(
				new Element('td').setStyle({ width: '25%' }).insert(this.previousLink)).insert(
				new Element('td', { align: 'center' }).setStyle({ width: '50%' }).insert(
					new ArtoButton('Insert selected pictures', { buttonClass: 'Green', onClick: this.insertImages.bind(this) })
				)
			).insert(
				new Element('td', { align: 'right' }).setStyle({ width: '25%' }).insert(this.nextLink)
			)
		);
		pageBarTable.insert(tbody);
		this.pageBarDiv.update(pageBarTable);
	},

	showNextPage: function() {
		if (this.currentPage < Math.ceil(this.imageList.length / 12) - 1) {
			this.currentPage++;
			this.appendImagesElement();
			this.setPageBarVisibility();
		}
	},

	showPreviousPage: function() {
		if (this.currentPage > 0) {
			this.currentPage--;
			this.appendImagesElement();
			this.setPageBarVisibility();
		}
	},

	setPageBarVisibility: function() {
		if (this.imageList.length <= 12) {
			this.nextLink.hide();
			this.previousLink.hide();
		} else {
			if (this.currentPage == 0) {
				this.previousLink.hide();
			} else {
				this.previousLink.show();
			}
			if (this.currentPage >= Math.ceil(this.imageList.length / 12) - 1) {
				this.nextLink.hide();
			} else {
				this.nextLink.show();
			}
		}
	}
});

var ImageBoxImage = Class.create({
	initialize: function(id, path) {
		this.id = id;
		this.path = path;
		this.selected = false;
		this.highlightColor = '#BBBBBB';
	},

	getElement: function() {
		this.cell = new Element('td', { valign: 'top' });
		if (this.selected) {
			this.cell.setStyle({ backgroundColor: this.highlightColor });
		}
		this.image = new Element('img', { src: this.path, alt: '', className: 'cursorHand' }).setStyle({ padding: '5px', width: '120px', height: '90px' });
		Event.observe(this.image, 'click', this.switchSelection.bind(this));
		this.cell.insert(this.checkBox);
		this.cell.insert(this.image);

		return this.cell;
	},

	switchSelection: function() {
		if (this.selected) {
			this.deselect();
		} else {
			this.select();
		}
	},

	select: function() {
		this.selected = true;
		this.cell.setStyle({ backgroundColor: this.highlightColor });
	},

	deselect: function() {
		this.selected = false;
		this.cell.setStyle({ backgroundColor: '' });
	}
});

/* File: /includes/js/framework/guestbook/guestbookreplybox.js (Modified: 3. september 2010 12:30:56) */

var GuestbookReplySystem = {};

GuestbookReplySystem.GuestbookReplyBox = Class.create({
	initialize: function(options) {
		this.options = Object.extend({
			recieverUsername: '',
			recieverUserID: 0,
			parentID: -1,
			width: 650,
			offsetLeft: 0,
			offsetTop: 150,
			zIndex: 9800,
			smileyPath: 'http://smilies.artodata.com/gfx/smilies/',
			textboxWidth: 453,
			showAdminFeatures: false
		}, options);
		if (GuestbookReplySystem.ActiveBox) {
			GuestbookReplySystem.ActiveBox.close();
		}
		this.loadRequiredSettings();
		GuestbookReplySystem.ActiveBox = this;
	},

	loadRequiredSettings: function() {
		this.selectedGift = -1;
		this.smsProduct = '';
		this.prices = { Sms: 16, SmsVip: 12 };
		new Ajax.Request('/section/user/profile/guestbook/guestbookajax.ashx?method=getsettings&recieverID=' + this.options.recieverUserID, { onComplete: function(response) {
			var result = eval('(' + response.responseText + ')');
			this.prices.Sms = result.SmsPrice;
			this.prices.SmsVip = result.SmsVipPrice;
			this.showAdminFeatures = this.showAdminFeatures && result.IsCoAdmin;
			this.SmsEnabled = result.SmsEnabled;
			this.recieverCanReply = result.RecieverCanReply;
			this.userCanSend = result.CanWriteToReciever;

			this.createBox();
		} .bind(this)
		});
	},

	createBox: function() {
		var dim = document.viewport.getDimensions();
		var offsets = document.viewport.getScrollOffsets();
		var positions = { left: (dim.width < 970 ? this.options.offsetLeft : ((dim.width - 970) / 2) + this.options.offsetLeft), top: (dim.height > 600 ? offsets.top + this.options.offsetTop : 50) };
		var elm = this.getMainTable();
		if (!this.userCanSend) {
			elm = new Element('div', { align: 'center' }).setStyle({ padding: '10px' }).update('Unfortunately, you can not use this feature, because you are not friends with ' + this.options.recieverUsername + ' or is part of ' + this.options.recieverUsername + '\'s chosen age group.<br /><br /><a href="/section/user/profile/friends/apply.aspx?id=' + this.options.recieverUserID + '">Click here to apply for friendship</a>');
		}
		this.mainElement = new Element('div').setStyle({ zIndex: this.options.zIndex, width: this.options.width + 'px', position: 'absolute', left: positions.left + 'px', top: positions.top + 'px' });
		var infobox = new InfoBox('Sign ' + this.options.recieverUsername + '\'s guestbook', elm, { className: 'shadowBox', width: this.options.width, altContent: this.getCloseButton(), useAltHeader: true });
		this.mainElement.insert(infobox.getInfoBox());

		this.infobox = infobox;

		infobox.header.className = 'cursorHand';
		new Draggable(this.mainElement, {
			starteffect: Prototype.emptyFunction,
			endeffect: Prototype.emptyFunction,
			scroll: window, handle: infobox.header
		});

		document.body.appendChild(this.mainElement);
		if (this.userCanSend) {
			this.messageTextbox.focus();
		}
	},

	getMainTable: function() {
		this.messageTextbox = new Element('textarea', { id: 'ReplyMessageTextBox', tabindex: 8 }).setStyle({ width: this.options.textboxWidth + 'px', height: '90px' }).observe('keydown', this.messageTextBoxKeyDown.bindAsEventListener(this)).observe('keyup', this.messageTextBoxKeyUp.bindAsEventListener(this));
		var containerDiv = new Element('div').setStyle({ paddingLeft: '5px' });
		var tableElement = new Element('table', { cellpadding: 0, cellspacing: 5 }).setStyle({ width: '100%', margin: '5px 0px 3px 0px' }).insert(
			new Element('tbody').insert(
				new Element('tr').insert(
					new Element('td', { valign: 'top' }).insert(
						this.messageTextbox
					).insert(
						this.getCheckBoxRow()
					).insert(
						this.getButtonsRow()
					)
				).insert(
					new Element('td', { valign: 'top', align: 'center' }).setStyle({ width: '130px' }).insert(
						this.getSmileyBox()
					)
				)
			)
		);
		containerDiv.insert(tableElement);
		this.exampleDiv = new Element('div', { id: 'replyMessagePreview' }).setStyle({ display: 'none', paddingRight: '10px', paddingBottom: '10px', paddingLeft: '5px' });
		containerDiv.insert(this.exampleDiv);
		return containerDiv;
	},

	getCheckBoxRow: function() {
		var width = Prototype.Browser.IE ? this.options.textboxWidth + 2 : this.options.textboxWidth;
		var result = new Element('div').setStyle({ width: width + 'px', paddingTop: '5px' });
		this.privateCheckBox = new Element('input', { type: 'checkbox', className: 'inputCheckbox', id: 'privateCheckBox' });
		this.attachGiftCheckBox = new Element('input', { type: 'checkbox', className: 'inputCheckbox', id: 'attachGiftCheckBox' }).observe('click', this.giftClicked.bind(this));
		this.smsOnAnswerCheckBox = new Element('input', { type: 'checkbox', className: 'inputCheckbox', id: 'smsOnAnswerCheckBox' }).observe('click', this.smsClicked.bind(this));
		this.attachedGiftSpan = new Element('span').setStyle({ paddingLeft: '5px' });
		this.smsProductSpan = new Element('span').setStyle({ paddingLeft: '5px' });
		result.insert(
			new Element('table', { cellpadding: 0, cellspacing: 0 }).insert(
				new Element('tbody').insert(
					new Element('tr').insert(
						new Element('td').insert(this.privateCheckBox)
					).insert(
						new Element('td').setStyle({ paddingRight: '10px' }).insert(new Element('label', { 'for': this.privateCheckBox.id }).update('Private'))
					).insert(
						new Element('td').insert(this.attachGiftCheckBox)
					).insert(
						new Element('td').setStyle({ paddingRight: '10px' }).insert(
							new Element('label', { 'for': this.attachGiftCheckBox.id }).update('Attach gift')
						).insert(
							this.attachedGiftSpan
						)
					).insert(
						new Element('td').insert(this.SmsEnabled ? this.smsOnAnswerCheckBox : '')
					).insert(
						new Element('td').insert(
							this.SmsEnabled ? new Element('label', { 'for': this.smsOnAnswerCheckBox.id }).update('SMS by answer') : ''
						).insert(
							this.smsProductSpan
						)
					)
				)
			)
		);
		return result;
	},

	getButtonsRow: function() {
		this.submitButton = new ArtoButton('Add message', { buttonClass: 'Green', onClick: this.submitButtonClick.bind(this), onKeyDown: this.submitButtonKeyDown.bindAsEventListener(this) });
		this.exampleButton = new ArtoButton('Example', { onClick: this.showExampleClick.bind(this) });
		this.imageButton = new ArtoButton('Picture...', { onClick: Arto.ShowInsertImageBox.curry(this.messageTextbox) });

		var tableElement = new Element('table', { cellpadding: 0, cellspacing: 0 }).setStyle({ marginTop: '3px', width: '100%' }).insert(
			new Element('tbody').insert(
				new Element('tr').insert(
					new Element('td', { width: 10 }).setStyle({ paddingRight: '5px' }).insert(this.submitButton)
				).insert(
					new Element('td', { width: 10 }).setStyle({ paddingRight: '5px' }).insert(this.exampleButton)
				).insert(
					new Element('td', { width: 10 }).insert(this.imageButton)
				).insert(
					new Element('td', { width: 10 }).setStyle({ paddingLeft: '3px' }).insert(this.getAdminContent())
				).insert(
					new Element('td', { align: 'right', nowrap: 'nowrap' }).insert(
						new Element('a', { href: 'javascript:void(0);' }).update('Smilies').observe('click', Arto.OpenSmileyPopup.curry(this.messageTextbox.id, 'smileyBox'))
					)
				)
			)
		);
		return tableElement;
	},

	getAdminContent: function() {
		this.adminCheckBox = new Element('input', { type: 'checkbox', className: 'inputCheckbox', tabindex: 13 });
		if (this.options.showAdminFeatures) {
			return new Element('table', { cellpadding: 0, cellspacing: 0 }).insert(
				new Element('tbody').insert(
					new Element('tr').insert(
						new Element('td').insert(this.adminCheckBox)
					).insert(
						new Element('td').insert(
							new Element('a', { href: 'javascript:void(0);', className: 'fontLille' }).update('Administrator').observe('click', function() { alert('Message from Co-administrator\n\nIf the box is ticked, ARTO becomes anonymous sender of the message.'); })
						)
					)
				)
			);
		}
	},

	submitButtonKeyDown: function(e) {
		if (e.keyCode == 32 || e.keyCode == 13) {
			this.submitButtonClick();
		}
	},
	
	messageTextBoxKeyUp: function(e){
		if(this.messageTextbox && this.messageTextbox.value.length > 10000){
			this.messageTextbox.value = this.messageTextbox.value.slice(0, 9999);
			Event.stop(e);
			return;
		}
	},

	messageTextBoxKeyDown: function(e) {
		if (e.keyCode == 9) {
			this.submitButton.focus();
			Event.stop(e);
		}
	},

	submitButtonClick: function() {
		if (this.messageTextbox.value != '') {
			this.submitButton.disabled = true;
			this.submitButton.value = 'Please wait..';
			var params = {
				method: 'writemessage',
				username: this.options.recieverUsername,
				userID: this.options.recieverUserID,
				parentID: this.options.parentID,
				message: this.messageTextbox.value,
				isPrivate: this.privateCheckBox.checked,
				isAdmin: this.adminCheckBox.checked
			}
			if (this.selectedGift > 0) {
				params.giftID = this.selectedGift;
			}
			if (this.smsProduct != '' && this.smsOnAnswerCheckBox.checked) {
				params.smsProduct = this.smsProduct;
			}
			if (!this.recieverCanReply) {
				if (confirm('The user you are writing can not respond to your message, because the user is not within the age group you have defined for your profile, or because the user is not friends with you. \r\nAre you sure you wish to post this message anyway?')) {
					new Ajax.Request('/section/user/profile/guestbook/guestbookajax.ashx', { parameters: params, onComplete: this.messageAddedHandler.bind(this) });
					this.timeout = setTimeout(this.messageAddedTimeoutHandler.bind(this), 5000);
				}
			} else {
				new Ajax.Request('/section/user/profile/guestbook/guestbookajax.ashx', { parameters: params, onComplete: this.messageAddedHandler.bind(this) });
				this.timeout = setTimeout(this.messageAddedTimeoutHandler.bind(this), 5000);
			}
		} else {
			alert('You have to write a message first :)');
		}
	},

	messageAddedHandler: function(response) {
		clearTimeout(this.timeout);
		var result = eval('(' + response.responseText + ')');
		if (result.Success) {
			//alert(this.mainElement.getHeight());
			//this.mainElement.setStyle({ height: (this.mainElement.getHeight() * 1.5) + 'px' });
			this.showMessageSentInfo();
			//location.href = '/section/user/profile/guestbook/?id=' + result.UserID;
		} else {
			if (result.CreditsError) {
				var smsCPrice = CurrentUser.vip ? this.prices.SmsVip : this.prices.Sms;
				CreditConfirmBox.show(smsCPrice, result.Balance);
			} else {
				alert(result.ErrorMessage);
			}
			this.submitButton.disabled = false;
			this.submitButton.value = 'Add message';
		}
	},

	showMessageSentInfo: function() {
		//this.infobox.body.setStyle({ height: '300px' });
		this.infobox.titleElm.nodeValue = 'The message has been sent! Here are the users latest activities:';

		var activities = new Element('iframe', {
			frameborder: 'no',
			marginheight: 0,
			marginwidth: 0,
			width: '600',
			height: '300',
			allowTransparency: true,
			src: '/section/user/activity/ActivityFrame.aspx?userid=' + this.options.recieverUserID + '&top=10'
		});
		this.infobox.body.update(activities);

		var wrapper = new Element('div').setStyle({ marginTop: '5px', marginBottom: '5px' });
		var btn = new ArtoButton('Close', {
			width: '100%',
			buttonClass: 'Green',
			onClick: this.close.bind(this)
		});
		wrapper.update(btn);
		this.infobox.body.insert(wrapper);

		this.enterObserver = document.observe('keydown', function(e) {
			e = e || event;
			if (e.keyCode == 13) {
				this.close();
			}
		} .bind(this));
	},

	messageAddedTimeoutHandler: function() {
		alert('The server is not responding at the moment. Wait a moment before you try to send your message again.');
		this.submitButton.disabled = false;
		this.submitButton.value = 'Add message';
	},

	insertSmiley: function(shortcut) {
		if (this.messageTextbox.value == '') {
			this.messageTextbox.value += shortcut;
		} else {
			this.messageTextbox.value += ' ' + shortcut;
		}
	},

	close: function() {
		if (this.enterObserver) {
			try {
				Event.stopObserving('keydown', this.enterObserver);
			} catch (e) { }
		}
		this.mainElement.remove();
		GuestbookReplySystem.ActiveBox = null;
	},

	getCloseButton: function() {
		return new Element('img', {
			src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/kvikchat/window_close.png',
			'class': 'cursorHand'
		}).setStyle({
			width: '15px',
			height: '15px',
			borderWidth: '0px'
		}).observe('click', this.close.bind(this));
	},

	giftClicked: function() {
		if (GuestbookReplySystem.smsPanel && GuestbookReplySystem.smsPanel.visible) {
			GuestbookReplySystem.smsPanel.close();
			this.smsOnAnswerCheckBox.checked = !this.smsOnAnswerCheckBox.checked;
		}
		if (this.attachGiftCheckBox.checked) {
			var offsets = document.viewport.getScrollOffsets();
			var dim = document.viewport.getDimensions();
			var pos = {
				left: (dim.width / 2) - 320,
				top: offsets.top + 100
			};
			if (GuestbookReplySystem.giftPanel) {
				GuestbookReplySystem.giftPanel.show()
				GuestbookReplySystem.giftPanel.setStyle({ top: pos.top + 'px', left: pos.left + 'px' });
			}
			else {
				var container = new Element('div').update(
					new Element('iframe', {
						src: '/section/giftshop/giftsframe.aspx?id=' + Arto.GetParam("id"),
						frameborder: 0
					}).setStyle({
						width: '600px',
						height: '400px'
					})
				);
				this.giftSelectionFunction = window.setGiftSelection;
				window.setGiftSelection = function(gift) {
					this.selectedGift = gift.id;
					this.attachedGiftSpan.update(
						new Element('img', { src: gift.image }).setStyle({ width: '16px', height: '16px', verticalAlign: 'middle' })
					).setStyle({ paddingLeft: '5px' });
					if (this.giftSelectionFunction) {
						window.setGiftSelection = this.giftSelectionFunction;
					}
				} .bind(this);
				this.closeGiftFunction = window.closeGiftWindow;
				window.closeGiftWindow = function() {
					if (GuestbookReplySystem.giftPanel && GuestbookReplySystem.giftPanel.visible()) {
						GuestbookReplySystem.giftPanel.hide();
					}
					if (this.closeGiftFunction) {
						window.closeGiftWindow = this.closeGiftFunction;
					}
				};
				var infobox = new InfoBox('Select gift', container, { 'useAltHeader': true, className: 'shadowBox', width: 648, altContent: this.getGiftCloseButton() });
				GuestbookReplySystem.giftPanel = new Element('div').setStyle({
					position: 'absolute',
					top: pos.top + 'px',
					left: pos.left + 'px',
					zIndex: '10000'
				}).update(infobox.getInfoBox());
				$(document.body).insert(GuestbookReplySystem.giftPanel);
			}
		}
		else {
			this.selectedGift = -1;
			this.attachedGiftSpan.update();
			this.attachedGiftSpan.setStyle({ paddingLeft: '0px' })
			if (GuestbookReplySystem.giftPanel && GuestbookReplySystem.giftPanel.visible) {
				GuestbookReplySystem.giftPanel.hide();
			}
		}
	},

	getGiftCloseButton: function() {
		return new Element('img', {
			src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/kvikchat/window_close.png',
			'class': 'cursorHand',
			title: 'Close'
		}).setStyle({
			width: '15px',
			height: '15px',
			borderWidth: '0px'
		}).observe('click', function() {
			this.selectedGift = -1;
			this.attachedGiftSpan.update();
			this.attachedGiftSpan.setStyle({ paddingLeft: '0px' });
			this.attachGiftCheckBox.checked = false;
			GuestbookReplySystem.giftPanel.hide();
		} .bind(this));
	},

	smsClicked: function() {
		if (GuestbookReplySystem.giftPanel && GuestbookReplySystem.giftPanel.visible()) {
			GuestbookReplySystem.giftPanel.hide();
			this.attachGiftCheckBox.checked = !this.attachGiftCheckBox.checked;
		}

		if (this.smsOnAnswerCheckBox.checked) {
			if (!GuestbookReplySystem.smsPanel) {
				var creditLogo = CurrentUser.vip ? '<img src="http://artogfx.cloud2.artodata.com/sitegfx/gfx/credits/creditVIP_19x19.png" align="absmiddle" />' : '<img src="http://artogfx.cloud2.artodata.com/sitegfx/gfx/credits/credit_19x19.png" align="absmiddle" />';
				var smsCPrice = CurrentUser.vip ? this.prices.SmsVip : this.prices.Sms;
				GuestbookReplySystem.smsPanel = new Panel.BasePanel(
					new Element('div').setStyle({ width: '250px', height: '110px', padding: '5px' }).insert(
						new Element('div').update('How often do you want to receive an SMS when the user writes in your guestbook? - The charge is ' + creditLogo + '' + smsCPrice + ' per message. If your account does not hold any credits, the charge is 1 DKK per message')
					).insert(
						new Element('table', { cellPadding: 0, cellSpacing: 0 }).insert(
							new Element('tbody').insert(
								new Element('tr').insert(
									new Element('td').insert(
										new Element('input', {
											'type': 'radio',
											'name': 'smsRadio',
											'id': 'onceRadio',
											'class': 'inputCheckbox'
										}).observe('click', function() {
											if ($('onceRadio').checked) {
												this.smsProduct = 'Once';
												this.smsProductSpan.update(' (1 time)');
												setTimeout(function() {
													$('onceRadio').checked = true;
													GuestbookReplySystem.smsPanel.close();
												} .bind($('onceRadio')), 1);
											}
										} .bind(this))
									)
								).insert(
									new Element('td').update('1 time')
								)
							).insert(
								new Element('tr').insert(
									new Element('td').insert(
										new Element('input', {
											'type': 'radio',
											'name': 'smsRadio',
											'id': 'alwaysRadio',
											'class': 'inputCheckbox'
										}).observe('click', function() {
											if ($('alwaysRadio').checked) {
												this.smsProduct = 'Always';
												this.smsProductSpan.update(' (every time)');
												setTimeout(function() {
													$('alwaysRadio').checked = true;
													GuestbookReplySystem.smsPanel.close();
												} .bind($('alwaysRadio')), 1);
											}
										} .bind(this))
									)
								).insert(
									new Element('td').update('Every time')
								)
							)
						)
					)
				);
				GuestbookReplySystem.smsPanel.sticky = true;
			}
			var offset = this.smsOnAnswerCheckBox.cumulativeOffset();
			GuestbookReplySystem.smsPanel.showAtPosition(null, offset.left, offset.top + this.smsOnAnswerCheckBox.getHeight() + 5);
		}
		else {
			this.smsProduct.value = 'invalid';
			this.smsProductSpan.update();
			if (GuestbookReplySystem.smsPanel && GuestbookReplySystem.smsPanel.visible) {
				GuestbookReplySystem.smsPanel.close();
			}
		}
	},

	showExampleClick: function() {
		new Ajax.Request('/section/user/profile/guestbook/guestbookajax.ashx', { parameters: { method: 'getpreview', message: this.messageTextbox.value }, method: 'POST', onComplete: this.showExample.bind(this) });
	},

	showExample: function(response) {
		var ajaxresult = eval('(' + response.responseText + ')');
		var userBGColor = ajaxresult.BackGroundColor;
		var userFontColor = ajaxresult.FontColor;
		var userFont = 'font-familty: ' + ajaxresult.Font + ', Verdana;';
		var userBGImage = this.getBackGroundImage(ajaxresult.BackGroundImage);

		var dateObj = new Date();
		var result = '';
		result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" style="border-top: 1px solid #' + userFontColor + '; background-color: #' + userBGColor + '; ' + userBGImage + ' color: #' + userFontColor + '">';
		result += '	<tr>';
		result += '		<td nowrap="nowrap" height="18">';
		result += '			<div style="width: 100%; overflow: hidden;">';
		result += '				<table border="0" cellpadding="0" cellspacing="0">';
		result += '					<tr>';
		result += '						<td nowrap="nowrap" style="color:#' + userFontColor + ';">';
		result += '							<b>&nbsp;Today, ' + dateObj.getHours() + ':' + dateObj.getMinutes() + ':</b>';
		result += '						</td>';
		result += '						<td nowrap="nowrap" style="color:#' + userFontColor + ';">';
		result += '							&nbsp;<b><img class="userOnlineIcon cursorHand" src="http://artogfx.cloud2.artodata.com/sitegfx/grafik/spacer.gif" align="absmiddle" style="margin:1px 3px 0px 0px;float:none;" /><a onmouseover="CallingCard.Show(' + CurrentUser.id + ');" onmouseout="CallingCard.Hide(' + CurrentUser.id + ');" href="/section/user/profile/?id=' + CurrentUser.id + '">' + CurrentUser.username + '</a><span style="margin-left:3px;">' + CurrentUser.sexAge + '</span>' + (CurrentUser.vip ? '<a title="' + CurrentUser.username + ' has a VIP profile - Click and read more..." href="/section/user/vip/?ref=%2fsection%2fuser%2fprofile%2fguestbook%2fdefault.aspx" style="margin-left:3px;">VIP</a>' : '') + '</b>';
		result += '						</td>';
		result += '					</tr>';
		result += '				</table>';
		result += '			</div>';
		result += '		</td>';
		result += '	</tr>';
		result += '</table>';
		result += '<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" style="border-top: 1px solid #' + userFontColor + '; background-color: #' + userBGColor + '; ' + userBGImage + ' color: #' + userFontColor + '">';
		result += '	<tr>';
		result += '		<td>';
		if (CurrentUser.gotPicture) {
			result += '		<a href="/section/user/profile/?id=' + CurrentUser.id + '"><img src="' + Arto.GetProfileImagePath(CurrentUser.id, true, CurrentUser.pictureUpdatedTime, ProfileImageSize.Small) + '" border="0" align="right" alt="' + CurrentUser.username + '" style="margin-left: 10px;" /></a>';
		}
		result += '			<div style="padding: 10px;' + userFont + '">';
		result += ajaxresult.ProcessedMessage;
		result += '			</div>';
		result += '		</td>';
		result += '	</tr>';
		result += '</table>';
		this.exampleDiv.update(result);
		this.exampleDiv.show();
		this.exampleButton.cell.update('Update example');
	},

	getBackGroundImage: function(src) {
		if (parseInt(src) > 0) {
			return 'background-image: url(http://smilies.artodata.com/gfx/textures/' + src + '.jpg);';
		} else {
			return '';
		}
	},

	getSmileyBox: function() {
		var table = new Element('table', { cellpadding: 0, cellspacing: 2 }).insert(
			new Element('tbody').insert(
				new Element('tr').insert(
					new Element('td').update(':)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':)'))
					)
				).insert(
					new Element('td').update(':I')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_blush.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':I'))
					)
				).insert(
					new Element('td').update('8)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_shy.png', alt: '' }).observe('click', this.insertSmiley.bind(this, '8)'))
					)
				)
			).insert(
				new Element('tr').insert(
					new Element('td').update(':D')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_big.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':D'))
					)
				).insert(
					new Element('td').update('8D')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_cool.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, '8D'))
					)
				).insert(
					new Element('td').update(':o)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_clown.png', alt: '' }).observe('click', this.insertSmiley.bind(this, ':o)'))
					)
				)
			).insert(
				new Element('tr').insert(
					new Element('td').update(';)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_wink.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ';)'))
					)
				).insert(
					new Element('td').update(':P')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_tongue.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':P'))
					)
				).insert(
					new Element('td').update(':x')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_kisses.png', alt: '' }).observe('click', this.insertSmiley.bind(this, ':x'))
					)
				)
			).insert(
				new Element('tr').insert(
					new Element('td').update('::)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'nye_rolleyes.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, '::)'))
					)
				).insert(
					new Element('td').update(':o!')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'nye_shocked.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':o!'))
					)
				).insert(
					new Element('td').update('I)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_sleepy.png', alt: '' }).observe('click', this.insertSmiley.bind(this, 'I)'))
					)
				)
			).insert(
				new Element('tr').insert(
					new Element('td').update(':-*')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'nye_kiss.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':-*'))
					)
				).insert(
					new Element('td').update('xx(')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_dead.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, 'xx('))
					)
				).insert(
					new Element('td').update(':o')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_shock.png', alt: '' }).observe('click', this.insertSmiley.bind(this, ':o'))
					)
				)
			).insert(
				new Element('tr').insert(
					new Element('td').update(':(')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_sad.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':('))
					)
				).insert(
					new Element('td').update('}:)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_evil.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, '}:)'))
					)
				).insert(
					new Element('td').update('B)')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_blackeye.png', alt: '' }).observe('click', this.insertSmiley.bind(this, 'B)'))
					)
				)
			).insert(
				new Element('tr').insert(
					new Element('td').update(':\'(')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'nye_cry.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':\'('))
					)
				).insert(
					new Element('td').update(':(!')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'icon_smile_angry.png', alt: '' }).setStyle({ marginRight: '2px' }).observe('click', this.insertSmiley.bind(this, ':(!'))
					)
				).insert(
					new Element('td').update(':-[')
				).insert(
					new Element('td').insert(
						new Element('img', { src: this.options.smileyPath + 'nye_embarassed.png', alt: '' }).observe('click', this.insertSmiley.bind(this, ':-['))
					)
				)
			)
		);

		return table;
	}
});

/* File: /includes/js/framework/extensions/controls.js (Modified: 3. september 2010 12:30:56) */

window.isInFocus = true;
window.focusTime = new Date().getTime();
Event.observe(window, 'load', function() {
	window.loaded = true;
	window.orgDocTitle = document.title;
});
Event.observe(window, 'blur', function() {
	var now = new Date().getTime();
	if (now - window.focusTime > 500) {
		window.isInFocus = false;
	}
});
Event.observe(window, 'focus', function() {
	window.isInFocus = true;
	window.focusTime = new Date().getTime();
});

document.observe('blur', function() {
	window.isInFocus = false;
});
document.observe('focus', function() {
	window.isInFocus = true;
});

function emoticonAdd(e, guid, shortcut) {
	shortcut = shortcut || 'na';

	var panel = new Panel.DropDownMenu();
	panel.setSize(150);

	panel.menu.add(new Panel.MenuItem('Add to collection', { href: '/section/user/emoticons/?smiley=' + guid + '&shortcut=' + shortcut, iconPath: '/r3/gfx/icons/ven_dark.png' }));
	panel.menu.add(new Panel.MenuItem('My smilies', { href: '/section/user/emoticons/', iconPath: '/r3/gfx/icons/galleri_favorit.png' }));
	try {
		panel.showAtCursor(e);
	} catch (ex) { }
}

function RegisterTranslation(id) {
	try {
		RegTr(id);
	} catch (e) { }
}

var controls = new Array();
var noPx = document.childNodes ? 'px' : 0;

controls.getInstance = function(controlid) {
	return controls.find(function(o) {
		return o.id == controlid;
	})
}

controls.remove = function(obj) {
	for (i = controls.length - 1; i >= 0; i--) {
		if (controls[i].id == obj.id) {
			controls.splice(i, 1);
		}
	}
}

controls.print = function() {
	var result = "";
	for (i = controls.length - 1; i >= 0; i--) {
		result += i + ": " + controls[i].id + "\r\n";
	}
	alert(result);
}

var Queue = Class.create({
	initialize: function() {
		this.items = new Array();
	}
});

var MaxedArray = Class.create({
	initialize: function(size) {
		this.maxSize = size;
		this.items = new Array();
		this.length = this.items.length;
		this.onAdd = Prototype.emptyFunction;
	},

	add: function(item) {
		var a = this.length >= this.maxSize ? 2 : 1;
		for (i = this.items.length - a; i >= 0; i--) {
			this.items[i + 1] = this.items[i];
		}
		this.items[0] = item;
		this.length = this.items.length;
		try{this.onAdd(this, item);}catch(e){}
	},

	addRange: function(range) {
		for (var i = 0; i < range.length; i++) {
			this.add(range[i]);
		}
	},

	get: function(index) {
		return this.items[index];
	}

});

String.prototype.contains = function(val) {
	return this.indexOf(val) >= 0;
}
String.prototype.indexOfAny = function(list) {
	for (var i = 0; i < list.length; i++) {
		var index = this.indexOf(list[i]);
		if (index >= 0) {
			return index;
		}
	}
}
String.prototype.containsAny = function(list) {
	return this.indexOfAny(list) >= 0;
}

Array.prototype.contains = function(obj) {
	var i = this.length;
	while (i--) {
		if (this[i] === obj) {
			return true;
		}
	}
	return false;
}

Array.prototype.remove2 = function(from, to) {
  var rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  return this.push.apply(this, rest);
}

Date.prototype.toQueryStringFormat = function(withTime) {
	var result = this.getFullYear() + '-' + (this.getMonth() + 1) + '-' + this.getDate();
	if (withTime) {
		result += ' ' + this.getHours() + ':' + this.getMinutes();
	}
	return encodeURIComponent(result);
};
Date.prototype.toUTCQueryStringFormat = function(withTime) {
	var result = this.getFullYear() + '-' + this.getMonth() + '-' + this.getDate();
	return encodeURIComponent(this.getUTCFullYear() + '-' + (this.getUTCMonth() + 1) + '-' + this.getUTCDate() + ' ' + this.getUTCHours() + ':' + this.getUTCMinutes());
};
Date.prototype.toUTCTime = function() {
	return Date.UTC(
		this.getFullYear(),
		this.getMonth(),
		this.getDate(),
		this.getHours(),
		this.getMinutes(),
		this.getSeconds(),
		this.getMilliseconds()
	);
};
Date.prototype.toLocaleDate = function() {
	return new Date(this.toUTCTime());
};

Number.prototype.decimalRound = function(dec) {
	return Math.round(this * Math.pow(10, dec)) / Math.pow(10, dec);
}

var emailRegex = new RegExp("^\\w+(?:[-+.]\\w+)*@\\w+(?:[-.]\\w+)*\\.\\w+(?:[-.]\\w+)*$");
String.prototype.isEmail = function() {
	return emailRegex.test(this);
}

function GetCurrentTimeZoneName() {
	var timezoneRegex = new RegExp("\\((.*?)\\)");
	return timezoneRegex.exec(new Date().toString())[1];
}

var ServerUrl = {
	GfxServer: 'http://gfx.artodata.com',
	ProfileVideoServer: 'http://video.artodata.com/data/user/profilevideo'
}

function SetImage(obj, src, scale) {
	if (Prototype.Browser.IE6 == true) {
		var scale = scale ? ", sizingMethod=scale" : "";
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + src + scale + ");";
	}
	else {
		obj.style.background = "url('" + src + "')";
	}
}

function GetImageTag(src, scale, title, onclick, id) {
	var OResult = "<img src=";
	if (Prototype.Browser.IE6 == true) {
	    OResult += "'http://artogfx.cloud2.artodata.com/sitegfx/grafik/spacer.gif'";
		var scale = scale ? ", sizingMethod=scale" : "";
		OResult += " style='_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + src + scale + "); position: relative;'";
	}
	else {
		OResult += "'" + src + "'";
	}
	OResult += title ? " title='" + title + "'" : "";
	OResult += onclick ? " onclick='" + onclick + "'" : "";
	OResult += id ? " id='" + id + "'" : "";
	OResult += id ? " id='" + id + "'" : "";
	OResult += " border='0' />";
	return OResult;
}

function DaysInMonth(month, year) {
	return 32 - new Date(year, month, 32).getDate();
}


/* onDOMLoaded */
var DOMLoadedListeners = new Array();
var DOMLoadedDone = false;
function addDOMLoadedListener(listener) {
	DOMLoadedListeners[DOMLoadedListeners.length] = listener;

	if (DOMLoadedListeners.length == 1) { //Only do this once
		// Mozilla/FireFox
		if (document.addEventListener) {
			document.addEventListener('DOMContentLoaded', handleDOMLoaded, false);
		}
		else if (Prototype.Browser.IE) {
			setTimeout('checkIEDOMLoaded()', 100);
		}
		else {
			window.onload = handleDOMLoaded;
		}
	}
}
function checkIEDOMLoaded() {
	if (/loaded|complete|interactive/.test(document.readyState)) {
		handleDOMLoaded();
	}
	else {
		setTimeout('checkIEDOMLoaded()', 100);
	}
}
function handleDOMLoaded() {
	if (DOMLoadedDone) return;

	DOMLoadedDone = true;

	DOMLoadedListeners.each(function(obj) { obj(); });
}

var WindowPos = {
	getWidth: function() {
		if (Prototype.Browser.IE) {
			return document.body.offsetWidth;
		}
		else {
			return window.innerWidth;
		}
	},

	getHeight: function() {
		if (Prototype.Browser.IE) {
			return document.body.offsetHeight;
		}
		else {
			return window.innerHeight;
		}
	}
};


/* Extend Prototype Position object */
var Pos = {
	regionLeft: function(element) {
		return Position.cumulativeOffset(element)[0];
	},

	regionRight: function(element) {
		return Position.cumulativeOffset(element)[0] + parseInt(element.style.width);
	},

	regionTop: function(element) {
		return Position.cumulativeOffset(element)[1];
	},

	regionBottom: function(element) {
		return Position.cumulativeOffset(element)[1] + parseInt(element.style.height);
	},

	regionMiddleX: function(element) {
		return Position.cumulativeOffset(element)[0] + (parseInt(element.style.width) / 2);
	},

	regionMiddleY: function(element) {
		return Position.cumulativeOffset(element)[1] + (parseInt(element.style.height) / 2);
	}
};


/* Static Arto JS Functions */
var ProfileImageSize = { Tiny: 1, Small: 2, Medium: 3, Large: 4 };
var Arto = {
	Banner: {
		WriteScriptFile: function(url){
			document.write('<scr' + 'ipt type="text/javascript" src="' + url + '"></scr' + 'ipt>');
		}
	},

	GetCookie: function(c_name) {
		if (document.cookie.length > 0) {
			c_start = document.cookie.indexOf(c_name + "=");
			if (c_start != -1) {
				c_start = c_start + c_name.length + 1;
				c_end = document.cookie.indexOf(";", c_start);
				if (c_end == -1) c_end = document.cookie.length;
				return unescape(document.cookie.substring(c_start, c_end));
			}
		}
		return "";
	},


	SetCookie: function(c_name, value, expiredays) {
		var exdate = new Date(); exdate.setDate(exdate.getDate() + expiredays);
		document.cookie = c_name + "=" + escape(value) +
    ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
	},

	ShowGalleryImage: function(id, options) {
		if (typeof (options) == 'object') {
			this.OpenPopup('/section/user/profile/gallery/viewentry/?id=' + id + '&' + Object.toQueryString(options), 'galleryimage', { width: 973, height: 615 });
		}
		else {
			this.OpenPopup('/section/user/profile/gallery/viewentry/?id=' + id, 'galleryimage', { width: 973, height: 615 });
		}
	},

	ShowInsertImageBox: function(elementID) {
		new InsertImageBox(elementID);
	},

	OpenUserLanguagePopUp: function(tagid, querystring) {
		if (tagid != '') {
			this.OpenPopup('/section/language/popup.aspx?tagid=' + tagid, 'LanguagePopup', { width: 440, height: 500 }, { toolbar: 'no' });
			//this.OpenPopup('/section/language/popup.aspx?visible=' + tagid + '&hidden=' + tagid, 'LanguagePopup', { width: 440, height: 500 }, { toolbar: 'yes' });
		}
		else {
			this.OpenPopup('/section/language/popup.aspx' + querystring, 'LanguagePopup', { width: 440, height: 500 }, { toolbar: 'no' });
		}
	},

	OpenTranslatorLanguagePopUp: function(tagid, sourcelanguage, targetlanguage, querystring) {
		var browserName = navigator.appName;
		var height = 0;
		if (tagid != '') {
			if (browserName == 'Microsoft Internet Explorer') {
				height = 618;
			}
			else {
				height = 593;
			}
			if (sourcelanguage != '' && targetlanguage != '') {
				this.OpenPopup('/section/language/admin/popup.aspx?tagid=' + tagid + "&sl=" + sourcelanguage + "&tl=" + targetlanguage, 'Language2Popup', { width: 800, height: height }, { toolbar: 'no' });
			}
			else {
				this.OpenPopup('/section/language/admin/popup.aspx?tagid=' + tagid, 'Language2Popup', { width: 800, height: height }, { toolbar: 'no' });
			}
			//this.OpenPopup('/section/language/admin/popup.aspx?visible=' + tagid + '&hidden=' + tagid, 'LanguagePopup', { width: 440, height: 500 }, { toolbar: 'yes' });
		}
		else {
			if (browserName == 'Microsoft Internet Explorer') {
				heigt = 515;
			}
			else {
				height: 500;
			}
			this.OpenPopup('/section/language/admin/popup.aspx' + querystring, 'Language2Popup', { width: 800, height: height }, { toolbar: 'no' });
		}
	},

	GetProfileImagePath: function(userid, pictureApproved, pictureUpdated, imageSize) {
		var folder = userid % 10000;
		var result = ArtoSettings.ImageServer;// 'http://' + (userid % 5) + '.gfx.artodata.com';
		pictureApproved = pictureApproved == true || pictureApproved == 'true';
		if (pictureApproved) {
			switch (imageSize) {
				case ProfileImageSize.Tiny:
					result += '/data/user/profile/tiny/' + folder + '/';
					break;
				case ProfileImageSize.Small:
					result += '/data/brugere/brugerbilleder/';
					break;
				case ProfileImageSize.Medium:
					result += '/data/user/profile/medium/' + folder + '/';
					break;
				case ProfileImageSize.Large:
					result += '/data/brugere/brugerbilleder/stor/';
					break;
				default:
					result += '/data/brugere/brugerbilleder/';
					break;
			}
		}
		else {
			switch (imageSize) {
				case ProfileImageSize.Tiny:
					return '/grafik/nopic_28x38.jpg';
					break;
				default:
					return '/grafik/nopic_105x145.jpg';
					break;
			}
		}
		var date = new Date(1997, 4, 4, 3, 2, 1);
		var updated = pictureUpdated;
		if(updated.getTime){
			updated = (updated - date) / 1000;
		}
		return result + userid + '.jpg?updated=' + updated;
	},

	GetParam: function(key) {
		if (this.params == null || typeof this.params == 'undefined') {
			this.SetParams();
		}
		return this.params.get(key.toLowerCase());
	},

	GetValidUrl: function(url) {
		return url.replace(/'/g, '');
	},

	IsValidUrl: function(url) {
		return new RegExp('^(?:https?):\/\/\\S+\.\\S+$', 'g').test(url);
	},

	IsValidUrlProtocol: function(url) {
		return new RegExp('^(?:https?):\/\/', 'g').test(url);
	},

	OpenPopup: function(url, name, dim, settings) {
		var winSettings = Object.extend({
			scrollbars: 'yes',
			status: 1,
			resizable: 1,
			toolbar: 'no'
		}, settings);
		var pos = {
			left: (screen.width) ? (screen.width - dim.width) / 2 : 0,
			top: (screen.height) ? (screen.height - dim.height) / 2 : 0
		};
		var features = 'height=' + dim.height + ',width=' + dim.width + ',top=' + pos.top + ',left=' + pos.left + ',scrollbars=' + winSettings.scrollbars + ',status=' + winSettings.status + ',resizable=' + winSettings.resizable + ',toolbar=' + winSettings.toolbar;
		return window.open(url, name, features);
	},

	SetParams: function() {
		this.params = new Hash();
		var paramString = location.href.substr(location.href.indexOf('?') + 1);
		var regex = /\??(.*?)\=(.*?)(?:&|$)/g;
		var match;
		while (match = regex.exec(paramString)) {
			this.params.set(match[1].toLowerCase(), match[2].toLowerCase());
		}
	},

	ShowCustomTooltip: function(text, options) {
		var opt = Object.extend({
			width: 200,
			keepLinebreaks: true
		}, options);
		var data = new Element('div', { 'class': 'tdSpeciel2' }).setStyle({ padding: '5px' });
		data.appendChild(document.createTextNode(text));
		var tempWrapper = new Element('div');
		tempWrapper.appendChild(data);
		var dataHtml = opt.keepLinebreaks ? tempWrapper.innerHTML.replace('&lt;br /&gt;', '<br />') : tempWrapper.innerHTML;
		return overlib(dataHtml, NOCLOSE, WIDTH, opt.width, 0, BGCLASS, 'tdSpeciel2', FGCLASS, 'tdSpeciel2BlackBorder', TEXTSIZE, '9px');
	},

	HideCustomTooltip: function(text) {
		return nd();
	},

	SubmitCheck: function(ev, id) {
		if (ev.keyCode == 13) {
			$(id).click();
			return false;
		}
		return true;
	},

	GetTopDomain: function() {
		if (!this.topDomain) {
			var regex = new RegExp('([a-z0-9-]+\.[a-z0-9-]+)$');
			this.topDomain = regex.exec(document.domain)[1];
		}
		return this.topDomain;
	},

	GetOnlineInfo: function(online, onlineStatus) {
		var onlineClass;
		var onlineTitle;
		if (online) {
			switch (parseInt(onlineStatus)) {
				case 0:
					onlineClass = 'userOnlineIcon';
					onlineTitle = 'Online';
					break;
				case 1:
					onlineClass = 'userBusyIcon';
					onlineTitle = 'Busy';
					break;
				case 2:
					onlineClass = 'userAwayIcon';
					onlineTitle = 'Be right back';
					break;
				case 3:
					onlineClass = 'userAwayIcon';
					onlineTitle = 'Not available';
					break;
			}
		}
		else {
			onlineClass = 'userOfflineIcon';
			onlineTitle = 'Offline';
		}

		var onlineIcon = new Element('img', {
			'align': 'absmiddle',
			src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/spacer.gif'
		}).setStyle({ margin: '1 px 3px 0px 0px' });
		onlineIcon.addClassName(onlineClass);
		onlineIcon.title = onlineTitle;
		return { 'class': onlineClass, title: onlineTitle, icon: onlineIcon };
	},

	GetUsernameOnlineVIP: function(userid, username, online, onlineStatus, sexage, vip, options) {
		options = Object.extend({
			useCallingcard: true
		}, options);
		var wrapper = new Element('span');
		if (username && !username.empty()) {
			//			var onlineIcon = new Element('img', {
			//				'align': 'absmiddle',
			//				src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/spacer.gif'
			//			}).setStyle({ margin: '1 px 3px 0px 0px' });
			var onlineInfo = this.GetOnlineInfo(online, onlineStatus);
			//			onlineIcon.addClassName(onlineInfo.class);
			//			onlineIcon.title = onlineInfo.title;

			onlineInfo.icon.observe('click', function() {
				brugerPopup(userid, username);
			});
			wrapper.appendChild(onlineInfo.icon);

			var namelink = new Element('a', { href: '/section/user/profile/?id=' + userid });
			if (options.useCallingcard) {
				namelink.observe('mouseover', function() { CallingCard.Show(userid); });
				namelink.observe('mouseout', function() { CallingCard.Hide(userid); });
			}
			namelink.appendChild(document.createTextNode(username));
			wrapper.appendChild(namelink);

			if (sexage && !sexage.empty()) {
				var sexAge = new Element('span', { 'class': 'fontNote' }).setStyle({ marginLeft: '3px' });
				sexAge.appendChild(document.createTextNode(sexage));
				wrapper.appendChild(sexAge);
			}

			if (vip) {
				var vipLink = new Element('a', {
					title: '' + username + ' has a VIP profile - click and read more...',
					href: '/section/user/vip/?ref=' + escape(location.href),
					'class': 'fontNote'
				}).setStyle({ marginLeft: '3px' });
				vipLink.appendChild(document.createTextNode('VIP'));
				wrapper.appendChild(vipLink);
			}
		}
		else {
			var noUser = new Element('span').setStyle({ color: '#FF0000', fontWeight: 'bold' });
			noUser.appendChild(document.createTextNode('*slettet*'));
			wrapper.appendChild(noUser);
		}
		return wrapper;
	},

	UpdateLastRequest: function() {
		new Ajax.Request('/section/user/common/updateonlinestatus.ashx');
		new Ajax.Request('/r3/frames/ping.asp');
		setTimeout(Arto.UpdateLastRequest, 300000);
	},

	AddVideo: function(ref) {
		this.OpenPopup('http://encoder.arto.com/section/user/profile/video/admin/upload.aspx' + (ref ? '?ref=' + ref : ''), 'VideoUpload', { width: 500, height: 410 }, '');
	},

	AddIdolVideo: function(categoryID) {
		this.OpenPopup('http://encoder.arto.com/section/user/profile/video/admin/upload.aspx?referer=idol&categoryid=' + categoryID, 'VideoUpload', { width: 500, height: 400 }, '');
	},

	OpenSmileyPopup: function(textboxID, name) {
		var popName = name || 'smileyBox';
		if (typeof (textboxID) != 'undefined' && textboxID != '' && textboxID != null) {
			Arto.OpenPopup('/section/user/emoticons/insertsmiley.aspx?jsID=' + textboxID, popName, { width: 600, height: 500 }, { scrollbars: 'no' });
		}
		else {
			Arto.OpenPopup('/section/user/emoticons/insertsmiley.aspx', popName, { width: 600, height: 500 }, { scrollbars: 'no' });
		}
	},

	loadAdIFrameSrc: function(id, src) {
		Event.observe(window, 'load', function() {
			var date = new Date().getTime();
			src = src.replace("{nocache}", date);
			$(id).src = src;
		});
	},

	InPlaceEditor: function(element, url, overrideOptions, options, creditCheck) {
		Ajax.InPlaceEditor.prototype.__enterEditMode = Ajax.InPlaceEditor.prototype.enterEditMode;
		Object.extend(Ajax.InPlaceEditor.prototype, {
			enterEditMode: function(e) {
				this.__enterEditMode(e);
				this.triggerCallback('onFormReady', this._form);
			}
		});

		var optionsObject = {};
		var optionsDefault = {
			okControl: 'none',
			cancelControl: 'none',
			okText: "Save",
			savingText: "Saving...",
			clickToEditText: "Click here to edit the text, press \"Enter\" to save",
			onEnterHover: false,
			onLeaveHover: false,
			callback: function(form, value) { return (options.valueParamName || 'value') + '=' + encodeURIComponent(value); },
			onFormReady: function(form, value) {
				var elm = $(element + '-inplaceeditor').select('[class="editor_field"]')[0];
				elm.writeAttribute('maxlength', options.inputMaxLength || 2147483647);
				elm.title = options.inputTitle || "Press \"Enter\" to save";
				elm.style.width = options.inputWidth || '150px';
			},
			onComplete: function(transport, element) {
				return false;
				if (element.value) {
					element.value = transport.responseText;
				} else {
					element.update(transport.responseText);
				}
			},
			onFailure: function(element, transport) {
				if (creditCheck) {
					var errorObj = eval('(' + transport.responseText + ')');
					CreditConfirmBox.show(errorObj.price, errorObj.amount);
				}
			}
		}
		if (overrideOptions) {
			optionsObject = Object.extend(optionsObject, options);
		} else {
			optionsObject = Object.extend(optionsObject, optionsDefault);
			optionsObject = Object.extend(optionsObject, options);
		}

		new Ajax.InPlaceEditor(element, url, optionsObject);
	},

	showUserMenu: function(event, userID, username) {
		if (this.userDropDown) {
			this.userDropDown.close();
		}
		this.userDropDown = new Panel.DropDownMenu();
		this.userDropDown.menu.add(new Panel.MenuItem('Guest book', { href: '/section/user/profile/guestbook/?id=' + userID }));
		this.userDropDown.menu.add(new Panel.MenuItem('Gallery', { href: '/section/user/profile/gallery/?id=' + userID }));
		this.userDropDown.menu.add(new Panel.MenuItem('Groups', { href: '/section/user/profile/clubs/?id=' + userID }));
		this.userDropDown.menu.add(new Panel.MenuItem('Quizzes', { href: '/section/user/profile/quiz/?id=' + userID }));
		this.userDropDown.menu.add(new Panel.MenuItem('Friendbook', { href: '/section/user/profile/friendbook/?id=' + userID }));
		this.userDropDown.menu.add(new Panel.MenuItem('Friends', { href: '/section/user/profile/friends/?id=' + userID }));
		this.userDropDown.showAtCursor(event);
	},

	isSilverlightInstalled: function(minVer) {
		var ver = Arto.getSilverlightVersion();
		if (ver == -1) {
			return false;
		}
		minVer = minVer || 0;
		return ver >= minVer;
	},

	getSilverlightVersion: function() {
		var ver = -1;
		if (window.ActiveXObject) {
			try {
				var control = new ActiveXObject('AgControl.AgControl');
				for (var i = 1; i <= 20; i++) {
					if (control.IsVersionSupported(i + '.0')) {
						ver = i;
					}
					else {
						break;
					}
				}
				control = null;
			}
			catch (e) { }
		}
		else if (navigator.plugins) {
			var plugin = navigator.plugins["Silverlight Plug-In"];
			if (plugin) {
				if (plugin.description === '1.0.30226.2') {
					ver = 2;
				}
				else {
					ver = parseInt(plugin.description);
				}
			}
		}
		return ver;
	},

	showGuestbookReplyBox: function(userID, username, parentID, isAdmin) {
		new GuestbookReplySystem.GuestbookReplyBox({ recieverUserID: userID, recieverUsername: username, showAdminFeatures: isAdmin, parentID: parentID });
	},

	checkContentSafety: function(strElementID) {

		var ok = true;

		objElement = document.getElementById(strElementID);
		text = objElement.value;

		if (new RegExp("([a-zA-Z0-9_.-]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9-]+\\.)+))([a-zA-Z]{2,8}|[0-9]{1,3})(\\]?)", "i").test(text)) {
			alert("It looks like you are trying to give your e-mail/MSN adress to another user.\nPlease note that this can be dangerous for your safety.\n\nWe advise that you do not give out personal information.");
		}

		if (new RegExp("(\\s+|^)([0-9][0-9]\\s*?-*?){4,}", "i").test(text)) {
			alert("It looks like you are trying to give your phone number to another user.\nPlease note that this can be dangerous for your safety.\n\nWe advise that you do not give out personal information.");
		}
	}

};

var GuidFunc = {
	IsEmpty: function(guid) {
		return guid == '00000000-0000-0000-0000-000000000000';
	}
};

/* File: /includes/js/framework/infobox.js (Modified: 3. september 2010 12:30:56) */

var InfoBox = Class.create();
InfoBox.prototype = {
	initialize: function(title, content, options) {
		this.options = Object.extend({
			disableHeader: false,
			width: 192,
			height: 0,
			transparency: '',
			document: document,
			className: 'contentBox',
			useAltHeader: false,
			altContent: null
		}, options);
		this.title = title;
		this.content = content;
	},

	getInfoBox: function() {
		var table = this.options.document.createElement('table');
		table.cellPadding = '0';
		table.cellSpacing = '0';
		if (typeof this.options.width == 'string') {
			table.style.width = this.options.width;
		} else {
			table.style.width = this.options.width + 'px';
		}
		var tableBody = this.options.document.createElement('tbody');
		tableBody.appendChild(this.getBoxTopRow());
		if (!this.options.disableHeader) {
			tableBody.appendChild(this.getHeaderRow());
		}
		tableBody.appendChild(this.getContentRow());
		tableBody.appendChild(this.getBottomRow());
		table.appendChild(tableBody);
		return table;
	},

	getBoxTopRow: function() {
		var tr = this.options.document.createElement('tr');

		var left = this.options.document.createElement('td');
		left.className = this.options.className + 'TopLeft' + this.options.transparency;
		tr.appendChild(left);

		var middle = this.options.document.createElement('td');
		middle.className = this.options.className + 'TopMiddle' + this.options.transparency;
		tr.appendChild(middle);

		var right = this.options.document.createElement('td');
		right.className = this.options.className + 'TopRight' + this.options.transparency;
		tr.appendChild(right);

		return tr;
	},

	getHeaderRow: function() {
		var tr = this.options.document.createElement('tr');

		var left = this.options.document.createElement('td');
		left.className = this.options.className + 'Left' + this.options.transparency;
		tr.appendChild(left);

		var body = this.options.document.createElement('td');
		body.className = this.options.className + 'Body' + this.options.transparency;
		body.style.verticalAlign = 'top';
		body.appendChild(this.getHeaderTable());
		tr.appendChild(body);

		var right = this.options.document.createElement('td');
		right.className = this.options.className + 'Right' + this.options.transparency;
		tr.appendChild(right);

		this.header = tr;
		return tr;
	},

	getHeaderTable: function() {
		var table = this.options.document.createElement('table');
		table.cellPadding = '0';
		table.cellSpacing = '0';
		table.style.width = '100%';
		table.className = 'contentBoxHeaderBackground' + (this.options.useAltHeader ? 'Alt' : '');

		var tbody = this.options.document.createElement('tbody');
		var tr = this.options.document.createElement('tr');

		var title = this.options.document.createElement('td');
		title.align = 'left';
		//title.style.verticalAlign = 'top';
		title.className = 'contentBoxHeaderTitle' + (this.options.useAltHeader ? 'Alt' : '');
		this.titleElm = this.options.document.createTextNode(this.title);
		title.appendChild(this.titleElm);
		tr.appendChild(title);

		if (this.options.altContent) {
			var altContent = $(this.options.document.createElement('td'));
			altContent.align = 'right';
			altContent.setStyle({ verticalAlign: 'top' });
			altContent.className = 'contentBoxHeaderLinkTd' + (this.options.useAltHeader ? 'Alt' : '')
			altContent.update(this.options.altContent);
			tr.appendChild(altContent);
		}

		tbody.appendChild(tr);
		table.appendChild(tbody);
		return table;
	},

	getContentRow: function() {
		var tr = this.options.document.createElement('tr');

		var left = this.options.document.createElement('td');
		left.className = this.options.className + 'Left' + this.options.transparency;
		left.appendChild(this.getSpacerImg());
		tr.appendChild(left);
		var bodyElm = this.options.document.createElement('td');
		bodyElm.className = this.options.className + 'Body' + this.options.transparency;
		if (this.options.height > 0) {
			bodyElm.style.height = height + 'px';
		}
		if (typeof this.content == 'string') {
			bodyElm.innerHTML = this.content;
		}
		else {
			bodyElm.appendChild(this.content);
		}
		tr.appendChild(bodyElm);

		var right = this.options.document.createElement('td');
		right.className = this.options.className + 'Right' + this.options.transparency;
		right.appendChild(this.getSpacerImg());
		tr.appendChild(right);

		this.body = $(bodyElm);
		this.contentBody = bodyElm;
		return tr;
	},

	getSpacerImg: function() {
		var img = this.options.document.createElement('img');
		with (img.style) {
			width = '8px';
			height = '8px';
			borderWidth = '0px';
		}
		img.src = '/grafik/spacer.gif';
		return img;
	},

	getBottomRow: function() {
		var tr = this.options.document.createElement('tr');

		var left = this.options.document.createElement('td');
		left.className = this.options.className + 'BottomLeft' + this.options.transparency;
		tr.appendChild(left);

		var middle = this.options.document.createElement('td');
		middle.className = this.options.className + 'BottomMiddle' + this.options.transparency;
		tr.appendChild(middle);

		var right = this.options.document.createElement('td');
		right.className = this.options.className + 'BottomRight' + this.options.transparency;
		tr.appendChild(right);

		return tr;
	},

	setTitle: function(title) {
		this.titleElm.nodeValue = title;
	}
}

/* File: /Controls/CreditControls/CreditConfirmBox.js (Modified: 3. september 2010 12:30:54) */

var CreditConfirmBox = {
	element: null,

	show: function(purchaseAmount, accountBalance, options) {
		if (CreditConfirmBox.element) {
			CreditConfirmBox.element.remove();
		}
		CreditConfirmBox.element = new CreditConfirmBoxElement(purchaseAmount, accountBalance, options);
		CreditConfirmBox.element.show();
	}
};

var CreditConfirmBoxElement = Class.create({
	initialize: function(purchaseAmount, accountBalance, options) {
		this.options = Object.extend({
			width: 500,
			height: 200,
			text: null,
			onCancel: Prototype.emptyFunction,
			onBuy: Prototype.emptyFunction
		}, options);
		this.amount = purchaseAmount;
		this.balance = accountBalance;
		this._createElement();
	},

	_getInfoText: function() {
		if (this.options.text) {
			return this.options.text;
		}
		else {
			var creditLogo = '<img src="http://artogfx.cloud2.artodata.com/sitegfx/gfx/credits/credit_19x19.png" align="absmiddle" />';
			return 'Unfortunately, haven\'t got enough credits on your account.<br />You have chosen to buy for ' + creditLogo + '' + this.amount + ' but you only have ' + creditLogo + '' + this.balance + ' on your account. You may order more credits after which you can make the purchase.';
		}
	},

	_createElement: function() {
		var content = new Element('div', { 'class': 'salesBackgroundCredits' }).setStyle({
			padding: '10px 10px 0px 0px',
			width: this.options.width + 'px',
			height: this.options.height + 'px'
		}).insert(
			new Element('div', { 'class': 'vipHeaderTextAlt' }).setStyle({
				position: 'absolute',
				right: '28px',
				top: '36px',
				width: (this.options.width - 165) + 'px'
			}).update(this._getInfoText())
		).insert(
			new Element('table').setStyle({ position: 'absolute', bottom: '24px', right: '24px' }).update(
				new Element('tbody').update(
					new Element('tr').insert(
						new Element('td').update(
							new ArtoButton('Read more / order', { onClick: this._onBuyClicked.bind(this), buttonClass: 'LargeGreen' })
						)
					).insert(
						new Element('td').setStyle({ paddingLeft: '10px' }).update(
							new ArtoButton('Cancel', { onClick: this._onCancelClicked.bind(this), buttonClass: 'LargeGreen' })
						)
					)
				)
			)
		);

			var infobox = new InfoBox('', content, { disableHeader: true, className: 'shadowBox', width: this.options.width + 58 });
		content = infobox.getInfoBox();

		this.winDim = {
			width: Prototype.Browser.IE ? document.body.offsetWidth : window.outerWidth,
			height: Prototype.Browser.IE ? document.body.offsetHeight : window.outerHeight
		};
		var dim = document.viewport.getDimensions();
		var offsets = document.viewport.getScrollOffsets();
		var width = null, height = null, top = null, left = null;
		if (dim.width < this.options.width + 50) {
			if (Prototype.Browser.IE) {
				width = this.options.width + 80;
			}
			else {
				width = this.options.width + 50;
			}
			left = 25;
		}
		else {
			left = (dim.width / 2) - (this.options.width / 2) - 172;
			if (left <= 0) {
				left = 25;
			}
		}

		if (dim.height < this.options.height + 120) {
			if (dim.height < this.options.height) {
				height = this.options.height + 150;
				top = offsets.top + 25;
			}
			else {
				height = this.options.height + 120 + 50;
				top = offsets.top + 120;
			}
		}
		else {
			top = offsets.top + 120;
		}

		if (width || height) {
			width = width || dim.width;
			height = height || dim.height;
			window.resizeTo(width, height);
			this.resized = true;
		}
		//top: ((dim.height / 3) - (this.options.height / 2)) + 'px',
		//left: ((dim.width / 2) - (this.options.width / 2) - 172) + 'px',
		this.element = new Element('div').setStyle({
			position: 'absolute',
			zIndex: 9998,
			top: top + 'px',
			left: left + 'px',
			width: (this.options.width + 48) + 'px',
			height: (this.options.height + 48) + 'px'
		});
		this.element.insert(content);
	},

	show: function() {
		document.body.appendChild(this.element);
	},

	remove: function() {
		this.element.remove();
		if (this.resized) {
			if (Prototype.Browser.IE) {
				window.resizeTo(this.winDim.width + 30, this.winDim.height + 100);
			}
			else {
				window.resizeTo(this.winDim.width, this.winDim.height);
			}
		}
		CreditConfirmBox.element = null;
	},

	_onBuyClicked: function() {
		window.open('/section/credits/');
		this.remove();
		this.options.onBuy();
	},

	_onCancelClicked: function() {
		this.remove();
		this.options.onCancel();
	}
});

/* File: /Controls/CreditControls/CreditSystem.js (Modified: 3. september 2010 12:30:54) */

var CreditProduct = Class.create({
    initialize: function(controlid, id, price, hash) {
        this.controlid = controlid;
        this.id = id;
        this.price = price;
        this.hash = hash;
        this.bought = false;
    }
});

var CreditSystem = Class.create({
	initialize: function() {
		this.products = new Array();
		$(document.forms[0]).getInputs('hidden').each(function(input) {
			if (input.id && input.id.startsWith('__CREDIT_PRODUCT_')) {
				var elements = input.value.split(';');
				if (elements.length == 3) {
					var productid = parseInt(elements[0]);
					var price = parseInt(elements[1]);
					var hash = elements[2];

					this.products[this.products.length] = new CreditProduct(input.id, productid, price, hash);
				}
			}
		} .bind(this));
	},

	getProduct: function(id) {
		if (id == 0) {
			return new CreditProduct(0, 0, '');
		}
		var OResult = this.products.find(function(p) { return p.id == id });
		if (OResult == undefined) {
			return null;
		}
		return OResult;
	},

	getCurrentProducts: function(group) {
		var productresult = this.products.findAll(function(p) { return p.controlid.startsWith('__CREDIT_PRODUCT_' + group) });
		$(document.forms[0]).getElements().each(function(s) {
			if (s.id && s.id.startsWith('__CREDIT_DROPDOWN_' + group)) {
				if (s.value > 0) {
					var p = productresult.find(function(p) { return p.id == s.value });
					p.bought = true;
				}
			}
			if (s.id && s.id.startsWith('__CREDIT_RADIOBUTTON_' + group)) {
				if (s.checked == true) {
					var p = productresult.find(function(p) { return p.id == s.value });
					p.bought = true;
				}
			}
		});
		productresult.each(function(p) {
			var OControl = $('__CREDIT_CHECKBOX_' + group + "_" + p.id);
			if (OControl != undefined) {
				p.bought = OControl.checked;
			}
		});
		return productresult;
	},

	getJSONPostBody: function(group) {
		var productresult = this.getCurrentProducts(group);
		var result = productresult.toJSON();
		//Reset product items
		productresult.each(function(p) { p.bought = false; });
		return "CreditAjaxPostJSON=" + result;
	},

	checkBalance: function(group) {
		var OOptions = {
			method: 'post',
			postBody: this.getJSONPostBody(group),
			onSuccess: this.handleCheckResponse
		}
		new Ajax.Request("/Controls/CreditControls/CreditControlsAjax.ashx?m=checkBalance&g=" + group, OOptions);
	},

	checkSpecializedProduct: function(id) {
		var OOptions = { onSuccess: this.handleCheckResponse };
		new Ajax.Request('/Controls/CreditControls/CreditControlsAjax.ashx?m=checkSpecializedProduct&id=' + id, OOptions);
	},

	handleCheckResponse: function(t) {
		var OResult = eval('(' + t.responseText + ')');
		if (OResult && OResult.ReturnCode == 0 && OResult.Amount > OResult.Balance) {
			CreditConfirmBox.show(OResult.Amount, OResult.Balance);
		}
	},

	performAjaxPost: function(url, group, onSuccess) {
		var OOptions = {
			method: 'post',
			postBody: this.getJSONPostBody(group),
			onSuccess: onSuccess
		}
		new Ajax.Request(url, OOptions);
	},

	resetForm: function(group) {
		var productresult = this.getCurrentProducts(group);
		// Reset checkboxes
		productresult.each(function(p) {
			var OControl = $('__CREDIT_CHECKBOX_' + group + "_" + p.id);
			if (OControl != undefined) {
				OControl.checked = false;
			}
		});

		// Reset dropdowns
		$(document.forms[0]).getElements().each(function(s) {
			if (s.id && s.id.startsWith('__CREDIT_DROPDOWN_' + group)) {
				s.value = 0;
			}
		});

		// Reset radio buttons
		var OElements = $(document.forms[0]).getElements();
		for (var i = 0; i < OElements.length; i++) {
			var r = OElements[i];
			if (r.id && r.id.startsWith('__CREDIT_RADIOBUTTON_' + group)) {
				r.checked = true;
				break;
			}
		}
	}
});

var ArtoCreditSystem;

document.observe('dom:loaded', function() {
  ArtoCreditSystem = new CreditSystem();
});

/* File: /Controls/DonateBox/DonateBox.js (Modified: 3. september 2010 12:30:54) */

var DonateBox = Class.create({
	initialize: function(id, message, group, params, forcePositions) {
		this.id = id;
		this.message = message;
		this.group = group;
		this.controls = {
			image: $(id + '_DonateImage'),
			container: $(id + '_DonateContainer'),
			submitButton: $(id + '_SubmitButton'),
			closeButton: $(id + '_CloseButton'),
			okBox: $(id + '_OkMessageBox'),
			okButton: $(id + '_okButton')
		};
		this.params = Object.extend({
			itemID: 0,
			recieverUserID: 0,
			senderUserID: 0,
			categoryID: 0
		}, params);
		this.boxForcedPositions = Object.extend({
			left: -1,
			right: -1,
			top: -1
		}, forcePositions);
		this.visible = false;
		this.setEventListeners();
	},
	
	setPositions: function() {
		var screenWidth = Prototype.Browser.IE ? document.body.offsetWidth : window.outerWidth;
		var offsets = document.viewport.getScrollOffsets();
		var left = this.boxForcedPositions.left > 0 ? this.boxForcedPositions.left : Math.round(screenWidth / 2) - 250;
		var top = this.boxForcedPositions.top > 0 ? this.boxForcedPositions.top : offsets.top + 100;
		this.controls.container.setStyle({
			position: 'absolute',
			top: top + 'px',
			left: left + 'px'
		});
		this.controls.okBox.setStyle({
			position: 'absolute',
			top: top + 'px',
			left: left + 'px'
		});
	},

	showElement: function(e) {
		this.setPositions();
		this.visible = true;
		this.controls.container.style.display = '';
		ArtoCreditSystem.initialize();
	},

	hideElement: function() {
		this.visible = false;
		this.controls.container.style.display = 'none';
		this.controls.okBox.style.display = 'none';
	},

	showOkBox: function() {
		this.setPositions();
		this.controls.container.style.display = 'none';
		this.controls.okBox.style.display = '';
	},

	onClick: function() {
		if (this.visible) {
			this.hideElement();
		} else {
			this.showElement();
		}
	},

	submit: function() {
		var querystring = '?' + Object.toQueryString(this.params);
		ArtoCreditSystem.performAjaxPost('/controls/donatebox/donateboxajax.ashx' + querystring, this.group, this.onSuccess.bind(this));
	},

	onSuccess: function(response) {
		var result = eval('(' + response.responseText + ')');
		if (result.success) {
			ArtoCreditSystem.resetForm(this.group);
			this.showOkBox();
		} else {
			if (result.fundsError) {
				var creditLogo = '<img src="http://artogfx.cloud2.artodata.com/sitegfx/gfx/credits/credit_19x19.png" align="absmiddle" />';
				CreditConfirmBox.show(result.price, result.balance, { text: 'Unfortunately, you haven\'t got enough credits on your account.<br /><br />You have chosen to donate ' + creditLogo + '' + result.price + ' but you only have ' + creditLogo + '' + result.balance + ' on your account. You may order more credits after which you can make the donation.' });
			} else {
				alert(result.error);
			}
		}
	},

	setEventListeners: function() {
		Event.observe(this.controls.image, 'click', this.onClick.bind(this));
		Event.observe(this.controls.submitButton, 'click', this.submit.bind(this));
		Event.observe(this.controls.okButton, 'click', this.hideElement.bind(this));
		Event.observe(this.controls.closeButton, 'click', this.hideElement.bind(this));
	}
});

/* File: /includes/js/framework/callingcard.js (Modified: 3. september 2010 12:30:56) */

var CallingCard = {
	Show: function (userid, isUsername) {
		if (!CallingCard.cards.contains(userid)) {
			CallingCard.cards.set(userid, new CallingCardContent(userid, isUsername));
		}
		CallingCard.cards.get(userid).show();
	},

	Hide: function (userid) {
		var card = CallingCard.cards.get(userid);
		if (card) {
			card.hide();
		}
	},

	ShowPicture: function (userid) {
		CallingCard.cards.get(userid).showPicture();
	},

	SetListeners: function (elm, userID) {
		elm = $(elm);
		elm.observe('mouseover', CallingCard.Show.curry(userID, false));
		elm.observe('mouseout', CallingCard.Hide.curry(userID));
		return elm;
	}
}
CallingCard.cards = new Hash();

var CallingCardContent = Class.create();
CallingCardContent.prototype = {
  initialize: function(userid, isUsername){
    this.userid = userid;
    this.isUsername = isUsername;
    this.user = null;
    this.content = null;
    this.callingcardRequested = false;
  },
  
  show: function(){
    this.hidden = false;
    if(!this.callingcardRequested && this.content == null){
			var params = this.isUsername ? 'username=' : 'id=';
      new Ajax.Request('/section/user/callingcard/CallingCardAjax.ashx?m=getcallingcard&' + params + this.userid, {onComplete: this.handleUser.bindAsEventListener(this)});
    }
    else if(this.callingcardRequested && this.content != null){
      this.displayCard();
    }
  },
  
  handleUser: function(response){
    this.callingcardRequested = true;
    this.user = eval('(' + response.responseText + ')');
    this.renderCard();
  },
  
  renderCard: function(){
    if(this.user.ID > 0){
      var table = document.createElement('table');
      var tbody = document.createElement('tbody');
      var tr = document.createElement('tr');
      
      tr.appendChild(this.getImageCell());
      tr.appendChild(this.getInfoCell());
      
      tbody.appendChild(tr);
      table.appendChild(tbody);
      var infobox = new InfoBox('', table, {disableHeader: true});
      this.content = infobox.getInfoBox();
      this.displayCard();
    }
  },
  
  getImageCell: function(){
    var td = document.createElement('td');
    var wrapper = document.createElement('div');
    wrapper.id = 'cc_picture_' + this.user.ID;
    with(wrapper.style){
      width = '54px';
      height = '72px';
    }
    
    wrapper.appendChild(this.getImage());
    td.appendChild(wrapper);
    return td;
  },
  
  getImage: function(){
    var img = new Image();
    with(img.style){
      width = '54px';
      height = '72px';
      borderWidth = '0px';
    }
    if(this.user.ImageApproved && this.user.ImageUpdatedTime.getTime() > 0){
			img.src = Arto.GetProfileImagePath(this.user.ID, this.user.ImageApproved, this.user.ImageUpdatedTime, ProfileImageSize.Small);
      //img.src = ArtoSettings.ImageServer + '/data/brugere/brugerbilleder/' + this.user.ID + '.jpg?updated=' + this.user.ImageUpdatedTime.getTime();
    }
    else{
      img.src = '/grafik/photo_noPhoto.gif';
    }
    return img;
  },
  
  playVideo: function(){
    if(this.visible){
      var so = new SWFObject('http://artogfx.cloud2.artodata.com/sitegfx/components/mediaplayer/player_5.2.swf', 'mymovie', '54px', '72px', '8', true);
      so.addVariable("overstretch", "fit");
	    so.addVariable("autostart", true);
	    var prefix = this.user.ProfilevideoID.substr(0,3);
	    so.addVariable("file", ServerUrl.ProfileVideoServer + '/' + prefix + '/' + this.user.ProfilevideoID + ".flv");
	    so.addVariable("image", ServerUrl.ProfileVideoServer + '/' + prefix + '/' + this.user.ProfilevideoID + ".jpg");
	    so.addVariable("logo", "");
	    so.addVariable("type", "flv");
	    so.addVariable("displaywidth", 54);
	    so.addVariable("displayheight", 72);
	    so.addVariable("width", 54);
	    so.addVariable("height", 73);
	    try{
        so.write('cc_picture_' + this.user.ID);
      }catch(e){}
    }
  },
  
  getInfoCell: function(){
    var td = document.createElement('td');
    with(td.style){
      width = '100%';
      verticalAlign = 'top';
      fontSize = '9px';
    }
    
    td.appendChild(this.getUsernameBox());
    td.appendChild(this.getNameBox());
    td.appendChild(this.getGenderBox());
    td.appendChild(this.getRegionBox());
    td.appendChild(this.getPersonalBox());
    td.appendChild(this.getCprBox());
    
    return td;
  },
  
  getUsernameBox: function(){
    var wrapper = document.createElement('div');
    wrapper.className = 'boxListLine';
    with(wrapper.style){
      overflow = 'hidden';
      width = '100%';
      height = '12px';
    }

    var username = document.createElement('a');
    username.href = '/section/user/profile/?id=' + this.user.ID;
    username.appendChild(document.createTextNode(this.user.Username));
    wrapper.appendChild(username);
    
    if(this.user.VIP){
      var vip = document.createElement('a');
      vip.style.paddingLeft = '3px';
      vip.href = '/section/user/vip/';
      vip.appendChild(document.createTextNode('VIP'));
      wrapper.appendChild(vip);
    }
    
    return wrapper;
  },
  
  getNameBox: function(){
    var div = document.createElement('div');
    with(div.style){
      overflow = 'hidden';
      width = '100%';
      height = '12px';
      paddingTop = '2px';
    }
    div.appendChild(document.createTextNode(this.user.Firstname));
    if(this.user.Lastname != ''){
      div.appendChild(document.createTextNode(' ' + this.user.Lastname));
    }

    return div;
  },
  
  getGenderBox: function(){
    var div = document.createElement('div');
    div.style.paddingTop = '2px';
    if(this.user.Gender){
      div.appendChild(document.createTextNode('Girl, ' + this.user.Age + ' years'));
    }
    else{
      div.appendChild(document.createTextNode('Boy, ' + this.user.Age + ' years'));
    }
    return div;
  },
  
  getRegionBox: function(){
    var div = document.createElement('div');
    with(div.style){
      overflow = 'hidden';
      width = '100%';
      height = '12px';
      paddingTop = '2px';
      if(this.user.RegionID <= 0){
        display = 'none';
      }
    }
    div.appendChild(document.createTextNode(this.user.Region));
    return div;
  },
  
  getPersonalBox: function(){
    var div = document.createElement('div');
    with(div.style){
      overflow = 'hidden';
      width = '100%';
      height = '12px';
      paddingTop = '2px';
      if(this.user.PersonalStatusID == 1){
        display = 'none';
      }
    }
    div.appendChild(document.createTextNode(this.user.PersonalStatus));
    return div;
  },
  
  getCprBox: function(){
    var div = document.createElement('div');
    with(div.style){
      position = 'absolute';
      bottom = '10px';
      right = '5px';
      margin = '0px';
      padding = '0px';
    }
    div.className = (this.user.IrlVerified) ? 'irlIcon' : 'irlIconDisabled';
    return div;
  },
  
  showPicture: function(){
    $('cc_picture_' + this.user.ID).update();
    $('cc_picture_' + this.user.ID).appendChild(this.getImage());
  },
  
  displayCard: function(){
    if(this.user.ProfilevideoID != '00000000-0000-0000-0000-000000000000'){
      setTimeout(this.playVideo.bindAsEventListener(this), 2000);
    }
    
    var temp = document.createElement('div');
    temp.appendChild(this.content);
    this.visible = true;
    if(this.hidden === false){
      return overlib(temp.innerHTML, DELAY, 300, FULLHTML, VAUTO, HAUTO);
    }
  },
  
  hide: function(){
    this.visible = false;
    this.hidden = true;
    try{
      $('mymovie').sendEvent('stop');
    }catch(e){}
    return nd();
  }
}

function getUpdate(type, pr1, pr2, pid){
  if(pid != "null") {
		if((type == "state") && (pr1 != undefined)) { 
			if(pr1 == "3"){
			  CallingCard.ShowPicture(parseInt(pid));
			}
		}
	}
}

/* File: /includes/js/framework/OnlineStatus.js (Modified: 3. september 2010 12:30:56) */

var OnlineStatus = {
  ClassName: new Array('userOnlineArrowIcon','userBusyArrowIcon','userAwayArrowIcon','userAwayArrowIcon'),
  TitleText: new Array('Online','Busy','Be right back','Not available'),
  
  ShowMenu: function(status, elm){
    this.mouseOutInvoked = false;
    $(elm).observe('mouseout', function(){OnlineStatus.mouseOutInvoked = true});
    setTimeout(this._showMenu.bindAsEventListener(this, status, elm), 500);
  },
  
  _showMenu: function(e, status, elm, val4, val5){
    if(this.mouseOutInvoked == false){
      if(this.menu != null && typeof this.menu != 'undefined'){
        this.menu.show();
      }
      else{
        this.menu = new OnlineStatusMenu(status, {statusChanged:this._statusChanged.bindAsEventListener(this)});
        $('friendBoxWrapper').appendChild(this.menu.getMenu());
        this.menu.show();
        this.status = status;
      }
    }
  },
  
  _statusChanged: function(status){
    if(status == null || typeof status == 'undefined'){
      status = 0;
    }
    $('onlineStatus' + this.status).className = this.ClassName[status];
  }
};

var OnlineStatusMenu = Class.create();
OnlineStatusMenu.prototype = {
  initialize: function(status, options){
    this.options = Object.extend({
      tableClass: 'friendMenu',
      rowClass: 'menuRow',
      rowMOClass: 'menuRowMO',
      statusChanged: Prototype.emptyFunction
    }, options);
    this.status = status;
  },
  
  getMenu: function(){
    this.elm = new Element('table', {
      'class': this.options.tableClass,
      cellpadding: '3',
      cellspacing: '0'
    }).setStyle({
      position: 'absolute',
      zIndex: '500',
      top: '25px',
      right: '3px'
    }); 
    var tbody = new Element('tbody');
    tbody.appendChild(this._getStatusRow('userOnlineIcon', 'Online', 0));
    tbody.appendChild(this._getStatusRow('userBusyIcon', 'Busy', 1));
    tbody.appendChild(this._getStatusRow('userAwayIcon', 'Will be back soon', 2));
    tbody.appendChild(this._getStatusRow('userAwayIcon', 'Not present', 3));
    this.elm.appendChild(tbody);
    
    this.elm.observe('mouseout', this._elmMouseOut.bindAsEventListener(this));
    return this.elm;
  },
  
  _getStatusRow: function(icon, label, status){
    var row = new Element('tr', { 'class': this.options.rowClass });
    
    var iconCell = new Element('td').setStyle({width:'16px'});
    var icon = new Element('div').addClassName('friendlistUserIcon').addClassName(icon);
    iconCell.appendChild(icon);
    row.appendChild(iconCell);
    
    var labelCell = new Element('td', {colspan:2});
    if(status == this.status){
      labelCell.setStyle({fontWeight:'bold'});
      this.statusCell = labelCell;
    }
    labelCell.update(label);
    row.appendChild(labelCell);
    
    row.observe('click', this._handleOnClick.bindAsEventListener(this, labelCell, status));
    row.observe('mouseover', this._handleMouseOver.bindAsEventListener(this, row));
    row.observe('mouseout', this._handleMouseOut.bindAsEventListener(this, row));
    
    return row;
  },
  
  show: function(){
    this.elm.show();
  },
  
  hide: function(){
    this.elm.hide();
  },
  
  _elmMouseOut: function(e){
    var coords = {
      x: Event.pointerX(e || event),
      y: Event.pointerY(e || event)
    }
    if(!Position.within(this.elm, coords.x, coords.y)){
      this.hide();
    }
  },
  
  _handleOnClick: function(e, cell, status){
    new Ajax.Request('/section/user/friends/FriendsAjax.ashx?m=setstatus&status=' + status);
    this.status = status;
    this.statusCell.setStyle({fontWeight:'normal'});
    cell.setStyle({fontWeight:'bold'});
    this.statusCell = cell;
    this.options.statusChanged(status);
    this.hide();
  },
  
  _handleMouseOver: function(e, row){
    row.className = this.options.rowMOClass;
  },
  
  _handleMouseOut: function(e, row){
    row.className = this.options.rowClass;
    Event.stop(e);
  }
};


/* File: /includes/js/framework/profileadmin.js (Modified: 3. september 2010 12:30:56) */

var ProfileAdmin = {
  ShowMenu: function(userid){
		var bannerWrapper = $('sideBarTopBanner');
    if(bannerWrapper != null && typeof bannerWrapper != 'undefined'){
      //$('bannerWrapper').setStyle({height:'250px',width:'300px'});
      bannerWrapper.setStyle({padding:'8px 8px 8px 8px',height:'230px',width:'285px',textAlign:'left'});
      bannerWrapper.update();
      //$('bannerWrapper').appendChild(this._getLoader());
      //setTimeout(function(){
        new Ajax.Updater(bannerWrapper, '/section/user/profile/staff/?id=' + userid);
      //}, 800);
    }
  },
  
  _getLoader: function(){
    var table = new Element('table').setStyle({width:'100%',height:'100%'});
    var tbody = new Element('tbody');
    var row = new Element('tr');
    var cell = new Element('td', {align:'center'}).setStyle({height:'100%',verticalAlign:'middle'});
    var img = new Element('img', {src:'/grafik/ajax-loader_100.gif'}).setStyle({width:'100px',height:'100px'});
    cell.appendChild(img);
    row.appendChild(cell);
    tbody.appendChild(row);
    table.appendChild(tbody);
    return table;
  }
 };

/* File: /includes/JSPopup.js (Modified: 8. februar 2007 16:22:34) */

var win = null;

function PopWin(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	TopPosition = TopPosition-30 // -30 = kompenser for titellinje og statuslinje
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',status=no,resizable=1';
	win = window.open(mypage,myname,settings);
}

/* File: /includes/js/brugerPopup.js (Modified: 8. oktober 2008 12:02:24) */

function brugerPopup(id, brugernavn){
	var data;
	data = '<a href="JavaScript:KvikBesked(\''+ brugernavn +'\');">Send&nbsp;KvikBesked<a><br />';
	data += '<a href="JavaScript:GBbesked('+ id +', \''+ brugernavn + '\');">Skriv&nbsp;i&nbsp;g&aelig;stebog<a><br />';
	data += '<a href="/section/user/profile/guestbook/?id='+id+'" target="hovedside">Se&nbsp;g&aelig;stebog<a>';
	return overlib(data, STICKY, CENTER, NOCLOSE, WRAP, BGCLASS, 'tdTitel', FGCLASS, 'tdSpeciel2BlackBorder', CAPTIONFONTCLASS, 'fontTitel', TIMEOUT, 1000);
}

function profilPopup(userID){
	var data;
	data = '';
	data += '<table border="0" cellpadding="3" cellspacing="0" class="tdSpeciel2">';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="location.href=\'/section/user/profile/interests/?id='+ userID +'\';"><a href="/section/user/profile/interests/?id='+ userID +'">Interesser</a></td></tr>';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="location.href=\'/section/user/articles/article.aspx?brugerID='+ userID +'\';"><a href="/section/user/articles/article.aspx?brugerID='+ userID +'">Artikler</a></td></tr>';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="location.href=\'/section/user/profile/top10/?id='+ userID +'\';"><a href="/section/user/profile/top10/?id='+ userID +'">Top&nbsp;10<a></td></tr>';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="location.href=\'/brugere/kalender/?id='+ userID +'\';"><a href="/brugere/kalender/?id='+ userID +'">Kalender<a></td></tr>';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="location.href=\'/section/user/profile/questions/?id='+ userID +'\';"><a href="/section/user/profile/questions/?id='+ userID +'">20&nbsp;sp&oslash;rgsm&aring;l<a></td></tr>';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="openAlphabet('+ userID +');"><a href="JavaScript:openAlphabet('+ userID +');">Alfabet<a></td></tr>';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="location.href=\'/section/jokes/searchUser.aspx?id='+ userID +'\';"><a href="/section/jokes/searchUser.aspx?id='+ userID +'">Favorit&nbsp;vitser<a></td></tr>';
	data += '<tr><td class="tdGenerelMB2" style="cursor: pointer; cursor: hand;" onclick="window.open(\'/brugere/links/?id='+ userID +'\');"><a href="/brugere/links/?id='+ userID +'" target="_blank">Favorit&nbsp;links<a></td></tr>';
	data += '</table>';
	//alert(data);
	return overlib(data, STICKY, NOCLOSE, WIDTH, 100, FIXY, 76, FIXX, 540, BGCLASS, 'tdSpeciel2', FGCLASS, 'tdSpeciel2BlackBorder', TIMEOUT, 1000);
}

function openAlphabet(userID){
	PopWin('/section/user/profile/alphabet/?id='+ userID,'alfabet',390,300,'yes');
}

/* File: /includes/js/generelt.js (Modified: 28. oktober 2008 13:37:17) */

function setHome(objid) {
	if (document.all) {
		objid.style.behavior = 'url(#default#homepage)'; 
		objid.setHomePage('http://www.arto.com');
	} else {
		 alert ( "Denne funktion understøttes desværre kun af Internet Explorer" );
	}
}

function addFavorite() {
	if ( document.all ) {
		window.external.AddFavorite('http://www.arto.com', 'Arto - Venner, fællesskab & underholdning');
	} else {
		 alert ( "Denne funktion understøttes desværre kun af Internet Explorer" );
	}
}

function getPageHeight(){
	var pageHeight;
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		pageHeight = window.innerHeight + window.scrollMaxY;
	} else if (document.documentElement && document.documentElement.scrollHeight) {
		pageHeight = document.documentElement.scrollHeight;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		pageHeight = document.body.scrollHeight;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		pageHeight = document.body.offsetHeight;
	}
	return pageHeight;
}

function SwapBox2(id){
	if (document.getElementById("SwapPanel" + id).style.display=="") {
		new Effect.toggle($('SwapPanel' + id),'blind');
		var img = document.getElementById("SwapImage" + id); img.className = "dropDownOut";
	} else {
		new Effect.toggle($('SwapPanel' + id),'blind');
		var img = document.getElementById("SwapImage" + id); img.className = "dropDownIn";
	}
}

var win = null;

function PopWin(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',status=1,resizable=1'
	win = window.open(mypage,myname,settings)
}

function KvikBesked(brugernavn){
	PopWin('/section/user/profile/mail/message.aspx?fc=0&recipient=' + brugernavn,'QuickMessage',666,524,'no');
}

function GBbesked(BrugerID, brugernavn){
	PopWin('/section/user/profile/guestbook/answerpopup.aspx?id=' + BrugerID + '&username=' + brugernavn + '&fc=0','Guestbook',620,170,'no');
}

function billede(id){
	PopWin('/brugere/billedgalleri/billedeResize.asp?id=' + id,'Galleribillede',600,500,'no');
}

function indsaetBillede(){
	PopWin('/section/user/profile/gallery/insertpicture.aspx?fc=0','Billede',350,450,'yes');
}

function insertPicture(jsID){
	PopWin('/section/user/profile/gallery/insertpicture.aspx?fc=0&jsID='+ jsID,'Billede',350,450,'yes');
}

function indsaetBilledeNote(){
	PopWin('/section/user/profile/gallery/insertpicture.aspx?fc=0&note=1','Billede',350,450,'yes');
}

function indsaetSignatur(){
	PopWin('/section/user/profile/mail/signature.aspx?fc=0','Signatur',450,250,'yes');
}

function netradioPopup(id, brugernavn){
	var data;
	data = '<table border="0" cellpadding="2" cellspacing="0" width="100%">';
	data += '<tr><td class="borderBottom"><a href="JavaScript:PopWin(\'http://www.dr.dk/radio/player.asp?station=1\',\'ArtoNetradio\',702,520,\'no\');">DR P3<a></td></tr>';
	data += '<tr><td class="borderBottom"><a href="JavaScript:PopWin(\'/annoncer/tekstKlik.asp?id=279\',\'ArtoNetradio\',702,520,\'no\');">The Voice netradio<a></td></tr>';
	data += '<tr><td><a href="JavaScript:PopWin(\'/annoncer/tekstKlik.asp?id=280\',\'ArtoNetradio\',768,420,\'no\');">Energy Netradio<a></td></tr>';
	data += '</table>';
	return overlib(data, STICKY, CENTER, NOCLOSE, WRAP, BGCLASS, 'tdTitel', FGCLASS, 'tdSpeciel2BlackBorder', CAPTIONFONTCLASS, 'fontTitel');
}

function copyToClipboard(strElementID) {
	if (navigator.userAgent.indexOf('MSIE') != -1) { 
		objElement = document.getElementById(strElementID);
		copied = objElement.createTextRange();
		copied.execCommand("Copy");
	}
}

function checkContentSafety(strElementID) {

	var ok = true;

	objElement = document.getElementById(strElementID);
	text = objElement.value;

	if (new RegExp("([a-zA-Z0-9_.-]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9-]+\\.)+))([a-zA-Z]{2,8}|[0-9]{1,3})(\\]?)", "i").test(text)) {
		if(!confirm("Det ser ud til at du er ved at give din e-mail/MSN-adresse ud til andre brugere.\nBemærk at dette kan være farligt for din sikkerhed.\n\nØnsker du at sende beskeden alligevel?")){
			return false;
		}
	}
    
	if (new RegExp("(\\s+|^)([0-9][0-9]\\s*?-*?){4,}", "i").test(text)) {
		if(!confirm("Det ser ud til at du er ved at give dit telefonnummer ud til andre brugere.\nBemærk at dette kan være farligt for din sikkerhed.\n\nØnsker du at sende beskeden alligevel?")){
			return false;
		}
	}

}

function openSupportWindow(){
	PopWin('/section/support/?fc=0','ArtoSupport',830,490,'no');
}

function openSupportWindowTab(iTab){
	PopWin('/section/support/?fc=0&tab='+ iTab,'ArtoSupport',830,490,'no');
}

function openSupportWindowSection(iSection){
	PopWin('/section/support/?fc=0&section='+ iSection,'ArtoSupport',830,490,'no');
}

/* File: /brugere/brugerInfo.js (Modified: 4. juni 2010 10:29:18) */

function showProfilevideo(path, guid){

	document.getElementById('photoContainerDiv').style.background = 'url(/grafik/spacer.gif)';
	document.getElementById('photoContainerDiv').innerHTML = '<div style="padding-top: 10px;">Du skal installere Flash for at se videoen<br /><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Hent Flash<br />gratis her</a></div>';

	var so = new SWFObject("/section/user/profile/video/flvplayer.swf", "mymovie", "105px", "145px", "8", true);
	so.addParam("allowFullScreen", true);
	so.addVariable("overstretch", "fit");
	so.addVariable("autostart", true);
	so.addVariable("file", path + guid + ".flv");
	so.addVariable("image", path + guid + ".jpg");
	so.addVariable("logo", "");
	so.addVariable("type", "flv");
	so.addVariable("displaywidth", 105);
	so.addVariable("displayheight", 145);
	so.addVariable("width", 105);
	so.addVariable("height", 146); //height+1
	so.write("photoContainerDiv");
}

function guestsInactive(){
	return confirm('\'Gæster\' opdateres kun indtil der er 2.500 online hos standard profiler.\nHos VIP profiler opdateres \'Gæster\' altid uanset online tallet.\n\nTryk \'OK\' for at læse mere om VIP eller tryk \'Annuller\' for at lukke denne boks.');
}

function sendQuickChatRequest(userID){
	PopWin('http://webnotifier.arto.com/section/notifier/messenger.aspx?init='+ userID,'QuickChatWindow_' + userID,600,400,'no');
}

function buddylistAdmin(userID){
	//document.getElementById('buddylist').src='/brugere/venner/iframeAdmin.asp';
	parent.location.href='/section/user/profile/friends/applications.aspx?id=' + userID;
}

function applyForFriendship(userID, sessionID){
	//document.getElementById('buddylist').src='/brugere/ven.asp?a=opret&id='+ userID +'&sid='+ sessionID +'&ref=/brugere/venner/iframe.asp';
	location.href='/section/user/profile/friends/apply.aspx?id=' + userID;
}

function applyForFriendshipAlt(userID, sessionID){
	//document.getElementById('buddylist').src='/brugere/ven.asp?a=opret&id='+ userID +'&sid='+ sessionID +'&ref=/brugere/venner/iframe.asp';
	parent.location.href='/section/user/profile/friends/apply.aspx?id=' + userID;
}

function SwapAdministrationBox(){

	var obj = document.getElementById("AdministrationPanel");

	if (obj.style.display == "inline") {
		obj.style.display = "none";
	} else {
		obj.style.display = "inline";
	}

	document.getElementById('bottom').scrollIntoView(true);

}

function selectAll(formID, checkboxID) {
     var objForm = document.getElementById(formID);
     for (var i = 0; i < objForm.length; i++) {
         if (objForm.elements[i].name == checkboxID) {
             objForm.elements[i].checked = (!objForm.elements [i].checked);
         }
     }
}

function deleteGbMsg(msgID, username, controlID) {
	if (confirm('Vil du slette beskeden skrevet af "'+ username +'"?')==true){
		location.href='/brugere/gaestebog/gbActions.asp?action=deleteMessages&controlID='+ controlID +'&id='+ msgID +'&destination='+ escape('/brugere/gaestebog/' + location.search);
	}
}

function deleteGbMsgALL(controlID){
	if (confirm('Er du sikker på at du ønsker at slette ALLE beskederne i HELE din gæstebog?\n\nHandlingen kan ikke fortrydes.')==true){
		location.href='/brugere/gaestebog/gbActions.asp?action=deleteMessages&deleteAll=1&controlID='+ controlID +'&destination='+ escape('/brugere/gaestebog/' + location.search);
	}
}

function blokerBruger(brugernavn) {
	if (confirm('Vil du blokere for brugeren "'+ brugernavn +'"?\n\Brugeren vil ikke kunne sende interne beskeder til dig eller skrive beskeder i din gaestebog!')==true){
		PopWin('/section/user/profile/mail/filter.aspx?fc=0&ny='+ brugernavn,'filter',280,400,'yes');
	}
}

function blockUser(userID, username) {
	if (confirm('Vil du blokere for brugeren "'+ username +'"?\n\Brugeren vil ikke kunne sende interne beskeder til dig eller skrive beskeder i din gæstebog!')==true){
		PopWin('/section/user/profile/mail/filter.aspx?fc=0&addUserID='+ userID,'filter',280,400,'yes');
	}
}

function stortProfilbillede(id, b, h, opdateret, btm){
	PopWin('/brugere/profilbillede/stort.asp?id=' + id + '&opdateret=' + opdateret + '&framecheck=off&btm='+ btm,'zoom',b,h,'no');
}

function stortKlubbillede(id, b, h, opdateret, btm){
	PopWin('/net/asp/clubIcon.asp?id=' + id + '&opdateret=' + opdateret + '&fc=0&btm='+ btm,'zoom',b,h,'no',0);
}

function GivKys(BrugerID){
	PopWin('/section/user/profile/kisshugslap/?id='+ BrugerID +'&funktionID=1&fc=0','KysKramKlask',350,330,'yes');
}

function GivKrammer(BrugerID){
	PopWin('/section/user/profile/kisshugslap/?id='+ BrugerID +'&funktionID=2&fc=0','KysKramKlask',350,330,'yes');
}

function GivSpark(BrugerID){
	PopWin('/section/user/profile/kisshugslap/?id='+ BrugerID +'&funktionID=3&fc=0','KysKramKlask',350,330,'yes');
}

function lyt(fil){
	PopWin('/brugere/lyde/default.asp?fil=' + fil,'Lyt',200,80,'no');
}

function showMap(userID, zip, photoUpdated){
	PopWin('/section/google/map.aspx?userID='+ userID +'&zip='+ zip +'&imageUpdated='+ escape(photoUpdated) +'&fc=0','Map',500,315,'no');
}

function mobilBillede(id){
	mobilBillede(id, 'http://gfx.artodata.com');
}

function mobilBillede(id, dataServer){
	window.open('http://mobile.arto.com/section/mobileimage/?Customer=FF884FC6-50E1-4802-AB35-8014423247C6&Image='+ dataServer +'/data/brugere/brugerbilleder/stor/'+ id +'.jpg','MobilePicture','status=no,toolbar=no,menubar=no,location=no');
}

function sikkerhed(){
	PopWin('/safety/default.asp?fc=0','Sikkerhed',630,500,'yes');
}

// Co-admin funktioner:

function sletBillede() {
	return confirm('Som co-admin kan du slette uegnede profilbilleder ved at klikke på dem.\n\nEr du sikker på at du vil slette denne brugers profilbillede?');
}

function retBilledeAfMig(BrugerID, destination, autoBesked) {
	if (confirm('Skal der også fratrækkes 10 profilpoint?')==true){
		document.location.href='/coadmin/retProfil.asp?funktion=retBilledeAfMig&id='+ BrugerID +'&fratraekPoint=1&autoBesked='+ autoBesked +'&destination=' + escape(destination);
	} else {
		document.location.href='/coadmin/retProfil.asp?funktion=retBilledeAfMig&id='+ BrugerID +'&fratraekPoint=0&autoBesked='+ autoBesked +'&destination=' + escape(destination);
	}
}

function brugerLog(BrugerID){
	PopWin('/coadmin/brugerLog.asp?id=' + BrugerID +'&framecheck=off','Log',800,500,'yes');
}

function pointJustering(BrugerID){
	PopWin('/coadmin/point/default.asp?id=' + BrugerID +'&framecheck=off','Point',500,300,'yes');
}

function confirmReportVideo(msgID, username) {
	if (confirm('Er du sikker på at du ønsker at anmelde "'+ username +'" for overtrædelse af Arto\'s retningslinjer?\n\nBemærk at misbrug af anmelde funktionen kan medføre spærring af din egen profil.')==true){
		document.location.href='/section/user/profile/guestbook/reportvideo.aspx?id=' + msgID;
	}
}

function viewVideoGreeting(msgID) {
	PopWin('/section/user/profile/guestbook/playguestbookvideo.aspx?id=' + msgID,'ArtoVideoGreeting',700,525,'no');
}

/* File: /includes/js/tabs.js (Modified: 3. september 2010 12:30:56) */

function TabOver(id) {				
	if (document.getElementById("tabItemLeft" + id).className != "tabItemLeftSelected") {
		document.getElementById("tabItemLeft" + id).className = "tabItemLeftMO";
		document.getElementById("tabItemContent" + id).className = "tabItemContentMO";
		document.getElementById("tabItemRight" + id).className = "tabItemRightMO";
	}
}

function TabOut(id) {
	if (document.getElementById("tabItemLeft" + id).className != "tabItemLeftSelected") {
		document.getElementById("tabItemLeft" + id).className = "tabItemLeft";
		document.getElementById("tabItemContent" + id).className = "tabItemContent";
		document.getElementById("tabItemRight" + id).className = "tabItemRight";				
	}
}

function ProfileTabOver(id) {				                            
	if (document.getElementById("tabItemLeft" + id).className != "tabItemLeftSelected customTopTabLeftSelected") {
		document.getElementById("tabItemLeft" + id).className = "tabItemLeftMO customTopTabLeftMO";
		document.getElementById("tabItemContent" + id).className = "tabItemContentMO customTopTabMiddleMO";
		document.getElementById("tabItemRight" + id).className = "tabItemRightMO customTopTabRightMO";
	}
}

function ProfileTabOut(id) {
	if (document.getElementById("tabItemLeft" + id).className != "tabItemLeftSelected customTopTabLeftSelected") {
		document.getElementById("tabItemLeft" + id).className = "tabItemLeft customTopTabLeft";
		document.getElementById("tabItemContent" + id).className = "tabItemContent customTopTabMiddle";
		document.getElementById("tabItemRight" + id).className = "tabItemRight customTopTabRight";				
	}
}

/* File: /includes/js/framework/advertisement.js (Modified: 3. september 2010 12:30:56) */

function rotateAd() {
	if($('HeliosBannerIframe') != null) {
		$('HeliosBannerIframe').src = $('HeliosBannerIframe').src;
	}
}

/* File: /includes/js/framework/history.js (Modified: 3. september 2010 12:30:56) */

var CookieHistory = Class.create();
CookieHistory.prototype = {
  initialize: function() {
		var defaultPage = 'default.aspx';
		this.relativeURL = document.URL.replace('http://' + location.hostname + '/section', '').toLowerCase();
		var params = this.relativeURL.contains('?') ? this.relativeURL.substring(this.relativeURL.indexOf('?')) : '';
		if(params != ''){
		  this.relativeURL  = this.relativeURL.replace(params, '');
		}
		this.relativeURL = this.relativeURL.indexOf('.aspx') >= 0 ? this.relativeURL : this.relativeURL + defaultPage;
		this.identifier = null;
  },

	setCookie: function(c_name,value,expiredays) {
		var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +value+ ((expiredays==null || typeof expiredays == 'undefined') ? "" : ";expires="+exdate.toGMTString()) + ";path=/;domain=" + document.domain;
	},

	getCookie: function(c_name) {
		if (document.cookie.length>0) {
			c_start=document.cookie.indexOf(c_name + "=");
			if (c_start!=-1) { 
				c_start=c_start + c_name.length+1; 
				c_end=document.cookie.indexOf(";",c_start);
				if (c_end==-1) c_end=document.cookie.length;
					return document.cookie.substring(c_start,c_end);
				} 
			}
		return "";
	},

	updateCookie: function(c_name, key, value, expires) {
	  var id = this.identifier != null && this.identifier != '' && typeof this.identifier != 'undefined' ? this.identifier : this.relativeURL;
		var cookie = this.getCookie(c_name);
		var newCookie;
		if(cookie != '' && cookie != null && typeof cookie != 'undefined') {
			var newCookieContent = '';
			if(cookie.indexOf(id) >= 0) {
				var tmpArr = new Array();
				tmpArr = cookie.split('&');
				for(var i = 0; i < tmpArr.length; i++) {
					var tmpArr2 = tmpArr[i].split('=');
					if(tmpArr2[0] == id) {
						var newPair;
						if(tmpArr2[1].indexOf(key) >= 0) {
							newPair = tmpArr[i].replace(new RegExp("(" + key + "):(.+?)(\||$)", "ig"), "$1:" + value + "$3");
						} else {
							newPair = tmpArr[i] + '|' + key + ':' + value;
						}
						newCookieContent += (i > 0) ? '&' + newPair : newPair;
					} else {
						newCookieContent += (i > 0) ? '&' + tmpArr[i] : tmpArr[i];
					}
				}
				newCookie = newCookieContent;
			} else {
				newCookie = this.getCookie(c_name) + '&' + id + '=' + key + ':' + value;
			}
		} else {
			newCookie = id + '=' + key + ':' + value;
		}
		this.setCookie(c_name, this.checkCookieLength(newCookie, 1024), expires);
	},

	getValueFromCookie: function(c_name, key) {
	  var id = this.identifier != null ? this.identifier : this.relativeURL;
		var cookie = this.getCookie(c_name);
		var regex = /(.*?):(.*?)(\||$)/ig;
		if(cookie != '' && cookie != null && typeof cookie != 'undefined') {
			var cookiekeys = cookie.split('&');
			for(var i = 0; i < cookiekeys.length; i++) {
				var keyValueArr = cookiekeys[i].split('=');
				if(keyValueArr[0] == id) {
					var match;
					while (match = regex.exec(keyValueArr[1])) {
						if(match[1] == key) {
							return match[2];
						}
					}
				}
			}
			return null;
		} else {
			return null;
		}
	},

	checkCookieLength: function(cookieContent, maxLength) {
		var contentLength = cookieContent.length;
		if(contentLength > maxLength) {
			var resultString = '';
			var cookiekeys = cookieContent.split('&');
			for(var i = 0; i < cookiekeys.length; i++) {
				if(contentLength > maxLength) {
					contentLength -= cookiekeys[i].length;
				} else {
					resultString += resultString.length == 0 ? cookiekeys[i] : '&' + cookiekeys[i];
				}
			}
			return resultString;
		} else {
			return cookieContent;
		}
	}
}

var HashHistory = Class.create();
HashHistory.prototype = {
  initialize: function() {
		this.currentHash = location.hash;
		Event.observe(window, 'load', function() {
			if( document.getElementById('historyFrame') != null) {
				var doc = document.getElementById("historyFrame").contentWindow.document;
				doc.open("javascript:'<html></html>'");
				doc.write("<html><head><scri" + "pt type=\"text/javascript\">parent.hashClass.onFrameLoaded('" + location.hash + "');</scri" + "pt></head><body></body></html>");
				doc.close();
			}
		});
  },
  
   generateHash: function(key, value) {
		var currentHash = location.hash;
		var newHash;
		if(currentHash.indexOf(key) >= 0) {
			newHash = currentHash.replace(new RegExp("(" + key + "):(.+?)(\||$)", "ig"), "$1:" + value + "$3");
		} else {
			newHash = currentHash.substring(1).length > 0 ? currentHash + '|' + key + ':' + value : key + ':' + value;
		}
		
		this.currentHash = newHash;
		return newHash;
  },
  
  setHash: function(key, value) {
		var newHash = this.generateHash(key, value);
		if(Prototype.Browser.IE) {
      var doc = document.getElementById("historyFrame").contentWindow.document;
			doc.open("javascript:'<html></html>'");
      doc.write("<html><head><scri" + "pt type=\"text/javascript\">parent.hashClass.onFrameLoaded('" + newHash + "');</scri" + "pt></head><body></body></html>");
      doc.close();
		} else {
			window.location.hash = newHash;
		}
  },
  
  onFrameLoaded: function(hash) {
		location.hash = hash;
  },
  
  getValueFromHash: function(controlName) {
		var tmpArr = new Array();
		var tmpArr2 = new Array();
		tmpArr = location.hash.replace('#','').split('|');
		for(var i = 0; i < tmpArr.length; i++) {
			tmpArr2 = tmpArr[i].split(':');
			if(controlName == tmpArr2[0]) {
				return tmpArr2[1];
			}
		}
		return 0;
  },
  
  checkHash: function(controlName) {
		var hashValue = this.getValueFromHash(controlName);
		this.currentHash = location.hash;
		if(typeof hashValue == 'undefined') {
			hashValue = 0;
		}
		return hashValue;
  }
}

/* File: /includes/js/framework/iframetabcontrol.js (Modified: 3. september 2010 12:30:56) */

var tabTempCookie = 'artoTempTabCookie';
var tabPermCookie = 'artoTabCookie';

function iFrameTabItem(id, name, tabClass, tabSelectedClass, tabBorderClass) { //Constructor
	this.id = id;
	this.name = name;
	this.tabClass = tabClass;
	this.tabSelectedClass = tabSelectedClass;
	this.tabBorderClass = tabBorderClass;
}

var IFrameTabControl = Class.create();
IFrameTabControl.prototype = {
	initialize: function(tabControlId, saveMode, tabControlName, selectedItem, cookieIdentifier) {
		this.cookieClass = new CookieHistory();
		this.tabItems = new Array();
		this.tabControlId = tabControlId;
		this.saveMode = saveMode;
		this.tabControlName = tabControlName;
		this.selectedItem = selectedItem;
		this.adCount = 0;
		this.adMaxCount = 3;
		this.oldPath = '';
		this.cookieClass.identifier = cookieIdentifier;
		setTimeout(this.selectFirstItem.bindAsEventListener(this), 400);
	},

	addTabItem: function(id, name, tabClass, tabSelectedClass, tabBorderClass) {
		this.tabItems[this.tabItems.length] = new iFrameTabItem(id, name, tabClass, tabSelectedClass, tabBorderClass);
	},

	selectFirstItem: function() {
		this.selectedTab = this.getSelectedTab();
		this.oldSelectedTab = this.selectedTab;
		this.setSelected(this.tabControlId, this.selectedTab);
	},

	getSelectedTab: function() {
		var selTab = this.selectedItem >= 0 ? this.selectedItem : this.tabItems[0].id;
		var tmp;
		switch (this.saveMode) {
			case 1:
				tmp = this.cookieClass.getValueFromCookie(tabPermCookie, this.tabControlName);
				if (tmp != null && typeof tmp != 'undefined') {
					selTab = tmp;
				}
				break;
			case 2:
				tmp = this.cookieClass.getValueFromCookie(tabTempCookie, this.tabControlName);
				if (tmp != null && typeof tmp != 'undefined') {
					selTab = tmp;
				}
				break;
		}
		if (this.findTabItem(selTab) == null) {
			selTab = this.tabItems[0].id;
		}
		return selTab;
	},

	changeTab: function(tabPage) {
		this.oldSelectedTab = this.selectedTab;
		this.selectedTab = tabPage;
		this.setSelected(this.tabControlId, this.selectedTab);
		if (this.selectedTab != this.oldSelectedTab) {
			this.setUnselected(this.tabControlId, this.oldSelectedTab);
		}
		switch (this.saveMode) {
			case 1:
				this.cookieClass.updateCookie(tabPermCookie, this.tabControlName, tabPage, 7);
				break;
			case 2:
				this.cookieClass.updateCookie(tabTempCookie, this.tabControlName, tabPage);
				break;
		}
	},

	setSelected: function(elm, id) {
		if (document.getElementById(elm + id) != null) {
			var tabItem = this.findTabItem(id);
			document.getElementById(elm + id + 'Left').className = tabItem.tabSelectedClass + 'Left';
			document.getElementById(elm + id).className = tabItem.tabSelectedClass;
			document.getElementById(elm + id + 'Right').className = tabItem.tabSelectedClass + 'Right';
		}
	},

	setUnselected: function(elm, id) {
		if (document.getElementById(elm + id) != null) {
			var tabItem = this.findTabItem(id);
			document.getElementById(elm + id + 'Left').className = tabItem.tabClass + 'Left';
			document.getElementById(elm + id).className = tabItem.tabClass;
			document.getElementById(elm + id + 'Right').className = tabItem.tabClass + 'Right';
		}
	},

	findTabItem: function(id) {
		var item = null;
		this.tabItems.each(function(obj) {
			if (obj.id == id) {
				item = obj;
			}
		});
		return item;
	},

	rotateAd: function() {
		if (++this.adCount == this.adMaxCount) {
			rotateAd();
			this.adCount = 0;
		}
	}
}

/* File: /includes/js/framework/ajaxtabcontrol.js (Modified: 3. september 2010 12:30:56) */

//var cookieClass = new CookieHistory();
var hashClass = new HashHistory();
var tabTempCookie = 'artoTempTabCookie';
var tabPermCookie = 'artoTabCookie';

function TabItem(id, name, path, tabClass, tabSelectedClass, tabBorderClass) { //Constructor
	this.id = id;
	this.name = name;
	this.path = path;
	this.tabClass = tabClass;
	this.tabSelectedClass = tabSelectedClass;
	this.tabBorderClass = tabBorderClass;
}
 
var AjaxTabControl = Class.create();
AjaxTabControl.prototype = {
  initialize: function(elementId, tabControlId, saveMode, tabControlName, selectedItem, cookieIdentifier){
    this.cookieClass = new CookieHistory();
		this.tabItems = new Array();
    this.elementId = elementId;
    this.tabControlId = tabControlId;
    this.saveMode = saveMode;
    this.tabControlName = tabControlName;
    this.selectedItem = selectedItem;
    if(saveMode == 3) {
			if(this.selectedItem > 0) {
				hashClass.setHash(this.tabControlName, this.selectedItem);
			}
    }
		this.selectedTab = this.getSelectedTab();
		this.oldSelectedTab = this.selectedTab;
		this.adCount = 0;
		this.adMaxCount = 3;
		this.oldPath = '';
		this.cookieClass.identifier = cookieIdentifier;
		setTimeout(this.tabClick.bindAsEventListener(this) , 400);
  },
  
  addTabItem: function(id, name, path, tabClass, tabSelectedClass, tabBorderClass) {
		this.tabItems[this.tabItems.length] = new TabItem(id, name, path, tabClass, tabSelectedClass, tabBorderClass);
  },
  
  tabClick: function() {
		var tabItem = this.findTabItem(this.selectedTab);
		this.changeTab(tabItem.id);
  },
  
  checkHash: function() {
		var newSelectedTab = hashClass.checkHash(this.tabControlName);
		if(typeof newSelectedTab != 'undefined') {
			if(this.selectedTab != newSelectedTab) {
				this.changeTab(newSelectedTab, false);
			}
		}
	},
  
  getSelectedTab: function() {
		var selTab = this.selectedItem >= 0 ? this.selectedItem : this.tabItems[0].id;
		var tmp;
		switch(this.saveMode) {
			case 1:
				tmp = this.cookieClass.getValueFromCookie(tabPermCookie, this.tabControlName);
				if(tmp != null && typeof tmp != 'undefined' && tmp >= 0) {
					selTab = tmp;
				}
			break;
			case 2:
				tmp = this.cookieClass.getValueFromCookie(tabTempCookie, this.tabControlName);
				if(tmp != null && typeof tmp != 'undefined' && tmp >= 0) {
					selTab = tmp;
				}
			break;
			case 3:
				if (this.selectedItem > 0){
					tmp = hashClass.getValueFromHash(this.tabControlName);	
					if(tmp != null && typeof tmp != 'undefined' && tmp >= 0) {
						selTab = tmp;
					}
				}
			break;
		}
		return selTab;
  },
  
  changeTab: function(tabPage, hash) {
		this.switchTabs(tabPage);
		switch(this.saveMode) {
			case 1:
				this.cookieClass.updateCookie(tabPermCookie, this.tabControlName, tabPage, 7);
			break;
			case 2:
				this.cookieClass.updateCookie(tabTempCookie, this.tabControlName, tabPage);
			break;
			case 3:
				if(hash) {
					hashClass.setHash(this.tabControlName, tabPage);
				}
			break;
		}
		this.loadContent(this.findTabItem(tabPage).path);
	},
	
	switchTabs: function(tabPage){
	  this.oldSelectedTab = this.selectedTab;
		this.selectedTab = tabPage;
		this.setSelected(this.tabControlId, this.selectedTab);
		if(this.selectedTab != this.oldSelectedTab) {
			this.setUnselected(this.tabControlId, this.oldSelectedTab);
		}
	},
	
	loadContent: function(path, firstrun) {
			if (!path || path.empty()) {
				return;
			}
		//if(path != this.oldPath) { //include this to disable loading the active tab again.
		  var parameter = '?controlid=';
		  var includePath;
		  if(typeof firstrun != 'undefined') {
				includePath = firstrun;
		  } else {
				includePath = path;
			}
		  if (includePath.toString().indexOf('?') >= 0) {
		    parameter = '&controlid=';
		  }
		  parameter += this.tabControlId;
			new Ajax.Updater(this.elementId, includePath + parameter, {onComplete:this.parseResult.bindAsEventListener(this)});
			this.rotateAd();
			this.oldPath = path;
		//} //and this
	},
	
	parseResult: function(content) {
		var element = document.getElementById(this.elementId);
		var regex = /<script\s+type\s*=\s*.?text\/javascript.?\s*>((.|[\r\n])*?)<\/script>/ig;
		var regexscr = /<script\s+type\s*=\s*.?text\/javascript.?\s+src\s*=\s*.?(.*?).?\s*(\/>|\s*<\/)/ig;
		var match;										
		while (match = regexscr.exec(content.responseText)) {
			var newScript = document.createElement('script');
			newScript.type = 'text/javascript';
			newScript.src = match[1];
			element.appendChild(newScript);
		}
		while (match = regex.exec(content.responseText)) {
			var newScript = document.createElement('script');
			newScript.type = 'text/javascript';
			newScript.text = match[1];
			element.appendChild(newScript);
		}
	},
	
	setSelected: function(elm, id) {
		if(document.getElementById(elm + id) != null) {
			var tabItem = this.findTabItem(id);
			document.getElementById(elm + id + 'Left').className = tabItem.tabSelectedClass + 'Left cursorHand';
			document.getElementById(elm + id).className = tabItem.tabSelectedClass + ' cursorHand';
			document.getElementById(elm + id + 'Right').className = tabItem.tabSelectedClass + 'Right cursorHand';
		}
	},

	setUnselected: function(elm, id) {
		if(document.getElementById(elm + id)!=null) {
			var tabItem = this.findTabItem(id);
			document.getElementById(elm + id + 'Left').className = tabItem.tabClass + 'Left cursorHand';
			document.getElementById(elm + id).className = tabItem.tabClass + ' cursorHand';
			document.getElementById(elm + id + 'Right').className = tabItem.tabClass + 'Right cursorHand';
		}
	},
	
	findTabItem: function(id) {
		var item = null;
		this.tabItems.each(function(obj) {
			if(obj.id == id) {
				item = obj;
			}
		});
		return item;
	},
	
	rotateAd: function() {
		if(++this.adCount == this.adMaxCount) {
			rotateAd();
			this.adCount=0;
		}
	}
}

/* File: /includes/js/framework/soundplayer.js (Modified: 3. september 2010 12:30:56) */

var artoSoundPlayer;
var SoundPlayer = {

  flashInitialized: false,
  flashReady: false,
  
  initFlash: function(){
    if(!this.flashInitialized){
      var flashWrapper = document.createElement('div');
      flashWrapper.style.visibility = 'hidden';
      flashWrapper.id = 'artoSoundPlayer_Wrapper';
      document.body.appendChild(flashWrapper);
      var so = new SWFObject('/section/notifier/SoundPlayer.swf?v=20080515', 'artoSoundPlayer', '100', '100', '9');
      var loaded = so.write('artoSoundPlayer_Wrapper');
      artoSoundPlayer = document.getElementById('artoSoundPlayer');
      this.flashInitialized = true;
    }
  },
  
  play: function(sound){
    if(!this.flashInitialized){
      this.initFlash();
    }
    if(!this.flashReady){
      setTimeout(function(){
        SoundPlayer.play(sound);
      },100);
      return;
    }
    document.getElementById('artoSoundPlayer').playSound(sound);
  },
  
  ready: function(){
    this.flashReady = true;
    return true;
  }
};

/* File: /includes/js/framework/videoplayer.js (Modified: 3. september 2010 12:30:56) */

var VideoPlayer = {
	play: function(video, options) {
		var options = Object.extend({
			x: 100,
			y: 100,
			width: 100,
			height: 100,
			image: null,
			useHeader: false,
			headerTitle: '',
			useTimeout: true
		}, options);
		VideoPlayer.stop();
		if (options.useTimeout) {
			VideoPlayer.timeout = setTimeout(function(video, options) {
				VideoPlayer._createPlayer(video, options);
			} .curry(video, options), 500);
		}
		else {
			VideoPlayer._createPlayer(video, options);
		}
	},

	_createPlayer: function(video, options) {
	    var so = new SWFObject('http://artogfx.cloud2.artodata.com/sitegfx/components/mediaplayer/player_5.2.swf', 'aVideoPlayer', options.width + 'px', options.height + 'px', '8', true);
		so.addParam('allowfullscreen', 'true');
		so.addParam('allowscriptaccess', 'always');
		so.addVariable("file", video);
		if (options.image) {
			so.addVariable("image", options.image);
		}
		so.addVariable("repeat", "always");
		so.addVariable("autostart", true);
		so.addVariable("controlbar", "none");
		so.addVariable("displayclick", "fullscreen");

		if (VideoPlayer.element) {
			$('aVideoPlayer').replace(so.getSWFHTML());
			VideoPlayer.element.setStyle({
				top: options.y + 'px',
				left: options.x + 'px'
			});
			if (options.headerTitle) {
				VideoPlayer.infobox.setTitle(options.headerTitle);
			}
			VideoPlayer.element.show()
			return;
		}
		else {
			VideoPlayer.element = new Element('div', { id: 'artoVideoPlayer' }).setStyle({
				position: 'absolute',
				top: options.y + 'px',
				left: options.x + 'px',
				width: options.width + 'px'
			});
			var wrapper = new Element('div').setStyle({
				position: 'absolute',
				top: '0px',
				left: '0px',
				zIndex: 9999
			});

			VideoPlayer.infobox = new InfoBox(options.headerTitle, so.getSWFHTML(), { width: options.width + 48, disableHeader: !options.useHeader, useAltHeader: true, altContent: VideoPlayer._getCloseButton(), className: 'shadowBox' });
			wrapper.update(VideoPlayer.infobox.getInfoBox());
			VideoPlayer.element.update(wrapper);
			VideoPlayer.element.insert(VideoPlayer._getIframeHack(options));
			$(document.body).insert(VideoPlayer.element);
			VideoPlayer.timeout = null;
		}
	},

	_getIframeHack: function(options) {
		return new Element('iframe', { scrolling: 'no', frameborder: 0 }).setStyle({
			position: 'absolute',
			top: '24px',
			left: '24px',
			zIndex: 9998,
			width: (options.width) + 'px',
			height: (options.height) + 'px'
		});
	},

	_getCloseButton: function() {
		return new Element('img', {
			src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/kvikchat/window_close.png',
			'class': 'cursorHand',
			title: 'Close'
		}).setStyle({
			width: '15px',
			height: '15px',
			borderWidth: '0px'
		}).observe('click', function() {
			VideoPlayer.stop();
		});
	},

	stop: function() {
		if (VideoPlayer.element) {
			VideoPlayer.element.hide();
			if (VideoPlayer.timeout) {
				clearTimeout(VideoPlayer.timeout);
				VideoPlayer.timeout = null;
			}
		}
	}
};

/* File: /includes/js/framework/PromotionBoxUpdater.js (Modified: 3. september 2010 12:30:56) */

var PromotionBoxUpdater = Class.create({
	initialize: function(elm, controlpath, options) {
		this.element = $(elm);
		this.controlPath = '/section/promotion/promotionajax.aspx?control=' + controlpath;
		this.options = Object.extend({
			firstUpdateInterval: 5000,
			updateInterval: 5000,
			fadeDuration: 0.75
		}, options);

		this.setEventListeners();
		this.timeout = setTimeout(this.fadeOut.bind(this), this.options.firstUpdateInterval);
	},

	setEventListeners: function() {
		Event.observe(this.element, 'mouseover', this.mouseOver.bindAsEventListener(this));
		Event.observe(this.element, 'mouseout', this.mouseOut.bindAsEventListener(this));
	},

	mouseOver: function() {
		clearTimeout(this.timeout);
	},

	mouseOut: function() {
		this.timeout = setTimeout(this.fadeOut.bind(this), this.options.updateInterval);
	},

	fadeOut: function() {
		new Effect.Opacity(this.element, { from: 1, to: 0, duration: this.options.fadeDuration });
		setTimeout(this.update.bind(this), this.options.fadeDuration * 1000);
	},

	update: function() {
		new Ajax.Updater(this.element, this.controlPath, {
			onComplete: this.fadeIn.bind(this)
		});
	},

	fadeIn: function() {
		new Effect.Opacity(this.element, { from: 0, to: 1, duration: this.options.fadeDuration });
		this.timeout = setTimeout(this.fadeOut.bind(this), this.options.updateInterval);
	}
});

/* File: /includes/js/framework/multivideoplayer.js (Modified: 3. september 2010 12:30:56) */

var MultiVideoPlayer = {
	play: function(video, options) {
		var options = Object.extend({
			x: 100,
			y: 100,
			width: 100,
			height: 100,
			image: null,
			useHeader: false,
			headerTitle: '',
			useTimeout: true,
			mediaSource: 'arto',
			streamServer: null
		}, options);
		MultiVideoPlayer.stop();
		if (options.useTimeout) {
			MultiVideoPlayer.timeout = setTimeout(function(video, options) {
				MultiVideoPlayer._createPlayer(video, options);
			} .curry(video, options), 500);
		}
		else {
			MultiVideoPlayer._createPlayer(video, options);
		}
	},

	_createPlayer: function(video, options) {
		if (options.mediaSource == 'vix') {
			if (video.substring(video.length - 1, 1) != '/') {
				video = video + '/';
			}
		}
		var src = options.mediaSource == 'arto' ? 'http://artogfx.cloud2.artodata.com/sitegfx/components/mediaplayer/player_5.2.swf' : video + (options.mediaSource == 'vix' ? options.width + '/' + options.height : "");
		var so = new SWFObject(src, 'aMultiVideoPlayer', options.width + 'px', options.height + 'px', '8', true);
		so.addParam('allowfullscreen', 'true');
		so.addParam('allowscriptaccess', 'always');
		if (options.mediaSource == 'arto') {
			if (options.streamServer) {
				so.addVariable('streamer', options.streamServer);
			}
			so.addVariable("file", video);
			if (options.image) {
				so.addVariable("image", options.image);
			}
			so.addVariable('backcolor', '0x000000');
			so.addVariable('frontcolor', '0xFFFFFF');
			so.addVariable('lightcolor', '0xffffff');
			so.addVariable('width', options.width);
			so.addVariable('height', options.height);
		}
		so.addVariable("autostart", true);

		if (MultiVideoPlayer.element) {
			$('aMultiVideoPlayer').replace(so.getSWFHTML());
			MultiVideoPlayer.element.setStyle({
				top: options.y + 'px',
				left: options.x + 'px'
			});
			if (options.headerTitle) {
				MultiVideoPlayer.infobox.setTitle(options.headerTitle);
			}
			MultiVideoPlayer.element.show()
			return;
		}
		else {
			MultiVideoPlayer.element = new Element('div', { id: 'artoMultiVideoPlayer' }).setStyle({
				position: 'absolute',
				top: options.y + 'px',
				left: options.x + 'px',
				width: options.width + 'px'
			});
			var wrapper = new Element('div').setStyle({
				position: 'absolute',
				top: '0px',
				left: '0px',
				zIndex: 9999
			});

			MultiVideoPlayer.infobox = new InfoBox(options.headerTitle, so.getSWFHTML(), { width: options.width + 48, disableHeader: !options.useHeader, useAltHeader: true, altContent: MultiVideoPlayer._getCloseButton(), className: 'shadowBox' });
			wrapper.update(MultiVideoPlayer.infobox.getInfoBox());
			MultiVideoPlayer.element.update(wrapper);
			MultiVideoPlayer.element.insert(MultiVideoPlayer._getIframeHack(options));
			$(document.body).insert(MultiVideoPlayer.element);
			MultiVideoPlayer.timeout = null;
		}
	},

	_getIframeHack: function(options) {
		return new Element('iframe', { scrolling: 'no', frameborder: 0 }).setStyle({
			position: 'absolute',
			top: '24px',
			left: '24px',
			zIndex: 9998,
			width: (options.width) + 'px',
			height: (options.height) + 'px'
		});
	},

	_getCloseButton: function() {
		return new Element('img', {
			src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/kvikchat/window_close.png',
			'class': 'cursorHand',
			title: 'Close player'
		}).setStyle({
			width: '15px',
			height: '15px',
			borderWidth: '0px'
		}).observe('click', function() {
			MultiVideoPlayer.stop();
		});
	},

	stop: function() {
		if (MultiVideoPlayer.element) {
			MultiVideoPlayer.element.hide();
			if (MultiVideoPlayer.timeout) {
				clearTimeout(MultiVideoPlayer.timeout);
				MultiVideoPlayer.timeout = null;
			}
		}
	}
};

/* File: /includes/js/framework/InsufficientFundsBox.js (Modified: 3. september 2010 12:30:56) */

var InsufficientFundsBox = Class.create({
	initialize: function (text) {
		this.options = {
			boxWidth: 600,
			offsetLeft: 25,
			offsetTop: 250
		};
		this.text = text;
		this.renderBox();
	},

	renderBox: function () {
		var infobox = new InfoBox('You do not have enough Credits to play with.', this.getContent(), { width: '100%', className: 'shadowBox', altContent: this.getCloseImage() });
		var pos = this.getPosition();

		this.boxElement = new Element('div').setStyle({
			width: this.options.boxWidth + 'px',
			position: pos.position,
			left: pos.left,
			top: pos.top,
			color: '#000000'
		}).insert(infobox.getInfoBox());
		infobox.header.style.cursor = 'move';
		new Draggable(this.boxElement, {
			starteffect: Prototype.emptyFunction,
			endeffect: Prototype.emptyFunction,
			scroll: window, handle: infobox.header
		});
		document.body.appendChild(this.boxElement);
	},

	getContent: function () {
		return new Element('table', { cellpadding: 2, cellspacing: 1 }).insert(
			new Element('tbody').insert(
				new Element('tr').insert(
					new Element('td').update(this.text)
				)
			).insert(
				new Element('tr').insert(
					new Element('td').update('You can earn Credits by playing games, or by buying them.')
				)
			).insert(
				new Element('tr').insert(
					new Element('td').insert(
						new Element('table').insert(
							new Element('tbody').insert(
								new Element('tr').insert(
									new Element('td').insert(
										new ArtoButton('Buy Credits', { url: '/section/credits/BuyCredits.aspx', buttonClass: 'Green' })
									)
								).insert(
									new Element('td').insert(
										new ArtoButton('What are credits', { url: '/section/credits/' })
									)
								)
							)
						)
					)
				)
			)
		);
	},

	getPosition: function () {
		var dim = document.viewport.getDimensions();
		var offsets = document.viewport.getScrollOffsets();
		var positions = {
			left: (dim.width < 970 ? this.options.offsetLeft : ((dim.width - 970) / 2) + this.options.offsetLeft),
			top: offsets.top + this.options.offsetTop
		};
		return { position: 'absolute', top: positions.top + 'px', left: positions.left + 'px' };
	},

	getCloseImage: function () {
		return new Element('img', {
			src: 'http://artogfx.cloud2.artodata.com/sitegfx/grafik/kvikchat/window_close.png',
			'class': 'cursorHand'
		}).setStyle({
			width: '15px',
			height: '15px',
			borderWidth: '0px'
		}).observe('click', this.close.bind(this));
	},

	close: function () {
		if (this.boxElement) {
			this.boxElement.remove();
		}
	}
});

/* File: /includes/js/emediate.js (Modified: 3. september 2010 12:30:55) */

EAS_flash = 1;
EAS_proto = "http:";
if (location.protocol == "https:") {
   EAS_proto = "https:";
}
if (document.getElementById) {
   EAS_dom = true;
} else {
   EAS_dom = false;
}
EAS_server = EAS_proto + "//eas8.emediate.eu";

function EAS_load(url) {
	document.write('<scr' + 'ipt language="JavaScript" src="' + url + '"></sc' + 'ript>');
}

function EAS_init(pages, parameters) {
	var EAS_ord=new Date().getTime();
	var EAS_url = EAS_server + "/eas?target=_blank&EASformat=jsvars&EAScus=" + pages + "&ord=" + EAS_ord;

	EAS_detect_flash();

	EAS_url += "&EASflash=" + EAS_flash;

	if (parameters) EAS_url += "&" + parameters;

	EAS_load(EAS_url);

	return;
}

function EAS_detect_flash() {
   if (EAS_flash > 1) return;

	var maxVersion = 11;
	var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

	// write vbscript detection if we're not on mac.
	if(isIE && isWin && !isOpera){ 
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \nDim eas_flobj(' + maxVersion + ') \n');
		for (i = 2; i < maxVersion; i++) {
			document.write('Set eas_flobj(' + i + ') = CreateObject("ShockwaveFlash.ShockwaveFlash.' + i + '") \n');
			document.write('if(IsObject(eas_flobj(' + i + '))) Then EAS_flash='+i+' \n');
		}
		document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
	} else if (navigator.plugins) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]){

			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var flashVersion = parseInt(flashDescription.substr(flashDescription.indexOf(".") - 2, 2), 10);

			if (flashVersion > 1) EAS_flash = flashVersion;
		}
	}

	// alert("Version is " + EAS_flash);

}

function EAS_show_flash(width, height, src, extra) {
   var EAS_args = [];
   if (extra) EAS_args = extra.split(",");

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '"><param name=src value=' + src + '>');
   for (i = 0; i < EAS_args.length; i++) {
      EAS_eq = EAS_args[i].indexOf('=');
      EAS_nv0 = EAS_args[i].substring(0, EAS_eq );
      EAS_nv1 = EAS_args[i].substring(EAS_eq+1, EAS_args[i].length);
      document.write('<param name="' + EAS_nv0 + '" value="' + EAS_nv1 + '">');
   }
   document.write('<embed src="' + src + '" width="' + width + '" height="' + height + '" type="application/x-shockwave-flash"');
   for (i = 0; i < EAS_args.length; i++) {
      EAS_eq = EAS_args[i].indexOf('=');
      EAS_nv0 = EAS_args[i].substring(0, EAS_eq );
      EAS_nv1 = EAS_args[i].substring(EAS_eq+1, EAS_args[i].length);

      document.write(' ' + EAS_nv0 + '="' + EAS_nv1 + '"');
   }
   document.write('></embed></object>');
}

function EAS_statistics() {

   var t = new Date();
   var EAS_time = t.getTime();
   var bWidth = 0;
   var bHeight = 0;
   var cdepth = 0;
   var plugins = "";
   var tmz = t.getTimezoneOffset() / 60;
   if (navigator.plugins) {
      var p = navigator.plugins;
      var pArr = new Array();
      for (var i = 0; i < p.length; i++) {
         if (p[i].name.indexOf("RealPlayer") != -1) pArr[0] = 1;
         else if (p[i].name.indexOf("Adobe Reader") != -1) pArr[1] = 1;
         else if (p[i].name.indexOf("Adobe Acrobat") != -1) pArr[1] = 1;
         else if (p[i].name.indexOf("Windows Media Player") != -1) pArr[2] = 1;
         else if (p[i].name.indexOf("QuickTime") != -1) pArr[3] = 1;
      }
      for (var i = 0; i < 4; i++) if (pArr[i]) plugins += i + ",";
   }

   if (typeof(EAS_cu) == "undefined") return;
   if (EAS_flash == 1) EAS_detect_flash();

   if (screen && screen.colorDepth) cdepth = screen.colorDepth;

   if (document.body && document.body.clientHeight > 50) {
      bWidth = document.body.clientWidth;
      bHeight = document.body.clientHeight;
   } else if (document.documentElement && document.documentElement.clientHeight > 50) {
      bWidth = document.documentElement.clientWidth;
      bHeight = document.documentElement.clientHeight;
   } else if (typeof(window.innerHeight == 'number')) {
      bWidth = window.innerWidth;
      bHeight = window.innerHeight;
   }

   var EAS_stat_tag = EAS_server + '/eas?cu=' + EAS_cu + ';ord=' + EAS_time;
   EAS_stat_tag += ';logrest=width=' + screen.width + ';height=' + screen.height + ';bwidth=' + bWidth + ';bheight=' + bHeight + ';time=' + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds();
   EAS_stat_tag += ";tmz=" + tmz;
   if (EAS_flash > 2) EAS_stat_tag += ';flash=' + EAS_flash;
   if (typeof(EAS_page) != "undefined") EAS_stat_tag += ';page=' + EAS_page;
   if (typeof(java) != "undefined" && java.installed) EAS_stat_tag += ';jversion=' + java.lang.System.getProperty("java.version");
   if (typeof(EAS_jsversion) != "undefined") EAS_stat_tag += ';jsversion=' + EAS_jsversion;
   if (cdepth) EAS_stat_tag += ';cdepth=' + cdepth;
   if (plugins) EAS_stat_tag += ';plugins=' + plugins;
   if (document.referrer) EAS_stat_tag += ';ref=' + escape(document.referrer);
   if (document.location) EAS_stat_tag += ';url=' + escape(document.location);
   if (typeof(EAS_capture) != "undefined") EAS_stat_tag += ';EAScapture=' + escape(EAS_capture);

   document.write('<img width="1" height="1" src="' + EAS_stat_tag + '">');
}

function EAS_duplicate(cu, expires) {
   var cookie_arr = document.cookie.split('; ');
   var nv_arr;
   var cu_arr;
   var duplicate = 0;
   var found_cu = 0;
   var now = Math.round(new Date().getTime() / 1000);
   var new_cookie = "";
   if (cookie_arr.length > 0) {
      for (var i = 0; i < cookie_arr.length; i++) {
         nv_arr = cookie_arr[i].split('=');
         if (nv_arr[0] == 'eas_dup') {
            cu_arr = nv_arr[1].split(':');
            for (var j = 0; j < cu_arr.length; j++) {
               cu_val = cu_arr[j].split('_');
               if (now - cu_val[1] < expires) {
                  if (cu_val[0] == cu) {
                     found_cu = 1;
                     duplicate = 1;
                     break;
                  } else {
                     if (new_cookie) new_cookie += ":";
                     new_cookie += cu_arr[j];
                  }
               }
            }
            break;
         }
      }
   }

   if (!duplicate) {
      if (!found_cu) {
         if (new_cookie) new_cookie += ":";
         new_cookie += cu + "_" + now;
      }
      document.cookie = "eas_dup=" + new_cookie + "; path=/; expires=Mon, 16-Mar-20 01:00:00 GMT;";
   }
   if (duplicate) return true;
   return false;
}

function EAS_place_ad(cus, EAS_options) {
   if(!EAS_dom) return;
   var set_size = 1;
   var safe_log = 0;
   var move_pos = 1;
   if (EAS_options) {
      var EAS_options_arr = EAS_options.split(",");
      for (var i = 0; i < EAS_options_arr.length; i++) {
         var EAS_temp = EAS_options_arr[i].split("=");
         var EAS_temp_val = 0;
         if (EAS_temp[1] == "1" || EAS_temp[1] == "y" || EAS_temp[1] == "yes") {
            EAS_temp_val = 1;
         }
         if (EAS_temp[0] == "set_size") set_size = EAS_temp_val;
         else if (EAS_temp[0] == "safe_log") safe_log = EAS_temp_val;
         else if (EAS_temp[0] == "move_pos") move_pos = EAS_temp_val;
      }
   }

   var EAS_cu_arr = cus.split(",");
   for (var i = 0; i < EAS_cu_arr.length; i++) {
      var EAS_cu = EAS_cu_arr[i];
      if (set_size || move_pos) {
         var EAS_temp = "EAS_position_" + EAS_cu;
         var EAS_div_position = document.getElementById(EAS_temp);
         if (EAS_div_position) {
            EAS_temp = "EAS_tag_" + EAS_cu;
            var EAS_div_tag = document.getElementById(EAS_temp);
            if (EAS_div_tag) {
               if (set_size) {
                  var EAS_width = eval("EAS_found_width_" + EAS_cu);
                  var EAS_height = eval("EAS_found_height_" + EAS_cu);
                  if (EAS_width && EAS_height) {
                     EAS_div_position.style.width = EAS_width + "px";
                     EAS_div_position.style.height = EAS_height + "px";
                  }
               }
               if (move_pos) {
                  var EAS_pos_top = EAS_pos_left = 0;
                  var EAS_pos_obj = EAS_div_position;
                  if (EAS_pos_obj.offsetParent) {
                     do {
                        EAS_pos_top += EAS_pos_obj.offsetTop;
                        EAS_pos_left += EAS_pos_obj.offsetLeft;
                     } while (EAS_pos_obj = EAS_pos_obj.offsetParent);
                     EAS_div_tag.style.position = "absolute";
                     EAS_div_tag.style.top = EAS_pos_top + "px";
                     EAS_div_tag.style.left = EAS_pos_left + "px";
                  }
               }
               EAS_div_tag.style.display = "block";
            }
         }
      }
      if (safe_log) {
         var confirm_img_src = eval("EAS_confirm_" + EAS_cu);
         if (confirm_img_src) {
            var confirm_img = new Image(1,1);
            confirm_img.src = confirm_img_src;
         }
      }
   }
}



try {
RegTr("16847");
RegTr("16848");
RegTr("16849");
RegTr("16850");
RegTr("16851");
RegTr("16852");
RegTr("16853");
RegTr("16854");
RegTr("17542");
RegTr("17543");
RegTr("16890");
RegTr("8694");
RegTr("14248");
RegTr("14249");
RegTr("8697");
RegTr("13126");
RegTr("17361");
RegTr("8690");
RegTr("8691");
RegTr("8693");
RegTr("16891");
RegTr("17544");
RegTr("16892");
RegTr("8697");
RegTr("17721");
RegTr("18757");
RegTr("17571");
RegTr("8697");
RegTr("15931");
RegTr("15932");
RegTr("14243");
RegTr("14244");
RegTr("14245");
RegTr("14246");
RegTr("14247");
RegTr("14989");
RegTr("8937");
RegTr("8936");
RegTr("8935");
RegTr("13095");
RegTr("13096");
RegTr("60");
RegTr("59");
RegTr("58");
RegTr("57");
RegTr("56");
RegTr("55");
RegTr("13097");
RegTr("13098");
RegTr("13099");
RegTr("13100");
RegTr("13539");
RegTr("13540");
RegTr("13541");
RegTr("13542");
RegTr("13543");
RegTr("13544");
RegTr("17359");
RegTr("17360");
RegTr("13768");
RegTr("13769");
RegTr("13770");
RegTr("15352");
RegTr("15205");
RegTr("15206");
RegTr("15207");
RegTr("15206");
RegTr("64");
RegTr("63");
RegTr("62");
RegTr("61");
RegTr("14789");
RegTr("14790");
RegTr("14791");
RegTr("14792");
RegTr("15934");
RegTr("15964");
RegTr("20598");
RegTr("20599");
RegTr("20600");
RegTr("20601");
} catch (e) {}
