﻿$(document).ready(function (){

    getSpecialsWidth();
    addScrollbars();
    addNavigationLastClass();
    removeToolTips();
    
});


function removeToolTips()
{
    $('#topNav [title]').each( function() {
        var $this = $(this);
        $this.data('title',$this.attr('title'));
        $this.removeAttr('title');
    });
}



function addNavigationLastClass(){
    $('.navOn4 li:last-child').addClass('lastChild');
}

function getSpecialsWidth() {

    // set the counter and the height to 0   
    var specialsWidth = 4;    
    
    $(".leadRow .leadContent").each(
        function() {
            // alert("this has a width of " + $(this).outerWidth());
            specialsWidth += $(this).outerWidth() + 4;
        }
    );
    
    $('.specials .leadRow').css("width",specialsWidth);
}


function addScrollbars() {   
    //$('#leadContainer .overlayLeft').show();
    //$('#leadContainer .overlay').show();
    
    if($('#specialsBox').length != 0)
    {
        $('#specialsBox').jScrollHorizontalPane({
            scrollbarHeight: 16,
            showArrows: true,
            arrowSize: 16,
            animateTo: true,
            resize: false,
            dragMaxWidth: 300,
            dragMinWidth: 20
        });
    }    
    
    
}

function checkIfOnState(){
    if($("#topNav .navOn2 li:has(.on)").attr("id") == undefined){
       $("#topLevel1").addClass("on");
    }
}

function changeHotelImage(myName)
{    
    var i = "#" + myName;
    var img = "#" + myName + " img";
    var el = $(i);
    var el2 = $(img);    
    $("#hotelImages a").removeClass("on");
    $(el).addClass("on");    
    var mainImg = $(el2).attr("src");
    $(".hotelInfoMainImage").attr({
    src: mainImg
    });    
}

