// Copyright year snippet
function setCopyright(element)
{
theSpan = document.getElementById(element);
var date = parseInt(theSpan.innerHTML);
var year = new Date().getFullYear();
if(year > date)
theSpan.innerHTML = year;
else
theSpan.innerHTML = date;
}

// Function to Clear intial value in a form field
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}



// Navigation animation
$(function() {
		$('a#navhome')
		.css( {backgroundPosition: "-160px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:400, easing: 'easeOutBack'})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-160px 0)"}, {duration:500, easing: 'easeOutBounce', complete:function(){
				$(this).css({backgroundPosition: "-160px 0"})
			}})
		})
		$('a#navport')
		.css( {backgroundPosition: "-160px -60px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -60px)"}, {duration:400, easing: 'easeOutBack'})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-160px -60px)"}, {duration:500, easing: 'easeOutBounce', complete:function(){
				$(this).css({backgroundPosition: "-160px -60px"})
			}})
		})
		$('a#navclie')
		.css( {backgroundPosition: "-160px -120px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -120px)"}, {duration:400, easing: 'easeOutBack'})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-160px -120px)"}, {duration:500, easing: 'easeOutBounce', complete:function(){
				$(this).css({backgroundPosition: "-160px -120px"})
			}})
		})
		$('a#navserv')
		.css( {backgroundPosition: "-160px -180px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -180px)"}, {duration:400, easing: 'easeOutBack'})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-160px -180px)"}, {duration:500, easing: 'easeOutBounce', complete:function(){
				$(this).css({backgroundPosition: "-160px -180px"})
			}})
		})
		$('a#navcult')
		.css( {backgroundPosition: "-160px -240px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -240px)"}, {duration:400, easing: 'easeOutBack'})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-160px -240px)"}, {duration:500, easing: 'easeOutBounce', complete:function(){
				$(this).css({backgroundPosition: "-160px -240px"})
			}})
		})
		$('a#navnews')
		.css( {backgroundPosition: "-160px -300px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -300px)"}, {duration:400, easing: 'easeOutBack'})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-160px -300px)"}, {duration:500, easing: 'easeOutBounce', complete:function(){
				$(this).css({backgroundPosition: "-160px -300px"})
			}})
		})
		$('a#navcont')
		.css( {backgroundPosition: "-160px -360px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -360px)"}, {duration:400, easing: 'easeOutBack'})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-160px -360px)"}, {duration:500, easing: 'easeOutBounce', complete:function(){
				$(this).css({backgroundPosition: "-160px -360px"})
			}})
		})
});

// 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;
		  });
		});
	  }
	}
  });
});

// Accordian
//$(function() {
//	$("#subnav").accordion({
//		active: false, 
//		collapsible: true,
//		alwaysOpen: false,
//		autoheight: true,
//		animated: 'bounceslide', 
//		clearStyle: false
//	});
//});


