var selected = "";

$(function(){
	// New Windows
	$("a[rel=external]").attr("target", "_blank");

	// Hide lang if mouse drops down too low
	$(document).mousemove(function(e){
		if(e.pageY > 200)
		{
			$('#lang_tip').hide('fast');
		}
	});

	// Carousel
	if ($('.scroll').length > 0) {
		$('.scroll').jCarouselLite({
			auto: 4000,
		    speed: 500,
			btnNext: ".next",
			btnPrev: ".prev",
			visible: 1,
			
			initCallback: carousel_initCallback

		});
	}
	//products-view scroller
	if ($('.videoscroll').length > 0) {
		$('.videoscroll').jCarouselLite({
			speed: 500,
			btnNext: ".videonext",
			btnPrev: ".videoprev",
			visible: 3.5
		});
	}
});

function carousel_initCallback(carousel)
{

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function lpos(l)
{
	if(l !== selected)
	{
		selected = l;

		var position = $("#lang_" + l).offset();

		$("#lang_tip").animate({
			"left": position.left - 5
		}, 100);

		if(l == "nl")
			$("#lang_tip").html("dutch");
		else if(l == "de" || l == "ch")
			$("#lang_tip").html("german");
		else
			$("#lang_tip").html("english");
	}

	$("#lang_tip").show("fast");
}
