// JavaScript Document


function toTop(){
	var dest = $("body").offset().top;
	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: dest}, 1000 );
}

function navi(url) {
	document.location=url;
}

function slideshow() {
	var $active = $('#headImages IMG.active');

	if ( $active.length == 0 ) $active = $('#headImages IMG:last');

	var $next =  $active.next().length ? $active.next()
		: $('#headImages IMG:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active');
		});
}

$(document).ready(function(){
	$("a[rel='newtab']").click(function(){
		window.open(this.href);
		return false;
	});
	
	$(".slider").each(function(i,e){	
		var next = $(e).next('.next');
		var prev = $(e).prev('.prev');
		$(e).jCarouselLite({
			btnNext: next,
			btnPrev: prev,
			visible: 5,
			auto: 5000,
			speed: 1000
		});
	});
	
	$("a.fancy").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'titlePosition' :	'over'
	});
	
//	setInterval( "slideshow()", 5000 );

});

function addFav() {
  if(document.all) {
    window.external.AddFavorite(location.href,document.title)
  } else {
    if(window.sidebar) {
      window.sidebar.addPanel(document.title,location.href,'');
    }
  }
}

function createBanner(id,url,src,w,h){
	$(id).html('<a href="'+url+'" rel="newtab"><img width="'+w+'" height="'+h+'" src="'+src+'" alt="" /></a>');
}
/*
//analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17739797-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
*/
