$(document).ready(function() {
			
	$(function() {
		$("a[rel='_blank']").attr("target","_blank");				
	});
	
	$.urlParam = function(name){
		var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
		if(results) {
			return results[1] || 0;
		}
	};
	
	jQuery.fn.delay = function(time,func){
		this.each(function(){
			setTimeout(func,time);
		});	
	return this;
	};
	
	jQuery.preloadImages = function(){
  		for(var i = 0; i<arguments.length; i++){
    		$("<img>").attr("src", arguments[i]);
  		}
	}
	//$.preloadImages("img/ajax-loader.gif");
	
	/*$('a.current').hover(function(){
		$(this).attr('title','');
	});
	$('a.ghost-link').hover(function(){
		$(this).attr('title','');
	});*/
	
	// AMMAZZA LINK
	$(function() {
		$('a.ghost-link, a.current').each(function(){
			$(this).attr('title','');
			/*$(this).mouseover(function(){
				window.status = this.title;
				return true;
			})
			.mouseout(function(){
				window.status='Done';
				return true;
			});*/
			$(this).click(function(){
				return false;
			});
		});		
	});
	
	// FUNZIONE HOME PAGE NEWS TICKER
	/*$(function() {
		if($('.news-ticker-show').length) {
			$('.news-ticker-show').show();
			$('.news-ticker').hide();
			$('.news-ticker-show').click(function(){
				$(this).fadeOut(1000, function () {
        			$('.news-ticker').fadeIn(1500);
      			});				
				return false
			});
			$('.news-ticker-hide').click(function(){
				$(this).parent().fadeOut(1000, function () {
        			$('.news-ticker-show').fadeIn(1500);
      			});				
				return false
			});
		}			
	});*/
	
	// INIZIO FUNZIONE APPEND ICONA E OVERLAY THUMBNAIL
	$(function() {
		if($('.get-more').length) {
			$('.get-more').append('<span class="overlay"></span><span class="icon-plus"></span>');
			$('.get-more .overlay').css({'opacity': 0});
			//
			$('.get-more').hoverIntent(
			function(){
				$(this).find('.overlay').animate({'opacity': 0.3}, 'normal'); 
				$(this).find('.icon-plus').animate({'bottom': '0px'}, 'normal');
			},
			function(){
				$(this).find('.overlay').animate({'opacity': 0});
				$(this).find('.icon-plus').animate({'bottom': '-25px'});		
			});
		}
	});

	$("a[rel=lightbox]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">'+(title.length ? ' &nbsp; ' + title : '')+'</span>';
		}
	});
			
});

