var $j = jQuery.noConflict();

function clearInput(input, original) {
	if(input.value == original) {
		input.value = '';
	}
}

function restoreInput(input, original) {
	if(input.value == '') {
		input.value = original;
	}
}

function onEnterSubmit(form, ev) {
	if(ev.keyCode == 13) {
		form.submit();
	}
}

function clearDefaultAndSubmit(input, original) {
	clearInput(input, original);
	input.form.submit();
	return false;
}

function checkForm(form, errorMessage) {
	var rval = true;
	var labels = document.getElementsByTagName("label");
	for(var i = 0; i < labels.length; ++i) {
		var l = labels[i];
		var id = l.htmlFor;
		if(!id) {
			continue;
		}
		var test = false;
		var c = l.childNodes;
		for(var j = 0; j < c.length; ++j) {
			if(c[j].className == "required") {
				test = true;
				break;
			}
		}
		if(!test) {
			continue;
		}
		var el = document.getElementById(id);
		if(!el || el.form != form) {
			continue;
		}
		var ok = false;
		if(el.name.match(/email/i)) {
			if(el.value.match(/^[\x21-\x2b\x2d-\x3a\x3c-\x3f\x41-\x7E]+@([a-zA-Z0-9]+[.-]?)+[a-zA-Z0-9]\.[a-zA-Z0-9]+$/)) {
				ok = true;
			}
		} else if(el.value.match(/\S/)) {
			// must be real boolean for later &= operator
			ok = true;
		}
		if(ok) {
			l.style.color = '#414141';
			l.style.fontWeight = 'normal';
		} else {
			l.style.color = '#ea8024';
			l.style.fontWeight = 'bold';
		}
		rval &= ok;
	}
	if(!rval) {
		alert(errorMessage);
	}
	return rval;
}

function checkFormAndSubmit(form, errorMessage) {
	if(checkForm(form, errorMessage)) {
		form.submit();
	}
	return false;
}

