$(document).ready(function() {
    $("a[rel=gallery_item_box]").fancybox({
        'titleShow'		: false,
        'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
    }
    });
 });
/*$(document).ready(function(){
    var speedgallerySlide = 200;
    var maxItemsView = 5;
    var iDhideItem = 0;
    // ON CLICK direction
    $('.gallery_direction').click( function() {
        var direction = $(this).attr('alt');
        var next;
        //if right
        if(direction == 'next') {
            if($('.gallery_item:visible').length > maxItemsView) {
                //hide the first element wich is display
                var showNext = $('.gallery_item:visible:first');
                iDhideItem = showNext.attr('id').split('item_')[1];
                //hide item
                showNext.hide(speedgallerySlide);
				//show the new image
				changeImageBig(iDhideItem);
            }
        }else {
			$('#gallery_item_'+iDhideItem).show(speedgallerySlide);
			if(iDhideItem > 0) iDhideItem--;
			changeImageBig(iDhideItem);
        }
    });
	//click accessories
	$('.gallery_item a').click( function(){
	//show the big image
		var src = '/uploads/images/product/gallery/'+$(this).attr('class');
        alert(src);
		$('#cybook_gallery_imageBig').attr('src', src);
	});
    // hover accessories
    $('.gallery_item a').hover( function(){
		//change position of select
		var pos = $(this).offset();
		$('.gallery_item_information').css('left', pos.left+125);
		$('.gallery_item_information').css('display', 'block');
    });
    //hide information on out gallery_items_list_middle
    $('#gallery_items_list_middle').hover(function(){}, function() {
        $('.gallery_item_information').css('display', 'none');
    });
	
	function changeImageBig(iDhideItem) {
		//show the new image
		var posCenter = parseInt(iDhideItem);
		if(posCenter == 0) posCenter = $('.gallery_item:first').attr('id').split('item_')[1];
		var newSelect = $('#gallery_item_'+(posCenter)).next().next().next();
		var newSrc = '/uploads/images/product/gallery/'+newSelect.children('a').attr('class');
        alert(newSrc);
		$('#cybook_gallery_imageBig').attr('src', newSrc);
	}
});
*/
