$(document).ready(function() {

	//TOGGLE SCRIPT
	$(".flowToggle").flowToggle(
		{
			//	DEFAULTS
			// showHideSelector : ".flowShowHide",
			// toggleText : "",
			// toggleTextAfter : "",
			// hideToggle : false

			showHideSelector : ".flowShowHide",
			toggleText : "Continue reading",
			toggleTextAfter : "Close this",
			hideToggle : false
		}
	);
	
	

		// first example
		$("#navigation").treeview({
			persist: "location",
			collapsed: true,
			unique: true
		});
		
		// // second example
		// $("#browser").treeview();
		// $("#add").click(function() {
		// 	var branches = $("<li><span class='folder'>New Sublist</span><ul>" + 
		// 		"<li><span class='file'>Item1</span></li>" + 
		// 		"<li><span class='file'>Item2</span></li></ul></li>").appendTo("#browser");
		// 	$("#browser").treeview({
		// 		add: branches
		// 	});
		// 	branches = $("<li class='closed'><span class='folder'>New Sublist</span><ul><li><span class='file'>Item1</span></li><li><span class='file'>Item2</span></li></ul></li>").prependTo("#folder21");
		// 	$("#browser").treeview({
		// 		add: branches
		// 	});
		// });
		// 
		// // third example
		// $("#red").treeview({
		// 	animated: "fast",
		// 	collapsed: true,
		// 	unique: true,
		// 	persist: "cookie",
		// 	toggle: function() {
		// 		window.console && console.log("%o was toggled", this);
		// 	}
		// });
		// 
		// // fourth example
		// $("#black, #gray").treeview({
		// 	control: "#treecontrol",
		// 	persist: "cookie",
		// 	cookieId: "treeview-black"
		// });


	//GLOBAL NOTIFICATIONS
	$(".notification").removeClass('noScript').addClass('hasScript').slideDown();

	$(".notification div").append("<a href='#' class='closethis'>&times;</a>");

	$(".notification").click(function(){
		$(".notification").fadeOut();
	});

	if(!$(".notification").hasClass('sticky'))
	{
	}
		

	//LIGHTBOX
	$('a.lightbox').lightBox({
		fixedNavigation : true
	}); // Select all links with lightbox class

	//SUPERFISH
	$('ul.sf-menu').superfish({
		pathClass:     'current' // the class you have applied to list items that lead to the current page
	}); 
	
	$('.tabs-box').tabs();
	

	// //SLIDESHOWS
	// makeSlideShow($('.promoSlide'));
	// // makeSlideShow($('.flickr-feed'));
	// 
	// function makeSlideShow(promoSlide){
	// 	
	// 	var h = promoSlide.find('img').height();
	// 	var w = promoSlide.find('img').width();
	// 	promoSlide.height(h);
	// 	promoSlide.width(w);
	// 
	// 	promoSlideCSS =	{
	// 						'overflow': 'hidden',
	// 						'background' : '#000 url(/theme/images/loaders/loader_1_black48.gif) center center no-repeat'
	// 					};
	// 
	// 	promoSlide.css(promoSlideCSS);	
	// 
	// 	// $('#promoSlide .slideItem').height(h).width(w);
	// 
	// 	SlideCaptionCSS =	{
	// 							'bottom': -1*$(this).height(),
	// 							'opacity' : '0.7',
	// 							'width' : '100%',
	// 							'position' : 'absolute'
	// 						};
	// 				
	// 	$('#promoSlide .slideCaption').each(function(){
	// 		$(this).css(SlideCaptionCSS);
	// 	});
	// 
	// 	function onBefore() {
	// 	}
	// 
	// 	function onAfter() {
	// 		sCaption = $(this).find('.slideCaption');
	// 		sCaptionH = -1*sCaption.height();
	// 		sCaption.show().animate({opacity: 0.7}, 500).animate({bottom: "0px"}, { queue:false, duration: 500 }).animate({opacity: 0.7}, 2000).animate({opacity: 0.0, bottom: sCaptionH}, 500);
	// 	}
	// 
	// 	function initSlideshow(slideShow)
	// 	{
	// 		slideShow.find('img').fadeIn();
	// 		promoSlide.css({'background' : 'none'});
	// 
	// 		slideShow.cycle({
	// 				    timeout: 5000, 
	// 					fx: 'fade',
	// 					speed: 1000,
	// 					before: onBefore,
	// 					after: onAfter,
	// 					pager: '#pager',
	// 					pause:   1
	// 				});
	// 	}
	// 
	// 	function is_image_loaded(image) {
	// 		if(!image.complete) {
	// 			return false;
	// 		}
	// 		if(typeof image.naturalWidth != "undefined" && image.naturalWidth == 0) {
	// 			return false;
	// 		}
	// 		return true;
	// 	};
	// 
	// 	var first_slide = $(promoSlide).find('img:first');
	// 
	// 	if(first_slide.length > 0){
	// 		if(is_image_loaded(first_slide.get(0))){
	// 			initSlideshow($(promoSlide));
	// 		} else {
	// 			first_slide.load(function(e) {
	// 				$('#loading').hide();
	// 				initSlideshow($(promoSlide));
	// 			});
	// 		}
	// 	}
	// 	
	// }
	
	/*-- JUST ANOTHE SLIDESHOW ----------------------*/
		//SLIDESHOWS


		function onBefore() {
		}

		function onAfter() {
		}

		function initSlideshowB(slideShow)
		{
			slideShow.find('img').fadeIn();
			slideShow.css({'background' : 'none'});

			slideShow.cycle({
			    timeout: 5000, 
				fx: 'fade',
				speed: 1000,
				pager: '#pager',
				pause:   1
			});
		}

		initSlideshowB($('#otherSlide'));
	

});


