var utils = new UtilsClass();

function UtilsClass() {
	
	this.computeTotalWidth = function(jQueryCollection) {
		var computedNavWidth = 0;
		jQueryCollection.each(function(){
			computedNavWidth += $(this).outerWidth(true);
		});
		return computedNavWidth;
	}

	this.setElementWidth = function(jQueryEl, aWidth) {
		jQueryEl.css({'width' : aWidth + 'px'});
	}
	
	this.AndroidDetected = function() {
		//alert(navigator.userAgent);
		var android = {webkit : false, gecko : false}
		if ((navigator.userAgent.indexOf("Android") >= 0) && (navigator.userAgent.indexOf("AppleWebKit") >= 0))
			android = {webkit : true, gecko : false}
		if ((navigator.userAgent.indexOf("Android") >= 0) && (navigator.userAgent.indexOf("Firefox") >= 0))
			android = {webkit : false, gecko : true}
		return android;
	};
	
	this.IEDetected = function() {
		//alert(navigator.userAgent);
		var isIE = (navigator.userAgent.indexOf("MSIE") >= 0) ? true : false;
		return isIE;
	}
	
	this.roundNumber = function(num, dec) {
		var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
		return result;
	}
	
	this.isNumber = function(value){
		var anum=/(^\-?\d+\.?\d*$)/
		if (anum.test(value))
			return true;
		return false;
    }
	
	this.IECompatEngine = function() {
		engine = 'Not Internet Explorer';
		if (window.navigator.appName == "Microsoft Internet Explorer") {
		   // This is an IE browser. What mode is the engine in?
		   if (document.documentMode) // IE8 or later
			  engine = document.documentMode;
		   else { // IE 5-7
			  engine = 5; // Assume quirks mode unless proven otherwise
			  if (document.compatMode) {
				 if (document.compatMode == "CSS1Compat")
					engine = 7; // standards mode
			  }
			  // There is no test for IE6 standards mode because that mode  
			  // was replaced by IE7 standards mode; there is no emulation.
		   }
		}
		return engine;
	}
}
