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
	if ( ! $.browser.msie ) { // IE crashes the whole thing when we do it this way. It may need to be moved to PHP.
		$('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.6;
hs.outlineType = null;
hs.marginBottom = 15; 
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,
	fixedControls: 'fit',
	overlayOptions: {
		className: 'text-controls',
		opacity: .7,
		position: 'bottom center',
		//relativeTo: 'viewport',
		hideOnMouseOut: true,
		offsetY: -20

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