
$(document).ready(function(){
	// Make Entire Block Element Clickable
	$('.module h3').click(function(){
	  window.location=$(this).parent().find("a").attr("href"); return false;
	});
	
	// Get year
	$("#year, #printYear").text( (new Date).getFullYear() );
	
	// Background Animations
	$('#navProd')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		})
		
	/*$('#navTherm')
		.css( {backgroundPosition: "-72px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-72px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-72px 0)"}, {duration:500})
		})*/
		
		
	$('#navCase')
		.css( {backgroundPosition: "-72px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-72px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-72px 0)"}, {duration:500})
		})
		
	$('#navFaq')
		.css( {backgroundPosition: "-161px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-161px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-161px 0)"}, {duration:500})
		})
		
	/*$('#navMark')
		.css( {backgroundPosition: "-384px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-384px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-384px 0)"}, {duration:500})
		})*/
		
	$('#navAbout')
		.css( {backgroundPosition: "-213px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-213px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-213px 0)"}, {duration:500})
		})
		
		
	$('#navNews')
		.css( {backgroundPosition: "-318px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-318px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-318px 0)"}, {duration:500})
		})
		
	$('#navCont')
		.css( {backgroundPosition: "-374px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-374px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-374px 0)"}, {duration:500})
		})
		
	$('#navCareers')
		.css( {backgroundPosition: "-458px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-458px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-458px 0)"}, {duration:500})
		})
		
	$('#navLine')
		.css( {backgroundPosition: "-527px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-527px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-527px 0)"}, {duration:500})
		})
		
	$('#navQuote')
		.css( {backgroundPosition: "-603px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-603px -250px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-603px 0)"}, {duration:500})
		})
		
	$('#build')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -260px)"}, {duration:800})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		})
});

// Animated scrolling 
$(function() {
  function filterPath(string) {
  return string
	.replace(/^\//,'')
	.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
	.replace(/\/$/,'');
  }
  var locationPath = filterPath(location.pathname);
  $('a[href*=#]').each(function() {
	var thisPath = filterPath(this.pathname) || locationPath;
	if (  locationPath == thisPath
	&& (location.hostname == this.hostname || !this.hostname)
	&& this.hash.replace(/#/,'') ) {
	  var $target = $(this.hash), target = this.hash;
	  if (target) {
		var targetOffset = $target.offset().top;
		$(this).click(function(event) {
		  event.preventDefault();
		  $('html, body').animate({scrollTop: targetOffset}, 400, function() {
			location.hash = target;
		  });
		});
	  }
	}
  });
});



