/*$('.main.container').hide(); // END Selector


//do when the document is ready
$(document).ready(function() {
    		    		
     $('.main.container').fadeIn('normal');

}); //END do when the document is ready

*/


$(document).ready(function() {

	//check to see if you are on a touchscreen
	if ($("html.no-touch").length > 0){
		//if no-touch then setup no-touch version of about slider
		$("#mySlider").royalSlider({
		  captionShowEffects:["fade"],
		  directionNavAutoHide: false,
		  slideshowEnabled: true,
		  slideshowAutoStart:true, 
		  slideshowPauseOnHover: true,
		  hideArrowOnLastSlide:true,
		  keyboardNavEnabled:true
	  });
	}else{
		$("#mySlider").royalSlider({
			//if on touch then setup touch version of about slider
		    captionShowEffects:["fade"],
		    directionNavAutoHide: false,
		    hideArrowOnLastSlide:true,
		    keyboardNavEnabled:true
		});
	
	}

	//set the timer for the banners
	$("div.banners img").last().addClass('last')
	$("div.banners img").hide().first().show().addClass("current").addClass('first').next().addClass("next");
	setInterval('rotateBanners()', 4000);
      
       
  });
  
  
  
  //setup events for clicking on artworks.
$(document).ready(function() {
    		    		
    // Sample Selector
    $('nav.artworks-grid a.artwork').click(function(){
    	var $artworkURL = $(this).attr('href');
    	$(".slide-down").hide().replaceWith('<div class="slide-down"><img class="loading" src="/img/ajax-loader.gif"/></div>');
    	$(this).nextAll(".slide-down:first").slideDown(100);
    	//$(this).nextAll(".slide-down:first").load($artworkURL);
    	
    	$(this).nextAll(".slide-down:first").load($artworkURL + ' .inside', function() {
    	  $('div.inside').slideDown(800);
    	  $("a.lb-image").fancybox({
    	  	'transitionIn'	: 'elastic',
    	  	'transitionOut'	: 'elastic',
    	  	'overlayColor'	: '#000',
    	  	'overlayOpacity':	'0.6',
    	  	'margin'		:	'15',
    	  	'padding'		:	'20',
    	  	'centerOnScroll':	true
    	  });
    	  $("#main div.slide-down a.button.artwork-cta").fancybox({
    	  	'overlayColor'	: '#000',
    	  	'overlayOpacity':	'0.6',
    	  	'type'			:	'ajax'
      	  });
    	});
    	
    	return false;
   	}); // END Selector
   	
   	
   	
   	
   	
   	
   	
   	// Sample Selector
//   	$('nav.artworks-grid a.artwork').click(function(){
//   		var $artworkURL = $(this).attr('href');
//   		$(".slide-down").hide().replaceWith('<div class="slide-down"><img class="loading" src="/img/ajax-loader.gif"/></div>');
//   		$(this).nextAll(".slide-down:first").slideDown('slow');
   		//$(this).nextAll(".slide-down:first").load($artworkURL);
//   		
//   		$(this).nextAll(".slide-down:first").load($artworkURL, function() {
//   		  $("a.lb-image").fancybox({
//   		  	'transitionIn'	: 'elastic',
//   		  	'transitionOut'	: 'elastic',
//   		  	'overlayColor'	: '#000',
//   		  	'overlayOpacity':	'0.6',
//   		  	'margin'		:	'15',
//   		  	'padding'		:	'20',
//   		  	'centerOnScroll':	'true'
//   		  });
//   		});
//   		
//   		return false;
//   		}); // END Selector

}); //END do when the document is ready


//activate fancyBox
$(document).ready(function() {
	$("a.lb-image").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'overlayColor'	: '#000',
		'overlayOpacity':	'0.6',
		'titleShow'		:	false
	});
	
	$("a.lb-iframe").fancybox({
		'overlayColor'	: '#000',
		'overlayOpacity':	'0.6',
		'type'			:	'iframe',
		'width'			:	700,
		'height'		:	600,
		'titleShow'		:	false
	});
	$("a.lb-ajax").fancybox({
		'overlayColor'	: '#000',
		'overlayOpacity':	'0.6',
		'type'			:	'ajax',
		'titleShow'		:	false
	});
	$("a.lb-youtube").fancybox({
		'overlayColor'	: '#000',
		'overlayOpacity':	'0.6',
		'type'			:	'iframe',
		'width'			:	700,
		'height'		:	600
	});
	$("a.lb-swf").fancybox({
		'overlayColor'	: '#000',
		'overlayOpacity':	'0.6',
		'type'			:	'inline'
	});
			
});




function rotateBanners(){
	$("div.banners img.current").css({ opacity: 1 }).stop().fadeOut(2000).removeClass("current");
	$("div.banners img.next").css({ opacity: 1 }).stop().fadeIn(2000).removeClass("next").addClass("current");
	if ($("div.banners img.current.last").length > 0)
	{
		$("div.banners img.first").fadeOut(2000).addClass("next");
	}else{
		$("div.banners img.current").next().addClass("next");
	}
	
	
}


