/**** Add application wide javascripts below this point  ******/
$(document).ready(function(){
  
  // open in new window
  // open in new window
  $('.external').click(function(){
  this.target = "_blank";
  });
  
  // City map
  $(".hotspot").hover(function(){
    $(this).css("cursor","pointer");
    var city = $(this).attr("rel");
    $("."+city).css("color","#FAFD10");
  },
  function(){
    var city = $(this).attr("rel");
    $("."+city).css("color","#E7E3FF");
  });

  $(".hotspot").click(function(){
    window.location=$(this).find("a").attr("href");
  });
  /*
  // Change bg color on tab
  $("#nav li").hover(function(){
    $(this).css("background","#29244A");
  },
  function(){
		$(this).css("background","transparent url(/images/right-tab.jpg) no-repeat scroll right top");
  });
  */
  // City Menu - show when hover over it.
  $("#nav .city-menu").hover(function(){
		$("#nav .city-menu").css("background","#29244A");
    $("#city-select").show();
  },
  function(){
  });

  // top 'visit city' menu hide when hover over options
  $("#city-select").hover(function(){
  },
  function(){
    $("#city-select").hide();
		$("#nav .city-menu").css("background","transparent url(/images/right-tab.jpg) no-repeat scroll right top");
  });
  
  // if pass over top of tab menu then hide city menu
  $(".cb").hover(function(){
  },
  function(){
    $("#city-select").hide();
		$("#nav .city-menu").css("background","transparent url(/images/right-tab.jpg) no-repeat scroll right top");
  });
  
  // when hover over wrapper hide the city menu
  $("#nav li").hover(function(){
  },
  function(){
    // if the li is not .city-menu
    if(!$(this).hasClass('city-menu')) {
      $("#city-select").hide();
  		$("#nav .city-menu").css("background","transparent url(/images/right-tab.jpg) no-repeat scroll right top");      
    }
  });

  // put titles on map
  $("#hotspots div").each(function(){
    var title = $(this).children(".detail").attr('title');
    $(this).attr('title',title);
    $(this).simpletooltip();    
  });
  
  // map hover homepage
  $("#hotspots div").hover(function(){
    var id = $(this).attr('rel');
    $("#"+id+" a").css("color","#FAFD10");
    // var title = $(this).children(".detail").attr('title');
    // $(this).attr('title',title);
    // $(this).simpletooltip();    
  },
  function(){
    var id = $(this).attr('rel');
    $("#"+id+" a").css("color","#FFFFFF");
  });

	// Superbreaks
	$("#superbreaks").click(function(){
		// get content from .superbreak-links and put in #booking-links
		$("#booking-links").html($(".superbreak-links").html());
		$("#booking-links").css("height","auto");
		$("#booking-links").css("padding-bottom","20px");
	});
	$(".superbreakslink").click(function(){
		// get content from .superbreak-links and put in #booking-links
		// alert($(".superbreak-links").css("height"));
		$("#booking-links").html($(".superbreak-links").html());
		$("#booking-links").css("height","auto");
		$("#booking-links").css("padding-bottom","20px");
		return false;
	});
	
  // // image carousel
  // $("#gallery .jCarouselLite").jCarouselLite({
  //       auto: 8000,
  //       speed: 1000,
  //       scroll: 3
  //   });
  
  /* insider ideas */
  // $("#idea1").click(function(){
  //   window.location=
  // });
	
});