
		 Cufon.now();

$(document).ready(function() {

	// TOP SLIDER
	$(".paging").show();
	$("#image_reel a").each(function(i){
		$('.paging').append('<a href="#"></a>');
	});
	$(".paging a").each(function(i){
			i = i+1;
			$(this).attr('rel',+ i + '');
	});
	$(".paging a:first").addClass("active");
	
	var imageWidth = $(".window").width();
	var imageSum = $("#image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;
	
	$("#image_reel").css({'width' : imageReelWidth});
	
	rotate = function(){
    	var triggerID = $active.attr("rel") - 1;
    	var image_reelPosition = triggerID * imageWidth;

    	$(".paging a").removeClass('active');
    	$active.addClass('active');

    	$("#image_reel").animate({
			left: -image_reelPosition
		}, 500 );
	}; 
//Rotation
	rotateSwitch = function(){
    	play = setInterval(function(){
       		$active = $('.paging a.active').next();
        	if ( $active.length === 0) {
        	    $active = $('.paging a:first');
        	}
        	rotate();
    	}, 7000);
	};

	rotateSwitch();

	//On Hover
	$("#image_reel a").hover(function() {
    	clearInterval(play);
		}, function() {
    		rotateSwitch();
	});	

	//On Click
	$(".paging a").click(function() {
    	$active = $(this);
    	clearInterval(play);
    	rotate();
    	rotateSwitch();
    	return false;
	});
	
});

//cufon fonts
	Cufon.replace('#top-menu .fontmenu', { fontFamily: 'sys', hover: true });
	Cufon.replace('.font', { fontFamily: 'helvetica', hover: true});
		Cufon.replace('.overskrift', { fontFamily: 'sys', hover: true });
	



