$(document).ready(function() {
    var $pageNav = $('.pageNav');
    $('.imgGallery').find('img').hover(function() {
        var pageItemClassName = this.className.replace(/.*(artist-item-\d+).*/, "$1");
        $pageNav.find('.' + pageItemClassName).addClass('hovered').css({color:'#FFFFFF'});
    },function() {
        var pageItemClassName = this.className.replace(/.*(artist-item-\d+).*/, "$1");
        $pageNav.find('.' + pageItemClassName).removeClass('hovered').css({color:''});
	});

    var $galleryNav = $('.imgGallery');
    $('.pageNav').find('a').hover(function() {
        var pageItemClassName = this.className.replace(/.*(artist-item-\d+).*/, "$1");
        $galleryNav.find('.' + pageItemClassName).addClass('bordered').attr('src', $(this).attr('onmouseover'));
    },function() {
        var pageItemClassName = this.className.replace(/.*(artist-item-\d+).*/, "$1");
        $galleryNav.find('.' + pageItemClassName).removeClass('bordered').attr('src', $(this).attr('onmouseout'));
	});
		
		//$galleryNav.find('.' + pageItemClassName).replace("/images/no-display.jpg", "/userfiles/artist-display/mousse_t_BW.jpg");
		//$('.imgGallery').find('img').attr("src", $(this).replace("/images/no-display.jpg", "/userfiles/artist-display/mousse_t_BW.jpg"));

    //});
});


$(document).ready(function() {
    $('img[data-hover]').hover(function() {
        $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
    }).each(function() {
        $('<img />').attr('src', $(this).attr('data-hover'));
    });;
});


$(document).ready(function() {
    $('.imgGallery').find('img').hover(function() {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('onmouseover'));
        $(this).attr('onmouseover', currentImg);
    }, function() {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('onmouseover'));
        $(this).attr('onmouseover', currentImg);
    });
});


$(document).ready(function() {
	$("a[rel=gallery]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		}
	});
});

$(document).ready(function() {
	$('.datetimepicker2').datetime({
		format: 'dd-mm-yy hh:ii',
		stepMins: 15,
		numMonths: 1
	});
});

$(document).ready(function() {
	$('.header').cycle({ 
		fx		: 'fade',
		speed	: 1500,
		delay	: -1000,
	});
});
