// Cufon Replacement
Cufon.replace('#page-title h1, ul.tabs li a',{hover: true}, { fontFamily: 'roman' });

Cufon.replace('.block h2, .content-block h2, h2.page-title, .twitter-link',{hover: true}, { fontFamily: 'book' });

Cufon.replace('#nav-content h2, #home-tabs h2', { fontFamily: 'light' });

// jQuery Features
$(document).ready(function() {
  
  // Variables
  
  // Set up backgrounds
  var aboutBg = "/images/banners/Invensys_background_01.jpg";
  var oppBg = "/images/banners/Invensys_background_02.jpg";
  var railBg = "images/banners/Invensys_background_03.jpg";
  var controlBg = "/images/banners/Invensys_background_04.jpg";
  
  
  // Style Forms
  $(function() {
      $("form.jqtransform").jqTransform();
  });
  
  // Home Page Tabs
  	$(".tab_content").hide(); //Hide all content
  	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
  	$(".tab_content:first").show(); //Show first tab content

  	//On Click Event
  	$("ul.tabs li").click(function() {

  		$("ul.tabs li").removeClass("active"); //Remove any "active" class
  		$(this).addClass("active"); //Add "active" class to selected tab
  		$(".tab_content").hide(); //Hide all tab content

  		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
  		$(activeTab).fadeIn(); //Fade in the active ID content
  		
  		// Background Image changes
  		
  		if ($(this).find("a").attr('href') == "#tab1") {
        $("body").css("background", "url(" + aboutBg + ") no-repeat center top");  	
      } else if ($(this).find("a").attr('href') == "#tab2") {
        $("body").css("background", "url(" + oppBg + ") no-repeat center top");  	
      } else if ($(this).find("a").attr('href') == "#tab3") {
        $("body").css("background", "url(" + railBg + ") no-repeat center top");  	
      } else if ($(this).find("a").attr('href') == "#tab4") {
        $("body").css("background", "url(" + controlBg + ") no-repeat center top");  	
      };

  		return false;
  	});
    
});

