var deviceIphone = "iphone";
var deviceIpod = "ipod";
var deviceIpad= "ipad";
var deviceAndroid = "android";
var deviceBlackBerry = "blackberry";
var deviceWindowsMobile = "windowsmobile";
var deviceWindowsMobile7 = "windowsphone7";
var devicePalmOS = "palmos";
var devicePalmWebOS = "palmwebos";

//Initialize our user agent string to lower case.
var uagent = navigator.userAgent.toLowerCase();


if (DetectMobileDevice()) 
{

if(confirm("You seem to be using a mobile web browser.  Would you like to view our Mobile Site, optimized for your device?\nPress OK to visit the mobile site, or Cancel to view the full site."))
{
//Change to .com when that site turns on.
	window.location="http://m.flintriverquarium.net";
}
}



//**************************
// Detects if the current device is an iPhone.
function DetectIphone()
{
   if (uagent.search(deviceIphone) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is an iPod Touch.
function DetectIpod()
{
   if (uagent.search(deviceIpod) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is an iPad.
function DetectIpad()
{
   if (uagent.search(deviceIpad) > -1)
      return true;
   else
      return false;
}


//**************************
// Detects if the current device is an Android phone.
function DetectAndroid()
{
   if (uagent.search(deviceAndroid) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is a Blackberry.
function DetectBlackBerry()
{
   if (uagent.search(deviceBlackBerry) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is a Windows Phone.
function DetectWindowsMobile()
{
   if (uagent.search(deviceWindowsMobile) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is a Windows Phone 7.
function DetectWindowsMobile7()
{
   if (uagent.search(deviceWindowsMobile7) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is a Palm Device.
function DetectPalm()
{
   if (uagent.search(devicePalmOS) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if the current device is a Palm Device.
function DetectPalmWeb()
{
   if (uagent.search(devicePalmWebOS) > -1)
      return true;
   else
      return false;
}

//**************************
// Detects if device is mobile or not.
function DetectMobileDevice()
{
    if (DetectIphone())
       return true;
    else if (DetectIpod())
       return true;
    else if (DetectIpad())
       return true;
    else if (DetectAndroid())
       return true;
    else if (DetectBlackBerry())
       return true;
    else if (DetectWindowsMobile())
       return true;
    else if (DetectWindowsMobile7())
       return true;
    else if (DetectPalm())
       return true;
    else if (DetectPalmWeb())
       return true;
    else
       return false;
}