var regexHasSpecial = /[&<>"]/;
var regexAmp = /&/g;
var regexGt = />/g;
var regexLt = /</g;
var regexQuote = /"/g;

function escapeHTML(str) {
	var s = String(str == undefined ? '' : str);
	// testing first is much faster
	return regexHasSpecial.test(s) ? s.replace(regexAmp, '&amp;').replace(regexGt, '&gt;').replace(regexLt, '&lt;').replace(regexQuote, '&quot;') : s;
}

// navigation menus

var menuContainerFinder = function () { return document.getElementById("mainNavigation"); };
var menuContainer;
var menuMouseX = -1;
var menuMouseY = -1;
var menuShow = {};
var menuActive = {};
var menuUpdateHandler = 0;
var menuNodeCounter = 0;

function MenuFragment(_title, _link, _submenu) {
	this.title = _title;
	this.link = _link;
	this.submenu = _submenu;
}

MenuFragment.prototype.buildMenu = function (outArray) {
	var t = escapeHTML(this.title);
	outArray.push('<div id="menu', menuNodeCounter++, '" class="menuEntry">');
	var s = this.submenu;
	if(s) {
		outArray.push('<div class="menu">');
		for(var i = 0, sl = s.length; i < sl; ++i) {
			s[i].buildMenu(outArray);
		}
		outArray.push('</div>');
	}
	var l = this.link;
	if(l) {
		outArray.push('<a href="', escapeHTML(l), '">', t, '</a>');
	} else {
		outArray.push('<span>', t, '</span>');
	}
	outArray.push('</div>');
}

function menuWrite() {
	var m = [];
	m.push('<div class="menu">');
	for(var i = 0, al = arguments.length; i < al; ++i) {
		arguments[i].buildMenu(m);
	}
	m.push('</div>');
//	alert(m.join(''));
	document.write(m.join(''));
	if(!menuContainer) {
		menuContainer = menuContainerFinder();
	}
}

function menu(title, link, submenu) {
	return new MenuFragment(title, link, submenu);
}

function menuTrackMouse(ev) {
	var de = document.documentElement;
	menuMouseX = ev.clientX + (window.pageXOffset ? window.pageXOffset : de.scrollLeft);
	menuMouseY = ev.clientY + (window.pageYOffset ? window.pageYOffset : de.scrollTop);
	var sl = document.getElementById("searchLight");
	if(sl && sl.style.display != 'none') {
		return;
	}
	menuShow = {};
	var x = menuContainer.offsetLeft;
	var y = menuContainer.offsetTop;
	var children = menuContainer.childNodes;
	for(var i = 0, cl = children.length; i < cl; ++i) {
		var c = children[i];
		if(c.hasChildNodes() && menuTestChildren(c, x + c.offsetLeft, y + c.offsetTop)) {
			menuUpdateDisplayListDeferred();
			return;
		}
	}
	for(var idx in menuActive) {
		menuUpdateDisplayListDeferred();
		return;
	}
}

function menuTestChildren(node, nodeX, nodeY) {
	var children = node.childNodes;
	for(var i = 0, cl = children.length; i < cl; ++i) {
		var c = children[i];
		var cn = c.className;
		var n;
		if(cn && cn.indexOf("menuEntry") == 0
			&& (menuTestPoint(c, nodeX, nodeY) || ((n = menuNext(c)) && menuTestChildren(n, nodeX + n.offsetLeft, nodeY + n.offsetTop)))) {
			menuShow[c.id] = c;
			return true;
		}
	}
	return false;
}

function menuNext(node) {
	if(node.className == "menuEntryActive") {
		var children = node.childNodes;
		for(var i = 0, cl = children.length; i < cl; ++i) {
			var c = children[i];
			if(c.className == "menu") {
				return c;
			}
		}
	}
	return null;
}

function menuTestPoint(node, currentX, currentY) {
	var x = node.offsetLeft + currentX;
	var y = node.offsetTop + currentY;
	return menuMouseY >= y && menuMouseX >= x && menuMouseY <= y + node.offsetHeight && menuMouseX <= x + node.offsetWidth;
}

function menuUpdateDisplayListDeferred() {
	for(var idx in menuActive) {
		var wantDefer = 300;
		for(var idx in menuShow) {
			wantDefer = 0;
			break;
		}
		if(!wantDefer) {
			for(var idx in menuActive) {
				if(menuActive[idx].firstChild.className == 'menu') {
					// doesn't need long timeout, because it will be
					// cleared again and again as long as the mouse moves
					wantDefer = 30;
					break;
				}
			}
		}
		if(menuUpdateHandler) {
			clearTimeout(menuUpdateHandler);
		}
		if(wantDefer) {
			menuUpdateHandler = setTimeout(menuUpdateDisplayList, wantDefer);
		} else {
			menuUpdateDisplayList();
		}
		return;
	}
	menuUpdateDisplayList();
}

function menuUpdateDisplayList() {
	var e;
	try {
		for(var idx in menuShow) {
			menuShow[idx].className = "menuEntryActive";
			delete menuActive[idx];
		}
		for(var idx in menuActive) {
			menuActive[idx].className = "menuEntry";
		}
		menuActive = menuShow;
		menuUpdateHandler = 0;
	} catch(e) {
		// page unloaded or whatever
	}
}

function KySlider() {}
KySlider.construct = function () {
	var l = new KySlider();
	l.init();
	return l;
};
KySlider.prototype = {
	container: null,
	elements: null,
	buttons: null,
	current: -1,
	previous: -1,
	interval: null,
	timeout: null,
	isAnimating: false,
	isInTransition: false,
	browseTo: -1,
	stepsRemaining: 1,
	init: function () {},
	xBrowserAddListener: function (element, name, handler) {
		if(!element) {
			return;
		}
		if(element.addEventListener) {
			element.addEventListener(name, handler, false);
		} else if(element.attachEvent) {
			element.attachEvent('on' + name, handler);
		}
	},
	xBrowserRemoveListener: function (element, name, handler) {
		if(!element || !handler) {
			return;
		}
		if(element.removeEventListener) {
			element.removeEventListener(name, handler, false);
		} else if(element.detachEvent) {
			element.detachEvent('on' + name, handler);
		}
	},
	start: function () {
		this.container = this.createContainer();
		this.elements = this.createElements();
		this.buttons = this.createButtons();
		this.showElement(0);
		this.startAnimation();
	},
	createElements: function () {
		var el = [];
		for(var c = this.container.firstChild; c; c = c.nextSibling) {
			if(c.nodeType == 1) {
				// c.nodeType == Node.ELEMENT_NODE
				this.prepareElement(c, el.length);
				el.push(c);
			}
		}
		return el;
	},
	prepareElement: function (element, idx) {
		var me = this;
		this.xBrowserAddListener(element, 'mouseover', function () {
			me.onMouseOverElement(element, idx);
			var mo = null;
			mo = function () {
				me.onMouseOutElement(element, idx);
				me.xBrowserRemoveListener(element, 'mouseout', mo);
			};
			me.xBrowserAddListener(element, 'mouseout', mo);
		});
		this.xBrowserAddListener(element, 'click', function () {
			return me.onClickElement(element, idx);
		});
	},
	onMouseOverElement: function (element, idx) {
		this.stopAnimationDeferred();
	},
	onMouseOutElement: function (element, idx) {
		this.startAnimation();
	},
	onClickElement: function (element, idx) {
		return this.action(idx);
	},
	getElement: function (idx) {
		return this.elements[idx];
	},
	prepareButton: function (element, idx) {
		var me = this;
		this.xBrowserAddListener(element, 'mouseover', function () {
			me.onMouseOverButton(element, idx);
			var mo = null;
			mo = function () {
				me.onMouseOutButton(element, idx);
				me.xBrowserRemoveListener(element, 'mouseout', mo);
			};
			me.xBrowserAddListener(element, 'mouseout', mo);
		});
		this.xBrowserAddListener(element, 'focus', function () {
			me.onFocusButton(element, idx);
			var mo = null;
			mo = function () {
				me.onBlurButton(element, idx);
				me.xBrowserRemoveListener(element, 'blur', mo);
			};
			this.xBrowserAddListener(element, 'blur', mo);
		});
		this.xBrowserAddListener(element, 'click', function () {
			return me.onClickButton(element, idx);
		});
	},
	onMouseOverButton: function (element, idx) {
		this.browseElement(idx);
	},
	onMouseOutButton: function (element, idx) {
		this.startAnimation();
	},
	onFocusButton: function (element, idx) {
		this.onMouseOverButton(element, idx);
	},
	onBlurButton: function (element, idx) {
		this.onMouseOutButton(element, idx);
	},
	onClickButton: function (element, idx) {
		return this.onClickElement(element, idx);
	},
	getButton: function (idx) {
		return this.buttons[idx];
	},
	showElement: function (idx) {
		this.stopAnimation();
		this.show(idx);
	},
	show: function (idx) {
		if(this.previous != -1) {
			this.applyFinalElementStyle(this.previous);
			this.applyFinalButtonStyle(this.previous);
		}
		if(this.current != -1) {
			this.applyFinalElementStyle(this.current);
			this.applyFinalButtonStyle(this.current);
		}
		this.applyDisplayElementStyle(idx);
		this.applyDisplayButtonStyle(idx);
		this.current = idx;
		this.previous = -1;
	},
	browseElement: function (idx) {
		this.stopAnimationDeferred();
		if(this.isInTransition) {
			this.browseTo = idx;
			return;
		}
		this.browse(idx);
	},
	browse: function (idx) {
		if(idx == this.current) {
			return false;
		}
		this.previous = this.current;
		this.current = idx;
		this.animateCurrent();
		return true;
	},
	browseIfSet: function () {
		var b = this.browseTo;
		if(b != -1) {
			this.browseTo = -1;
			return this.browse(b);
		}
		return false;
	},
	browseNext: function () {
		this.browseStep(1);
	},
	browsePrevious: function () {
		this.browseStep(-1);
	},
	browseStep: function (step) {
		var l = this.elements.length;
		this.browseElement((l + this.current + step) % l);
	},
	applyStartElementStyle: function (idx) {
		this.applyElementStyleAndClassName(idx, this.startElementStyle(idx), this.startElementClassName(idx));
	},
	applyDisplayElementStyle: function (idx) {
		this.applyElementStyleAndClassName(idx, this.displayElementStyle(idx), this.displayElementClassName(idx));
	},
	applyFinalElementStyle: function (idx) {
		this.applyElementStyleAndClassName(idx, this.finalElementStyle(idx), this.finalElementClassName(idx));
	},
	applyStartButtonStyle: function (idx) {
		this.applyButtonStyleAndClassName(idx, this.startButtonStyle(idx), this.startButtonClassName(idx));
	},
	applyDisplayButtonStyle: function (idx) {
		this.applyButtonStyleAndClassName(idx, this.displayButtonStyle(idx), this.displayButtonClassName(idx));
	},
	applyFinalButtonStyle: function (idx) {
		this.applyButtonStyleAndClassName(idx, this.finalButtonStyle(idx), this.finalButtonClassName(idx));
	},
	applyElementStyleAndClassName: function (idx, style, className) {
		var el = this.getElement(idx);
		if(el) {
			this.applyStyleAndClassName(el, style, className);
		}
	},
	applyButtonStyleAndClassName: function (idx, style, className) {
		var el = this.getButton(idx);
		if(el) {
			this.applyStyleAndClassName(el, style, className);
		}
	},
	applyStyleAndClassName: function (element, style, className) {
		this.applyStyle(element, style);
		element.className = className;
	},
	applyStyle: function (element, style) {
		var es = element.style;
		for(var i in style) {
			switch(i) {
			case 'zIndex':
				es.zIndex = Math.round(style[i]);
				break;
			case 'opacity':
				es.filter = 'alpha(opacity=' + (style[i] * 100) + ')';
				// fall through
			default:
				es[i] = style[i];
			}
		}
	},
	startAnimation: function () {
		if(this.isAnimating || this.elements.length == 0 || this.elements.length == 1) {
			return;
		}
		this.isAnimating = true;
		if(!this.isInTransition) {
			this.startTimeout();
		}
	},
	stopAnimation: function () {
		if(this.isAnimating) {
			this.isAnimating = false;
			this.stopInterval();
			this.stopTimeout();
		}
	},
	stopAnimationDeferred: function () {
		if(this.isAnimating) {
			this.isAnimating = false;
			this.stopTimeout();
		}
	},
	animate: function () {
		if(this.stepsRemaining == 1) {
			this.animateLastFrame();
			this.stopInterval();
			if(this.browseIfSet()) {
				return;
			}
			if(this.isAnimating) {
				this.startTimeout();
			}
			return;
		}
		this.stepsRemaining -= 1;
		this.animateCurrentFrame();
	},
	animateFirstFrame: function () {
		if(this.previous != -1) {
			this.applyFinalButtonStyle(this.previous);
		}
		this.applyStartElementStyle(this.current);
		this.applyStartButtonStyle(this.current);
	},
	animateLastFrame: function () {
		if(this.previous != -1) {
			this.applyFinalElementStyle(this.previous);
			this.applyFinalButtonStyle(this.previous);
			this.previous = -1;
		}
		this.applyDisplayElementStyle(this.current);
		this.applyDisplayButtonStyle(this.current);
	},
	animateCurrentFrame: function () {
		var cs = this.computeCurrentRatio();
		this.applyStyle(this.getElement(this.previous), this.computeStyle(cs, this.displayElementStyle(this.previous), this.finalElementStyle(this.previous)));
		this.applyStyle(this.getElement(this.current), this.computeStyle(cs, this.startElementStyle(this.current), this.displayElementStyle(this.current)));
		return cs;
	},
	animateNext: function () {
		this.nextElement();
		this.animateCurrent();
	},
	animateCurrent: function () {
		this.stepsRemaining = this.getSteps(this.current);
		this.startInterval();
		this.animateFirstFrame();
	},
	nextElement: function () {
		this.previous = this.current;
		this.current = (this.current + 1) % this.elements.length;
	},
	startInterval: function () {
		this.stopInterval();
		this.isInTransition = true;
		var me = this;
		this.interval = setInterval(function () {
			me.animate();
		}, 1000 / 24);
	},
	stopInterval: function () {
		this.isInTransition = false;
		if(this.interval !== null) {
			clearInterval(this.interval);
			this.interval = null;
		}
	},
	startTimeout: function () {
		this.stopTimeout();
		var me = this;
		this.timeout = setTimeout(function () {
			me.animateNext();
		}, this.getSleepTime(this.current));
	},
	stopTimeout: function () {
		if(this.timeout !== null) {
			clearTimeout(this.timeout);
			this.timeout = null;
		}
	},
	computeCurrentRatio: function () {
		var r = this.stepsRemaining;
		var t = this.getSteps(this.current);
		return this.computeRatio(t, r, this.getDeceleration(this.current, t - r));
	},
	computeRatio: function (total, remaining, deceleration) {
		return Math.pow((remaining / total), deceleration);
	},
	styleRegex: /^(-?\d*\.?\d+)([^\d].*|)$/,
	computeStyle: function (ratio, from, to) {
		var c = {};
		for(var i in from) {
			var sFrom = from[i];
			var sTo = to[i];
			if(sTo != undefined) {
				if(sFrom !== sTo) {
					var rFrom = this.styleRegex.exec(sFrom);
					if(rFrom) {
						var rTo = this.styleRegex.exec(sTo);
						if(rTo) {
							var nFrom = parseFloat(rFrom[1]);
							var nTo = parseFloat(rTo[1]);
							c[i] = (nTo - ((nTo - nFrom) * ratio)) + rFrom[2];
							continue;
						}
					}
				}
			}
			c[i] = sFrom;
		}
		return c;
	},
	getDirection: function () {
		var p = this.previous;
		var c = this.current;
		if(p == -1 || c == -1 || c == p) {
			return 0;
		}
		var l = this.elements.length - 1;
		if(p % l == 0) {
			if(c == l) {
				return -1;
			}
			if(c == 0) {
				return 1;
			}
		}
		return c - p;
	},
	createContainer: function () {
		alert("createContainer() not implemented");
		return null;
	},
	createButtons: function () {
		alert("createButtons() not implemented");
		return [];
	},
	action: function (idx) {
		return true;
	},
	getSteps: function (idx) {
		return 18;
	},
	getDeceleration: function (idx, step) {
		return 2;
	},
	getSleepTime: function (idx) {
		return 10000;
	},
	startElementStyle: function (idx) {
		return {};
	},
	displayElementStyle: function (idx) {
		return {};
	},
	finalElementStyle: function (idx) {
		return {};
	},
	startElementClassName: function (idx) {
		return this.getElement(idx).className;
	},
	displayElementClassName: function (idx) {
		return this.getElement(idx).className;
	},
	finalElementClassName: function (idx) {
		return this.getElement(idx).className;
	},
	startButtonStyle: function (idx) {
		return {};
	},
	displayButtonStyle: function (idx) {
		return {};
	},
	finalButtonStyle: function (idx) {
		return {};
	},
	startButtonClassName: function (idx) {
		var b = this.getButton(idx);
		return b ? b.className : '';
	},
	displayButtonClassName: function (idx) {
		var b = this.getButton(idx);
		return b ? b.className : '';
	},
	finalButtonClassName: function (idx) {
		var b = this.getButton(idx);
		return b ? b.className : '';
	}
};

function slider() {
	var s = KySlider.construct();
	s.texts = null;
	s.createContainer = function () {
		var tcont = document.getElementById("homeOpenerTexts");
		if(tcont) {
			this.texts = [];
			for(var c = tcont.firstChild; c; c = c.nextSibling) {
				if(c.nodeType == 1) {
					// c.nodeType == Node.ELEMENT_NODE
					this.texts.push(c);
				}
			}
		}
		return document.getElementById("homeOpenerContent");
	};
	s.createButtons = function () {
		var c = document.getElementById("homeOpenerButtons");
		var l = document.createElement("div");
		l.className = 'homeOpenerLeft';
		var r = document.createElement("div");
		r.className = 'homeOpenerRight';
		c.appendChild(r);
		c.appendChild(l);
		this.xBrowserAddListener(l, 'click', function () { s.browsePrevious(); });
		this.xBrowserAddListener(r, 'click', function () { s.browseNext(); });
		var a = [];
		r.style.cssFloat = 'right';
		l.style.cssFloat = 'right';
		r.style.styleFloat = 'right'; // IE
		l.style.styleFloat = 'right'; // IE
		l.style.cursor = 'pointer';
		r.style.cursor = 'pointer';
/* no buttons
		for(var i = this.elements.length; --i >= 0;) {
			var b = document.createElement("div");
			c.appendChild(b);
			this.prepareButton(b, i);
			a[i] = b;
		}
*/
		return a;
	};
	s.getSleepTime = function (idx) {
		return 10000;
	};
	s.startElementStyle = function (idx) {
		return this.getDirection() >= 0 ? { left: '769px' } : { left: '-769px' };
	};
	s.displayElementStyle = function (idx) {
		return { left: '0px' };
	};
	s.finalElementStyle = function (idx) {
		return this.getDirection() >= 0 ? { left: '-769px' } : { left: '769px' };
	};
	s.startElementClassName = function (idx) {
		return "homeOpenerContentVisible";
	};
	s.displayElementClassName = function (idx) {
		return "homeOpenerContentVisible";
	};
	s.finalElementClassName = function (idx) {
		return "homeOpenerContentInvisible";
	};
	s.startButtonClassName = function (idx) {
		return "";
	};
	s.displayButtonClassName = function (idx) {
		return "homeOpenerActive";
	};
	s.finalButtonClassName = function (idx) {
		return "";
	};
	s._animateCurrentFrame = s.animateCurrentFrame;
	s.animateCurrentFrame = function () {
		var cs = this._animateCurrentFrame();
		if(this.texts) {
			this.applyStyle(this.texts[this.current], this.computeStyle(cs, { opacity: 0, zIndex: 24 }, { opacity: 1, zIndex: 12 }));
		}
		return cs;
	};
	s._animateFirstFrame = s.animateFirstFrame;
	s.animateFirstFrame = function () {
		this._animateFirstFrame();
		if(this.texts) {
			var t = this.texts[this.current];
			t.className = 'homeAreaOpenerVisible';
			this.applyStyle(t, { opacity: 0, zIndex: 24 });
		}
	};
	s._animateLastFrame = s.animateLastFrame;
	s.animateLastFrame = function () {
		var p = this.previous;
		this._animateLastFrame();
		if(this.texts) {
			this.applyStyle(this.texts[this.current], { opacity: 1, zIndex: 11 });
			if(p != -1) {
				this.texts[p].className = 'homeAreaOpenerInvisible';
			}
		}
	};
	s.start();
}

var popupCurrent = null;
var popupTimeout = null;

function popupSetup(containerId) {
	var container = document.getElementById(containerId);
	var c = container.childNodes;
	for(var i = 0; i < c.length; ++i) {
		var n = c[i];
		if(n.className == "homeAreaReferenz") {
			var nc = n.childNodes;
			for(var j = 0; j < nc.length; ++j) {
				var p = nc[j];
				if(p.className == "homeAreaPopup") {
					p.innerHTML = '<div class="homeAreaPopupContent">' + p.innerHTML + '</div>';
					p.style.left = -n.offsetLeft + 'px';
					n.onmouseover = function () { popupOpen(this); };
//					p.onmouseout = function () { popupDeferredClose(); };
					n.onmouseout = function () { popupDeferredClose(); };
					n.wallmedienPopup = p;
					break;
				}
			}
		}
	}
}

function popupOpen(popupContainer) {
	popupClose();
	popupContainer.className = 'homeAreaReferenzActive';
	var wm = popupContainer.wallmedienPopup;
	wm.style.top = (-wm.firstChild.offsetHeight - popupContainer.offsetTop - 3) + 'px';
	popupCurrent = popupContainer;
/*
	var y = popupContainer.offsetTop;
	for(var i = popupContainer.parentNode.firstChild; i; i = i.nextSibling) {
		if(i.offsetTop === y && i != popupContainer) {
			i.style.zIndex = 11;
		}
	}
*/
}

function popupClose() {
	if(popupCurrent) {
		popupCurrent.className = 'homeAreaReferenz';
/*
		var y = popupCurrent.offsetTop;
		for(var i = popupCurrent.parentNode.firstChild; i; i = i.nextSibling) {
			if(i.offsetTop === y && i != popupCurrent) {
				i.style.zIndex = 5;
			}
		}
*/
		popupCurrent = null;
	}
	if(popupTimeout !== null) {
		clearTimeout(popupTimeout);
		popupTimeout = null;
	}
}

function popupDeferredClose() {
	if(popupTimeout) {
		clearTimeout(popupTimeout);
	}
	popupTimeout = setTimeout(popupClose, 300);
}

function findLink(elt) {
	for(var c = elt.firstChild; c; c = c.nextSibling) {
		if(c.href && c.nodeName && c.nodeName.toLowerCase() == 'a') {
			return c.href;
		}
		var s = findLink(c);
		if(s) {
			return s;
		}
	}
	return '';
}

function clickableBox(elt) {
	var s = findLink(elt);
	if(s) {
		elt.onclick = function () {
			location.href = s;
		};
		elt.style.cursor = 'pointer';
	}
}

function findWhiteBox(elt) {
	for(var c = elt.firstChild; c; c = c.nextSibling) {
		var n = c.className;
		if(n == "whiteBox" || n == "whiteBoxHalf") {
			clickableBox(c);
		} else {
			var nn = c.nodeName;
			if(nn && nn.toLowerCase() != 'a') {
				findWhiteBox(c);
			}
		}
	}
}

function installClickableBox() {
	if(!document.getElementById("footerRSS")) {
		return;
	}
	clearInterval(installClickableBox.interval);
	findWhiteBox(document.body);
}
installClickableBox.interval = setInterval(installClickableBox, 100);


