$(document).ready(
	function() {
	    // Webkit browsers Loads CSS + scripts simultaniously, so we need to pause loading scripts a bit before loading css.
	    if (jQuery.browser.safari && document.readyState != "complete") {
	        //console.info('ready...');
	        setTimeout(arguments.callee, 100);
	        return;
	    }

	    // BEGIN : Add the fun from here...

// datepicker booking form
$("#st_datepicker").datepicker( 
	$.datepicker.regional["da"],
	"option", "dateFormat", "dd-mm-yy"
  );
    var myDate = new Date();
    var prettyDate = myDate.getDate() + '-' + (myDate.getMonth()+1) + '-' + myDate.getFullYear();
    $("#st_datepicker").val(prettyDate);

$("#periode1").datepicker(
	$.datepicker.regional["da"],
	"option", "dateFormat", "dd-mm-yy"
);
$("#periode2").datepicker(
	$.datepicker.regional["da"],
	"option", "dateFormat", "dd-mm-yy"
);


// Lighbox functionality
	    $("a.extLink").fancybox({
		'overlayShow' : true,
		'titleShow' : false,
	 	'overlayOpacity': 0.8,
	 	'hideOnContentClick': false,
	 	'width': 1000,
	 	'height': '80%'
		});
	
	     $(".popup").fancybox({
		'overlayShow' : true,
		'titleShow' : false,
	 	'overlayOpacity': 0.8,
	 	'hideOnContentClick': false,
		'type' : 'ajax'
		});

	    $("a .extLink").fancybox();

           

	    $("#buttonsearch").click(function() {
	        if ($("#textboxsearch").val() != '') {
		var query = $("#textboxsearch").val()
	            window.location = "/search.aspx?search=" + query;
	        }
	        else { $("#textboxsearch").addClass("error"); }
	    });
	    $("#textboxsearch").keyup(function(event) {
	        $("#textboxsearch").removeClass("error");
	    });

	    $("#textboxsearch").keydown(function(event) {
	        if (event.keyCode == "13")
	        { window.location = "/search.aspx?search=" + $("#textboxsearch").val(); }
	    });

	    $.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {
	        $(pager).find('li').removeClass('current').filter('li:eq(' + currSlideIndex + ')').addClass('current');
	    };

	    $('.slideshow').cycle(
        	{
		    fit: 1,
        	    fx: 'fade',
        	    speed: 1000,
        	    timeout: 3000,
	       	    before: onBefore,
        	    after: onAfter,
        	    pager: '#slideshowpager',
        	    pagerAnchorBuilder: function(idx, slide) {
        	        return '<li><a href="#"><img src="' + slide.src + '" width="75" /></a></li>';
        	    }

        	}).cycle("pause");

	    function onBefore() {
	    }
	    function onAfter(curr,next,opts) {
		var caption = 'Viser billede ' + (opts.currSlide + 1) + ' af ' + opts.slideCount;
		$('#imagecount').html(caption);
	    }


	    // blindX, blindY, blindZ, cover, curtainX, curtainY, fade, fadeZoom, growX, growY, none, scrollUp, scrollDown, scrollLeft, scrollRight, scrollHorz, scrollVert, shuffle, slideX, slideY, toss, turnUp, turnDown, turnLeft, turnRight, uncover, wipe, zoom	    

    ////$('.stselect').selectbox();

	$("#aspnetForm").validate();

	// Make main Content overflow slide with style
       // $('#slideshowpager').jScrollPane();



	    // END : ...to here

	})
;
