
// 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.
(function($){  
	$.fn.smoothScroll = function(speed){  
		if(!speed) var speed = 'slow';
		return this.each(function(){  
			$(this).bind("click", function(){
				var goscroll = false;  
				var the_hash = $(this).attr("href");  
				var regex = new RegExp("\#(.*)","gi");  
				if(the_hash.match("\#")) {  
					the_hash = the_hash.replace(regex,"$1");  
					if($("#"+the_hash).length>0) {  
						the_hash = "#" + the_hash;  
						goscroll = true;  
					}  
					else if($("a[name=" + the_hash + "]").length>0) {  
						the_hash = "a[name=" + the_hash + "]";  
						goscroll = true;  
					}  
					if(goscroll) {  
						var container = 'html';  
						if ($.browser.webkit) container = 'body';
						var delta = 78;

						if(the_hash == "#Fonctionnalites")
							delta += 21;

						$(container).animate({  
							scrollTop:($(the_hash).offset().top - delta)
						}, speed);
						return false;  
					}  
				}  
			});  
		});  
	};  
})(jQuery)
