// Pour Carousel produits crois�s
function mycarousel_initCallback(carousel)
{
		glob_carousel = carousel;
	
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});

	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});				    
};

jQuery(document).ready(function() {
	jQuery('.panel2').hide();
	jQuery('.product_cross_title').addClass('hover');
	jQuery('#mycarousel').jcarousel({
		auto: 2,
		wrap: 'last',
		scroll: 1,
		initCallback: mycarousel_initCallback
	});
	jQuery('.product_cross_title').click(function(){
		jQuery(this).addClass('hover');
		jQuery('.product_cross_title2').removeClass('hover');
		jQuery('.panel2').hide();
		jQuery('.panel1').show();
	});
	jQuery('.product_cross_title2').click(function(){
		jQuery('.product_cross_title2').addClass('hover');
		jQuery('.product_cross_title').removeClass('hover');
		jQuery('.panel1').hide();
		jQuery('.panel2').show();
	});
});

function showInformation( idInformation ) {
	$('#information_content_1').hide( );
	$('#information_content_2').hide( );
	$('#information_content_3').hide( );
	
	$('#informationLink_1').removeClass( 'title' );
	$('#informationLink_2').removeClass( 'title' );
	$('#informationLink_3').removeClass( 'title' );
	$('#informationLink_1').addClass( 'title2' );
	$('#informationLink_2').addClass( 'title2' );
	$('#informationLink_3').addClass( 'title2' );
	
	$('#informationLink_' + idInformation).removeClass( 'title2' );
	$('#informationLink_' + idInformation).addClass( 'title' );
	$('#information_content_' + idInformation).show( );
	return false;
}

/*function ajouterAuPanier( ) {
	retour = checkQuantity() ;
	if(retour == 1) {
		return false ;
	}else{
		document.cart_quantity.submit();
	}
}*/

function loadAjax(received) {
	aReceived = received.split('#') ;
	writeDiv('productColor', aReceived[0]) ;									
	writeDiv('productTaille', aReceived[1]) ;	
	writeDiv('productQuantity', aReceived[2]) ;	

}
	
function checkQuantity() {
	retour = 0 ;
	if(document.getElementById('quantity').value == 0) {
		alert('Merci de choisir la quantit�.');
		retour = 1 ;
	}
	return retour ;
}

var loadNewPhoto = function( fullsizePhotoFilename, idMini ) {	
	if( $( '#image_principale' ) ) {
		var img = $('#image_principale');
		//alert( fullsizePhotoFilename );
		img.attr( "src", $( '#imgMiniSrc_' + idMini ).val( ) );
	}
}		
