
$(document).ready(function(){

	$('#change_page').change(function(){window.location = $(this).attr('value');});

	$('#zoomer').draggable({ zIndex: '100', containment: 'parent', opacity: '.5', drag: function(e,ui){

			$("div#zoomdiv").get(0).scrollTop = 3*ui.position.top;

			$("div#zoomdiv").get(0).scrollLeft = 3*ui.position.left;

		}

	});

	$('.vzoom').click(function() {

		medSrc = $(this).parent().children('.m').html();

		bigSrc = $(this).parent().children('.b').html();

		$('.jqzoom').attr("src", medSrc);

		$('.bigimg').attr("src", bigSrc);

	});

	$('#tabnavwrap #tabnav li a').click(function(e){

		newtab = $(this).parents('li');

		oldtab = $('#tabnavwrap #tabnav li.act');

		newfiche = $('#fichecontent>#'+newtab.attr('rel'));

		oldfiche = $('#fichecontent>.active');

		oldtab.removeClass('act');

		if(oldtab.hasClass('act-first')){

			oldtab.removeClass('act-first').addClass('first');

			$('#fichecontent .topleft-corner').css('display','block');

		}

		if(oldtab.hasClass('act-last')){

			oldtab.removeClass('act-last').addClass('last');

		}

		newtab.addClass('act');

		if(newtab.hasClass('first')){

			newtab.removeClass('first').addClass('act-first');

			$('#fichecontent .topleft-corner').css('display','none');

		}

		if(newtab.hasClass('last')){

			newtab.removeClass('last').addClass('act-last');

		}

		oldfiche.removeClass('active').addClass('inactive');

		newfiche.removeClass('inactive').addClass('active');

		e.preventDefault();

	});

});





$(window).load(function () {

	x = 70;

	y = 70;

	$("#zoomer").css({top: y+'px', left: x+'px'});

	$("div#zoomdiv").get(0).scrollTop = 3*y;

	$("div#zoomdiv").get(0).scrollLeft = 3*x;

});
