/*
 *  Simple Ajax Toolset 2.2 (small)
 *
 *  tested with: IE 5.01/5.5/6/7, Firefox 1/1.5/2, Opera 8.5/9, Safari 1.3/2/3
 *  (to some extent on IE 5.0 SP2)
 *
 *  (c) Copyright by Soeren Mueller, 2006-2010 - soeren.mueller@all-digital.de
 */

function _$(e) {
	if (typeof e == 'object' || typeof e == 'function') {
		return e;
	}
	if (document.getElementById) {
		return document.getElementById(e);
	}
	if (document.all) {
		return document.all[e];
	}
	return null;
}

function $C(e) {
	return document.createElement(e);
}

function $AT(el, attr, val) {
	if (typeof val != 'undefined') {
		el.setAttribute(attr, val);
		return el;
	}
	return el.getAttribute(attr);
}

function $A(iterable, source) {
	var result = source || [], i;
	if (iterable) {
		for (i=0; i<iterable.length; ++i) {
			result.push(iterable[i]);
		}
	}
	return result;
}

function $E(doc, tag) {
	if (typeof doc == 'string') {
		if (typeof tag == 'undefined') {
			tag = doc;
			doc = document;//null;
		} else {
			doc = _$(doc);
		}
	}
//	doc = doc || document;
	var result = null;
	try {
		result = doc.getElementsByTagName(tag || 'e');
	} catch(e) {}
	if (!result || !result.length) {
		if (tag == '*' && document.all) {
			result = document.all;
		} else {
			result = null;
		}
	}
	return result;
}

function $EA(doc, tag) {
	var e = $E(doc, tag);
	if (e) {
		return $A(e);
	}
	return [];
}

function $isTag(el, tag) {
	return (el && el.tagName && el.tagName.toLowerCase() == tag);
}

function $hasClass(el, cname) {
	try {
		el = _$(el);
		if (el.className && el.className.length > 0) {
			var cn = el.className.split(' ');
			return cn.contains(cname);
		}
	} catch(e) {}
	return false;
}

function $remClass(el, cname) {
	try {
		el = _$(el);
		if (el.className && el.className.length > 0) {
			var cn = el.className.split(' ');
			el.className = cn.without(cname).join(" ");
		}
	} catch(e) {}
	return el;
}

function $addClass(el, cname) {
	if (typeof el == 'function') {
		this._cb = el;
		return el;
	}
	el = _$(el);
	if (cname.charAt(0) == '-') {
		$remClass(el, cname.substring(1));
		if (this._cb) {
			this._cb(el);
		}
	} else if (!$hasClass(el, cname)) {
		el.className = ((el.className && el.className.length > 0) ? (el.className + " ") : "") + cname;
		if (this._cb) {
			this._cb(el);
		}
	}
	return el;
}

function $CNS(doc, cname, tag) {
	if (typeof doc == 'string') {
		if (typeof cname == 'undefined') {
			cname = doc;
		} else {
//			tag = doc;
			tag = cname;
			cname = doc;
		}
//		doc = null;
		doc = document;
	}
	var result = [], el = $E(doc, tag || '*'), i;
	if (el) {
		for (i=0; i<el.length; ++i) {
			if ($hasClass(el[i], cname)) {
				result.push(el[i]);
			}
		}
	}
	return result;
}

function $CN(doc, cname, tag) {
	if (typeof doc == 'string') {
		if (typeof cname == 'undefined') {
			cname = doc;
		} else {
//			tag = doc;
			tag = cname;
			cname = doc;
		}
//		doc = null;
		doc = document;
	}
	var el = $E(doc, tag || '*'), i;
	if (el) {
		for (i=0; i<el.length; ++i) {
			if ($hasClass(el[i], cname)) {
				return el[i];
			}
		}
	}
	return null;
}

