function navi() {
	$$('#nav_hauptnavigation ul a').each(function(o) {
		o.getParent().addEvent("click",function() {
			document.location = o.href;
		});
	});
}


function log(what,where) {
		$(where).set("text","");
	w = "";
	w += what;
	w += "<br>";
	$(where).set("html",$(where).get("html")+""+w);
}

function toggler() {
	$$('.toggler').each(function(o) {
		o.addEvent('click',function() {			
			i = document.location+"?toggler="+o.get("text");
			piwikTracker.trackLink( i, 'link' );
		});
	});	
	
	$$('img').each(function(o) {
		o.addEvent('click',function() {			
			i = document.location+"?img="+o.get("src");
			piwikTracker.trackLink( i, 'link' );
		});
	});	
	
}

function popup() {	
	$$('.popup a').each(function(o) {		
		if ( o.get("rel") && o.get("rel").contains("lightbox") ) return true;
		o.set("rel","lightbox[box2 external 600 400]");		
		return true;
		p = o.getParent("div").getParent("div").get("class");
		if ( p.contains("mb_") ) {
			pm = p.match(/(mb_.[^ ]+)/);			
			if ( pm ) {				
				pm = pm[0];				
				o.addEvent("mouseover",function() {		
					alert(pm);
					$$(pm).setStyle("color","#008F35");
				});
				o.addEvent("mouseout",function() {					
					$$("a."+pm).setStyle("color","#353535");
				});
				
			}
		}
	});
}

function site() {
	this.init = function() {
		
		
		popup();
		toggler();
		navi();
	}
}


site = new site();


window.addEvent('domready', site.init );

function nope() {
	return false;
}
window.onerror = nope;

