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";

//Initialize our user agent string to lower case.
var uagent = navigator.userAgent.toLowerCase();

//**************************
// Detects if the current device is an iPhone.
if(uagent.search(deviceIphone) > -1){
	toMobi();
}
//**************************
// Detects if the current device is an iPod Touch.
if(uagent.search(deviceIpod) > -1){
      toMobi();
}
//**************************
// 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)){
		toMobi();
	} 
}
//**************************
// Detects if the current device is an Android OS-based device.
if (uagent.search(deviceAndroid) > -1){
	toMobi();
}

//**************************
// Detects if the current browser is a Windows Mobile device.
if (uagent.search(deviceWinMob) > -1){
      toMobi();
}
//**************************
// Detects if the current browser is a BlackBerry of some sort.
if (uagent.search(deviceBB) > -1){
      toMobi();
}
//**************************
// Detects if the current browser is on a PalmOS device.
if (uagent.search(devicePalm) > -1){
    toMobi();
}
//////////// Where to go? 
function toMobi(){
	window.location = "http://lukehayes.mobi";
}
