$(document).ready(function(){
	// hover
	$(".opacity").hover(function(){
		$(this).fadeTo(200,0.8);
	},function(){
		$(this).fadeTo(200,1.0);
	});
	// css
	$("#nav-bg").css('opacity','0.60');
	$("#nav-bg").css('-moz-opacity','0.60');
	// fade in
	$(".hide-n-seek").fadeIn(500);
	// cycle header
	$("#main-header").cycle({
		fx:'fade',
		speed:2000,
		timeout:7000
	});
	// home mouse overs
	$(".description").each(function(){
		$(this).css('opacity', 0);
		$(this).children().css('opacity', 0);
		$(this).css('width', $(this).siblings('img').width()-12);
		$(this).parent().css('width', $(this).siblings('img').width());
		$(this).css('height', $(this).siblings('img').height()-12);
		$(this).parent().css('height', $(this).siblings('img').height());
		$(this).css('display', 'block');
	});
	$(".home-highlight").hover(function(){
		$(this).children('.description').stop().fadeTo(500, 0.9);
		$(this).children('.description').children('.description_content').stop().fadeTo(500, 1.0);
	},function(){
		$(this).children('.description').stop().fadeTo(500, 0);
		$(this).children('.description').children('.description_content').stop().fadeTo(500, 0);
	});
	$(".hl-2,.hl-7,.hl-99,.hl-111").hover(function(){
		$(this).children('h2').animate({ 'color':'#0067b1' },500);
	},function(){
		$(this).children('h2').animate({ 'color':'#000000' },500);
	});
	$(".hl-3,.hl-6").hover(function(){
		$(this).children('h2').animate({ 'color':'#42b5d5' },500);
	},function(){
		$(this).children('h2').animate({ 'color':'#000000' },500);
	});
	$(".hl-4").hover(function(){
		$(this).children('h2').animate({ 'color':'#cc092f' },500);
	},function(){
		$(this).children('h2').animate({ 'color':'#000000' },500);
	});
	$(".hl-5").hover(function(){
		$(this).children('h2').animate({ 'color':'#f8ca00' },500);
	},function(){
		$(this).children('h2').animate({ 'color':'#000000' },500);
	});
	$(".hl-8").hover(function(){
		$(this).children('h2').animate({ 'color':'#cbe86b' },500);
	},function(){
		$(this).children('h2').animate({ 'color':'#000000' },500);
	});
	// farbhotel tooltip
	$(".farbhotel").tooltip({ showURL: false });
	// social media icon hover
	$("img.social[longdesc]").hoverswap();
	// booking de
	$(".arrive-de").datepicker({
		firstDay: 1,
		showOn: 'both',
		buttonImage: '_img/ico_calendar.png',
		buttonImageOnly: true,
		dateFormat: 'dd.mm.yy',
		showButtonPanel: true,
		closeText: 'schliessen',
		prevText: '&#x3c;zur&uuml;ck',
		nextText: 'Vor&#x3e;',
		currentText: 'heute',
		monthNames: ['Januar','Februar','M&auml;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
		monthNamesShort: ['Januar','Februar','M&auml;rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],
		dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
		dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
		weekHeader: 'Wo',
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: '',
		beforeShow: function(){
			$('#main-header,#main-header *').css('z-index', 1);
			$('#ui-datepicker-div').css('z-index', 999);
		}
	});
	// booking en
	$(".arrive-en").datepicker({
		firstDay: 1,
		showOn: 'both',
		buttonImage: '_img/ico_calendar.png',
		buttonImageOnly: true,
		dateFormat: 'dd.mm.yy',
		showButtonPanel: true
	});
	// booking button
	$(".bookerbutton").click(function(){
		$('<iframe frameborder="0" scrolling="auto" src="https://sb.ghix.net/default.aspx?View=Superbooking1&Action=List&HotelID=1430672&Language='+document.bookingform.lang.value+'&PartnerID=&IsChain=&tDate='+document.bookingform.arrive.value+'&tNights='+document.bookingform.nights.value+'" />').dialog({
			title: ($(this).attr('title')) ? $(this).attr('title') : 'Seehotel Wilerbad',
			autoOpen: true,
			width: 984,
			height: 600,
			modal: true,
			resizable: false,
			autoResize: false
		}).width(984 - 15).height(600 - 30);
	});
	// fancybox
	$("a[rel*=group]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'overlayOpacity'	: 0.7,
		'overlayColor'		: '#000000',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});
$(window).load(function(){
	//alert($.maxZIndex());
	$('#ui-datepicker-div').maxZIndex();
});
$(window).resize(function(){
	$("*").dialog("option","position",$("*").dialog("option","position","center"));
});

