Cufon.replace('.heading' );

var $nav;

Biblioteca = function(o)
{
	var me = this;
	
	var defaults = {};
	this.opt = $.extend({}, defaults, o);
	
	this.mainNav = $(this.opt.mainNav).superMenu({ move: true });
	
	this.textSize = new TextSizeController({ 
		target: this.opt.textSizeTarget,
		ctrl_increase: this.opt.textSizeInc,
		ctrl_decrease: this.opt.textSizeDec
	});
	
	this.init = function()
	{
		//cerca
		var label = $('#header label[for=cerca]').html();
		         
		$ricerca = $('#cerca').val(label).addClass('t');
		$ricerca.blur(function(){
			if (this.value == '')
			{ 
				$(this).addClass('t');
				this.value = label;
			}
		});
		$ricerca.focus(function(){
			if (this.value == label)
			{ 
				this.value = '';
				$(this).removeClass('t');	
			}
		});
		/*
		$('#form-cerca').submit(function(e){
			if (this.q.value == '') 
				return false;						
			window.open(this.action+'?sitesearch='+this.sitesearch.value+'&q='+this.q.value);
			return false;
		});
		*/
		return this;
	};
	return this.init();
};

$(function(){
	var biblioteca = new Biblioteca({
		mainNav: '#main-nav',
		textSizeTarget: '#content .content',
		textSizeInc: '#acc_inc',
		textSizeDec: '#acc_dec',
		accessibilityCtrl: '#acc_css'
	});
	
	$('.tooltip, a[title]:not(.notizie a)').aToolTip();
	$('.external, a[rel="external"]').external();
	$('.popup, .lightbox').fancybox();
	$(".slideshow").cycle({
		timeout: 5000,
		speed: 2000
	});	
});
