var deviceIphone = "iphone";
var deviceIpod = "ipod";
var deviceS60 = "series60";
var deviceSymbian = "symbian";
var engineWebKit = "webkit";
var deviceAndroid = "android";
var deviceWinMob = "windows ce";
var deviceBB = "blackberry";
var devicePalm = "palm";
var redirectURL = "/mobile"


function mobilePhoneLookUp(argAgent){
	
	//Initialize our user agent.
	var uagent = argAgent;
	var isMobile = false;
	
	// Detects if the current device is an iPhone or iPod Touch.	
	if ((uagent.search(deviceIphone) > -1) || (uagent.search(deviceIpod) > -1)) isMobile = true;

	// Detects if the current browser is the S60 Open Source Browser.
	// Screen out older devices and the old WML browser.
	if (uagent.search(engineWebKit) > -1){if ((uagent.search(deviceS60) > -1 || uagent.search(deviceSymbian) > -1)) isMobile = true;}
	
	// Detects if the current device is an Android OS-based device.
	if (uagent.search(deviceAndroid) > -1) isMobile = true;
	
	// Detects if the current browser is a Windows Mobile device.
	if (uagent.search(deviceWinMob) > -1) isMobile = true;
	
	// Detects if the current browser is a BlackBerry of some sort.
	if (uagent.search(deviceBB) > -1) isMobile = true;
	
	// Detects if the current browser is on a PalmOS device.
	if (uagent.search(devicePalm) > -1) isMobile = true;
	
	//If mobile device is supported redirect
	if(isMobile) window.location.replace(redirectURL);
	
	//Other webkit device
	if (uagent.search(engineWebKit) > -1) isMobile = true;
 
}

mobilePhoneLookUp(navigator.userAgent.toLowerCase());