/**
 * La Piazzetta Sorrento
 * Endesia
 */
$(function(){
	$('a.new').click(function(){
		window.open($(this).attr('href'));
		return false;
	});
	$('#quickbooking').attr("target", "_blank");
	$(".datepicker").datepicker({
		showOn: 'both',
		buttonImage: '/images/layout/calendar.gif',
		buttonImageOnly: true
	});
	$('a.fancybox').fancybox({
		zoomSpeedIn: 500,
		zoomSpeedOut: 500,
		width: 640,
		height: 480,
		transitionIn	: 'elastic',
		transitionOut	: 'elastic',
		onStart: function(){
			$('#anim2').hide();		
		},
		onClosed: function(){
			$('#anim2').show();
		}
	});
	/*
	if (swfobject.hasFlashPlayerVersion("9.0.18")) {
		swfobject.embedSWF("/images/layout/home-animation.swf", "anim", "650", "200", "9.0.18", "/images/expressInstall.swf", null, null, null, function(){$('#anim').addClass('loaded');});
		swfobject.embedSWF("/images/layout/reservation-animation.swf", "anim2", "650", "200", "9.0.18", "/images/expressInstall.swf", null, null, null, function(){$('#anim').addClass('loaded');});
		swfobject.embedSWF("/images/layout/rooms-animation.swf", "anim3", "650", "200", "9.0.18", "/images/expressInstall.swf", null, null, null, function(){$('#anim').addClass('loaded');});
	}
	*/	
	$('#slider').coinslider({
		width: 928,
		height: 235,
		delay: 7500,
		navigation: false,
		links : false, 
		hoverPause: false
	});
	
	if($("#apartmentsGallery").length>0){
		$("#apartmentsGallery").myGallery({perPage:4,thumbMargin:1,thumbWidth:127,thumbHeight:93});
		//$("#apartmentsGallery div.wrapper").find("img").reflect({height: 0.3, opacity: 0.3});
	}
	
	var quickbooking = $('#quickbooking');	
	if(quickbooking.length>0){
		var date = $.datepicker.formatDate('dd/mm/yy', new Date());
		var datepicker = $('<input type="text" class="date" name="ArrivalDate" />').val(date).datepicker({
			dateFormat: 'dd/mm/yy'
		});
		quickbooking.find('.days').parent().append(datepicker);
		quickbooking.find('.days, .month').remove();
	}
	
});
