jQuery(function()
{
    var site = function() {
        this.navLi = $('#nav li').children('ul').hide().end();
        this.init();
    };

    site.prototype = {

        init : function() {
            this.setMenu();
        },

        // Enables the slidedown menu, and adds support for IE6

        setMenu : function() {

        $.each($('#nav li'), function() {
            if ( $(this).children('ul')[0] ) {
                $(this)
                    .append('<span />')
                    .children('span')
                        .addClass('hasChildren')
            }
        });

            this.navLi.hover(function() {
                // mouseover
                $(this).find('> ul').stop(true, true).slideDown(250);
            }, function() {
                // mouseout
                $(this).find('> ul').stop(true, true).hide(); 		});

        }

    }
    new site();

    $("#news_ul").simplyScroll({
			className: 'vert',
			horizontal: false,
			frameRate: 20,
			speed: 5
	});

    if($('#slider').length != 0)
    {
        var size_li = $('#slider').find("li").size();

        if(size_li > 7)
        {
            $('#slider').carousel('#previous', '#next');
        }
    }

    /*Border for p element - hotels*/
    $("div.hotel_right").each(function(){$(this).children('p:first').css("border-bottom","2px solid #B2ADCC");});
});

function slideSwitch() {
    var $active = $('#slideshow img.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order

    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});

function MM_openBrWindow(theURL,winName,features)
{ //v2.0
  window.open(theURL,winName,features);
}

