var i = 0;
var imgArray = new Array();
var idArray = new Array();

$(document).ready(function () {
    $("#resorts .resort a").each(function() {
      id_b = $(this).attr('href');
      if($(id_b).css("display") == 'block') {
        $(id_b).hide();
      }
    });
    
    $("#resorts .resort a").each(function() {
        var id = $(this).attr('href');
        
        if(!$(this).hasClass('default')) {
          $(id).hide(); 
        }
        
        $(this).mouseover(changeRegions);
        
        $(this).click(changeRegions);

        
    });
});

function slideShow(imgs, ids) {
	imgArray = imgs;
	idArray = ids;
	changeHomepage();
}

function changeHomepage() {
	$("#home-content-wrapper").fadeTo("slow",0.1,function() {
		$(".home-content").hide();
		$("#home-content-wrapper").css("background-image","url(" + imgArray[i] + ")");
		$("#" + idArray[i]).show();
		$("#home-content-wrapper").fadeTo("slow",1);
		i++;
		if(i>=imgArray.length) i = 0;
		setTimeout("changeHomepage()",6000);
	});
	
}

function changeRegions() {
  id = $(this).attr('href');
  if($(id).css("display")=='none') {
    $("#resorts .resort a").each(function() {
      id_b = $(this).attr('href');
      if($(id_b).css("display") == 'block') {
        $(id_b).hide();
      }
    });
    $(id).fadeIn("slow");
    $("div.panel").css("height",$(id).innerHeight());
  }
  return false;
}
