if(top!=self){ top.location=self.location;}

function log(text) {
	if (!jQuery.browser.msie == true) {
		window.console.log(text);
	}
	else {
		//alert(text);
	}
}
function remote(id) {
	query = "a[name=a"+id+"]";
	//log($(query).next());
	klickRemote($(query).next()[0]);
}
function klickRemote(This) {
	// log("klick");
	// log($(This));
	thisOffset = $(This).offset();
	thisWidth = $(This).width();
	thisHeight = $(This).height();
	var scroll = $('body').attr("scrollTop");
	$.post('remote.php', "funktion=artikel&artikel="+This.pathname, function(xml) { //index/getcontent
		Cover = $('<div class="cover"></div>').css({height: $('body')[0].scrollHeight, opacity: '0.0'} ).appendTo($('body')).click(function(event) {
			event.preventDefault();
			//log("remove");
			$(".cover").remove();
			$('#Scroll2').remove();
			$('.inhaltContainer').remove();
		}).animate({ opacity: '0.6' }, 'fast');
		left = ($('body').width()/2)-200;
		if (jQuery.browser.msie == true) {
			Container = $('<div class="Scrollbereich" id="Scroll2" style="z-index:60;" ></div>').appendTo($('body')).click(function(event) {
				event.preventDefault();
				//log("remove2");
				$(".cover").remove();
				$('#Scroll2').remove();
				$('.inhaltContainer').remove();
			});
		}
		else {
			Container = $('body');
		}
			
		$('<div/>').addClass("inhaltContainer").css({top:thisOffset.top, left:thisOffset.left, width: thisWidth, opacity: '0.0'}).appendTo(Container).animate({top:scroll+30, left:left, opacity: '1.0', width:'360' }, 'fast').html(xml);
		$('<a href="#"><img src="seite/close.png" />schließen</a>').appendTo($('.inhaltContainer')).click(function() {
			//log("remove1");
			$(".cover").remove();
			$('.inhaltContainer').remove();
		});
		
		//log($('body')[0].scrollHeight+" "+thisOffset.top+" "+$('.inhaltContainer').height());
		Cover.css({height: $('body')[0].scrollHeight+100 });
	});
}

$(document).ready(function() {
	//log($('body').attr('ref'));
	$(".kasten a").click(function(event) {
		event.preventDefault();
		
		//log("vorRemote");
		klickRemote(this);
	});
});



if(top!=self){ top.location=self.location;}

function log(text) {
	if (!jQuery.browser.msie == true) {
		window.console.log(text);
	}
	else {
		alert(text);
	}
}