// change the following for the url you want to redirect to.
var qString = window.location.search.substring(1);
var redirect_location = "http://m.insphereis.com"
if ( qString.length > 0 )
	redirect_location = redirect_location+"?"+qString;


// ************************************************************
// DO NOT change below unless you KNOW what you're doing...
// ************************************************************

// looks for iphone, ipod, android, ipad, and BlackBerry devices

// if adding additional devices add in lowercase
var mobileStrings = new Array();
mobileStrings[0] = "iphone";
mobileStrings[1] = "ipod";
mobileStrings[2] = "android";
mobileStrings[3] = "ipad";
mobileStrings[4] = "blackberry";

// Initialize our user agent string to lower case.
var uagent = navigator.userAgent.toLowerCase();
// alert(uagent); // uncomment to alert User Agent string
var mobile = isMobileDevice();
if (mobile) {
	window.location = redirect_location;
}


// functions below

function isDevice(iDevice) {
	if (uagent.search(iDevice) > -1)
		return true;
	else
		return false;
}

function isMobileDevice()
{
    
    var temp = false;
    
    for ( x in mobileStrings ){
 		if (isDevice(mobileStrings[x]))
 			temp = true;
	}
    //	alert(temp);
    return temp;
}

