var sniffer = {
	init:function() {
 
		// Snag the URL, then look for the term "fullbrowser".
 
		var fullURL = document.URL;
		var index = fullURL.indexOf("fullbrowser");
 
		if (index == -1) {
			sniffer.sniff();
		}
 
	},
 
	// The following function redirects the user to the appropriate mobile site.
 
	sniff:function() {
		var userAgent = navigator.userAgent;
 
		/*
		 * Some notes...
		 * 
		 * User Agent strings are long and ugly.  Sometimes, one string will be caught
		 * by multiple cases below.  The reason they are in the order they are is to
		 * direct them as accurately as possible.
		 *
		 * - "Mini" is before "Mobi" because some strings contain both, and the ones that
		 *   contain "Mini" are best suited to the text version, whereas the ones that
		 *   contain "Mobi" but NOT "Mini" should be able to handle the graphical one.
		 *   Thus, "Mini" gets handled first to catch those that have both "Mini" and "Mobi"
		 *
		 * - "Symbian" & "Tablet" can handle JavaScript, so they should get the scripty version.
		 *Request.UserAgent.ToLower().Contains("blackberry") || 
		 */
 
		if (  userAgent.indexOf("iPhone") != -1 ||
			userAgent.indexOf("Blackberry") != -1 ||
			userAgent.indexOf("Symbian") != -1 ||
			userAgent.indexOf("Tablet") != -1 || 
			userAgent.indexOf("BlackBerry") != -1 ||
			userAgent.indexOf("Palm") != -1 ) {
			window.location = "/mobile/index.html";			
		}
 
		if (  userAgent.indexOf("Nokia") != -1 ||
			userAgent.indexOf("MOT") != -1 ) {
			window.location = "/mobile/index.html";
		}
 
		if ( userAgent.indexOf("Mini") != -1 ) {
			window.location = "/mobile/index.html";
		}
 
		if ( userAgent.indexOf("Mobi") != -1 ) {
			window.location = "/mobile/index.html";
		}
 
	}
};
 
sniffer.init();