// endless header animation
function animate_header () {
  $("h1#header").show('fast');
  $("h1#header").animate({color:'#fff'},{duration:500});
  $("h1#header").animate({color:'#FF6309'},{duration:1000});
  $("h1#header").animate({color:'#ff0000'},{duration:5000});
  $("h1#header").show('fast', animate_header);
}

function load_fx () {
  $('.location-box').hover(function() {
    $(this).children('h3').css('background-color', '#ff0000');
    $(this).children('h3').css('color', '#fff');
  }, function() {
    $(this).children('h3').css('background-color', '#ccc');    
    $(this).children('h3').css('color', '#000');
  });
  
  $('h1#header').each(function(index) {
    $(this).addClass(page_name());
  });
  
  $('.facebox').facebox();
  $('a[rel*=facebox]').facebox();
}

// returns the page name without the file extension
function page_name () {
  var file = window.location.pathname;
  var file_ary = file.split(".");
  var page = file_ary[0].split("/");
  return page[page.length-1];
}

$(document).ready(function() {
  load_fx();
  animate_header();
});

