<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 2/27/2018	ELL

$user_agent = $_SERVER['HTTP_USER_AGENT'];

echo "<script src='" . $scripts_dir_rel . "jquery.min.js'> </script>\n\n";
?>
<script>
	function is_touch_device() {
		return (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
	}
		
	var is_touchscreen = is_touch_device();
	var touchscreen = 0;
	if (is_touchscreen)
		touchscreen = 1;
	$.post( "<?php echo $php_dir_rel; ?>set_is_touchscreen.php", { is_touchscreen: touchscreen } ) ;
	
<?php
	if ((strpos($user_agent, "Android") === false) || (strpos($user_agent, "Firefox") === false))	{
?>
	var got_mobile = <?php if ($is_mobile === true) echo "true"; else echo "false"; ?>;
	if (is_touchscreen && !got_mobile)
		location.reload();
<?php
	}	else $is_touchscreen = 1;
?>
</script>
