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.
 *
 */

if (  userAgent.indexOf("iPhone") != -1 ||
	userAgent.indexOf("Blackberry") != -1 ||
	userAgent.indexOf("Symbian") != -1 ||
	userAgent.indexOf("Tablet") != -1 || 
	userAgent.indexOf("Palm") != -1 ) {
	window.location = "mobile/index.html";			
}

if (  userAgent.indexOf("Nokia") != -1 ||
	userAgent.indexOf("MOT") != -1 ) {
	window.location = "mobile-text/index.html";
}	

if ( userAgent.indexOf("Mini") != -1 ) {
	window.location = "mobile-text/index.html";
}

if ( userAgent.indexOf("Mobi") != -1 ) {
	window.location = "mobile/index.html";
}

