// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$(document).ajaxSend(function(event, request, settings) {
  if (typeof(AUTH_TOKEN) == "undefined") return;
  // settings.data is a serialized string like "foo=bar&baz=boink" (or null)
  settings.data = settings.data || "";
  settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
});


$(document).ready(function() {
	$('#header_settings').click(function(){
		var divDisplay = document.getElementById("login_header").style.display;
			if(divDisplay  == 'none')
				$('#login_header').slideDown('slow');
			else
				$('#login_header').slideUp('slow');
	});
	
	
	
	$(window).bind("load", function() { 
	    $("#my-folio-of-works").slideViewerPro({
			  thumbs: 3,  
	      autoslide: true,  
        asTimer: 3500, 
        galBorderWidth: 0, 
        thumbsBorderOpacity: 0,  
        buttonsTextColor: "#707070", 
				thumbsBorderColor: "#efefef", // the border color of the thumbnails but not the current one 
        buttonsWidth: 10, 
        thumbsActiveBorderOpacity: 0.8, 
        thumbsActiveBorderColor: "#cccccc", 
 				thumbsPercentReduction: 10, 
        shuffle: false,
				width: '800',
				height: '500'
			}); 
	});
	
	$('#galleries').sortable({items:'.gallery', containment:'parent', axis:'y', placeholder: 'gallery_holder', update: function() {
	  $.post('/galleries/sort', '_method=put&authenticity_token='+AUTH_TOKEN+'&'+$(this).sortable('serialize'));
	}});
})