$(document).ready(function() {
	$(".labelify").labelify();
	
	$('.fulllink').click(function() {
		window.location = $(this).find('a').attr('href');
	});

	//$('#nav li.menu ul').css('display', 'none'); 

	$('#nav li.menu:not(.link)').hover(function(){
		$('ul', this).css('display', 'block');
		$(this).addClass('hover');
	},function() { 
		$('ul', this).css('display', 'none');
		$(this).removeClass('hover');
	});

	$('#nav li.link').click(function(){ 
		window.location=$(this).find('a').attr('href');
	});
			
	/* FANCY BOX */
	
	$(".fbox").fancybox({
		'titleShow'	: false
	});	

	/* GAMME -- TOGGLER */

	$('.toggler:not(.open)').next('.tog-element').hide();
	$('.toggler').click(function(){
		$('.tog-element').hide('fast');
		$(this).next('.tog-element').show('fast');
		
		$('.toggler').removeClass('open');
		$(this).addClass('open');
		
		$('.toggler').stop().animate({ 
			width: 358, 
			height: 69
		}, { duration: 'fast'});
		
		$(this).stop().animate({ 
			width: 708, 
			height: 35
		}, { duration: 'fast'});
		
		$('.tabs li').removeClass('tactive');
		$('.tabs li.first').addClass('tactive');
		$('.gamme-plan').hide();
		$('.tab0').show();
	});
	
	/* TABS */
	$('.tab0').show();
	$('.tabs li').click(function(){
		$('.tabs li').removeClass('tactive');
		$(this).addClass('tactive');
		var displayNum = $(this).index();
		$('.gamme-plan').hide();
		$('.tab'+displayNum).show();
	});

	$('.categories li:odd').css('margin-right','0');

	$('.table-sale tr:even td').css('background-color','#f9f9f9');

	/* $(".spinbox").spinbox({
		min: 1,							
		max: 100
	});
	
	$('.addlink').click(function(){
		var this_qty = parseInt($(this).closest('td').siblings('.qty:first').find('input:first').val());
		if (this_qty > 1) {
			document.location.href = $(this).attr('href') + '/' + this_qty;
			return false;
		}
	}); */

	// -------------------------------------------------- LINKS
	$('.blank').click(function() {
		window.open($(this).attr('href'));
		return false;
	});
        
	/*$('#ce').click(function() {
		window.open('/pdf/communique-marquageCE.pdf');
		return false;
	});
        
        $('#ce-flash').click(function() {
		window.open('http://staging.loxam-module.com.ovh.sectionmedia.be/pdf/communique-marquageCE.pdf');
		return false;
	});*/



	/* -------------------------------------------------- DEBUG
	$('img').each(function(){
		$(this).wrap('<span></span>');
		var html = $(this).parent().html();
		var alt = html.match( /alt=/ );
		if(alt==null) {
			$(this).css('border','2px dotted #0FF');
		} else {
			$('img[alt=""]').css('border','5px solid #0F0');
		}
	});

	$('a[target="_blank"]').css('border','2px dashed #FC0'); */

});
