sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function prepareAjax()
{
	var a = $(this);
	a.click(function(e){
	e.preventDefault();
		var c = $('#content');
//		c.fadeOut("fast");
//		c.hide();
		href = a.attr('href');
		ajax = (href.indexOf("?") == -1 ? '?' : '&') + 'ajax=true';
		c.load(href + ajax, [], function()
		{
			page_actions['page11']();
//			c.fadeIn("fast");
		});
	});
}

var page_actions = {
	"page11": function() {
			$(".news-list-morelink a").each(prepareAjax);
			$(".browsebox a").each(prepareAjax);
			$(".news-single-backlink a").each(prepareAjax);
	},
	"page9": function()
	{

		p = $(".bodytext a:first-child");
		$("#content").append($('<a href="'+p[0]+'"><div style="position:absolute;top:0px;left:0px;width:580px;height:550px;background:url(/fileadmin/iepngfix/blank.gif)"></div></a>'));
		$("#content").append($('<a href="'+p[1]+'"><div style="position:absolute;top:0px;left:580px;width:370px;height:550px;;background:url(/fileadmin/iepngfix/blank.gif)"></div></a>'));
	}
	
};


$(document).ready(function(){
	body_id = document.body.id;
	if(page_actions[body_id])
	{
		page_actions[body_id]();
	}
	
	$("#content_wrap").hide();
//	$("#content > div").hide();
	
	setTimeout(function(){
		$("#content_wrap").show();
		/*
		$("#content_wrap").fadeIn("slow");
		var i = 0;
		$("#content > div").each(function(){
			var elem = $(this);
			setTimeout(function(){elem.fadeIn(1000)}, ++i * 200);
		});	
		*/
	}, 900);

	var i = 0;
	$("#projekte li").each(function() {
		if(i++)
		{
			$(this).hide();
		}
	});
	 
	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'dark_square'});	

});