$(function() {
  window.fbAsyncInit = function() {
		FB.init({appId: null, status: true, cookie: true,xfbml: true});
	};
	var e = '<script src="http://connect.facebook.net/en_US/all.js"></script>';
	$('#fb-root').append(e);
	function resize_image(image) {
		var ratio = Math.max($(window).width()/image.width(),$(window).height()/image.height());
		var w_ratio = Math.max($('#all').width()/image.width(),$('#all').height()/image.height());
		if ($(window).width() > $(window).height()) {
			image.css({width:image.width()*ratio,height:'auto'});
		} else {
			image.css({width:'auto',height:image.height()*ratio});
		}	
	}
	function load_image(image) {
		image.hide();
		var img = new Image();
		img.onload = function() {
			resize_image(image);
			//image.fadeIn();
			image.show();
		};
		$(img).attr('src', image.attr('src'));
	}
	image = $('#back').find('img');
  $(window).bind('resize', function(ev) {
    resize_image(image);
	});
	load_image(image);
	
	//alert($('#article_section').find('fb:like').text());
	
	$('.si_det').mouseover(function(){
	 $('<div class="explain"><p></p></div>').insertAfter('.si_det');
	 $('.explain p').text('For å inkludere bilde på profilen din, lim inn url i comment feltet!');
	});
	$('.si_det').mouseout(function(){
	 $('.explain').remove();
	});
	
});



