// JavaScript Document
Cufon.replace('.contentRightIntro', { fontFamily: 'HelveticaL' });
Cufon.replace('#bookNowBtn h3', { fontFamily: 'HelveticaT' });

function mycarousel_initCallback(carousel) { 
    $('#buttonSliderRight').click(function() {
        carousel.next();
        return false;
    });
 
    $('#buttonSlideLeft').click(function() {
        carousel.prev();
        return false;
    });
		
	if(carousel.size() > 1){
		$('#buttonSliderRight, #buttonSlideLeft').css({"display":"block"});
	}
};

function mycarousel_initCallbackRight(carousel) { 
    $('#rightGalleryNext').click(function() {
        carousel.next();
        return false;
    });
 
    $('#rightGalleryPrev').click(function() {
        carousel.prev();
        return false;
    });
		
	if(carousel.size() > 3){
		$('#rightGalleryNext, #rightGalleryPrev').css({"display":"block"});
	}
};

$(document).ready(function () {

    $("#galleryContainer").jcarousel({
        scroll: 1,
        wrap: 'both',
        auto: 5,
        animation: 600,
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });

    $("#galleryRightContainer").jcarousel({
        scroll: 3,
        vertical: true,
        wrap: 'both',
        //auto: 5,
        animation: 600,
        initCallback: mycarousel_initCallbackRight,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });

    $('#bookNowBtn').click(function () {
        $('a:first', this).trigger('click');        
    });

    $("a.fancylink").fancybox({
        'speedIn': 300,
        'speedOut': 300,
        'overlayShow': true,
        'overlayOpacity': 0.7,
        'overlayColor': '#000000',
        'padding': 2,
        'centerOnScroll': true
    });

    $("a.booking").fancybox({
        'hideOnContentClick': false,
        'overlayShow': true,
        'overlayColor': '#000',
        'overlayOpacity': 0.8,
        'width': 500,
        'height': 550
    });

    $("#mainMenu li").hover(function () {
        if ($(this).hasClass("active")) {
            $("#mainMenu .active a:first").css({ "background-color": "#edd360" });
        } else {
            $("#mainMenu .active a:first").css({ "background-color": "#ffffff" });
        }
    }, function () {
        $("#mainMenu .active a:first").css({ "background-color": "#edd360" });
    });

    if ($("#mainMenu li.active ul li").size() > 0) {
        $("#mainMenu li.active ul").show();
    }

    $("#mainMenu li a").click(function () {
        var p = $(this).parent();
        var targetList = $("ul", p);
        if (targetList.is(":hidden") && $('li', targetList).size() > 0) {
            targetList.slideDown();
        } else {
            targetList.slideUp();
        }
    });

    $("#startroutebtn").click(function () {
        window.open("http://maps.google.be/maps?f=d&source=s_d&saddr=" + $("#inputStartAdres").val() + "&daddr=Parkhotel+Roeselare&hl=" + $("#startAdresTaal").val()); 
        return false;
    });

});
