//getScript("http://174.143.175.98/Websites/Sample/scripts/utils.js");
//getScript("http://174.143.175.98/Websites/Sample/scripts/detectorscriptv10.js");
//Initialize some initial string variables we'll look for later.
var deviceIphone = "iphone";
var deviceIpod = "ipod";

var deviceWinMob65 = "windows phone";
var deviceWinMob = "windows ce";
var enginePie = "wm5 pie";
var deviceIeMob = "iemobile";

var deviceSymbian = "symbian";
var deviceS60 = "series60";
var deviceS70 = "series70";
var deviceS80 = "series80";
var deviceS90 = "series90";

var deviceBB = "blackberry";
var deviceBBStorm = "blackberry95"; //Storm 1 and 2

var deviceAndroid = "android";

var devicePalm = "palm";
var deviceWebOS = "webos"; //For Palm's new WebOS devices
var engineXiino = "xiino";
var engineBlazer = "blazer"; //Old Palm

var uagent = navigator.userAgent.toLowerCase();

	if (DetectSmartphone())
	{
		var fullSiteParam = getParam('fullsite');

		if ((fullSiteParam != null) && (fullSiteParam.indexOf("true") != -1))
		{	
		}
		else
		{
			window.location = msite;
		}
	}

function getScript(src) 
{
    document.write('<' + 'script src="' + src + '"' + ' type="text/javascript"><' + '/script>');
}



//**************************
// Detects if the current device is an iPhone.
function DetectIphone()
{
   if (uagent.indexOf(deviceIphone) != -1)
         return true;

   return false;
}

//**************************
// Detects if the current device is an iPod Touch.
function DetectIpod()
{
   if (uagent.indexOf(deviceIpod) != -1)
      return true;

   return false;
}

//**************************
// Detects if the current device is an iPhone or iPod Touch.
function DetectIphoneOrIpod()
{
   //We repeat the searches here because some iPods 
   //  may report themselves as an iPhone, which is ok.
   if ((uagent.indexOf(deviceIphone) != -1) ||
       (uagent.indexOf(deviceIpod) != -1))
       return true;

   return false;
}

//**************************
// Detects if the current device is an Android OS-based device.
function DetectAndroid()
{
   if (uagent.indexOf(deviceAndroid) != -1)
      return true;

   return false;
}

//**************************
// Detects if the current device is any Symbian OS-based device,
//   including older S60, Series 70, Series 80, Series 90, and UIQ, 
//   or other browsers running on these devices.
function DetectSymbianOS()
{
   if (uagent.indexOf(deviceSymbian) != -1 ||
       uagent.indexOf(deviceS60) != -1 ||
       uagent.indexOf(deviceS70) != -1 ||
       uagent.indexOf(deviceS80) != -1 ||
       uagent.indexOf(deviceS90) != -1)
      return true;

   return false;
}


//**************************
// Detects if the current browser is a BlackBerry of some sort.
function DetectBlackBerry()
{
   if (uagent.indexOf(deviceBB) != -1)
      return true;

   return false;
}


//**************************
// Detects if the current browser is a BlackBerry Touch
//    device, such as the Storm.
function DetectBlackBerryTouch()
{
   if (uagent.indexOf(deviceBBStorm) != -1)
      return true;

   return false;
}

//**************************
// Detects if the current browser is a Windows Mobile device.
function DetectWindowsMobile()
{
   //Most devices use 'Windows CE', but some report 'iemobile' 
   //  and some older ones report as 'PIE' for Pocket IE. 
   if (uagent.indexOf(deviceWinMob65) != -1 ||
   	   uagent.indexOf(deviceWinMob) != -1 ||
       uagent.indexOf(deviceIeMob) != -1 ||
       uagent.indexOf(enginePie) != -1)
      return true;

   return false;
}

//**************************
// Detects if the current browser is on a PalmOS device.
function DetectPalmOS()
{
   //Most devices nowadays report as 'Palm', 
   //  but some older ones reported as Blazer or Xiino.
   if (uagent.indexOf(devicePalm) != -1 ||
       uagent.indexOf(engineBlazer) != -1 ||
       uagent.indexOf(engineXiino) != -1)
   {
     //Make sure it's not WebOS first
     if (DetectPalmWebOS())
        return false;
     else
        return true;
   }

   return false;
}

//**************************
// Detects if the current browser is on a Palm device
//   running the new WebOS.
function DetectPalmWebOS()
{
   if (uagent.indexOf(deviceWebOS) != -1)
      return true;

   return false;
}


//**************************
// Check to see whether the device is a 'smartphone'.
//   You might wish to send smartphones to a more capable web page
//   than a dumbed down WAP page. 
function DetectSmartphone()
{
   //First, look for iPhone and iPod Touch.
   //if (DetectIphoneOrIpod())
   //   return true;

   if (DetectIphone())
   	  return true;

   if (DetectIpod())
   	  return true;
   	  
   //Android
   if (DetectAndroid())
      return true;

   //Check for Windows Mobile devices.
   if (DetectWindowsMobile())
      return true;

   //Check for other Symbian devices - older S60, UIQ, other.
   if (DetectSymbianOS())
      return true;

   //Next, look for a BlackBerry
   if (DetectBlackBerry())
      return true;

   //PalmOS.
   if (DetectPalmOS())
      return true;

   //PalmWebOS.
   if (DetectPalmWebOS())
      return true;

   //Otherwise, return false.
   return false;
};


function getParam(name) 
{
	name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 
	var regexS = "[\\?&]" + name + "=([^&#]*)"; 
	var regex = new RegExp(regexS); 
	var results = regex.exec(window.location.href); 
	if (results == null) 
	return ""; 
	else 
	return results[1]; 
}
