$(document).ready(function () {

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

	// SLIDESHOW
	if($('#slideshow').length > 0){
		$('#slideshow').cycle();
	};

	// GALLERY
	$('a[rel=group]').fancybox({
		'titlePosition' : 'inside'
	});

	// BOOKING FORM - IATA CODE - remove label over input
	$('#bf span#txt_accesscode').click(function(){
		$('#bf span#txt_accesscode').hide();
	});

	// CREDITS LINK - redirect to external page
	$("#footer_menu li a.cat_13").click( function(e){
		e.preventDefault();
		window.open('http://www.fastbooking.net/');
	});

}); // close document.ready


// GOOGLE MAP
function initialize() {

	var locations = [
		['<div style="width:130px;height:100px;"><h2>Residence Donatello</h2>Via Donatello 12<br/>20131 Milano<br />tel: +39 02.29528880<br /><a href="mailto:info@residencedonatello.com">info@residencedonatello.com</a></div><br /><center><a href="javascript:;" onclick="hhotelDispopriceFHP(\'ITMILHTLResDonatello\', \'\', \'\', \'\', \'\', \'\', \'\', \'\');">Book now!</a></div>', 45.480206, 9.218537, 2] 
	];

	var map = new google.maps.Map(document.getElementById('map_canvas'), {
		zoom: 14,
		center: new google.maps.LatLng(45.486291, 9.21778),
		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
		});
		
		infowindow.setContent(locations[i][0]);
		infowindow.open(map,marker);
		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
