var deviceIphone = "iphone";
var deviceIpod = "ipod";
var deviceIpad = "ipad";

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

//**************************
// 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 iPhone or iPod Touch.
function DetectIphoneOrIpod()
{
    if (DetectIphone())
       return true;
    else if (DetectIpod())
       return true;
    else
       return false;
}

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

//**************************
// Detects if the current device is an iPhone, iPod Touch or iPad.
function DetectIphoneOrIpodOrIpad()
{
    if (DetectIphone())
       return true;
    else if (DetectIpod())
       return true;
    else if (DetectIpad())
       return true;
    else
       return false;
}

//*************************
// Try to make a redirect based on the results
    if (DetectIphoneOrIpodOrIpad() === true)
{
        window.location = "http://djale.com/mobile";
}
else
{
        desktop=true;
}
