function mobileDetect(){	

	var defaultPage = 'home.html';
	var defaultMobilePage = 'mobile.html';
	
	//var androidPage = 'android.html';
	//var blackberryPage = 'blackberry.html';	
	//var iPhonePage = 'iPhone.html';	
	//var windowsMobilePage = 'windowsMobile.html';

	var page = defaultPage;
	
	var ua = navigator.userAgent.toLowerCase();	// lowercase everything to make matching easier

	// switch statement is more efficient than if/else blocks
	switch (true) 
	{	
		// check for android
	    case (ua.match("android") != null): 
	        //page = androidPage;
			page = defaultMobilePage;
	    break;

	 	// check for blackberry
        case (ua.match("blackberry") != null):
			//page = blackberryPage;
			page = defaultMobilePage;
		break;
	
		// check for iPhone || iPod
	    case ((ua.match("iphone") != null) || 
	    		(ua.match("ipod") != null)):
			//page = iPhonePage;
			page = defaultMobilePage;
		break;
		
		// check for opera mini
        case (ua.match("opera mini") != null):
			//page = mobilePage;	
			page = defaultMobilePage;
		break;

		// check for windowsMobile
        case ((ua.match("windows ce; ppc") != null) ||
        		(ua.match("windows ce; smartphone") != null) ||
        		(ua.match("iemobile") != null)):
			//page = windowsMobilePage;
			page = defaultMobilePage;
        break;
		
	}
	
	// check for other mobile browsers... existence of an x-wap-profile clearly means mobile


	
	
	
	
	// check for "Mozilla" or "Windows NT" -- if neither are found, it's not a desktop browser?!

	
	window.location = page;
}