$(document).ready(function(){
	// PRELOADER BEGIN
	/*
	$.ajaxSetup ({
    	cache: false
	});
	$('#kulle').remove();
	$("#ie").append("<div id='kulle'></div>")
	var laddad = false;
	var jpg = MEDIA_URL + 'img/bak_kulle_pozterize_sliced.jpg';
	var png = MEDIA_URL + 'img/bak_kulle_pozterize_sliced.png';
	$('<img />').attr('src', jpg).load(function(){
			if (laddad){
				klar();
			}else{
				laddad = true;
			}        				
	});	
	$('<img />').attr('src', png).load(function(){
			if (laddad){
				klar();
			}else{
				laddad = true;
			}        				
	});			
	function klar(){
		$('#kulle').append($("<img src=" + "'" + png + "'" + "/>"));
		$('#kulle').append($("<img src=" + "'" + jpg + "'" + "/>"));
		$('#ie').hide().fadeIn('slow');
	}
	// PRELOADER END
	*/
	// LOGOS BEGIN
	var overlay = false;
	var hide_overlay_klar = false;
	var pos, bredd;
	
	// Sparar a title i data, raderar title
	$('[title]').each(function() {
		$this = $(this);
	    $.data(this, 'title', $this.attr('title'));
		$this.removeAttr('title');
	});

	$('a#zeta,a#umani,a#delizie,a#lavilla,a#rana').hover(function(){
		// RollOver
		if(!hide_overlay_klar){
			$('#overlay').css({'display': 'block', 'opacity': '0'});
			hide_overlay_klar = true;
		}				
		$('.slogan').css({'display': 'block', 'opacity': '0'});
		
		// Title
		$('.slogan').html($(this).data('title'));				

			$('.slogan').stop(true,true).animate({ opacity: 0.8 }, 300);
		$('#overlay').stop(true,true).animate({ opacity: 0.7 }, 200);
		pos = $(this).position();
		bredd = $(this).width() - 8;
		flytta(pos.left,bredd);
		overlay = true;
	},function(){
		// RollOut
		$('.slogan').animate({ opacity: 0 }, 300).css({'display': 'none'});				
		overlay = false;
		timer();
	});
	function flytta(pos, bredd){
		$('.slogan').css({'left': pos, 'width': bredd});
	}
	function timer(){
		setTimeout(hide_overlay,1);
	}
	function hide_overlay(){
		if(!overlay){
			$('#overlay').stop(true,true).animate({ opacity: 0 },200, function(){
				$('#overlay').css({'display': 'none'});
			});	
			hide_overlay_klar = false;				
		}
	}
	// LOGOS END
});   
