public static function is_tablet($agent = null) {
		if(!$agent) $agent = $_SERVER['HTTP_USER_AGENT'];

		// Check if user agent is a Tablet
		if(
			(preg_match('/iP(a|ro)d/i', $agent)) 
			|| (preg_match('/tablet/i', $agent)) && (!preg_match('/RX-34/i', $agent)) || (preg_match('/FOLIO/i', $agent))
		) {
			return true;
		}
		// Check if user agent is an Android Tablet
		else if (
			(preg_match('/Linux/i', $agent)) 
			&& (preg_match('/Android/i', $agent)) 
			&& (!preg_match('/Fennec|mobi|HTC.Magic|HTCX06HT|Nexus.One|SC-02B|fone.945/i', $agent))
			&& (!preg_match('/Mobile/i', $agent))
		) {
			// see http://googlewebmastercentral.blogspot.de/2011/03/mo-better-to-also-detect-mobile-user.html		
			// see http://googlewebmastercentral.blogspot.de/2012/11/giving-tablet-users-full-sized-web.html
			return true;
		}
		// Check if user agent is a Kindle or Kindle Fire
		else if (
			(preg_match('/Kindle/i', $agent)) 
			|| (preg_match('/Mac.OS/i', $agent)) 
			&& (preg_match('/Silk/i', $agent))
		) {
			return true;
		}
		// Check if user agent is a pre Android 3.0 Tablet
		else if (
			(preg_match('/GT-P10|SC-01C|SHW-M180S|SGH-T849|SCH-I800|SHW-M180L|SPH-P100|SGH-I987|zt180|HTC(.Flyer|\_Flyer)|Sprint.ATP51|ViewPad7|pandigital(sprnova|nova)|Ideos.S7|Dell.Streak.7|Advent.Vega|A101IT|A70BHT|MID7015|Next2|nook/i', $agent)) 
			|| (preg_match('/MB511/i', $agent)) 
			&& (preg_match('/RUTEM/i', $agent))
		) {
			return true;
		} 
		// Browser is either a mobile handset or desktop.
		else {
			return false;
		}
	}