$(document).ready(function () {

	// SLIDESHOW
	$('#slideshow').cycle();
	
//SLIDESHOW
	$('.fancy').fancybox();

	
	// $('.cat_8').attr('href','http://www.cremonahotels.it/eventi').attr('target','_blank'); 	
	
	// METEO SHOW / HIDE
	$('#meteo_wrapper a.meteo_link').click(function(e){
		e.preventDefault();
		$('#meteo_box').slideToggle('slow');
	});

	// TOP MENU - SHOW / HIDE SUBCATEGORIES
	$('#top_menu ul li').hover(
		function(){
			$(this).children('ul').fadeIn(100);
		},
		function(){
			$(this).children('ul').fadeOut(500);
		}
	);

	// STYLE SELECT
	$('.my-dropdown').sSelect({ddMaxHeight: '100px'});

	// HOME TEXT
	$('#scroll_wrapper_home , #scroll_wrapper_default').jScrollPane();

	// OPEN CONTENT
	$('#main_content div.open a').toggle(function() {
		$('#main_content').css('z-index', '35');
		$('#main_content').animate({width: 940}, 500);
		$('#main_content .box ').css('overflow','auto').css('height','400px');
		$('#main_content div.open a span.opentxt').css('display', 'none');
		$('#main_content div.open a span.closetxt').css('display', 'block');
	}, function() {
		$('#main_content').animate({width: 420}, 500, function(){
			$('#main_content').css('z-index', '35');
		});
		$('#main_content .box ').css('overflow','hidden').css('height','460px'); 
		$('#main_content div.open a span.closetxt').css('display', 'none');
		$('#main_content div.open a span.opentxt').css('display', 'block');
	});
	
	// OPEN SLIDESHOW
	$('#slideshow_wrapper div.open a').toggle(function() {
		$('#slideshow_wrapper').css('z-index', '35');
		$('#slideshow_wrapper').animate({width: 940}, 500);
		$('#slideshow_wrapper div.open a span.opentxt').css('display', 'none');
		$('#slideshow_wrapper div.open a span.closetxt').css('display', 'block');
	}, function() {
		$('#slideshow_wrapper').animate({width: 520}, 500, function(){
			$('#slideshow_wrapper').css('z-index', '30');
		});
		$('#slideshow_wrapper div.open a span.closetxt').css('display', 'none');
		$('#slideshow_wrapper div.open a span.opentxt').css('display', 'block');
	});

	// SHOW CATEGORY ITEMS LIST
	$('#show_all_items').click(function(e){
		e.preventDefault();
		$('#show_all_items').hide();
		$('#items_list').css('height', 'auto');
		$('.scroll_wrapper').jScrollPane();
	});

	// CREDITS LINK
	$("#footer_menu li a.cat_15").click( function(e){
		e.preventDefault();
		window.open('http://www.fastbooking.com/');
	});


}); // close document.ready


// GOOGLE MAP
function initialize() {

	var locations = [
		['<div id="info_map"><h2>Hotel Delle Arti</h2>Via Bonomelli, 8 <br> Tel. +39 0372 23131 <br>fax. +39 0372 21654 <br /><br />  <a style=\'color: #FF6600; font-weight:bold; font-size:14px;\' href=\'javascript:;\' onclick=\"hhotelDispopriceFHP(\'ITCRDellearti\', \'\', \'\', \'\', \'\', \'\', \'\', \'\');\">Book Now!</a></div>', 45.133198,10.026952, 1],
		//['<h1>Residence Le Corti</h1>Via Vittoria Colonna, 32<br/>20149 Milano (Italia)', 45.46914894508222, 9.151549637317657, 2]
	];

	var map = new google.maps.Map(document.getElementById('map_canvas'), {
		zoom: 13,
		center: new google.maps.LatLng(45.133198,10.026952),
		mapTypeId: google.maps.MapTypeId.ROADMAP
	});

	var infowindow = new google.maps.InfoWindow({
		'maxWidth': 500
	});

	var marker, i;

	for (i = 0; i < locations.length; i++) {
		marker = new google.maps.Marker({
			position: new google.maps.LatLng(locations[i][1], locations[i][2]),
			map: map
		});

		google.maps.event.addListener(marker, 'click', (function(marker, i) {
			return function() {
				infowindow.setContent(locations[i][0]);
				infowindow.open(map, marker);
			}
		})(marker, i));
	};
}

$(window).load( function() {
	if($('#map_canvas').length > 0){
		initialize();
	}
}); // close window.load