String.prototype.trim = function() {
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

Array.prototype.iterate = function(func, bind) {
	var i;
	for (i=0; i<this.length; ++i) {
		if (bind) {		/* mootools compatibility! - required in Array.prototype.each */
			func.call(bind, this[i], i, this);
		} else {
			func(this[i], i);
		}
	}
};

Array.prototype.contains = function(what) {
	var i;
	for (i=0; i<this.length; ++i) {
		if (this[i] == what) {
			return true;
		}
	}
	return false;
};

if (!Array.prototype.each) {
	Array.prototype.each = Array.prototype.iterate;
}

String.prototype.contains = function(what) {
	return this.indexOf(what) >= 0;
};

Array.prototype.without = function(what) {
	var result = [], i;
	for (i=0; i<this.length; ++i) {
		if (this[i] != what) {
			result.push(this[i]);
		}
	}
	return result;
};

function $css(sel, dec) {
	var //ua = navigator.userAgent.toLowerCase(), isIE = (/msie/.test(ua)) && (/win/.test(ua) && !window.opera),
		style = $C("style"), lastStyle;
	$AT(style, "type", "text/css");
	$AT(style, "media", "screen");
	if (!util.isIE) {
		style.appendChild(document.createTextNode(sel+" {"+dec+"}"));
	}
	$E("head")[0].appendChild(style);
	if (util.isIE && document.styleSheets && document.styleSheets.length > 0) {
		lastStyle = document.styleSheets[document.styleSheets.length-1];
		if (lastStyle.addRule) {
			lastStyle.addRule(sel, dec);
		}
	}
}

function $attachEvent(el, evt, func) {
	el = _$(el);
	if (el) {
		if (el.each) {
			el.each(function(e){
				$attachEvent(e, evt, func);
			});
		} else {
			try {
				if (evt != 'click' && evt != 'dblclick' && el.addEventListener) {
					el.addEventListener(evt, func, false);
				} else if (el.attachEvent) {
					el.attachEvent("on"+evt, func);
				} else {
					el["on"+evt] = func;
				}
				el["__"+evt] = [(el["__"+evt] || [0])[0] + 1];
			} catch(e) {}
		}
	}
}

function $detachEvent(el, evt, func) {
	el = _$(el);
	if (el) {
		if (el.each) {
			el.each(function(e){
				$detachEvent(e, evt, func);
			});
		} else {
			try {
				if (evt != 'click' && evt != 'dblclick' && el.removeEventListener) {
					el.removeEventListener(evt, func, false);
				} else if (el.detachEvent) {
					el.detachEvent("on"+evt, func);
				} else {
					el["on"+evt] = null;
				}
				var useCount = (el["__"+evt] || [0])[0];
				if (useCount > 1) {
					el["__"+evt] = [useCount-1];
				} else {
					el["__"+evt] = null;
				}
			} catch(e) {}
		}
	}
}

/* REMOVED FOR MOOTOOLS COMPAT
Function.prototype.bind = function() {
	var method = this, args = $A(arguments), object = args.shift();
	return function() {
		return method.apply(object, args);
	};
};*/

if (!Function.prototype.apply) {
	Function.prototype.apply = function(thisArg, argArray) {
		if (typeof this != 'function') {
			// throw is commented out because safari 1.3 requires the ';' after throw which is removed by yui compressor!!!
			return null; //throw new Error('apply called on incompatible object (not a function)');
		}
		if (argArray != null && !(argArray instanceof Array) && typeof argArray.callee != 'function') {
			return null; //throw new Error('The 2nd argument to apply must be an array or arguments object');
		}

		thisArg = (thisArg == null) ? window : Object(thisArg);
		thisArg.__applyTemp = this;

		// youngpup's hack
		var parameters = [], length = (argArray || '').length >>> 0, i, functionCall;
		for (i = 0; i < length; i++) {
			parameters[i] = 'argArray[' + i + ']';
		}
		functionCall = 'thisArg.__applyTemp(' + parameters + ')';

		try {
			return eval(functionCall);
		} finally {
			try {
				delete thisArg.__applyTemp;
			} catch (e){}
		}
	};
}

if (!Function.prototype.call) {
	Function.prototype.call = function(thisArg) {
		return this.apply(thisArg, Array.prototype.slice.apply(arguments, [1]));
	};
}

Function.prototype.bindAsEventListener = function(object) {
	var method = this;
	return function(evt) {
		evt = evt || window.event;
		var target = evt.currentTarget || evt.target || evt.srcElement, result;
		if (evt.type && target && !target["__"+evt.type]) {
			do {
				target = target.parentNode;
			} while(!target["__"+evt.type]);
		}
		result = method.call(object, evt, (target && target.nodeType == 3) ? target.parentNode : target);
		if (evt && result === false) {
			if (evt.stopPropagation) {
				evt.stopPropagation();
			}
			evt.cancelBubble = true;
			if (evt.preventDefault) {
				evt.preventDefault();
			}
			evt.returnValue = false;
		}
		return result;
	};
};

Function.prototype.delay = function() {
	var scope = this, args = $A(arguments), delay = args.shift();
	return setTimeout(function() {
		scope.apply(scope, args);
	}, delay);
};

Function.prototype.after = function(delay) {
	return setTimeout(this, delay);
};

Function.prototype.every = function(interval) {
	return setInterval(this, interval);
};

function $style(el, which, def) {
	el = _$(el);
	var result = def, pos;
	try {
		if (document.defaultView && document.defaultView.getComputedStyle) {
			result = document.defaultView.getComputedStyle(el, "").getPropertyValue(which);
		} else if (el.currentStyle) {
			while((pos = which.indexOf('-')) != -1) {
				which = which.substring(0, pos) + which.substring(pos+1, pos+2).toUpperCase() + which.substring(pos+2);
			}
			result = el.currentStyle[which];
		}
		if ((pos = result.indexOf("px")) != -1) {
			return parseInt(result.substring(0, pos), 10);
		}
	} catch(e) {
	}
	return result;
}

function rand(max) {
	return Math.floor(Math.random()*max+1);
}

function $show(el, visible, opacity, display) {
	if (el.each) {
		el.each(function(e){
			$show(e, visible, opacity);
		});
		return el;
	}
	el = _$(el);
	if (typeof visible == 'number') {
		opacity = visible;
		visible = null;
	} else if (typeof visible == 'string') {
		display = visible;
		visible = null;
	}
	if (typeof opacity != 'undefined') {
		$setOpacity(el, opacity);
	}
	try {
		el.style.display = (visible === false) ? 'none' : (display || '');
		el.style.visibility = 'visible';
	} catch(e) {
	}
	return el;
}

function $hide(el, opacity) {
	return $show(el, false, opacity);
}

function $rem(el) {
	el = _$(el);
	if (el && el.parentNode) {
		el.parentNode.removeChild(el);
	}
}

function $append(where, el) {
	if (where.nextSibling) {
		where.parentNode.insertBefore(el, where.nextSibling);
	} else {
		where.parentNode.appendChild(el);
	}
}

function $visible(el) {
	el = _$(el);
	return ($style(el, "display").toLowerCase() != 'none' && $style(el, "visibility").toLowerCase() != 'hidden');
}

function $opacity(el, check) {
	if (check && !$visible(el)) {
		return 0;
	}
	try {
		var opacity = $style(el, "opacity");
		if (opacity) {
			return (opacity.length > 0) ? (parseFloat(opacity) * 100) : 100;
		} else if ((opacity = $style(el, "-moz-opacity"))) {
			return (opacity.length > 0) ? (parseFloat(opacity) * 100) : 100;
		} else if ((opacity = $style(el, "-khtml-opacity"))) {
			return (opacity.length > 0) ? (parseFloat(opacity) * 100) : 100;
		} else if ((opacity = $style(el, "filter"))) {
			return (opacity.length > 48) ? (parseInt(opacity.substring(48), 10)) : 100;
		}
	} catch(e) {}
	return 100;
}

function $setOpacity(el, opacity) {
	if (el.each) {
		el.each(function(e){
			$setOpacity(e, opacity);
		});
		return;
	}
	try {
		var s = _$(el).style;
		if (typeof s.opacity != 'undefined') {
			s.opacity = (opacity / 100);
		} else if (typeof s.MozOpacity != 'undefined') {
			s.MozOpacity = (opacity / 100);
		} else if (typeof s.KhtmlOpacity != 'undefined') {
			s.KhtmlOpacity = (opacity / 100);
		} else if (typeof s.KHTMLOpacity != 'undefined') {
			s.KHTMLOpacity = (opacity / 100);
		} else if (typeof s.filter != 'undefined') {
			s.filter = (opacity > 99) ? "" : ("progid:DXImageTransform.Microsoft.Alpha(opacity=" + Math.round(opacity) + ")");
		}
	} catch(e) {
	}
}

function $fade(el, from, to, duration, startDelay, zindex) {
	if (!el.each) {
		from = (typeof from != 'number') ? ($visible(el) ? $opacity(el) : 0) : from;
		to = (typeof to != 'number') ? ($visible(el) ? $opacity(el) : 100) : to;
		if (to == from) {
			return;
		}
	}
	var me = this;
	this._el = _$(el);
	this._from = from || 0;
	this._to = to;
	this._duration = duration || 300;
	this._zindex = zindex || 0;
	this._update = function() {
		var time = 0;
		if (!me._starttime) {
			me._starttime = (new Date()).getTime();
		} else {
			time = (new Date()).getTime() - me._starttime;
			if (time > me._duration) {
				time = me._duration;
			}
		}
		$setOpacity(me._el, me._from+((me._to-me._from)*(-(Math.cos(Math.PI*(time/me._duration))-1)/2)));
		if (!time && !me._from) {
			$show(me._el);
		}
		if (me._zindex) {
			me._el.style.zIndex = me._zindex;
		}
		if (time < me._duration) {
			if (me._timer) {
				me._timer = me._update.after(13);	// was: 40
			}
		} else if (me._to === 0) {
			$hide(me._el);
		}
	};
	this.stop = function() {
		if (me._timer) {
			window.clearTimeout(me._timer);
			me._timer = null;
		}
	};
	this._timer = this._update.after(startDelay || 0);
}

function $fadeStop(store, el, from, to, duration, startDelay, zindex) {
	if (store._fade && store._fade.stop) {
		store._fade.stop();
	}
	store._fade = new $fade(el, from, to, duration, startDelay, zindex);
}

function $anim(el, prop, from, to, duration, startDelay) {
	if (!el.each) {
		from = (typeof from != 'number') ? $style(el, prop, 0) : from;
		to = (typeof to != 'number') ? $style(el, prop, 0) : to;
		if (to == from) {
			return;
		}
	}
	var me = this;
	this._el = _$(el);
	this._prop = prop;
	this._from = from || 0;
	this._to = to;
	this._duration = duration || 300;
	this._update = function() {
		var time = 0;
		if (!me._starttime) {
			me._starttime = (new Date()).getTime();
		} else {
			time = (new Date()).getTime() - me._starttime;
			if (time > me._duration) {
				time = me._duration;
			}
		}
		me._el.style[prop] = me._from+((me._to-me._from)*(-(Math.cos(Math.PI*(time/me._duration))-1)/2)) + "px";
		if (time < me._duration) {
			if (me._timer) {
				me._timer = me._update.after(13);	// was: 40
			}
		}
	};
	this.stop = function() {
		if (me._timer) {
			window.clearTimeout(me._timer);
			me._timer = null;
		}
	};
	this._timer = this._update.after(startDelay || 0);
}

function $animStop(store, el, prop, from, to, duration, startDelay) {
	if (store._anim && store._anim.stop) {
		store._anim.stop();
	}
	store._anim = new $anim(el, prop, from, to, duration, startDelay);
}

function $x(el) {
	el = _$(el);
	var left = 0;
	try {
		if (el.offsetParent) {
			do {
				left += el.offsetLeft;
			} while ((el = el.offsetParent));
		} else if (el.x) {
			left += el.x;
		}
	} catch(e) {}
    return left;
}

function $y(el) {
	el = _$(el);
	var top = 0;
	try {
		if (el.offsetParent) {
			do {
				top += el.offsetTop;
			} while ((el = el.offsetParent));
		} else if (el.y) {
			top += el.y;
		}
	} catch(e) {}
    return top;
}

function $width(el, client) {
	try {
		if (el) {
			el = _$(el);
			if (client && el.clientWidth) {
				return el.clientWidth;
			} else if (el.innerWidth) {
				return el.innerWidth;
			} else {
				return el.offsetWidth;
			}
		}
		if (window.innerWidth) {
			return window.innerWidth;
		} else if (document.documentElement && document.documentElement.clientWidth) {
			return document.documentElement.clientWidth;
		} else if (document.body && document.body.offsetWidth) {
			return document.body.offsetWidth;
		}
	} catch(e) {}
	return 0;
}

function $height(el, client) {
	try {
		if (el) {
			el = _$(el);
			if (client && el.clientHeight) {
				return el.clientHeight;
			} else if (el.innerHeight) {
				return el.innerHeight;
			} else {
				return el.offsetHeight;
			}
		}
		if (window.innerHeight) {
			return window.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else if (document.body && document.body.offsetHeight) {
			return document.body.offsetHeight;
		}
	} catch(e) {}
	return 0;
}

function $setWidth(el, w) {
	el = _$(el);
	try {
		el.style.width = (w) ? w+'px' : '';
	} catch(e){}
}

function $setHeight(el, h) {
	el = _$(el);
	try {
		el.style.height = (h) ? h+'px' : '';
	} catch(e){}
}

function $link(text, url, target, title) {
	if (typeof url == 'undefined') {
		url = text;
	}
	var isMail = false;
	if (url && url.substring(0, 7) != "http://") {
		if (url.indexOf('@') >= 0) {
			isMail = true;
		} else {
			url = "http://"+url;
		}
	}
	return ((url)?("<a href='"+((isMail)?"mailto:":'')+url+"'"+((isMail)?" class='email'":'')+((target)?(" target='"+target+"'"):'')+((title)?(" title='"+title+"'"):'')+">"):'') + text + ((url)?"</a>":'');
}

function $pad(value, length, padding) {
	value = String(value);
	length = parseInt(length, 10) || 2;
	padding = padding || "0";
	while (value.length < length) {
		value = padding + value;
	}
	return value;
}

var pngfix = {
	fix : function(what) {
		if (util.isIE && util.browserVersion < 7.0 && !util.isMac) {
			pngfix._fixImg(what);
		}
	},
	_transparent : "/fileadmin/template/v1/img/transparent.gif",
	_fixImg : function(img) {
		if (img.src.contains(".png") && !img.__pngfix) {
			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src='"+img.src+"',sizingMethod='scale')";
			img.src = pngfix._transparent;
			img.attachEvent('onpropertychange', pngfix._onchange);
			img.__pngfix = true;
		}
	},
	_init : function() {
		if (util.isIE && util.browserVersion < 8.0 && !util.isMac) {
			try {
				document.execCommand('BackgroundImageCache', false, true);
			} catch(e){}
			if (util.browserVersion < 7.0) {
				$EA('img').each(pngfix._fixImg);
					$EA('*').each(function(el){
						var image = el.currentStyle.backgroundImage, urlStart, urlEnd, sizingMethod;
						if (image.contains(".png") && !el.__pngfix) {
							urlStart = image.indexOf("url(");
							urlEnd = image.indexOf(")", urlStart);
							image = image.substring(urlStart+5, urlEnd-1);
//							if (el.currentStyle.width == 'auto') {
//								el.style.width = '100%';
//							}
							el.style.backgroundImage = "url("+pngfix._transparent+")";
							sizingMethod = (el.currentStyle.backgroundRepeat == 'no-repeat') ? 'crop' : 'scale';
							el.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src='"+image+"',sizingMethod='"+sizingMethod+"')";
							el.__pngfix = true;
						}
					});
			}
		}
	    return true;
	},
	_inchange : false,
	_onchange : function() {
		if (window.event.propertyName == 'src' && !window.event.srcElement.src.contains(pngfix._transparent) && !pngfix._inchange) {
			pngfix._inchange = true;
			window.event.srcElement.filters.item(0).src = window.event.srcElement.src;
			window.event.srcElement.src = pngfix._transparent;
			pngfix._inchange = false;
		}
	}
};

