/*
// Configuration related to overlay
overlayBgColor: 		'#000',		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
overlayOpacity:			0.8,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9

// Configuration related to navigation
fixedNavigation:		false,		// (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.

// Configuration related to images
imageLoading:			'images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
imageBtnPrev:			'images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
imageBtnNext:			'images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
imageBtnClose:			'images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
imageBlank:				'images/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)

// Configuration related to container image box
containerBorderSize:	10,			// (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
containerResizeSpeed:	400,		// (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.

// Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts.
txtImage:				'Image',	// (string) Specify text "Image"
txtOf:					'of',		// (string) Specify text "of"

// Configuration related to keyboard navigation
keyToClose:				'c',		// (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to.
keyToPrev:				'p',		// (string) (p = previous) Letter to show the previous image
keyToNext:				'n',		// (string) (n = next) Letter to show the next image.

// Don�t alter these variables in any way
imageArray:				[],
activeImage:			0
*/
$(document).ready(function() {

//    $('a.picture').livequery(function(event) {
//        $('a.picture').lightBox({
    $('a.picture').livequery(function(event) {
        $(this).lightBox({
            fixedNavigation: false,
            txtImage:   '',
            txtOf:  '/',
            imageLoading: '/images/lightbox/lightbox-ico-loading.gif',
            imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif',
            imageBtnNext: '/images/lightbox/lightbox-btn-next.gif',
            imageBtnClose: '/images/lightbox/lightbox-btn-close.gif',
            imageBlank: '/images/lightbox/lightbox-blank.gif'
        });
        return false;
    });

    $('a.picture_one').livequery(function(event) {
        $('a.picture_one').lightBox({
            fixedNavigation: false,
            txtImage:   '',
            txtOf:  '/',
            imageLoading: '/images/lightbox/lightbox-ico-loading.gif',
            imageBtnPrev: '/images/lightbox/lightbox-btn-prev.gif',
            imageBtnNext: '/images/lightbox/lightbox-btn-next.gif',
            imageBtnClose: '/images/lightbox/lightbox-btn-close.gif',
            imageBlank: '/images/lightbox/lightbox-blank.gif',
            activeImage: 1
        });
        return false;
    });

    $('.one_picture_product').click(function() {
        var path  = $(this).children('img').attr('src');
        path = path.replace('min/', 'max/');
        $('#main_picture_gallery a').children('img').attr('src', path);
        
        path = path.replace('thumbnails/max/', 'pictures/');
        var title =  $(this).children('img').attr('title');
        $('#main_picture_gallery a').attr('href', path);
        $('#main_picture_gallery a').attr('title', title);
    });
    
    $('#right_pictures, #left_pictures').click(function() {

        var img = jQuery('.one_picture_product');
        var iCnt = jQuery(img).length;
        if(iCnt > 3)
        {
            $('#pictures_gallery_product').scrollTo($(this).attr('href'), 800);

            var pic = $(this).attr('href');
            var tab = pic.split("-");
            var l = parseInt(tab[1]) - 3;
            var r = parseInt(tab[1]) + 3;
            var left = '#picture_one-' + l
            var right = '#picture_one-' + r;
            var f = false;
            if(l >= 0) {
                jQuery('#left_pictures').attr('href', left);
                jQuery('#left_pictures').addClass('left_show');
                jQuery('#left_pictures').removeClass('left_hide');
            }
            else {
                jQuery('#left_pictures').removeClass('left_show');
                jQuery('#left_pictures').addClass('left_hide');
            }
            if(r < iCnt) {
                jQuery('#right_pictures').attr('href', right);
                jQuery('#right_pictures').addClass('right_show');
                jQuery('#right_pictures').removeClass('right_hide');
            }
            else {
                jQuery('#right_pictures').removeClass('right_show');
                jQuery('#right_pictures').addClass('right_hide');
            }
        }
        return false;
    });
   

});
