﻿$(document).ready(function() {
    
    
    //Hover Magic
    $("#home .items .item").hover(
      function () {
        var index = parseInt($(this).attr("rel"));
        if ($("#home .banner .banner_" + index).is(":visible") == false)
        {
            hoverBanner(index);
        }
        
        $(".image", this).css({ 'background-position' : '-2px -329px' });
      }, 
      function () {
        $(".image", this).css({ 'background-position' : '-2px 18px' });
      }
    );
    
    //Theme Menu
    $("#theme .banner_menu ul li a, #theme-location .banner_menu ul li a").hover(
      function () {
        //var index = parseInt($(this).attr("rel"));
        //if ($("#home .banner .banner_" + index).is(":visible") == false)
        //{
        //    hoverBanner(index);
        //}
        
        $(this).css({ 'background-position' : '0 -16px' });
      }, 
      function () {
        if ($(this).hasClass("current") == false)
        {
            $(this).css({ 'background-position' : '0 0' });
        }
      }
    );
    
    $("#theme-location .content .deals .hotels ul li").hover(
      function () {        
        $(".image", this).css({ 'background-position' : '0 -357px' });
      }, 
      function () {
        $(".image", this).css({ 'background-position' : '0 -10px' });
      }
    );

    
});

function hoverBanner(index)
{
    $("#home .banner img").hide();
    $("#home .banner .banner_" + index).fadeIn();
}
