$(document).ready(function(){
	if($("#facebook-invite-friends")) {
		$("#facebook-invite-friends").html('<a href="http://www.facebook.com/pages/Lars-Lokke-Rasmussen/58140803787"><img src="fileadmin/gattaca/page_templates/images/fb_page.gif" border="0" /></a><br /><br />Hvis du ikke har en Facebook-profil, kan du oprette en gratis på <a href="http://www.facebook.com" target="_blank">www.facebook.com</a><br />Husk at læse betingelserne og tænk over, hvad du offentliggør.');
	}

	/*
	$(".post-list-container").mouseover(function (){
		$(this).css("background-color", "#f2f3f4");
	});
	$(".post-list-container").mouseout(function (){
		$(this).css("background-color", "#FBFCFC");
	});
	*/
	$(".post-list-container").hover(function (){
			$(this).css("background-color", "#f2f3f4");
		},function (){
			$(this).css("background-color", "#FBFCFC");
		}
	);
	
	
	$(".tx-indexedsearch-results-inner").hover(function (){
			$(this).css("background-color", "#f2f3f4");
		},function (){
			$(this).css("background-color", "#FBFCFC");
		}
	);
	
	/*
	$(".content-col1").children("[attr]").each(function (){
		$(this).mouseover(function (){
			$(this).css("background-color", "#f2f3f4").css("border-top", "1px solid #000000");
		});
		$(this).mouseout(function (){
			$(this).css("background-color", "#FBFCFC").css("border-top", "1px solid #808080");
		});
	});
	
	$(".div-facebookbox, .div-twitterbox,.div-linkedinbox,.tx-bee3flickr-pi1").each(function (){
		$(this).mouseover(function (){
			$(this).css("border-top", "1px solid #000000");
		});
		$(this).mouseout(function (){
			$(this).css("border-top", "1px solid #D3D4D4");
		});
	});
	
	*/
	$(".post-list-container h1:eq(0)").css("font-size", "29px");

	$(".post-list-container h1:eq(0)").children().each(function (){
		$(this).css("font-size", "29px");
	});

	FB.init("1cc7d3fa3308a32854053f7fe9e1f2d9", "/typo3conf/ext/fbconnect/res/xd_receiver.htm", {"ifUserConnected" : facebook_login});

});

function facebook_login() {
	//FB.ensureInit(function() {
		FB.Connect.requireSession(function() {
		//FB.XFBML.Host.get_areElementsReady().waitUntilReady(function() {
			$(".div-facebookbox-content").html('Du er logget ind som <br/><fb:profile-pic uid="loggedinuser" facebook-logo="false"></fb:profile-pic><br /><fb:name uid="loggedinuser" useyou="false" linked="false"></fb:name><br /><a id="facebook-addfriends-button" href="facebook/"><img width="143" height="25" title="" alt="" src="fileadmin/gattaca/page_templates/images/Venner_fb_02.gif"/></a><div class="div-clr">&nbsp;</div>');
			$("#fbb_lu").html('<a href="#" onclick=\'facebook_logout(); return false;\'>Log ud</a>');
			$("#facebook-invite-friends").html('<iframe height="541" width="691" frameborder="0" padding="0" src="fileadmin/gattaca/connect/index.html" background="transparent" scrolling="no"></iframe>');
			FB.XFBML.Host.parseDomTree();
		});
		//$("#fbloading").remove();
	//});
}

function facebook_logout() {
	//FB.ensureInit(function() {
		FB.Connect.logout(function() {
			$(".div-facebookbox-content").html('<a href="#" onclick="facebook_login(); return false;" ><img width="143" height="25" title="" alt="" src="fileadmin/gattaca/page_templates/images/FolgLars_fb_01.gif"/></a><div class="div-clr">&nbsp;</div>');
			$("#fbb_lu").html('');
			$("#facebook-invite-friends").html('<a href="http://www.facebook.com/pages/Lars-Lokke-Rasmussen/58140803787"><img src="fileadmin/gattaca/page_templates/images/fb_page.gif" border="0" /></a><br /><br />Hvis du ikke har en Facebook-profil, kan du oprette en gratis på <a href="http://www.facebook.com" target="_blank">www.facebook.com</a><br />Husk at læse betingelserne og tænk over, hvad du offentliggør.');
		});
	//});
}

function showOlderNews(from) {
	$.ajax({
		url: '/index.php?id=5755&from=' + from,
		success: function (data) {
			$('.morenewsinsertpoint').replaceWith(data);
		}
	});
	//$('.morenewsinsertpoint').load('/index.php?id=5755&from=' + from, '', cleanUp());
}

function cleanUp() {
	//alert('test');
	//$('.morenewsinsertpoint :eq(0)').attr("class","dontusethis");
}



