//this function includes all necessary js files for the application
function include(file)
{

  var script  = document.createElement('script');
  script.src  = file;
  script.type = 'text/javascript';
  script.defer = true;

  document.getElementsByTagName('head').item(0).appendChild(script);

}

/* include any js files here */
 
// include('http://www.crowninn.nl/scripts/jquery.cycle.all.min.js');
// include('http://www.crowninn.nl/scripts/jquery.easing.1.3.js');
// include('http://www.crowninn.nl/scripts/jquery-ui-1.8.1.custom.min.js');
// include('http://www.crowninn.nl/scripts/cufon-yui-s.js');
// include('http://www.crowninn.nl/scripts/century-gothic.js');



function init ()
{

	
		// jQuery.noConflict();
	
		jQuery(".js #featured, .js div#tabbed").css("display","block");

		var $featured_content = jQuery('#featured_content'),
			$tabbed_area = jQuery('div#tabbed'),
			$controllers = jQuery('div#controllers'),
			$comments = jQuery('ol.commentlist');
			
		var $header_photos = jQuery('.header-photo');

		jQuery.easing.def = "easeInBack";
		
		if ($featured_content.length) {
			$featured_content.cycle({
				timeout: 0				,
				speed: 500,
				cleartypeNoBg: true,
				prev:   'a#left_arrow', 
				next:   'a#right_arrow',
				pager:  'div#controllers',
				speedOut: 500,
				fx: 'scrollHorz'
			});
			
		};
		
		$header_photos.cycle({
				timeout: 7500,
				speed: 4000,
				fx: 'fade'
			});
			
			
		$.datepicker.setDefaults($.datepicker.regional['']);

		$("#datepicker" ).datepicker({
			showOn: 'both',
			buttonImage: '/images/calendar-btn.png', 
			buttonImageOnly: true,
			constrainInput: true,
			onClose: function(dateText, inst) { showalert(dateText); },
 			showAnim: ''
		});

		
// Button availability

$('#resbutton').attr("href", "https://gc.synxis.com/rez.aspx?Hotel=11153");


$('#resbutton').click(function() {
 
 // window.open("http://www.google.com/");
 
 
 var arrival = $('#datepicker').val();
 var nights = $('#nightsstay').val();
 var promo = $('#promocode').val();
 var language = $('#formlanguage').val();

 if(language=="nl") { language = "nl-NL"; }
 if(language=="en") { language = "en-GB"; }

 var text_for_substitute = 'https://gc.synxis.com/rez.aspx?Hotel=11153&Chain=5265&shell=newsite&locale='+language+'&promo='+promo+'&nights='+nights+'&arrive='+arrival+'&adult=1&child=0&step=2';

 $('#resbutton').attr("href", text_for_substitute);



});
	
}


function showalert(dates)
{
	
	// function(dateText, inst) { ... }
}

