
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});


// place any jQuery/helper plugins in here, instead of separate, slower script files.

/**
 *	AUTOCLICK -- PLUGIN
 *
 *	This is a very simple plugin to enable a parent element
 *	to inherit the link behaviour of a child <a> element.
 *
 *	USAGE: Apply the plugin to a set of parent elements,
 *	optionally passing in a child selector (in an options object).
 *	The default selector is an <a> element. 
 *	The plugin (currently) assumes only one element matches.
 *
 *	EXAMPLES:
 *
 *		$('parents').autoclick() // Default behaviour, using an <a> child element.
 *
 *		$('parents').autoclick({selector:	'.linkclass'}); // Using a custom child selector.
 *	
 */
(function($) {

	$.fn.autoclick = function(options) {
	
		var opts = $.extend({}, $.fn.autoclick.defaults, options);
		
		return this.each(function() {
			
			$(this).click(function() {
				var url = $(opts.selector, $(this)).attr('href');
				document.location = url;
			});
			
		});
	};
   
	$.fn.autoclick.defaults = {
		selector:	'a'
	};

})(jQuery);






/**
 *	ELASTIC -- PLUGIN
 *
 *	Plugin to dynamically calculate, and set, the height of a container.
 *	Useful in conjunction with cross-fading slideshows, when the height of
 *	the elements to manipulate is either unknown, or variable (i.e. cross-fading
 *	between elements of varying size).
 *
 *	USAGE: Apply the plugin to a parent element, passing in a child selector 
 *	(in an options object). The default selector is a <div> element. 
 *
 *	EXAMPLE:
 *
 *		$('parent').elastic({selector:	'.some #child-element'}); // Using a custom child selector.
 *	
 */
(function($) {

	$.fn.elastic = function(options) {
	
		var opts = $.extend({}, $.fn.autoclick.defaults, options);
		
		return this.each(function() {
		
			var h = $(this).outerHeight();
			
			$(opts.selector, $(this)).each(function() {
				h = Math.max(h, $(this).outerHeight());
			});
			
			$(this).css({
				'min-height':	h
			});
		});
	};
   
	$.fn.elastic.defaults = {
		selector:	'div'
	};

})(jQuery);
