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() {
	return (uagent.search(deviceIphone) > -1);
}

// Detects if the current device is an iPad.
function detectIpad() {
	return (uagent.search(deviceIpad) > -1);
}

// Detects if the current device is an iPod Touch.
function detectIpod() {
	return (uagent.search(deviceIpod) > -1);
}

// Detects if the current device is an iPhone or iPod Touch.
function detectIOs() {
	if (detectIphone())
		return true;
	else if (detectIpod())
		return true;
	else if (detectIpad())
		return true;
	else
		return false;
}

