
// 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);
  if(this.console) {
    arguments.callee = arguments.callee.caller;
    var newarr = [].slice.call(arguments);
    (typeof console.log === 'object' ? log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr));
  }
};

// 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,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
{console.log();return window.console;}catch(err){return window.console={};}})());


// place any jQuery/helper plugins in here, instead of separate, slower script files.

/* Random Quote */
$(document).ready( function() {
	var quotes = [
		[ '"I just wanted to endorse Adcart.  I tried \'the other guys\' and what a mistake that was.  Nobody saw my ads and when I complained because they put me on the wrong side of the cart they completely denied what they promised me..."', 'Ja Lynn West' ],
		[ '"Adcart definitely is the mainstay of our new marketing campaign and will be for some time to come."', 'John & Mary Jo Downes' ],
		[ '"...Our children also see the ads when they go shopping with their parents and get so excited about their preschool. This is the best advertising we have ever done."', 'Donna Blair' ],
		[ '"Thank you Adcart for helping us grow to the largest wine & spirit shop in Madison, MS.  Since 1996 keeping my name in front of the local shoppers has been great exposure for us."', 'Peter Clark' ],
		[ '"We receive calls from new customers, who tell us that they saw the ad at the grocery store.  Adcart is the only advertising expenditure that we put in our annual budget."', 'Barbara Reid' ],
		[ '"I have been a client for over the past decade.  I know my exposure in my backyard is being seen by everyone who drives to the store, grabs a shopping cart, pushes me around for an hour...then drive off as my next potential customer."', 'Henry Wave' ]
		];
		$('#quote-content').loadQuote( quotes, 10000 );
	});

	$.fn.loadQuote = function( quotes, interval ) {
		return this.each( function() {
			var obj = $(this);
			var quote = random_array( quotes );
			var quote_text = quote[[0],[0]] + '<div id="quote-author">&mdash; ' + quote[[0],[1]] + '</div>';

			obj.fadeOut( 'slow', function() {
				$( this ).html( quote_text );
				obj.fadeIn( 'slow' );
			});
			timeOut = setTimeout( function(){ obj.loadQuote( quotes, interval )}, interval );
			
			$("#quote-reload").click( function(){
				if( !obj.is( ":animated" ) ){ clearTimeout( timeOut ); obj.loadQuote( quotes, interval ); }
			});
		});
	}
	
	function random_array( aArray ) {
		var rand = Math.floor( Math.random() * aArray.length + aArray.length );
		var randArray = aArray[ rand - aArray.length ];
		return randArray;
	}


