/*///////////////////////////////////////////////////////////
						The jQuery Firebug Logging Plugin
-------------------------------------------------------------

	File:						jquery.firebuglogging.js
	
	Developer:			Dominic Mitchell
									www.happygiraffe.net
									
	Modified by:		Lauren Herda
									www.laurenherda.com
									www.bcreativegroup.com
									
	Source:					http://happygiraffe.net/blog/2007/
										09/26/jquery-logging/
									
	Last Modified:	November 21, 2008

///////////////////////////////////////////////////////////*/

(function($) {
	$.log = function (msg) {
		if($.browser.mozilla || $.browser.safari) console.log("%s: %o", msg, this);
	};
	
	$.fn.log = function (msg) {
		if($.browser.mozilla || $.browser.safari) console.log("%s: %o", msg, this);
		return this;
	};
})(jQuery);

/*///////////////////////////////////////////////////////////
									The jQuery Drawer Plugin
-------------------------------------------------------------

	File:						jquery.drawer.js
	
	Developer:			Lauren Herda
									www.laurenherda.com
									www.bcreativegroup.com
									
	Last Modified:	November 21, 2008

///////////////////////////////////////////////////////////*/

(function($){
	$.fn.drawer = function(options) {
	
		/* If the user doesn't want to specify different 
			 speeds/easings for in/out animations, then have
			 the plugin duplicate the single passed setting
			 for both in & out animations. */
			 
		/*
if(options.speed.constructor == String) {
			options.speed = [options.speed, options.speed];
		}
*/
		
		options.debug = true;
		
		var opts = $.extend($.fn.drawer.defaults, options);

		/* The trigger will be the first instance 
			 matching the expression 'trigger', searching 
			 backwards from the position of $(this). */
			 
		return this.each(function(){
			var $this = $(this);
			$this.addClass('drawer');
			if(opts.debug) $.log("drawer: var h has been reset: "+h+". ");
			var h = 0;
			h = $(this).outerHeight();
			if(opts.debug) $.log("drawer: var h has been set to: "+h+". ");

			var t;
			if(opts.trigger.constructor == String) t = $this.prevAll(opts.trigger+':last').eq(0);
			else t = opts.trigger;
			
			t.css('cursor', 'pointer');
			$(this).wrap('<div class="shade"></div>');
			$('.shade', this).css({
				margin: 0,
				padding: 0
			});
			if(opts.debug) $.log("drawer: retracting drawer using var h; it is: "+h);
			$(this).css({
				marginTop: -h
			}).parent('.shade').css({
				overflow: 'hidden',
				height: '100%',
				clear: 'both'
			});
			t.toggle(function(){
				t.addClass('expanded');
				$this.animate({
					marginTop: 0
				}, opts.speed[0], opts.easing[0]);
				if(opts.scroll == true) $.scrollTo($this.parent('.shade'), opts.scrollSpeed, {
					offset: -50
				});
			}, function(){
				t.removeClass('expanded');
				if(opts.debug) $.log("drawer: expanding drawer using var h; it is: "+h);
				$this.animate({
					marginTop: -h
				}, opts.speed[1], opts.easing[1], function(){
					$this.parent('.shade').css({
						overflow: 'hidden'
					});
				});
			});
		});
	};
	
	/* Making defaults publicly-accessible,
		 so developers can override defaults. */
	
	$.fn.drawer.defaults = { 
		trigger: '.switch', 
		speed: ['slow', 'normal'],
		easing: ['easeOutQuad', 'easeInQuad'],
		scroll: true,
		scrollSpeed: 1000
	};
})(jQuery);