
var GetFileName = function(str){
	var regexp = /(\w|[-.])+$/;
	return regexp.exec(str);
}

var mycarousel_itemList = new Array();


function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));	
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
	carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
	return '<img src="' + item.url + '" width="150" height="150" alt="' + item.title + '" />';
};



$(document).ready(function(){
						   
	$("#coverFlow img").each(function(){
		mycarousel_itemList.push({url: $(this).attr('src'), title: $(this).attr('alt')});						
									
	});
	
	$("#coverFlow").jcarousel({
		scroll: 1,
        wrap: 'circular',
		itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
		itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}

	});
	
	
	
});














