
/*********************************************************************************************************/
		/*****************************carousel des actualités****************************************/
/*********************************************************************************************************/
function initActualites()
{	
	jQuery('#actualites').jcarousel({       		
		itemLoadCallback: actualites_itemLoadCallback,
		scroll: 1
    });	
}
function actualites_itemLoadCallback(carousel, state)
{	
    // Check if the requested items already exist
    if (carousel.has(carousel.first, carousel.last)) 
	{
        return;
    }

	//var id_product = $('#id_product').val();
    jQuery.get(
        'carousel_actualites.php',
        {				
            first: carousel.first,
            last: carousel.last
        },
        function(xml) {
            actualites_itemAddCallback(carousel, carousel.first, carousel.last, xml);
        },
        'xml'
    );
};

function actualites_itemAddCallback(carousel, first, last, xml)
{    
	// Set the size of the carousel
    carousel.size(parseInt(jQuery('total', xml).text()));

    jQuery('actualite', xml).each(function(i){			
		date 	= jQuery('date',this).text();
		titre   = jQuery('titre', this).text();		
		intro   = jQuery('intro', this).text();		
		carousel.add(first + i, actualites_getItemHTML(date,titre,intro));       
    });	
};
//Item html creation helper.
function actualites_getItemHTML(date,titre,intro)
{   	
	txt   = '<table border=0 width="100%"><tr><td width="19" rowspan="2"> width="19" height="10" /></td>';
	txt  += '<td class="date" valign="top" align="center">'+date+'</td>';
	txt  += '<td width="90" class="txtActu" nowrap>'+titre+'</td>';
	txt  += '</tr>';
	txt  +='<tr><td colspan="3">'+intro+'</td></tr>';
	txt  +='</table>';
	
	return txt;
};