var $focusElement = null;

function $focus(el, doSelect) {
	el = _$(el);
	$focusElement = el;
	try {
		if (doSelect) {
			el.select();
		}
		el.focus();
	} catch(e) {}
}

function $restoreFocus() {
	if ($focusElement) {
		$focusElement.focus();
	}
}

var util = {

	waitForStyles : false,

	isIE : false,
	isGecko : false,
	isFirefox : false,
	isSafari : false,
	isOpera : false,
	isKonqueror : false,

	isWin : false,
	isMac : false,
	isLinux : false,

	browserVersion : 0,
	webkitVersion : 0,

	onInit : function(func) {
		if (util._inited) {
			func();
		} else {
			util._initqueue.push(func);
		}
	},
	onStart : function(func) {
		if (util._started) {
			func();
		} else {
			util._startqueue.push(func);
		}
	},
	css : function() {
		if (!util._css) {
			util._css = [];
			if (document.styleSheets) {
				var i;
				for (i=0; i<document.styleSheets.length; ++i) {
					util._css = $A(document.styleSheets[i].cssRules || document.styleSheets[i].rules, util._css);
				}
			}
		}
		return util._css;
	},

	_css : null,
	_initqueue : [],
	_startqueue : [],
	_inited : false,
	_started : false,
	_timer : null,
	_load : function() {
		var ua = navigator.userAgent.toLowerCase(), pos, ver;
		ver = parseFloat(navigator.appVersion);
		if (window.opera) {
			util.isOpera = true;
			if ((pos = ua.indexOf("opera")) > 0) {
				ver = parseFloat(ua.substring(pos+6));
			}
		} else if (window.attachEvent) {
			util.isIE = true;
			if ((pos = ua.indexOf("msie")) > 0) {
				ver = parseFloat(ua.substring(pos+5));
			}
		} else if (document.childNodes) {
			if (navigator.taintEnabled) {
				util.isGecko = true;
				if ((pos = ua.indexOf("firefox")) > 0) {
					util.isFirefox = true;
					ver = parseFloat(ua.substring(pos+8));
				}
			} else if (!navigator.accentColorName) {
				if (navigator.vendor == 'KDE') {
					util.isKonqueror = true;
					if ((pos = ua.indexOf("konqueror")) > 0) {
						ver = parseFloat(ua.substring(pos+10));
					}
				} else {
					util.isSafari = true;
					if ((pos = ua.indexOf("safari")) > 0) {
						ver = parseFloat(ua.substring(pos+7));
						if (ver >= 533) {
 							ver = 5.0;
						} else if (ver >= 528) {
 							ver = 4.0;
						} else if (ver >= 525) {
 							ver = 3.1;
						} else if (ver >= 522) {
							ver = 3.0;
						} else if (ver >= 412) {
							ver = 2.0;
						} else if (ver >= 312) {
							ver = 1.3;
						} else if (ver >= 125) {
							ver = 1.2;
						} else if (ver >= 100) {
							ver = 1.1;
						} else if (ver >= 85) {
							ver = 1.0;
						} else if (ver >= 73) {
							ver = 0.9;
						} else if (ver >= 48) {
							ver = 0.8;
						}
					}
				}
			}
		}
		util.browserVersion = ver;
		if ((pos = ua.indexOf("webkit")) > 0) {
			util.webkitVersion = parseFloat(ua.substring(pos+7));
		}
		if (ua.contains("win")) {
			util.isWin = true;
		} else if (ua.contains("mac")) {
			util.isMac = true;
		} else if (ua.contains("linux")) {
			util.isLinux = true;
		}

//		window.onerror = function(){return true;};	// at least try to not totally bug out old browsers
		if (util.isIE) {
			// DOMContentLoaded event hack for IE
			try {
				document.write("<scr"+"ipt id=__onDOMContentLoaded defer src=//:><\/scr"+"ipt>");
				ua = _$("__onDOMContentLoaded");
				if (ua) {
					ua.onreadystatechange = function(){
						if (this.readyState == "complete") {
							/// $TODO: check is document.body is accessible!!!
							this.parentNode.removeChild(this);
							util._start();
						}
					};
				}
			} catch(e) {
				ua = null;
			}
		} else if ((util.isSafari || util.isKonqueror) && typeof document.readyState != 'undefined') {
			// DOMContentLoaded event hack for old Safari and Konqueror (newer Safari builds fire DOMContentLoaded natively!)
			util._timer = setInterval(function(){
				if (document.readyState == "loaded" || document.readyState == "complete") {
					util._start();
				}
			}, 10);
		}
		$attachEvent(document, 'DOMContentLoaded', util._start);
		$attachEvent(window, 'load', util._start);
		$attachEvent(window, 'unload', util._unload);
		
		util._init();
	},
	_unload : function() {
	},
	_init : function() {
		if (util.waitForStyles && document.styleSheets && !document.styleSheets.length) {
			util._init.after(10);
			return;
		}
		util._inited = true;
		var i;
		for (i=0; i<util._initqueue.length; ++i) {
			(util._initqueue[i])();
			util._initqueue[i] = null;
		}
		util._initqueue = [];
	},
	_start : function() {
		if (util._timer) {
			clearInterval(util._timer);
			util._timer = null;
		}
		if (util._started) {	// we only start once!
			return;
		}
		util._started = true;
		pngfix._init();
		var i;
		for (i=0; i<util._startqueue.length; ++i) {
			(util._startqueue[i])();
			util._startqueue[i] = null;
		}
		util._startqueue = [];
	},
	
	debug : function(msg) {
		try {
			console.log(msg);
		} catch(e) {}
	}
};

