
function customRange(input) {
    var min = new Date();
    return {
        minDate: ((input.id == "cphFullPage_txtArrivalDate") ? min : (input.id == "cphFullPage_txtDepDate" ? jq("#cphFullPage_txtArrivalDate").datepicker("getDate") : null)),
        maxDate: (input.id == "cphFullPage_txtArrivalDate" ? jq("#cphFullPage_txtDepDate").datepicker("getDate") : null)
    };
}


var jq = jQuery.noConflict();

jq(document).ready(function() {

    

    jq('#cphFullPage_txtArrivalDate, #cphFullPage_txtDepDate').datepicker(
            {
                showOn: "focus",
                beforeShow: customRange,
                dateFormat: "dd M yy",
                firstDay: 1,
                changeFirstDay: false
            });
    jq('#CalButton').click(function() {
        jq('.CalendarTextb').datepicker("show");
    });

    jq('#CalButton2').click(function() {
        jq('.CalendarTextb2').datepicker("show");
    });
    jq("#cphFullPage_ImageButton1").hover(function() {
        jq(this).attr("src", "/images/btBookOnlineon.png");
    }, function() {
        jq(this).attr("src", "/images/btBookOnline.png");
    });



    var config = {
        over: OpenMenu, // function = onMouseOver callback (REQUIRED)    
        timeout: 500, // number = milliseconds delay before onMouseOut    
        out: CloseMenu // function = onMouseOut callback (REQUIRED)    
    };

    function OpenMenu() {
        jq(this).children('ul').slideDown();
    }

    function CloseMenu() {
        jq(this).children('ul').slideUp();
    }

    jq(".mainMenu li").hoverIntent(config);


    jq.fn.preload = function() {
        this.each(function() {
            jq('<img/>')[0].src = this;
        });
    }
    jq(['/images/btroomssuitesoff.png', '/images/btDolmenExperinceon.png', '/images/bthomeon.png', '/images/btlocatinon.png', '/images/btmeetingson.png', '/images/btaboutuson.png', '/images/btmultimediaon.png', '/images/btcntacton.png', '/images/btExperienceItON.png', '/images/arrowNewsLeftOn.jpg', '/images/arrowNewsrightOn.jpg', '/images/arrowLeftBannerHomeON.png', '/images/arrowRightBannerHome.png', '/images/btBookOnlineon.png']).preload();

    
       


    jq(".TopMenuLink").hover(
                     function() {
                         var imgsrc = jq(this).children("img").attr('src').replace("off", "on");
                         jq(this).children("img").attr("src", imgsrc);
                     },
                     function() {
                         var imgsrc = jq(this).children("img").attr('src').replace("on", "off");
                         jq(this).children("img").attr("src", imgsrc);
                     }
            );


    jq("#drpRooms").hover(
                function() {
                    var image = document.getElementById('roomImage');
                    image.src = image.src.replace("off", "on");
                },
                function() {
                    if (jq('#roomImage').parent('a').hasClass('TopMenuLink')) {
                        var image = document.getElementById('roomImage');
                        image.src = image.src.replace("on", "off");
                    }
                });

    jq("#drpExp").hover(
                function() {
                    var image = document.getElementById('exImage');
                    image.src = image.src.replace("off", "on");
                },
                function() {
                    if (jq('#exImage').parent('a').hasClass('TopMenuLink')) {
                        var image = document.getElementById('exImage');
                        image.src = image.src.replace("on", "off");
                    }

                });
    jq("#drpLoc").hover(
                function() {
                    var image = document.getElementById('locImage');
                    image.src = image.src.replace("off", "on");
                },
                function() {
                    if (jq('#locImage').parent('a').hasClass('TopMenuLink')) {
                        var image = document.getElementById('locImage');
                        image.src = image.src.replace("on", "off");
                    }
                });

    jq('ul.mnexp li').hover(function() {
        jq(this).css('background-image', 'url(/images/bgdropdownDolmenExperienceOn.png)');
    }, function() {
        jq(this).css('background-image', 'url(/images/bgdropdownDolmenExperience.png)');
    });
    jq('ul.mnrooms li').hover(function() {
        jq(this).css('background-image', 'url(/images/bgdropdownRoomsON.png)');
    }, function() {
        jq(this).css('background-image', 'url(/images/bgdropdownRooms.png)');
    });
    jq('ul.mnloc li').hover(function() {
        jq(this).css('background-image', 'url(/images/bgdropdownLocationsON.png)');
    }, function() {
        jq(this).css('background-image', 'url(/images/bgdropdownLocations.png)');
    });

    jq("#nleftbtn").hover(function() {
        jq(this).attr("src", "/images/arrowNewsLeftOn.jpg");
    }, function() {
        jq(this).attr("src", "/images/arrowNewsLeft.jpg");
    });

    jq("#bookonline").hover(function() {
        jq(this).attr("src", "/images/btBookOnlineon.png");
    }, function() {
        jq(this).attr("src", "/images/btBookOnline.png");
    });

    jq("#nrightbtn").hover(function() {
        jq(this).attr("src", "/images/arrowNewsrightOn.jpg");
    }, function() {
        jq(this).attr("src", "/images/arrowNewsright.jpg");
    });

    jq(".lbb").hover(function() {
        jq(this).attr("src", "/images/arrowLeftBannerHomeON.png");
    }, function() {
        jq(this).attr("src", "/images/arrowLeftBannerHome.png");
    });

    jq(".experienceitbutton").hover(function() {
        jq(this).children('img').attr("src", "/images/btexperienceiton.png");
    }, function() {
        jq(this).children('img').attr("src", "/images/btexperienceit.png");
    });

    jq(".rbb").hover(function() {
        jq(this).attr("src", "/images/arrowRightBannerHomeOn.png");
    }, function() {
        jq(this).attr("src", "/images/arrowRightBannerHome.png");
    });


});

jq(window).load(function() {
    jq('#holder').show();
    jq('#bannerouter').cycle({
        fx: 'fade',
        timeout: 8000,
        slideResize: 0,
        pause: 1,
        speed: 3000,
        before: onBannerBefore,
        after: onBannerAfter,
        prev: '.lbb',
        next: '.rbb'
    });
    jq('#newsRotating').cycle({
        fx: 'scrollLeft',
        timeout: 8000,
        speed: 1500,
        pause: 1,
        prev: '#nleftbtn',
        next: '#nrightbtn',
        pager: '#newsRotating-paginate',
        pagerAnchorBuilder: function(index, el) {
            return '<a href="#"> </a>'; // whatever markup you want
        }
    });
    function onBannerBefore() {
        jq('.homebanPanel').hide();
    };
    function onBannerAfter() {
        jq('.homebanPanel').fadeIn();
    };
});

