function CheckIfMobileDevice() {
	if(null!=window.navigator.userAgent) {

		var userAgentString = window.navigator.userAgent;

		// Quick Array to kill out matches in the user agent
		// that might cause false positives

		var badmatches = ["OfficeLiveConnector","MSIE\ 8\.0","OptimizedIE8","MSN\ Optimized","Creative\ AutoUpdate","Swapper"];

		var checkCondition = null;
		for(var i=0; i<badmatches.length; i++){
			checkCondition = new RegExp(badmatches[i], 'i');
			if(null!=userAgentString.match(checkCondition)) return false;
		}

		// Now we'll go for positive matches

		var uamatches = ["midp", "j2me", "avantg", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/", "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi", "phone", "cdm", "up\.b", "audio", "SIE\-", "SEC\-", "samsung", "HTC", "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto","webos"];

		for(var i=0; i<uamatches.length; i++){
			checkCondition = new RegExp(uamatches[i], 'i');
			if(null!=userAgentString.match(checkCondition)) return true;
		}

	}
	return false;
}

function CheckIfSmartPhoneDevice() {
	if(null!=window.navigator.userAgent) {
		var userAgentString = window.navigator.userAgent;

		var uamatches = ["windows\ phone ", "android", "iphone", "ipad"];
		var checkCondition = new RegExp();

		for(var i=0; i<uamatches.length; i++){
			checkCondition = new RegExp(uamatches[i], 'i');
			if(null!=userAgentString.match(checkCondition)) return true;
		}

	}
	return false;
}

