$(function() {
	$(".fancybox").fancybox();
	
	$(".widget.acc").toggleWidget();
});

/* Sidebar toggle 
 * -----------------
 * Plugin by Boris Strahija
 * 
 */
(function ($) {
	$.fn.toggleWidget = function(params) {
		// Default options
		var params = jQuery.extend({
			 
		}, params);
		
		$(this).each(function() {
			if ($(this).hasClass("closed")) {
				$(this).children(".acc-cnt").hide();
			} //end if
			
			// Add click event
			$(this).children("h2").click(function() {
				$el 	= $(this).parent(".acc");
				$toggle = $el.children("h2");
				$cont 	= $el.children(".acc-cnt")
				$state 	= false;
				if ( $el.hasClass("open") ) $state = true;
				
				if ($state) {
					$cont.hide();
					$state = false;
					$el.removeClass("open");
					$el.addClass("closed");
				} else {
					$cont.show();
					$state = true;
					$el.addClass("open");
					$el.removeClass("closed");
				} //end if
			});
			
		}); //end each()
		
	}; //end function()
})(jQuery);