$(function() {
	$('a.loupe').hover(function() {
		$(this).parent().find('img.chaussette_depliee').css('display','block');
		$(this).parent().find('a.chaussette_pliee img').css('visibility','hidden');
	}, function() {
		$(this).parent().find('img.chaussette_depliee').css('display','none');
		$(this).parent().find('a.chaussette_pliee img').css('visibility','visible');
	});
	$('a.loupe').click(function() { return false; });
	
	$('#cho7_gratos img.quasi_invisible').css('opacity', '0.2');
	//$('#please_share_here').html($('#share_boxes').html());
	//$('#share_boxes').html('');
	
	$('div#productscategory_list ul li a').attr('title', '');
	$('div#productscategory_list ul li').hover(function() {
		$(this).find('.meme_cat_titre').css('display', 'block');
	}, function() {
		$(this).find('.meme_cat_titre').css('display', 'none');
	});

	// roundèd corneurz:
	$('div.ajouter_une_chaussette_trop_geniale a.add_to_cart').css({
		WebkitBorderBottomLeftRadius: 2,
		WebkitBorderBottomRightRadius: 2,
		MozBorderRadius: '0 0 2px 2px',
		BorderBottomRightRadius: 2,
		BorderBottomLeftRadius: 2});
	$('ul#product_list span.price').css({
		WebkitBorderRadius: 2,
		MozBorderRadius: '2px',
		BorderRadius: 2});
	$('ul#mainmenu li a').css({
		WebkitBorderRadius: 6,
		MozBorderRadius: '6px',
		BorderRadius: 6});

	function franco(){
				// calcul du franco
				var qte = $(".archi_price").html();
				
        //var qte = parseInt($(".ajax_cart_quantity").html());
        franco = parseInt(36 - qte);		
				if (franco < 1) { 
					$(".franco").addClass("franco_vert");
					$(".franco").removeClass("franco_rouge");
					franco_ok = $(".franco_ok").html();
					$(".franco").html(franco_ok);
				} else {
					
					$(".franco").addClass("franco_rouge");
					$(".franco").removeClass("franco_vert");
					
				}
				qte = $(".reste_franco").html(franco);
				$("#franco").show();
	}
	
	franco();

	// easter egg!! easter egg!!!
	if ( window.addEventListener ) {
		var kkeys = [], archiEGG = "38,38,40,40,37,39,37,39,66,65";
		window.addEventListener("keydown", function(e){
			kkeys.push( e.keyCode );
			if ( kkeys.toString().indexOf(archiEGG) >= 0 )
				window.location = "http://www.axome.com";
		}, true);
	}


	if( $('body#product p#add_to_cart a#go').length ) {
		/*var bgcoul = $('body#product p#add_to_cart a#go').css('background-color');
		var parts = bgcoul.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
		delete (parts[0]);
		for (var i = 1; i <= 3; i++) {
			parts[i] = parseInt(parseInt(parts[i])/1.2).toString(16);
			if (parts[i].length == 1) parts[i] = '0' + parts[i];
		}
		var achete_ma_chaussette_steupl = '#'+parts.join('');
		
		$('span#our_price_display').css('background-color', achete_ma_chaussette_steupl);*/
		$('body#product p#add_to_cart a#go').css('opacity', '0.7');
	}
	
	
	$('body#product p#add_to_cart a#go').hover(function() {
		//$(this).css('background-color', achete_ma_chaussette_steupl);
		$('body#product p#add_to_cart a#go').css('opacity', '1');
		
	}, function() {
		//$(this).css('background-color', bgcoul);
		$('body#product p#add_to_cart a#go').css('opacity', '0.7');
	});
	
	
	
	//pour les mini-pages, avoir le footer tout en bas c'est cool.
	var t = 191;
	var h = $(window).height();
	var d = t+$('div#gros_gros_footer').position().top;
	if( d<h ) {
		//$('div#gros_gros_footer').css('height', t+(h-d)+'px');
		//$('div#center_column').css('min-height', t+(h-d)+'px');
		var newheight = parseInt($('div#center_column').css('height').replace('px', ''))+(h-d)-30;
		$('div#center_column').css('height', newheight+'px');
	}
	
});

function go(bout){
	//alert(bout);
	$(bout).click();
}




$(window).bind("load", function() {
	$("div#mygalone").slideView({
		easeFunc: "easeInOutBack", 
		easeTime: 1200 
	});
}); 

 

