window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var a=[].slice.call(arguments);(typeof console.log==="object"?log.apply.call(console.log,console,a):console.log.apply(console,a))}};
(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={};}})());


function imageFit (e, eWidth, eHeight){
	var div = $(e).parent(),
		maxht = div.height(),
		maxwdt = div.width(),
		img = $(e),
		ht = eHeight,
		wdt = eWidth;

	divRatio = (maxht / maxwdt) * 100;
	imageRatio = (ht / wdt) * 100;

	if (divRatio > imageRatio) {
		img.height(maxht);

		rest = img.width() - maxwdt;

		img.css({'margin-left':'-' +(rest/2)+'px','margin-top':0,'width':'auto'});
	} else {
		img.width(maxwdt);

		rest = img.height() - maxht;

		img.css({'margin-top':'-' +(rest/2)+'px','margin-left':0,'height':'auto'});
	}

}

var nav = navigator.userAgent;
var isMobile = nav.match(/ipad/i) ? true :
	(nav.match(/ipod/i) ? true :
	(nav.match(/iphone/i) ? true :
	(nav.match(/Opera Mini/i) ? true :
	(nav.match(/Opera Mobi/i) ? true :
	(nav.match(/Fennec/i) ? true :
	(nav.match(/android/i) ? true : false ))))));

