/* jQuery Carousel Lite INIT */

jQuery(document).ready(function() {
	var $ = jQuery;
	
	/* // MOVED TO PHP TO AVOID FLICKER
	var artist_menu = $('#sidebars li.widget_artist_submenu ul.tags');
	artist_menu.find('li').each(function(){
		if( $(this).text() == 'Available Works' ) {
			window.li = $(this);
		}
	});
	artist_menu.prepend( window.li );
	*/
	
	// Setup Highslide to work with built-in WordPress galleries
	$('div.gallery', '#content').each(function(){
		var gal_group = $(this).attr('id');
		$(this).find('dt.gallery-icon a').each(function(){
			var caption = $(this).parent().next('dd.gallery-caption').text();
			$(this).addClass('highslide')
				.attr('onclick', "return hs.expand(this, { slideshowGroup: '"+gal_group+"' })")
				.after('<div class="highslide-caption">'+caption+'</div>');
		});
			
	});
	
	
    $('#exhibition_carousel').jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
		circular: false,
		scroll:2
    });
	
	$('body').append('<div id="artist_index_hover"></div>');
	var hov = $('#artist_index_hover');
	
	$('#wpmenu30_content a').hover(function(e){
		var img_src = $(this).find('img.attachment-post-thumbnail').attr('src'); 
		hov.html('<img src="'+img_src+'" />')
			.css({left: (e.pageX+150)+'px', top: (e.pageY-100)+'px'});
	},function(e){
		hov.html('');
	});
	
	
});




/* Highslide INIT */
hs.graphicsDir = '/wp-content/themes/thesis/custom/img/highslide/';

hs.align = 'center';
hs.transitions = ["fade", "crossfade"];
hs.fadeInOut = true;
hs.dimmingOpacity = 0.8;
hs.outlineType = null;
hs.marginBottom = 170; // make room for the thumbstrip and the controls
hs.marginLeft = 15;
hs.marginRight = 15;
hs.marginTop = 15;
hs.numberPosition = 'caption';
hs.showCredits = false;


// Add the slideshow providing the controlbar and the thumbstrip
hs.addSlideshow({
	//slideshowGroup: 'group1',
	interval: 5000,
	repeat: false,
	useControls: true,
	overlayOptions: {
		className: 'text-controls',
		position: 'bottom center',
		relativeTo: 'viewport',
		offsetY: -130

	},
	thumbstrip: {
		position: 'bottom center',
		mode: 'horizontal',
		relativeTo: 'viewport'
	}
});