var u, Util = u = new function() {}
u.version = "current";
Util.testURL = function(url) {
	return true;
	return url.match(/http\:\/\/mkn\.|http\:\/\/w\.|\.local/i);
}
Util.debug = function(output) {
	if(Util.testURL(location.href)) {
		var element, br;
		if(Util.debugWindow && Util.debugWindow.document) {
			element = Util.debugWindow.document.createTextNode(output);
			br = Util.debugWindow.document.createElement('br');
			Util.debugWindow.document.body.appendChild(element);
			Util.debugWindow.document.body.appendChild(br);
			Util.debugWindow.scrollBy(0,1000);
		}
		else {
			Util.openDebugger();
			if(!Util.debugWindow) {
				alert("Disable popup blocker!");
			}
			else {
				Util.debug(output);
			}
		}
	}
}
Util.debugWindow = false;
Util.openDebugger = function() {
	Util.debugWindow = window.open("", "debugWindow", "width=600, height=400, scrollbars=yes, resizable=yes");
	Util.debugWindow.document.body.style.fontFamily = "Courier";
	var element = Util.debugWindow.document.createTextNode("--- new session ---");
	var br = Util.debugWindow.document.createElement('br');
	Util.debugWindow.document.body.appendChild(br);
	Util.debugWindow.document.body.appendChild(element);
	Util.debugWindow.document.body.appendChild(br.cloneNode(br));
	Util.debugWindow.document.body.appendChild(br.cloneNode(br));
}
Util.tracePointer = function(e) {
	if(Util.testURL(location.href)) {
		var position = document.createElement("div");
		document.body.appendChild(position);
		position.id = "debug_pointer";
		position.style.position = "absolute";
		position.style.backgroundColor = "#ffffff";
		position.style.color = "#000000";
		this.trackMouse = function(event) {
			u.ge("debug_pointer").innerHTML = event.pageX+"x"+event.pageY;
			u.ge("debug_pointer").style.left = 7+event.pageX+"px";
			u.ge("debug_pointer").style.top = 7+event.pageY+"px";
		}
		u.e.addEvent(e, "mousemove", this.trackMouse);
	}
}
Util.bug = function(target, message, color) {
	if(Util.testURL(location.href)) {
		var option, options = new Array(new Array(0, "auto", "auto", 0), new Array(0, 0, "auto", "auto"), new Array("auto", 0, 0, "auto"), new Array("auto", "auto", 0, 0));
		if((!color && !message) || (!color && isNaN(target))) {
			color = message;
			message = target;
			target = 0;
		}
		if(!color) {
			color = "black";
		}
		if(!u.ge("debug_"+target)) {
			for(var i = 0; option = options[i]; i++) {
				if(!u.ge("debug_id_"+i)) {
					var d_target = document.createElement("div");
					document.body.appendChild(d_target);
					d_target.style.position = "absolute";
					d_target.style.zIndex = 100;
					d_target.style.top = option[0];
					d_target.style.right = option[1];
					d_target.style.bottom = option[2];
					d_target.style.left = option[3];
					d_target.style.backgroundColor = "#ffffff";
					d_target.style.color = "#000000";
					d_target.style.padding = "3px";
					d_target.id = "debug_id_"+i;
					d_target.className = "debug_"+target;
					break;
				}
			}
		}
		u.ae(u.ge("debug_"+target), "div", ({"style":"color: " + color})).innerHTML = message;
	}
}
Util.htmlToText = function(string) {
	return string.replace(/>/g, "&gt;").replace(/</g, "&lt;");
}
Util.listObjectContent = function(object) {
	var x, s = "";
	for(x in object) {
		s += x + "=" + object[x]+"<br>";
	}
	return s;
}
Util.cutString = function(string, length) {
	var length_compensation, matches, i;
	length_compensation = 0;
	matches = string.match(/\&[\w\d]+\;/g);
	if(matches) {
		for(i = 0; match = matches[i]; i++){
			if(string.indexOf(match) < length){
				length += match.length-1;
			}
		}
	}
	return string.substring(0, length) + (string.length > length ? "..." : "");
}
Util.random = function(min, max) {
	return Math.round((Math.random() * (max - min)) + min);
}
Util.randomKey = function(length) {
	var key = "", i;
	length = length ? length : 8;
	var pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
	for(i = 0; i < length; i++) {
		key += pattern[u.random(0,35)];
	}
	return key;
}
Util.randomString = function(length) {
	var key = "", i;
	length = length ? length : 8;
	var pattern = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(i = 0; i < length; i++) {
		key += pattern[u.random(0,35)];
	}
	return key;
}
Util.uuid = function() {
	var chars = '0123456789abcdef'.split('');
	var uuid = [], rnd = Math.random, r, i;
	uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
	uuid[14] = '4';
	for(i = 0; i < 36; i++) {
		if(!uuid[i]) {
			r = 0 | rnd()*16;
			uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r & 0xf];
		}
 	}
	return uuid.join('');
}
Util.ge = function(id, target) {
	var e, i, regexp, t;
	t = target ? target : document;
	if(document.getElementById(id)) {
		return document.getElementById(id);
	}
	regexp = new RegExp("(^|\\s)" + id + "(\\s|$|\:)");
	for(i = 0; e = t.getElementsByTagName("*")[i]; i++) {
		if(regexp.test(e.className)) {
			return e;
		}
	}
	return t.getElementsByTagName(id).length ? t.getElementsByTagName(id)[0] : false;
}
Util.ges = function(id, target) {
	var e, i, regexp, t;
	var elements = new Array();
	t = target ? target : document;
	regexp = new RegExp("(^|\\s)" + id + "(\\s|$|\:)");
	for(i = 0; e = t.getElementsByTagName("*")[i]; i++) {
		if(regexp.test(e.className)) {
			elements.push(e);
		}
	}
	return elements.length ? elements : t.getElementsByTagName(id);
}
Util.gs = function(e, direction) {
	try {
		var node_type = e.nodeType;
		var ready = false;
		var prev_node = false
		for(var i = 0; node = e.parentNode.childNodes[i]; i++) {
			if(node.nodeType == node_type) {
				if(ready) {
					return node;
				}
				if(node == e) {
					if(direction == "next") {
						ready = true;
					}
					else {
						return prev_node;
					}
				}
				else {
					prev_node = node;
				}
			}
		}
		return false;
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.gs, called from: "+arguments.callee.caller);
	}
}
Util.qs = function(query, target) {
	t = target ? target : document;
	return t.querySelector(query);
}
Util.qsa = function(query, target) {
	t = target ? target : document;
	return t.querySelectorAll(query);
}
Util.previousSibling = u.ps = function(e, exclude) {
	var node = e.previousSibling;
	if(exclude) {
		while(node && (node.nodeType == 3 || node.nodeType == 8 || node.className.match("(^|\\s)" + exclude + "(\\s|$)") || node.nodeName.match(exclude.toUpperCase()))) {
			node = node.previousSibling;
		}
	}
	else {
		while(node && (node.nodeType == 3 || node.nodeType == 8)) {
			node = node.previousSibling;
		}
	}
	return node;
}
Util.nextSibling = u.ns = function(e, exclude) {
	var node = e.nextSibling;
	if(exclude) {
		while(node && (node.nodeType == 3 || node.nodeType == 8 || node.className.match("(^|\\s)" + exclude + "(\\s|$)") || node.nodeName.match(exclude.toUpperCase()))) {
			node = node.nextSibling;
		}
	}
	else {
		while(node && (node.nodeType == 3 || node.nodeType == 8)) {
			node = node.nextSibling;
		}
	}
	return node;
}
Util.ae = function(e, node_type, attributes) {
	try {
		var node = e.appendChild(document.createElement(node_type));
		if(attributes) {
			if(typeof(attributes) == "object") {
				for(attribute in attributes) {
					node.setAttribute(attribute, attributes[attribute]);
				}
			}
			else {
				u.addClass(node, attributes)
			}
		}
		node.e = e;
		return node;
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.ae, called from: "+arguments.callee.caller.name);
		u.bug("e="+e + ":nodename="+e.nodeName + ":id="+e.id + ":classname="+e.classname + ":attributes=" + attribute);
	}
}
Util.ie = function(e, node_type, attributes) {
	var node = e.insertBefore(document.createElement(node_type), e.firstChild);
	if(attributes) {
		if(typeof(attributes) == "object") {
			for(attribute in attributes) {
				node.setAttribute(attribute, attributes[attribute]);
			}
		}
		else {
			u.addClass(node, attributes)
		}
	}
	node.e = e;
	return node;
}
Util.getIJ = function(e, id) {
	try {
		var regexp = new RegExp(id + ":[?=\\w/\\#~:.?+=?&%@!\\-]*");
		if(e.className.match(regexp)) {
			return e.className.match(regexp)[0].replace(id + ":", "");
		}
		return false;
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.getIJ, called from: "+arguments.callee.caller);
	}
}
Util.setClass = u.sc = function(e, classname) {
	try {
		e.className = classname;
		e.offsetTop;
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.setClass, called from: "+arguments.callee.caller);
	}
}
Util.addClass = u.ac = function(e, classname) {
	try {
		if(classname) {
			var regexp = new RegExp("(^|\\s)" + classname + "(\\s|$|\:)");
			if(!regexp.test(e.className)) {
				e.className += e.className ? " " + classname : classname;
				e.offsetTop;
			}
		}
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.addClass, called from: "+arguments.callee.caller);
	}
}
Util.removeClass = u.rc = function(e, classname) {
	try {
		if(classname) {
			var regexp = new RegExp(classname + " | " + classname + "|" + classname);
			e.className = e.className.replace(regexp, "");
			e.offsetTop;
		}
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.removeClass, called from: "+arguments.callee.caller);
	}
}
Util.toggleClass = u.tc = function(e, classname, second_classname) {
	try {
		var regexp = new RegExp("(^|\\s)" + classname + "(\\s|$|\:)");
		if(regexp.test(e.className)) {
			Util.removeClass(e, classname);
			if(second_classname) {
				Util.addClass(e, second_classname);
			}
		}
		else {
			Util.addClass(e, classname);
			if(second_classname) {
				Util.removeClass(e, second_classname);
			}
		}
		e.offsetTop;
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.toggleClass, called from: "+arguments.callee.caller);
	}
}
Util.applyStyle = u.as = function(e, style, value) {
	try {
		e.style[style] = value;
		e.offsetHeight;
	}
	catch(exception) {
		u.bug("Exception ("+exception+") in u.applyStyle, called from: "+arguments.callee.caller);
	}
}
Util.getComputedStyle = u.gcs = function(e, attribute) {
	e.offsetHeight;
	if(document.defaultView && document.defaultView.getComputedStyle) {
		return document.defaultView.getComputedStyle(e, null).getPropertyValue(attribute);
	}
	return false;
}
Util.wrapElement = u.we = function(e, wrap) {
	wrap = e.parentNode.insertBefore(document.createElement(wrap), e);
	wrap.appendChild(e);
	return wrap;
}
Util.Form = u.f = new function() {
	this.init = function(e, activate, insertlabels) {
		var i, o;
		var fields = u.qsa(".field", e);
		for(i = 0; field = fields[i]; i++) {
			field.lN = u.qs("label", field);
			if(field.className.match(/string|email|tel/)) {
				field.iN = u.qs("input", field);
				field.iN.field = field;
				if(activate) {
					this.activate(field.iN);
				}
				if(insertlabels) {
					this.insertLabel(field.iN);
				}
				if(field.className.match(/required/)) {
					u.e.addEvent(field.iN, "keyup", this._validateInput);
					this.validateInput(field.iN);
				}
			}
			if(field.className.match(/numeric/)) {
				field.iN = u.qs("input", field);
				field.iN.field = field;
				if(activate) {
					this.activate(field.iN);
				}
				if(insertlabels) {
					this.insertLabel(field.iN);
				}
				if(field.className.match(/required/)) {
					u.e.addEvent(field.iN, "keyup", this._validateInput);
					this.validateInput(field.iN);
				}
			}
			if(field.className.match(/text/)) {
				field.iN = u.qs("textarea", field);
				field.iN.field = field;
				if(activate) {
					this.activate(field.iN);
				}
				if(insertlabels) {
					this.insertLabel(field.iN);
				}
				if(field.className.match(/required/)) {
					u.e.addEvent(field.iN, "keyup", this._validateInput);
					this.validateInput(field.iN);
				}
				u.as(field.iN, "height", field.iN.scrollHeight+"px");
				field.iN.offset = 0;
				if(parseInt(u.gcs(field.iN, "height")) != field.iN.scrollHeight) {
					field.iN.offset = field.iN.scrollHeight - parseInt(u.gcs(field.iN, "height"));
				}
				u.as(field.iN, "height", (field.iN.scrollHeight - field.iN.offset) +"px");
				field.iN.setHeight = function() {
					var height = parseInt(u.gcs(this, "height")) + this.offset;
					if(this.value && this.scrollHeight > height) {
						u.as(this, "height", (this.scrollHeight - this.offset) +"px");
					}
				}
				u.e.addEvent(field.iN, "keyup", field.iN.setHeight);
			}
			if(field.className.match(/select|country/)) {
				field.iN = u.qs("select", field);
				field.iN.field = field;
				if(activate) {
					this.activate(field.iN);
				}
				if(field.className.match(/required/)) {
					u.e.addEvent(field.iN, "change", this._validateInput);
					this.validateInput(field.iN);
				}
			}
			if(field.className.match(/file/)) {
				field.iN = u.qs("input", field);
				field.iN.field = field;
				if(activate) {
					this.activate(field.iN);
				}
				if(insertlabels) {
					this.insertLabel(field.iN);
				}
				field.file_input = u.ae(field, "div", "input_file");
				var file_button = u.ae(field, "div", "button");
				var file_a = u.ae(file_button, "a").innerHTML = "Browse";
				field.iN.size = "39"
				if(field.className.match(/required/)) {
					u.e.addEvent(field.iN, "change", this._validateInput);
					this.validateInput(field.iN);
				}
				field.iN.changed = function() {
					this.field.file_input.innerHTML = this.value;
				}
				u.e.addEvent(field.iN, "change", field.iN.changed);
			}
			if(field.className.match(/date/)) {
				field.iNs = u.qsa("select", field);
				var date = field.iNs[0];
				date.field = field;
				var month = field.iNs[1];
				month.field = field;
				var year = field.iNs[2];
				year.field = field;
				if(activate) {
					this.activate(date);
					this.activate(month);
					this.activate(year);
				}
				if(field.className.match(/required/)) {
					u.e.addEvent(date, "change", this._validateInput);
					u.e.addEvent(month, "change", this._validateInput);
					u.e.addEvent(year, "change", this._validateInput);
					this.validateInput(date)
					this.validateInput(month)
					this.validateInput(year)
				}
			}
		}
	}
	this.isDefault = function(iN) {
		if(iN.value == iN.field.default_value) {
			return true;
		}
		return false;
	}
	this.insertLabel = function(iN) {
		var abbr = u.qs("abbr", iN.field.lN);
		if(abbr) {
			iN.field.lN.removeChild(abbr);
		}
		iN.field.default_value = iN.field.lN.innerHTML;
		if(!iN.value) {
			iN.value = iN.field.default_value;
			u.ac(iN.field, "default");
		}
		iN.labelFocus = function(event) {
			if(u.f.isDefault(this)) {
				this.value = "";
			}
			u.rc(this.field, "default");
		}
		iN.labelBlur = function(event) {
			if(this.value == "") {
				this.value = this.field.default_value;
				u.ac(this.field, "default");
			}
		}
		u.e.addEvent(iN, "focus", iN.labelFocus);
		u.e.addEvent(iN, "blur", iN.labelBlur);
	}
	this.activate = function(iN) {
		iN.activeFocus = function(event) {
			this.field.focused = true;
			u.ac(this.field, "focus");
			u.ac(this, "focus");
		}
		iN.activeBlur = function(event) {
			this.field.focused = false;
			u.rc(this.field, "focus");
			u.rc(this, "focus");
		}
		u.e.addEvent(iN, "focus", iN.activeFocus);
		u.e.addEvent(iN, "blur", iN.activeBlur);
	}
	this.validateForm = function(form) {
	}
	this._validateInput = function() {
		u.f.validateInput(this);
	}
	this.validateInput = function(iN) {
		if(iN.field.className.match(/string/)) {
			if(iN.value.length > 1 && !this.isDefault(iN)) {
				u.ac(iN, "correct");
				u.ac(iN.field, "correct");
			}
			else {
				u.rc(iN, "correct");
				u.rc(iN.field, "correct");
			}
		}
		if(iN.field.className.match(/numeric/)) {
			if(iN.value && !isNaN(iN.value) && !this.isDefault(iN)) {
				u.ac(iN, "correct");
				u.ac(iN.field, "correct");
			}
			else {
				u.rc(iN, "correct");
				u.rc(iN.field, "correct");
			}
		}
		if(iN.field.className.match(/tel/)) {
			if(iN.value.length > 3 && !this.isDefault(iN)) {
				u.ac(iN, "correct");
				u.ac(iN.field, "correct");
			}
			else {
				u.rc(iN, "correct");
				u.rc(iN.field, "correct");
			}
		}
		if(iN.field.className.match(/email/)) {
		}
		if(iN.field.className.match(/text/)) {
			if(iN.value.length > 2 && !this.isDefault(iN)) {
				u.ac(iN, "correct");
				u.ac(iN.field, "correct");
			}
			else {
				u.rc(iN, "correct");
				u.rc(iN.field, "correct");
			}
		}
		if(iN.field.className.match(/select|country|date/)) {
			if(iN.options[iN.selectedIndex].value != "") {
				u.ac(iN, "correct");
				u.ac(iN.field, "correct");
			}
			else {
				u.rc(iN, "correct");
				u.rc(iN.field, "correct");
			}
		}
		if(iN.field.className.match(/file/)) {
			if(iN.value.length > 1) {
				u.ac(iN, "correct");
				u.ac(iN.field, "correct");
			}
			else {
				u.rc(iN, "correct");
				u.rc(iN.field, "correct");
			}
		}
	}
}
Util.explorer = function(version, scope) {
	if(document.all) {
		var undefined;
		var current_version = navigator.userAgent.match(/(MSIE )(\d+.\d)/i)[2];
		if(scope && !eval(current_version + scope + version)){
			return false;
		}
		else if(!scope && version && current_version != version) {
			return false;
		}
		else {
			return current_version;
		}
	}
	else {
		return false;
	}
}
Util.safari = function(version, scope) {
	if(navigator.userAgent.indexOf("Safari") >= 0) {
		var undefined;
		var current_version = navigator.userAgent.match(/(Safari\/)(\d+)(.\d)/i)[2];
		if(scope && !eval(current_version + scope + version)){
			return false;
		}
		else if(!scope && version && current_version != version) {
			return false;
		}
		else {
			return current_version;
		}
	}
	else {
		return false;
	}
}
Util.webkit = function(version, scope) {
	if(navigator.userAgent.indexOf("AppleWebKit") >= 0) {
		var undefined;
		var current_version = navigator.userAgent.match(/(AppleWebKit\/)(\d+.\d)/i)[2];
		if(scope && !eval(current_version + scope + version)){
			return false;
		}
		else if(!scope && version && current_version != version) {
			return false;
		}
		else {
			return current_version;
		}
	}
	else {
		return false;
	}
}
Util.firefox = function(version, scope) {
	var browser = navigator.userAgent.match(/(Firefox\/)(\d+\.\d+)/i);
	if(browser) {
		var current_version = browser[2];
		if(scope && !eval(current_version + scope + version)){
			return false;
		}
		else if(!scope && version && current_version != version) {
			return false;
		}
		else {
			return current_version;
		}
	}
	else {
		return false;
	}
}
Util.opera = function() {
	return (navigator.userAgent.indexOf("Opera") >= 0) ? true : false;
}
Util.windows = function() {
	return (navigator.userAgent.indexOf("Windows") >= 0) ? true : false;
}
Util.osx = function() {
	return (navigator.userAgent.indexOf("OS X") >= 0) ? true : false;
}
Util.Animation = u.a = new function() {
	this.support = function() {
		var node = document.createElement("div");
		if(node.style[this.variant() + "Transition"] !== undefined) {
			return true;
		}
		return false;
	}
	this.variant = function(e) {
		if(this.implementation == undefined) {
			if(document.body.style.webkitTransition != undefined) {
				this.implementation = "webkit";
			}
			else if(document.body.style.MozTransition != undefined) {
				this.implementation = "Moz";
			}
			else if(document.body.style.oTransition != undefined) {
				this.implementation = "o";
			}
			else {
				this.implementation = "";
			}
		}
		return this.implementation;
	}
	this.translate = function(e, x, y) {
		e.style[this.variant() + "Transform"] = "translate("+x+"px, "+y+"px)";
		e.element_x = x;
		e.element_y = y;
		e._x = x;
		e._y = y;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.rotate = function(e, deg) {
		e.style[this.variant() + "Transform"] = "rotate("+deg+"deg)";
		e._rotation = deg;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.scale = function(e, scale) {
		e.style[this.variant() + "Transform"] = "scale("+scale+")";
		e.scale = scale;
		e._scale = scale;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.setOpacity = function(e, opacity) {
		e.style.opacity = opacity;
		e._opacity = opacity;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.setWidth = function(e, width) {
		var width_px = (width == "auto" ? width : width+"px");
		e.style.width = width_px;
		e._width = width;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.setHeight = function(e, height) {
		var height_px = (height == "auto" ? height : height+"px");
		e.style.height = height_px;
		e._height = height;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.rotateTranslate = function(e, deg, x, y) {
		e.style[this.variant() + "Transform"] = "rotate("+deg+"deg) translate("+x+"px, "+y+"px)";
		e.rotation = deg;
		e.element_x = x;
		e.element_y = y;
		e._rotation = deg;
		e._x = x;
		e._y = y;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.translateRotate = function(e, x, y, deg) {
		e.style[this.variant() + "Transform"] = "translate("+x+"px, "+y+"px) rotate("+deg+"deg)";
		e.element_x = x;
		e.element_y = y;
		e.rotation = deg;
		e._x = x;
		e._y = y;
		e._rotation = deg;
		e.transition_timestamp = new Date().getTime();
		e.offsetHeight;
	}
	this.transition = function(e, transition) {
		try {
			e.style[this.variant() + "Transition"] = transition;
			u.e.addEvent(e, this.variant() + "TransitionEnd", this._transitioned);
			u.e.addEvent(e, "transitionend", this._transitioned);
			var duration = transition.match(/[0-9.]+[ms]/g);
			if(duration) {
				var d = duration[0];
				e.duration = d.match("ms") ? parseFloat(d) : (parseFloat(d) * 1000);
			}
			else {
				e.duration = false;
			}
			e.offsetHeight;
		}
		catch(exception) {
			u.bug("Exception ("+exception+") in u.a.transition, called from: "+arguments.callee.caller);
		}
	}
	this._transitioned = function(event) {
		if(event.target == this && typeof(this.transitioned) == "function") {
			this.transitioned(event);
		}
	}
	this.fadeIn = function(e, duration) {
		duration = duration == undefined ? "0.5s" : duration;
		u.as(e, "opacity", 0);
		if(u.gcs(e, "display") == "none") {
			u.as(e, "display", "block");
		}
		u.a.transition(e, "all "+duration+" ease-in");
		u.as(e, "opacity", 1);
	}
}
Util.Events = u.e = new function() {
	this.event_pref = typeof(document.ontouchmove) == "undefined" ? "mouse" : "touch";
	this.kill = function(event) {
		if(event) {
			event.preventDefault();
			event.stopPropagation()
		}
	}
	this.addEvent = function(e, type, action) {
		try {
			e.addEventListener(type, action, false);
		}
		catch(exception) {
			u.bug("exception in addEvent:" + e + "," + type + ":" + exception);
		}
	}
	this.removeEvent = function(e, type, action) {
		try {
			e.removeEventListener(type, action, false);
		}
		catch(exception) {
			u.bug("exception in removeEvent:" + e + "," + type + ":" + exception);
		}
	}
	this.addStartEvent = this.addDownEvent = function(e, action) {
		u.e.addEvent(e, (this.event_pref == "touch" ? "touchstart" : "mousedown"), action);
	}
	this.removeStartEvent = this.removeDownEvent = function(e, action) {
		u.e.removeEvent(e, (this.event_pref == "touch" ? "touchstart" : "mousedown"), action);
	}
	this.addMoveEvent = function(e, action) {
		u.e.addEvent(e, (this.event_pref == "touch" ? "touchmove" : "mousemove"), action);
	}
	this.removeMoveEvent = function(e, action) {
		u.e.removeEvent(e, (this.event_pref == "touch" ? "touchmove" : "mousemove"), action);
	}
	this.addEndEvent = this.addUpEvent = function(e, action) {
		u.e.addEvent(e, (this.event_pref == "touch" ? "touchend" : "mouseup"), action);
		if(e.snapback && u.e.event_pref == "mouse") {
			u.e.addEvent(e, "mouseout", this._snapback);
		}
	}
	this.removeEndEvent = this.removeUpEvent = function(e, action) {
		u.e.removeEvent(e, (this.event_pref == "touch" ? "touchend" : "mouseup"), action);
		if(e.snapback && u.e.event_pref == "mouse") {
			u.e.removeEvent(e, "mouseout", this._snapback);
		}
	}
	this.overlap = function(element, target, strict) {
		if(target.constructor.toString().match("Array")) {
			var target_start_x = Number(target[0]);
			var target_start_y = Number(target[1]);
			var target_end_x = Number(target[2]);
			var target_end_y = Number(target[3]);
		}
		else {
			var target_start_x = target.element_x ? target.element_x : 0;
			var target_start_y = target.element_y ? target.element_y : 0;
			var target_end_x = Number(target_start_x + target.offsetWidth);
			var target_end_y = Number(target_start_y + target.offsetHeight);
		}
		var element_start_x = Number(element.element_x);
		var element_start_y = Number(element.element_y);
		var element_end_x = Number(element_start_x + element.offsetWidth);
		var element_end_y = Number(element_start_y + element.offsetHeight);
		if(strict && element_start_x >= target_start_x && element_start_y >= target_start_y && element_end_x <= target_end_x && element_end_y <= target_end_y) {
			return true;
		}
		else if(strict) {
			return false;
		}
		else if(element_end_x < target_start_x || element_start_x > target_end_x || element_end_y < target_start_y || element_start_y > target_end_y) {
			return false;
		}
		return true;
	}
	this.resetEvents = function(e) {
		u.t.resetTimer(e.t_held);
		u.t.resetTimer(e.t_clicked);
		this.removeEvent(e, "mouseup", this._dblclicked);
		this.removeEvent(e, "touchend", this._dblclicked);
		this.removeEvent(e, "mousemove", this._inputClickMove);
		this.removeEvent(e, "touchmove", this._inputClickMove);
		this.removeEvent(e, "mousemove", this._pick);
		this.removeEvent(e, "touchmove", this._pick);
		this.removeEvent(e, "mousemove", this._drag);
		this.removeEvent(e, "touchmove", this._drag);
		this.removeEvent(e, "mouseup", this._drop);
		this.removeEvent(e, "touchend", this._drop);
		this.removeEvent(e, "mouseout", this._snapback);
		this.removeEvent(e, "mouseout", this._drop);
	}
	this._inputStart = function(event) {
		this.event_var = event;
		this.input_timestamp = new Date().getTime();
		this.start_event_x = u.eventX(event);
		this.start_event_y = u.eventY(event);
		this.current_xps = 0;
		this.current_yps = 0;
		this.swiped = false;
		if(this.e_click || this.e_dblclick || this.e_hold) {
			u.e.addMoveEvent(this, u.e._inputClickMove);
			u.e.addEndEvent(this, u.e._dblclicked);
		}
		if(this.e_hold) {
			this.t_held = u.t.setTimer(this, u.e._held, 750);
		}
		if(this.e_drag || this.e_swipe) {
			u.e.addMoveEvent(this, u.e._pick);
			u.e.addEndEvent(this, u.e._drop);
		}
		if(typeof(this.inputStarted) == "function") {
			this.inputStarted(event);
		}
	}
	this._inputClickMove = function(event) {
		u.e.resetEvents(this);
		if(typeof(this.clickMoved) == "function") {
			this.clickMoved(event);
		}
		if(typeof(this.moved) == "function") {
			this.moved(event);
		}
	}
	this.hold = function(e) {
		e.e_hold = true;
		u.e.addStartEvent(e, this._inputStart);
	}
	this._held = function(event) {
		u.e.resetEvents(this);
		if(typeof(this.held) == "function") {
			this.held(event);
		}
	}
	this.click = this.tap = function(e) {
		e.e_click = true;
		u.e.addStartEvent(e, this._inputStart);
	}
	this._clicked = function(event) {
		u.e.resetEvents(this);
		if(typeof(this.clicked) == "function") {
			this.clicked(event);
		}
	}
	this.dblclick = this.doubletap = function(e) {
		e.e_dblclick = true;
		u.e.addStartEvent(e, this._inputStart);
	}
	this._dblclicked = function(event) {
		if(u.t.valid(this.t_clicked) && event) {
			u.e.resetEvents(this);
			if(typeof(this.dblclicked) == "function") {
				this.dblclicked(event);
			}
			return;
		}
		else if(!this.e_dblclick) {
			this._clicked = u.e._clicked;
			this._clicked(event);
		}
		else if(!event) {
			this._clicked = u.e._clicked;
			this._clicked(this.event_var);
		}
		else {
			u.e.resetEvents(this);
			this.t_clicked = u.t.setTimer(this, u.e._dblclicked, 400);
		}
	}
	this.drag = function(e, target, strict, snapback) {
		e.e_drag = true;
		e.strict = strict ? true : false;
		e.allowed_offset = e.strict ? 0 : 250;
		e.elastica = 2;
		e.snapback = snapback ? true : false;
		if(target.constructor.toString().match("Array")) {
			e.start_drag_x = Number(target[0]);
			e.start_drag_y = Number(target[1]);
			e.end_drag_x = Number(target[2]);
			e.end_drag_y = Number(target[3]);
		}
		else {
			e.start_drag_x = target.element_x ? target.element_x : 0;
			e.start_drag_y = target.element_y ? target.element_y : 0;
			e.end_drag_x = Number(e.start_drag_x + target.offsetWidth);
			e.end_drag_y = Number(e.start_drag_y + target.offsetHeight);
		}
		e.element_x = e.element_x ? e.element_x : 0;
		e.element_y = e.element_y ? e.element_y : 0;
		e.locked = ((e.end_drag_x - e.start_drag_x == e.offsetWidth) && (e.end_drag_y - e.start_drag_y == e.offsetHeight));
		e.vertical = (!e.locked && e.end_drag_x - e.start_drag_x == e.offsetWidth);
		e.horisontal = (!e.locked && e.end_drag_y - e.start_drag_y == e.offsetHeight);
		u.e.addStartEvent(e, this._inputStart);
	}
	this._pick = function(event) {
		var init_speed_x = Math.abs(this.start_event_x - u.eventX(event));
		var init_speed_y = Math.abs(this.start_event_y - u.eventY(event));
		u.e.resetEvents(this);
		if(init_speed_x > init_speed_y && this.horisontal || init_speed_x < init_speed_y && this.vertical || !this.vertical && !this.horisontal) {
		    u.e.kill(event);
			this.move_timestamp = new Date().getTime();
			this.current_xps = 0;
			this.current_yps = 0;
			this.start_input_x = u.eventX(event) - this.element_x; // - u.absLeft(this);//(event.targetTouches ? event.targetTouches[0].pageX : event.pageX);
			this.start_input_y = u.eventY(event) - this.element_y; // - u.absTop(this);//.targetTouches ? event.targetTouches[0].pageY : event.pageY);
			u.a.transition(this, "none");
			if(typeof(this.picked) == "function") {
				this.picked(event);
			}
			u.e.addMoveEvent(this, u.e._drag);
			u.e.addEndEvent(this, u.e._drop);
		}
	}
	this._drag = function(event) {
			this.new_move_timestamp = new Date().getTime();
				var offset = false;
				this.current_x = u.eventX(event) - this.start_input_x;
				this.current_y = u.eventY(event) - this.start_input_y;
					this.current_xps = Math.round(((this.current_x - this.element_x) / (this.new_move_timestamp - this.move_timestamp)) * 1000);
					this.current_yps = Math.round(((this.current_y - this.element_y) / (this.new_move_timestamp - this.move_timestamp)) * 1000);
				this.move_timestamp = this.new_move_timestamp;
				if(this.vertical) {
					this.element_y = this.current_y;
				}
				else if(this.horisontal) {
					this.element_x = this.current_x;
				}
				else if(!this.locked) {
					this.element_x = this.current_x;
					this.element_y = this.current_y;
				}
				if(!this.locked) {
					if(u.e.overlap(this, new Array(this.start_drag_x, this.start_drag_y, this.end_drag_x, this.end_drag_y), true)) {
						if(this.current_xps && (Math.abs(this.current_xps) > Math.abs(this.current_yps) || this.horisontal)) {
							if(this.current_xps < 0) {
								this.swiped = "left";
							}
							else {
								this.swiped = "right";
							}
						}
						else if(this.current_yps && (Math.abs(this.current_xps) < Math.abs(this.current_yps) || this.vertical)) {
							if(this.current_yps < 0) {
								this.swiped = "up";
							}
							else {
								this.swiped = "down";
							}
						}
						u.a.translate(this, this.element_x, this.element_y);
					}
					else {
						this.swiped = false;
						this.current_xps = 0;
						this.current_yps = 0;
						if(this.element_x < this.start_drag_x && !this.vertical) {
							offset = this.element_x < this.start_drag_x - this.allowed_offset ? - this.allowed_offset : this.element_x - this.start_drag_x;
							this.element_x = this.start_drag_x;
							this.current_x = this.element_x + offset + (Math.round(Math.pow(offset, 2)/this.allowed_offset)/this.elastica);
						}
						else if(this.element_x + this.offsetWidth > this.end_drag_x && !this.vertical) {
							offset = this.element_x + this.offsetWidth > this.end_drag_x + this.allowed_offset ? this.allowed_offset : this.element_x + this.offsetWidth - this.end_drag_x;
							this.element_x = this.end_drag_x - this.offsetWidth;
							this.current_x = this.element_x + offset - (Math.round(Math.pow(offset, 2)/this.allowed_offset)/this.elastica);
						}
						else {
							this.current_x = this.element_x;
						}
						if(this.element_y < this.start_drag_y && !this.horisontal) {
							offset = this.element_y < this.start_drag_y - this.allowed_offset ? - this.allowed_offset : this.element_y - this.start_drag_y;
							this.element_y = this.start_drag_y;
							this.current_y = this.element_y + offset + (Math.round(Math.pow(offset, 2)/this.allowed_offset)/this.elastica);
						}
						else if(this.element_y + this.offsetHeight > this.end_drag_y && !this.horisontal) {
							offset = (this.element_y + this.offsetHeight > this.end_drag_y + this.allowed_offset) ? this.allowed_offset : (this.element_y + this.offsetHeight - this.end_drag_y);
							this.element_y = this.end_drag_y - this.offsetHeight;
							this.current_y = this.element_y + offset - (Math.round(Math.pow(offset, 2)/this.allowed_offset)/this.elastica);
						}
						else {
							this.current_y = this.element_y;
						}
						if(offset) {
							u.a.translate(this, this.current_x, this.current_y);
						}
					}
				}
			if(typeof(this.moved) == "function") {
				this.moved(event);
			}
	}
	this._drop = function(event) {
		u.e.resetEvents(this);
		if(this.e_swipe && this.swiped) {
			if(this.swiped == "left") {
				if(typeof(this.swipedLeft) == "function") {
					this.swipedLeft(event);
				}
			}
			else if(this.swiped == "right") {
				if(typeof(this.swipedRight) == "function") {
					this.swipedRight(event);
				}
			}
			else if(this.swiped == "down") {
				if(typeof(this.swipedDown) == "function") {
					this.swipedDown(event);
				}
			}
			else if(this.swiped == "up") {
				if(typeof(this.swipedUp) == "function") {
					this.swipedUp(event);
				}
			}
		}
		else if(!this.locked && this.start_input_x && this.start_input_y) {
			this.start_input_x = false;
			this.start_input_y = false;
			this.current_x = this.element_x + (this.current_xps/2);
			this.current_y = this.element_y + (this.current_yps/2);
			if(this.current_x < this.start_drag_x) {
				this.current_x = this.start_drag_x;
			}
			else if(this.current_x + this.offsetWidth > this.end_drag_x) {
				this.current_x = this.end_drag_x - this.offsetWidth;
			}
			if(this.current_y < this.start_drag_y) {
				this.current_y = this.start_drag_y;
			}
			else if(this.current_y + this.offsetHeight > this.end_drag_y) {
				this.current_y = this.end_drag_y - this.offsetHeight;
			}
			if(!this.strict && (this.current_xps || this.current_yps)) {
				u.a.transition(this, "all 1s cubic-bezier(0,0,0.25,1)");
			}
			else {
				u.a.transition(this, "all 0.1s cubic-bezier(0,0,0.25,1)");
			}
			u.a.translate(this, this.current_x, this.current_y);
		}
		if(typeof(this.dropped) == "function") {
			this.dropped(event);
		}
	}
	this.swipe = function(e, target, strict) {
		e.e_swipe = true;
		u.e.drag(e, target, strict);
	}
	this._swipe = function(event) {
	}
	this._snapback = function(event) {
	    u.e.kill(event);
		u.bug(2, "snap")
		if(this.start_input_x && this.start_input_y) {
			input_x = event.targetTouches ? event.targetTouches[0].pageX : event.pageX;
			input_y = event.targetTouches ? event.targetTouches[0].pageY : event.pageY;
			offset_x = 0;
			offset_y = 0;
			if(this.vertical) {
				offset_y = input_y - this.current_y;
			}
			else if(this.horisontal) {
				offset_x = input_x - this.current_x;
			}
			else {
				offset_x = input_x - this.current_x;
				offset_y = input_y - this.current_y;
			}
			u.a.translate(this, (this.element_x+offset_x), (this.element_y+offset_y));
		}
	}
}
Util.absoluteX = u.absX = function(e) {
	if(e.offsetParent) {
		return e.offsetLeft + u.absX(e.offsetParent);
	}
	return e.offsetLeft;
}
Util.absoluteY = u.absY = function(e) {
	if(e.offsetParent) {
		return e.offsetTop + u.absY(e.offsetParent);
	}
	return e.offsetTop;
}
Util.relativeX = u.relX = function(e) {
	if(e.offsetParent && u.gcs(e.offsetParent, "position").match(/relative|absoute/) == null) {
		return e.offsetLeft + u.relX(e.offsetParent);
	}
	return e.offsetLeft;
}
Util.relativeY = u.relY = function(e) {
	if(e.offsetParent && u.gcs(e.offsetParent, "position").match(/relative|absoute/) == null) {
		return e.offsetTop + u.relY(e.offsetParent);
	}
	return e.offsetTop;
}
Util.relativeOffsetX = u.relOffsetX = function(e) {
	if(e.offsetParent && u.gcs(e.offsetParent, "position").match(/relative|absoute/) != null) {
		return u.absX(e.offsetParent); // - e.offsetLeft u.relOffsetX(e.offsetParent);
	}
	return 0; //u.absX(e) - e.offsetLeft;
}
Util.relativeOffsetY = u.relOffsetY = function(e) {
	if(e.offsetParent && u.gcs(e.offsetParent, "position").match(/relative|absoute/) != null) {
		return u.absY(e.offsetParent);
	}
	return 0; // u.absY(e) - e.offsetTop;
}
Util.actualWidth = function(e) {
	return parseInt(u.gcs(e, "width"));
}
Util.actualHeight = function(e) {
	return parseInt(u.gcs(e, "height"));
}
Util.eventX = function(event){
	return (event.targetTouches ? event.targetTouches[0].pageX : event.pageX);
}
Util.eventY = function(event){
	return (event.targetTouches ? event.targetTouches[0].pageY : event.pageY);
}
Util.browserWidth = u.browserW = function() {
	return document.documentElement.clientWidth;
}
Util.browserHeight = u.browserH = function() {
	return document.documentElement.clientHeight;
}
Util.htmlWidth = u.htmlW = function() {
	return document.documentElement.offsetWidth;
}
Util.htmlHeight = u.htmlH = function() {
	return document.documentElement.offsetHeight;
}
Util.pageScrollX = u.scrollX = function() {
	return window.pageXOffset;
}
Util.pageScrollY = u.scrollY = function() {
	return window.pageYOffset;
}
Util.saveCookie = function(name, value) {
	document.cookie = encodeURIComponent(name) + "=" + value +";"
}
Util.savePermCookie = function(name, value) {
	document.cookie = encodeURIComponent(name) + "=" + value +";expires=Mon, 04-Apr-2020 05:00:00 GMT;"
}
Util.getCookie = function(name) {
	var matches;
	return (matches = document.cookie.match(encodeURIComponent(name) + "=([^;]+)")) ? matches[1] : false;
}
Util.delCookie = function(name) {
	document.cookie = encodeURIComponent(name) + "=;expires=Thu, 01-Jan-70 00:00:01 GMT";
}
Util.Image = u.i = new function() {
	this.load = function(e, src) {
		var image = new Image();
		image.e = e;
		u.addClass(e, "loading");
	    u.e.addEvent(image, 'load', u.i._loaded);
		image.src = src;
	}
	this._loaded = function(event) {
		u.removeClass(this.e, "loading");
		if(typeof(this.e.loaded) == "function") {
			this.e.loaded(event);
		}
	}
	this._progress = function(event) {
		u.bug("progress")
		if(typeof(this.e.progress) == "function") {
			this.e.progress(event);
		}
	}
	this._debug = function(event) {
		u.bug("event:" + event.type);
	}
}
Util.Timer = u.t = new function() {
	this.actions = new Array();
	this.objects = new Array();
	this.timers = new Array();
	this.setTimer = function(object, action, timeout) {
		var id = this.actions.length;
		this.actions[id] = action;
		this.objects[id] = object;
		this.timers[id] = setTimeout("u.t.execute("+id+")", timeout);
		return id;
	}
	this.resetTimer = function(id) {
		clearTimeout(this.timers[id]);
		this.objects[id] = false;
	}
	this.execute = function(id) {
		this.objects[id].exe = this.actions[id];
		this.objects[id].exe();
		this.objects[id].exe = null;
		this.actions[id] = null;
		this.objects[id] = false;
		this.timers[id] = null;
	}
	this.valid = function(id) {
		return this.objects[id] ? true : false;
	}
}
Util.Hash = u.h = new function() {
	this.catchEvent = function(callback, node) {
		this.node = node;
		this.node.callback = callback;
		hashChanged = function(event) {
			u.h.node.callback();
		}
		if("onhashchange" in window) {
			window.onhashchange = hashChanged;
		}
		else {
			u.current_hash = window.location.hash;
			window.onhashchange = hashChanged;
			setInterval(
				function() {
					if(window.location.hash !== u.current_hash) {
						u.current_hash = window.location.hash;
						window.onhashchange();
					}
				}, 200
			);
		}
	}
	this.cleanHash = function(string) {
		return string.replace(location.protocol+"//"+document.domain, "");
	}
}
Util.link = function(e) {
	var a = u.qs("a", e);
	u.addClass(e, "link");
	e.url = a.href;
	a.removeAttribute("href");
	u.e.click(e);
}
Util.createRequestObject = function() {
	var request_object = false;
		try {
			request_object = new XMLHttpRequest();
		}
		catch(e){
			request_object = new ActiveXObject("Microsoft.XMLHTTP");
		}
	return typeof(request_object.send) == 'undefined' ? false : request_object;
}
Util.XMLRequest = function(url, node, parameters, async, method) {
	parameters = parameters ? parameters : "";
	async = async ? async : true;
	method = method ? method : "POST";
	node.url = url;
	node.parameters = parameters;
	node.async = async;
	node.method = method;
	var XMLRequest = new Object();
	XMLRequest.Http = this.createRequestObject();
	if(!XMLRequest.Http) {
		node.XMLResponse(u.validateResponse(false, false));
		return;
	}
	if(async) {
		XMLRequest.Http.node = node ? node : Util;
		XMLRequest.Http.onreadystatechange = function() {
			if(XMLRequest.Http.readyState == 4) {
				if(!this.node) {
					u.bug("Lost track of node: " + XMLRequest.Http.statusText);
				}
				else {
					this.node.XMLResponse(u.validateResponse(this, true));
				}
			}
		}
	}
	try {
		XMLRequest.Http.open(method, url, async);
		XMLRequest.Http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		XMLRequest.Http.send(parameters);
	}
	catch(e) {
		node.XMLResponse(u.validateResponse(XMLRequest, false));
		return;
	}
	if(!async) {
		node.XMLResponse(u.validateResponse(XMLRequest, true));
	}
}
Util.XMLResponse = function(response) {
}
Util.validateResponse = function(request, state){
	var div = document.createElement("div");
	if(state) {
		try {
			request.status;
			if(request.status == 200) {
				div.innerHTML = request.responseText;
				var body_class = request.responseText.match(/<body class="([a-z0-9A-Z_ ]+)"/);
				div.body_class = body_class ? body_class[1] : "";
				var head_title = request.responseText.match(/<title>([^$]+)<\/title>/);
				div.head_title = head_title ? head_title[1] : "";
			}
			else {
				div.innerHTML = '<div class="error">Response error:'+request.status+ ':'+request.node.url + request.node.parameters +'</div>';
				u.bug("status NOT 200:" + request.status);
				u.bug(request.statusText);
			}
		}
		catch(exception) {
			div.innerHTML = '<div class="error">Response error: no status</div>';
			u.bug("NO status exceptions:" + exception);
			u.bug(request.statusText);
		}
	}
	else {
		div.innerHTML = '<div class="error">Request error:'+request.node.url + request.node.parameters + '</div>';
		u.bug("Request error:" + request.node.url + request.node.parameters);
	}
	return div;
}
Util.Objects = u.o = new Array();
Util.init = function() {
	var i, e, elements, ij_value;
	elements = u.ges("i\:([_a-zA-Z0-9])+");
	for(i = 0; e = elements[i]; i++) {
		while((ij_value = u.getIJ(e, "i"))) {
			u.removeClass(e, "i:"+ij_value);
			if(ij_value && typeof(u.o[ij_value]) == "object") {
				u.o[ij_value].init(e);
			}
		}
	}
}
window.onload = u.init;
Util.Objects["page"] = new function() {
	this.init = function(e) {
		var i, node;
		e.home_url = u.qs(".servicenavigation .front a").href;
		e.hN = u.qs("#header", e);
		e.hN.page = e;
		e.cN = u.qs("#content", e);
		e.cN.page = e;
		e.nN = u.qs("#navigation", e);
		if(e.nN) {
			e.nN = e.insertBefore(e.nN, e.cN);
			e.nN.page = e;
			e.nN.ul = u.qs("ul", e.nN);
			var h3 = u.ae(u.ie(e.nN.ul, "li", ({"class":"front"})), "h3");
			h3.appendChild(u.qs(".servicenavigation .front a"), e.hN);
		}
		e.fN = u.qs("#footer", e);
		e.fN.page = e;
		e.hN.service_nav = u.qs(".servicenavigation", e.hN)
		e.hN.service_nav.insertBefore(u.qs(".servicenavigation .about", e.fN), u.qs(".servicenavigation .contact", e.hN));
		e.hN.service_nav.insertBefore(u.qs(".servicenavigation .terms", e.fN), u.qs(".servicenavigation .help", e.hN));
		e.home = u.ae(e.hN, "div", "home");
		e.home.url = e.home_url;
		e.home.clicked = function(event) {
			location.href = this.url;
		}
		u.e.click(e.home);
		e.fN.removeChild(u.qs(".servicenavigation", e.fN));
		if(u.qs(".servicenavigation .search")) {
			e.search = u.ae(e.hN, "div", "search");
			e.search.e = e;
			e.search.url = u.qs(".servicenavigation .search a").href+".content";
			u.XMLRequest(e.search.url, e.search);
			e.search.XMLResponse = function(response) {
				this.innerHTML = u.qs("#content", response).innerHTML;
				this.input = u.qs("input.search", this);
				this.input.e = this;
				this.input.onfocus = function() {
					this.focused = true;
					u.ac(this.e, "focus");
				}
				this.input.onblur = function() {
					this.focused = false;
					u.rc(this.e, "focus");
				}
				this.onmouseover = function() {
					u.ac(this, "focus");
				}
				this.onmouseout = function() {
					if(!this.input.focused) {
						u.rc(this, "focus");
					}
				}
				this.ready();
			}
			e.search.ready = function() {
				if(!this.initialized) {
					this.initialized = true;
				}
				if(this.initialized && this.e.cart.initialized) {
					this.e.cart.transitioned = function(event) {
						u.a.fadeIn(this.e.search);
					}
					if(!u.a.support()) {
						this.e.cart.transitioned();
					}
					u.a.fadeIn(this.e.cart, "0.2s");
				}
			}
		}
		if(u.qs(".servicenavigation .cart")) {
			e.cart = u.ae(e.hN, "div", "cart");
			e.cart.e = e;
			e.cart.url = u.qs(".servicenavigation .cart a").href+".content";
			u.XMLRequest(e.cart.url, e.cart, "", "", "GET");
			e.cart.XMLResponse = function(response) {
				var header = u.ae(this, "div", "header");
				var footer = u.ae(this, "div", "footer");
				header.innerHTML = u.qs("#content h2", response).innerHTML;
				var total = u.ae(footer, "div", "total");
				total.innerHTML += u.qs("#content .total", response).innerHTML;
				u.e.click(this);
				this.clicked = function(event) {
					location.href = this.url.replace(/.content$/, "");
				}
				this.ready();
			}
			e.cart.ready = function() {
				this.initialized = true;
				if(u.qs(".servicenavigation .search")) {
					this.e.search.ready();
				}
				else {
					u.a.fadeIn(this, "0.2s");
				}
			}
		}
		u.addClass(e, "ready");
	}
}
Util.Objects["geo"] = new function() {
	this.init = function(e) {
		var google_link = u.ae(u.qs(".adr", e), "a", "google_link");
		google_link.href = "http://maps.google.dk/maps?q="+u.qs(".street-address", e).innerHTML+"+"+u.qs(".postal-code", e).innerHTML+"+"+u.qs(".locality", e).innerHTML+"";
		google_link.target = "_blank";
		google_link.innerHTML = "Se på Google map"
	}
}
Util.Objects["front"] = new function() {
	this.init = function(e) {
		var i, li;
		var page = u.qs("#page");
		var ul = u.ae(e, "ul", ({"class":"list"}));
		var nav_h3s = u.qsa("h3", page.nN);
		for(i = 0; nav_h3 = nav_h3s[i]; i++) {
			if(!nav_h3.parentNode.className.match(/front/i)) {
				li = u.ae(ul, "li");
				li.url = u.qs("a", nav_h3).href;
				h3 = u.ae(li, "h3");
				h3.innerHTML = nav_h3.innerHTML;
				li.onclick = function() {
					location.href = this.url.replace(/.content$/, "");
				}
				li.XMLResponse = function(response) {
					var first_li = u.qs("li", u.qs("#content", response));
					this.style.backgroundImage = "url(" + Dearshop.ecommerce_image_path() + "/"+u.getIJ(first_li, "image_id")+"/200_width."+u.getIJ(first_li, "image_format")+")";
				}
				u.XMLRequest(li.url+".content", li);
			}
		}
	}
}
Util.Objects["list"] = new function() {
	this.init = function(list) {
		var i, product;
		var page = u.qs("#page");
		list.products = u.qsa("li", list);
		for(i = 0; product = list.products[i]; i++) {
			product.list = list;
			product.tags = new Array();
			product.style.backgroundImage = "url(" + Dearshop.ecommerce_image_path() + "/"+u.getIJ(product, "image_id")+"/200_width."+u.getIJ(product, "image_format")+")";
			u.link(product);
			product.XMLResponse = function(response) {
				var i, tag;
				var form = this.appendChild(u.qs("#content form", response));
				form.insertBefore(u.qs("#content .price", response), u.qs(".button.submit", form));
				u.e.click(form);
				form.clicked = function(event) {
					u.e.kill(event);
					this.submit();
				}
				var tags = u.qsa("#content ul.tags li", response);
				for(i = 0; tag = tags[i]; i++) {
					this.tags[u.getIJ(tag, "tag").toLowerCase()] = true;
				}
			}
			u.XMLRequest(product.url+".content", product);
			product.clicked = function() {
				location.href = this.url.replace(/.content$/, "");
			}
		}
		list.subnavigation = u.ae(u.ie(page.cN, "div", ({"class":"c100"})), "ul", ({"class":"subnavigation"}));
		var selected = u.qs(".selected ul", page.nN);
		if(selected) {
			list.subnavigation.innerHTML = selected.innerHTML;
		}
		list.option_groups = u.qsa("li ul", list.subnavigation);
		for(i = 0; group = list.option_groups[i]; i++) {
			group.list = list;
			group.options = u.qsa("li", group);
			for(y = 0; option = group.options[y]; y++) {
				option.list = list;
				option.group = group;
				u.link(option);
				option.clicked = function(event) {
					u.e.kill(event);
					u.tc(this, "checked");
					this.checked = this.className.match(/checked/) ? "checked" : "unchecked"
					u.saveCookie(this.tag, this.checked);
					this.list.optionChanged(this);
				}
				var tag = option.url.match(/tags\/([^\b|\&]+)/);
				if(tag) {
					option.tag = tag[1].toLowerCase();
				}
				else {
					option.tag = false;
				}
				if(!option.className.match(/all/) && u.getCookie(option.tag) != "unchecked") {
					u.ac(option, "checked");
					this.checked = "checked";
				}
				else {
					this.checked = "unchecked";
				}
			}
			if(!u.qsa("li.checked", group).length) {
				var all_option = u.qs("li.all", group);
				all_option.checked = "checked";
				u.ac(all_option, "checked");
			}
		}
		list.optionChanged = function(option) {
			if(option.className.match("all")) {
				if(option.checked == "checked") {
					for(y = 0; group_option = option.group.options[y]; y++) {
						if(group_option != option) {
							u.rc(group_option, "checked");
							group_option.checked = "unchecked";
							u.saveCookie(group_option.tag, "unchecked");
						}
					}
				}
				else {
					for(y = 0; group_option = option.group.options[y]; y++) {
						if(group_option != option) {
							u.ac(group_option, "checked");
							group_option.checked = "checked";
							u.saveCookie(group_option.tag, "checked");
						}
					}
				}
			}
			else {
				var all_option = u.qs("li.all", option.group);
				if(!u.qsa("li.checked", option.group).length) {
					all_option.checked = "checked";
					u.ac(all_option, "checked");
				}
				else {
					all_option.checked = "unchecked";
					u.rc(all_option, "checked");
				}
			}
			this.transitioned = function(event) {
				this.updateList();
			}
			if(1 || !u.a.support() || u.gcs(this, "opacity") == 0) {
				this.transitioned();
			}
			else {
				u.as(this, "opacity", 0);
			}
		}
		list.updateList = function() {
			var i, o, y, product, group, option;
			this.transitioned = null;
			for(i = 0; product = this.products[i]; i++) {
				u.as(product, "display", "block");
				for(o = 0; group = this.option_groups[o]; o++) {
					group.safe = false;
					if(u.qs("li.all", group).checked == "checked") {
						group.safe = true;
					}
					else {
						var checked_options = u.qsa("li.checked", group);
						for(y = 0; option = checked_options[y]; y++) {
							if(product.tags[option.tag]) {
								group.safe = true;
							}
						}
					}
					if(!group.safe) {
						u.as(product, "display", "none");
					}
				}
			}
		}
	}
}
Util.Objects["view"] = new function() {
	this.init = function(e) {
		var i, thumb;
		var images = u.qs(".images");
		images.thumbnails = u.qsa(".thumbnails li", images);
		images.image = u.ae(images, "img", ({"class":"image"}));
		images.image.images = images;
		u.e.click(images.image);
		images.image.clicked = function(event) {
			this.images.fullscreen();
		}
		images.show = function(thumb) {
			this.image.src = Dearshop.ecommerce_image_path() + "/"+u.getIJ(thumb, "id")+"/360_width."+u.getIJ(thumb, "format");
		}
		images.fullscreen = function() {
		}
		for(i = 0; thumb = images.thumbnails[i]; i++) {
			thumb.images = images;
			u.link(thumb);
			thumb.clicked = function(event) {
				this.images.show(this);
			}
		}
		images.show(images.thumbnails[0]);
	}
}
Util.Objects["cart"] = new function() {
	this.init = function(e) {
		var i, form, select;
		var quantity_forms = u.qsa(".items .cart_item");
		for(i = 0; form = quantity_forms[i]; i++) {
			form.select = u.qs("select", form);
			form.select.form = form;
			form.select.changed = function(event) {
				this.form.submit();
			}
			u.e.addEvent(form.select, "change", form.select.changed);
		}
	}
}
Util.Objects["paymentform"] = new function() {
	this.init = function(e) {
		e.submit();
	}
}
Util.Objects["form"] = new function() {
	this.init = function(e) {
		u.f.init(e, true, true);
		e.onsubmit = function() {
			var i, field;
			var fields = u.qsa(".field", this);
			for(i = 0; field = fields[i]; i++) {
				if(field.iN && field.default_value == field.iN.value) {
					field.iN.value = "";
				}
			}
			return true;
		}
		var delivery_check_no = u.qs("#dearshop_checkout_ship_to_billing_address_false", e);
		delivery_check_no.onclick = function() {
			if(delivery_check_no.checked) {
				u.qs(".delivery_address", e).style.display = "block";
			}
		}
		var delivery_check_yes = u.qs("#dearshop_checkout_ship_to_billing_address_true", e);
		delivery_check_yes.onclick = function() {
			if(delivery_check_yes.checked) {
				u.qs(".delivery_address", e).style.display = "none";
			}
		}
	}
}