util._load();


///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

/*var faq = {

	init : function() {
		$css(".headline-item p", "visibility:hidden;position:absolute");
	},

	start : function() {
		$CNS("headline-item").each(function(e) {
			var text = $EA(e, "p")[0];
			e._textheight = $height(text);
			text.style.overflow = "hidden";
			text.style.height = "0px";
			text.style.position = "static";
			text.style.visibility = "visible";
			$attachEvent(e, "click", faq.onClick);
		});
	},
	
	onClick : function(evt, target) {
		var text = $EA(target, "p")[0];
		if ($hasClass(target, "act")) {
			$remClass(target, "act");
			$animStop(target, text, "height", null, 0, 300);
		} else {
			$addClass(target, "act");
			$animStop(target, text, "height", null, target._textheight, 300);
			$CNS("headline-item").each(function(e) {
				if (e != target && $hasClass(e, "act")) {
					$remClass(e, "act");
					$animStop(e, $EA(e, "p")[0], "height", null, 0, 300);
				}
			});
		}
	}.bindAsEventListener()
};
util.onInit(faq.init);
util.onStart(faq.start);*/

var products = {
	
	start : function() {
		//$remClass(document.body, "nojs");
		$CNS("product-item").each(function(el) {
			$attachEvent(el, "mouseover", products.onOver);
			$attachEvent(el, "mouseout", products.onOut);
		});
		$CNS("image").each(function(el) {
			$attachEvent(el, "mouseover", products.onOver);
			$attachEvent(el, "mouseout", products.onOut);
		});
	},
	
	onOver : function(evt, target) {
		
		if (target._timer) {
			clearTimeout(target._timer);
			target._timer = null;
			return;
		}
		var desc = $CN(target, "desc"), bg = $CN(target, "bg");
		$animStop(desc, desc, "bottom", null, 0, 200);
		$fadeStop(bg, bg, null, 95, 200);
	}.bindAsEventListener(),

	onOut : function(evt, target) {
		target._timer = products.onOutTimer.delay(150, evt, target);
	}.bindAsEventListener(),
	
	onOutTimer : function(evt, target) {
		target._timer = null;
		var desc = $CN(target, "desc"), bg = $CN(target, "bg");
		$animStop(desc, desc, "bottom", null, -85, 300);
		$fadeStop(bg, bg, null, 0, 300);
	}
};
util.onStart(products.start);

