// JavaScript Document
var slidehome = null;
var homepage	=	{
	init	:	function()
	{
		jQuery(".box14 .item-list .item .item-info .address-info").tooltip({
			content: function() {
				return jQuery(this).text();
			},
			position: {
				my: "center top",
				at: "center bottom",
				offset: "0 10"
			},
			tooltipClass: "luogo-tooltip"
		});
		
		jQuery(".article-highlight .highlight-title").tooltip({
			content: function() {
				return jQuery(this).text();
			},
			position: {
				my: "center top",
				at: "center bottom",
				offset: "0 10"
			},
			tooltipClass: "luogo-tooltip"
		});
		jQuery('.slideshow .slideshow-controls .control-list').append('<ul class="clearfix"></ul>');
		var numimages = null;
		numimages = jQuery('.slideshow .slideshow-list .images img').size();
		
		if( numimages > 1 )
		{
			var appe = '<a href="#play" title="Avvia lo slideshow" class="play">\n\
                                                    	<span>PLAY</span>\n\
                                                    </a>\n\
                                                    <span> / </span>\n\
                                                    <a href="#stop" title="Ferma lo slideshow" class="stop">\n\
                                                    	<span>STOP</span>\n\
                                                    </a>';
			jQuery('.slideshow .slideshow-controls .control-buttons .clear').append(appe);
			
			var y = 0;
			slidehome = jQuery('.slideshow .slideshow-list .images').cycle({
				fx:      'fade', 
				speed:    1000, 
				timeout:  4000,
				pager:  '.slideshow .slideshow-controls .control-list ul',
				pagerAnchorBuilder: function(idx, slide) { 
					y = y+1;
					return '<li class="column item item'+y+'"><a href="#" title="Vedi immagine: '+slide.alt+'"><span>'+y+'</span></a></li>'; 
				}
			});
			jQuery( '.slideshow .slideshow-controls .control-buttons .stop').click(function(){
				slidehome.cycle('pause');
				return false;
			});
			jQuery( '.slideshow .slideshow-controls .control-buttons .play').click(function(){
				slidehome.cycle('resume');
				return false;
			});
		}
	}
};
