
jQuery(window).load(function(){
	jQuery("body").addClass("addbg");
});

jQuery(document).ready(function(){
	// Grid JS
	jQuery(document).bind('keydown', 'Alt+Shift+g', function(){
		jQuery("body").toggleClass("gridsystem");
	});
	
	jQuery('.anythingSlider').anythingSlider({
        easing: "easeInOutQuint",                // Anything other than "linear" or "swing" requires the easing plugin
        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
        startStopped: false,            // If autoPlay is on, this can force it to start stopped
        delay: 5000,                    // How long between slide transitions in AutoPlay mode
        animationTime: 700,             // How long the slide transition takes
        hashTags: true,                 // Should links change the hashtag in the URL?
        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        startText: "Start",             // Start text
        stopText: "Stop",               // Stop text
        navigationFormatter: null       // Details at the top of the file on this use (advanced use)
	});

	// Fetch the title
	jQuery.fn.getTitle = function() {
		var arr = jQuery("a.fancybox");
		jQuery.each(arr, function() {
			var title = jQuery(this).children("img").attr("title");
			jQuery(this).attr('title',title);
		})
	}

	// Set file types for Fancybox class
	var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';

	// Add Fancybox class to gallery links.
	jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();

	// Fancybox settings
	jQuery(".gallery a.fancybox").fancybox({
		'transitionIn': 'fade',
		'transitionOut': 'fade',
		'titleShow': false,
		'imageScale': true,
		'padding': 5,
		'zoomOpacity': true,
		'zoomSpeedIn': 500,
		'zoomSpeedOut': 500,
		'zoomSpeedChange': 300,
		'overlayShow': true,
		'overlayColor': "#333333",
		'overlayOpacity': 0.4,
		'enableEscapeButton': true,
		'showCloseButton': false,
		'hideOnOverlayClick': true,
		'hideOnContentClick': false,
		'frameWidth':  560,
		'frameHeight':  340,
		'callbackOnStart': null,
		'callbackOnShow': null,
		'callbackOnClose': null,
		'centerOnScroll': true
	});

});
