/**
 * Créer un carousel.
 * 
 * @param id Identificateur du DIV contenant les images du carousel
 */   
function createCarousel(id, radius, x, y, reflect) {
    // Initialiser le carousel
    $("#" + id).CloudCarousel( { 
    	reflHeight: reflect,
    	reflGap:4,
    	titleBox: null,
    	altBox: null,
    	buttonLeft: $('#' + id + '-previous'),
    	buttonRight: $('#' + id + '-next'),
    	yRadius: radius,
    	xPos: x,
    	yPos: y,
    	speed:0.15,
    	mouseWheel:true,
    	autoRotate: 'left',
    	autoRotateDelay: 3000
    });
    
    // Montrer le carousel
    setTimeout("showCarousel('" + id + "')", 500);
}

/**
 * Montrer un carousel.
 * 
 * @param id Identificateur du DIV contenant les images du carousel
 */    
function showCarousel(id) {
    var c = document.getElementById(id);
    //alert($(c).css('height'));
    $(c).css('visibility', 'visible');
}

/**
 * Rechercher les références d'un produit.
 */ 
function rechercher() {
    var value = $('#code_produit').val();
    $.ajax({
      url: "/rpc/recherche.php",
      data: "code=" + value,
      async: true,
      type: "GET",
      success: function(data){
        $('#code_reference').html(data);
        $('#acces_produit').css('visibility', 'visible');
      }
    });    
}


/**
 * Afficher un produit résultat de la recherche.
 */ 
function acces_produit() {
    var value = $('#code_reference').val();
    if (value == '') return;
    location = value;
}
