// Achtung: jquery!

var loggedIn = false;
var showAds = false;

function isUserLogged() {
	var location = window.location.href;
	var blogIndex = location.indexOf("blog");
	var mainUrl = location.substr(0, blogIndex);
	
	 $.ajax({
   		type: "GET",
   		url: mainUrl + 'checkLoggedIn.action',
   		complete: showTreeLink
   	 });
}

function showTreeLink(response) {
	var status = response.responseText.split("|");
	if (status[0] != '-1') {
		$('#tree-link').show();
		$('#banner').hide();
		$('#teaser').hide();
		loggedIn = true;
		if (status[1] == '0') {
			showAds = true;
		}
	} else {
		$('#banner').show();
		showAds = true;
	}
}

function checkIETitle() {
	if (document.title.match(/#/)) {
		var docTitle = document.title;
		document.title = docTitle.substr(0,docTitle.indexOf('#'));
	}
}

$(document).ready(function(){
	if (showAds) {
		$('#leaderboard-blog').show();
		$('#skyscraper120-blog').show();
	}
});
