$(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:110px;height:90px;"><h1>Hotel Tiffany</h1>Via Leonardo da Vinci, 209<br/>Trezzano sul Naviglio 20090 (MI)<br /><a href="mailto:info@hoteltiffanymilano.com">info@hoteltiffanymilano.com</a></div><br /><a href="javascript:;" onclick="hhotelDispopriceFHP(\'ITMILHTiffany\', \'\', \'\', \'\', \'\', \'\', \'\', \'\');">Book now!</a></div>', 45.418742, 9.052895, 2]
	];

	var map = new google.maps.Map(document.getElementById('map_canvas'), {
		zoom: 13,
		center: new google.maps.LatLng(45.418742,9.052895),
		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
