$(document).ready(function() {
	$('input[type="text"]').addClass("idleField");
  	$('input[type="text"]').focus(function() {
       	$(this).removeClass("idleField").addClass("focusField");
    	if (this.value == this.defaultValue){ 
    		this.value = '';
		}
		if(this.value != this.defaultValue){
	    	this.select();
	    }
    });
    $('input[type="text"]').blur(function() {
    	$(this).removeClass("focusField").addClass("idleField");
    	if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}					
		// validate signup form on keyup and submit
	/*	var validator = $("#signupform").validate({
			rules: {
				nome: "required",
				email: {
					required: true,
					email: true
				},
				messaggio: "required",
				terms: "required"
			},
			messages: {
				nome: "Inserire il Nome",
				email: {
					required: "Inserire un indirizzo valido",
					minlength: "Inserire un indirizzo valido",
					email: "Inserire un indirizzo valido",
				},
				messaggio: "Inserire il messaggio",
				terms: "Accettare il consenso"
			},	
			// set this class to error-labels to indicate valid fields
			success: function(label) {
				// set   as text for IE
				label.html(" ").addClass("checked");
			}
		});	*/	
				
	});	
	
	$(".fade").live('mouseenter',function(){
			$(this).fadeTo("fast", 0.5);
		});
	$(".fade").live('mouseleave',function(){
			$(this).fadeTo("fast", 1.0);
	});
	$(".fade_social").css({ opacity: 0.5 });

	$(".fade_social").hover(function(){	
			$(this).fadeTo("fast", 1.0);
		},function(){
			$(this).fadeTo("fast", 0.5);
	});
// create custom animation algorithm for jQuery called "bouncy"
	$.easing.bouncy = function (x, t, b, c, d) {
	    var s = 1.70158;
	    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	};
	$.tools.tooltip.addEffect("bouncy",
		// opening animation
		function(done) {
			this.getTip().animate({top: '+=40'}, 400, 'bouncy', done).show();
		},
		// closing animation
		function(done) {
			this.getTip().animate({top: '-=10'}, 100, 'bouncy', function()  {
				$(this).fadeOut("fast");
				done.call();
			});
		}
	);

	$("#nav img[title]").tooltip({effect: 'bouncy'});
});

		
$(window).load(function() {
	$('#slider').nivoSlider({
		effect:'boxRainGrow',
		controlNav:false,
		captionOpacity:1,
		pauseTime:5000
	});
});

