
// 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={};}})());

// Menu.js
// Created by ramon@boxelinc.com
// Menu Class for handling roll over staes
// and drop downs on home page
// this class is pretty much uselss outside the home page
function menu(el){
	this.element = el;
	return this;
}
(function($){
	menu.prototype.click = function(ev){
		ev.preventDefault();
		// hide all others first
		var el = $(ev.currentTarget);
		var sm = el.siblings('.submenu');
		var parent = el.parent().parent();
		parent.children('li').each(function(){
			$(this).children('.submenu').hide();
		})
		sm.show().bind('mouseleave', function(ev){
			if( $(ev.currentTarget).has( ev.relatedTarget ).length == 0 ){
				$(ev.currentTarget).hide();
				$(ev.currentTarget).unbind('mouseleave');
			}
		});
	}
	menu.prototype.leave = function(ev){
		var el = $(ev.currentTarget);
	}
	menu.prototype.expand = function(event){
		var el = $(event.currentTarget).children('p.quote');
		el.animate({
			height: '200px'
		}, '1000');
	}
	menu.prototype.collapse = function(event){
		var el = $(event.currentTarget).children('p.quote');
		el.animate({
			height: '0'
		},'fast');
	}
	$(document).ready(function(){
		
		var nav = new menu( $('#menu') );
		
		// only execute if you are in home
		
		if( $('.front').length > 0 ){
			$('#billboards .nav ul li').each(function(){
				if( $(this).parent().hasClass('module') == false ){
					$(this).bind('mouseenter', {self: nav}, nav.expand, false)
					.bind('mouseleave', {self: nav}, nav.collapse, false);
				}
			});
			/*
			$('#menu .nav ul li a.parent-anchor').each(function(index, element){
				if( $(this).parent().hasClass('module') == false ){
					$(this).bind('click', {dad: $(this)}, nav.click)
					// .bind('mouseleave', {dad: $(this)}, nav.leave);
				}
			});
			*/
		}
	});
}(jQuery));
// jQuery.fn.extend({
// 	is: function( selector ) {
// 		if(POS !== undefined ){
// 			return !!selector && ( 
// 				typeof selector === "string" ?
// 					// If this is a positional selector, check membership in the returned set
// 					// so $("p:first").is("p:last") won't return true for a doc with two "p".
// 					POS.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 );
// 		}
// 	}
// });
