$(document).ready(function() {
	
	$('div#logo, div#slogan').hover(function() {
		$("div#logo").find("img").attr("src","http://www.lakesbikers.it/images/general/logo-over.png");
			}, function() {
		$("div#logo").find("img").attr("src","http://www.lakesbikers.it/images/general/logo.png");
	});

	$("div.col-group h2, div.center-group h2 ").wrap("<div class='bottom-border'>");
	
	var inputWidth = ($("div.form-element input").outerWidth())-10;
	$("div.form-element textarea").css('width' , inputWidth );
	
	$('span.day').each (function () {
			var day_number = $(this).html().toLowerCase();
			$(this).addClass ("d" + day_number);
			var day_xpos = (day_number * (-60))+60;
			$(this).css ({'background-position' : day_xpos + 'px bottom' });
	});
	
	$('span.month').each (function () {
			var month_name = $(this).html().toLowerCase();
			$(this).addClass (month_name);
			if (month_name == 'gen') { var month_name = 1; }
			if (month_name == 'feb') { var month_name = 2; }
			if (month_name == 'mar') { var month_name = 3; }
			if (month_name == 'apr') { var month_name = 4; }
			if (month_name == 'mag') { var month_name = 5; }
			if (month_name == 'giu') { var month_name = 6; }
			if (month_name == 'lug') { var month_name = 7; }
			if (month_name == 'ago') { var month_name = 8; }
			if (month_name == 'set') { var month_name = 9; }
			if (month_name == 'ott') { var month_name = 10; }
			if (month_name == 'nov') { var month_name = 11; }
			if (month_name == 'dic') { var month_name = 12; }
			var month_xpos = (month_name * (-60))+60;
			$(this).css ({'background-position' : month_xpos + 'px top' });
	});
	
	$("span.small-day").each(function() {
		var day_small_number = $(this).html().toLowerCase();
		var day_small_ypos = (day_small_number * (-18))+18;
		$(this).css ({'background-position' : 'left ' + day_small_ypos + 'px' })
	});
	
	$("span.small-month").each(function() {
		var month_small_name = $(this).html().toLowerCase();
		if (month_small_name == 'gen') { var month_small_ypos = 2; }
		if (month_small_name == 'feb') { var month_small_ypos = -16; }
		if (month_small_name == 'mar') { var month_small_ypos = -34; }
		if (month_small_name == 'apr') { var month_small_ypos = -52; }
		if (month_small_name == 'mag') { var month_small_ypos = -70; }
		if (month_small_name == 'giu') { var month_small_ypos = -88; }
		if (month_small_name == 'lug') { var month_small_ypos = -106; }
		if (month_small_name == 'ago') { var month_small_ypos = -124; }
		if (month_small_name == 'set') { var month_small_ypos = -142; }
		if (month_small_name == 'ott') { var month_small_ypos = -161; }
		if (month_small_name == 'nov') { var month_small_ypos = -179; }
		if (month_small_name == 'dic') { var month_small_ypos = -197; }
		$(this).css ({'background-position' : '-21px ' + month_small_ypos + 'px' })
	});
	
	$('div#meteo-fader').innerfade({
		animationtype: 'fade',
		speed: 750,
		timeout: 4000,
		type: 'random',
		containerheight: '80px'
	});

  // Initialize Galleria
  $('div#gallery').galleria({
		height: 540,
		autoplay: 'true',
		transition: 'fade'
  });

});
