window.addEvent('domready', function (){

	// Window Resize for Flash
	// -----------------------
	if (window.getSize().size) {
		windowheight = window.getSize().size.y;
		windowwidth = window.getSize().size.x;
		if ($('meet-alma') != null)
			scalediv = $('meet-alma').getSize().size.y;
		newheight = windowheight - 145;

		if ($('meet-alma') != null)
			$('meet-alma').setStyle('height', (Math.round(newheight)));

		window.addEvent('resize', function(newheight){
			windowheight = window.getSize().size.y;
			windowwidth = window.getSize().size.x;
			if ($('meet-alma') != null) {
				scalediv = $('meet-alma').getSize().size.y;
				newheight = windowheight;
				$('meet-alma').setStyle('height', newheight);
			}
		});
	}

	// Reservation Drop-Down
	// ---------------------

	if($('btn-book')) {
		$('btn-book').addEvent('click', function(){
			var form = $('book-reservation');
			var content = ($('content') == null)?$('meet-alma'):$('content');
			var wrap = $('content-wrap');


			if (form.getStyle('visibility') == 'hidden') {
				form.setStyle('visibility','visible');
				if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('8.0')) == -1) {
					content.setStyle('z-index', '-1');
					if (wrap != null)
						wrap.setStyle('z-index', '-2');
				}
			}
		});
	}

	$$('#close-form a').addEvent('click', function(){
		var form = $('book-reservation');
		var content = ($('content') == null)?$('meet-alma'):$('content');
		var wrap = $('content-wrap');
		form.setStyle('visibility','hidden');
		if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('8.0')) == -1) {
			content.setStyle('z-index', '0');
			if (wrap != null)
				wrap.setStyle('z-index', '0');
		}
	});

	// Create Calendar
	// ---------------
	try {
		checkinCal = new Calendar({
			inDateCal: {
				checkin_date: 'd',
				checkin_month: 'm',
				textdatein: 'm/d/Y'
			},
			outDateCal: {
				checkout_date: 'd',
				checkout_month: 'm',
				textdateout: 'm/d/Y'
			}
		}, { direction: .5, pad: 1 });
	} catch(err) {}
});
