//	Scroll to top: http://jsbin.com/ubila4/7/
//	Bildekarusell: http://www.zurb.com/playground/orbit-jquery-image-slider/

<!--


// Searchform
function search_submit_top() { document.forms["search_top"].submit(); }
function search_submit_bottom() { document.forms["search_bottom"].submit(); }


// Bottom 2 Top
function interpolate(source,target,pos) { return (source + (target - source) * pos); }
function easing(pos){ return (-Math.cos(pos * Math.PI) / 2) + 0.5; }
function scrollTop(duration) {
	duration  = duration || 1000;
	var startY = window.pageYOffset, start  = Number(new Date()), finish = start + duration;
	var interval = setInterval(function() {
		var now = Number(new Date()), pos = (now > finish) ? 1 : (now - start) / duration;
		scrollTo(0, interpolate(startY, 0, easing(pos)));
		if(now > finish)
			clearInterval(interval);
	}, 15);
};
var el = document.getElementById("bottom_2_top"); el.onclick = function() { scrollTop(500); };


// Bildekarusell
jQuery(window).load(function() {
	jQuery('#bilde_karusell').orbit({
		'animationSpeed' : 500,
		'advanceSpeed' : 10000,
		'directionalNav' : false,
		'bullets': true,
		'timer' : true,
		'captions' : false
	});
});


// jQuery
jQuery(document).ready(function(){

	jQuery('[title]').removeAttr('title');

	jQuery('#bottom_2_top img').hover(
		function() { jQuery(this).css('bottom', '21px'); },
		function() { jQuery(this).css('bottom', '0px'); });

	jQuery('#sidebar_samarbeidspartnere a').hover(
		function() { jQuery(this).animate({ paddingRight: "8px" }, 100 ); },
		function() { jQuery(this).animate({ paddingRight: "0px" }, 100 ); });

	jQuery('#kampanje_1').hover(
		function() { jQuery('#kampanje_1 img').fadeOut('fast'); },
		function() { jQuery('#kampanje_1 img').fadeIn('fast'); });

	jQuery('#kampanje_2').hover(
		function() { jQuery('#kampanje_2 img').fadeOut('fast'); },
		function() { jQuery('#kampanje_2 img').fadeIn('fast'); });
	
	jQuery('.representanter_info div').each(function() {
		var hThis = jQuery(this).height();
		var hParent = jQuery(this).parent().height();
		var vPosition = (hParent - hThis) / 2;
		jQuery(this).css('margin-top', vPosition);
		});

});


-->
