<?php

# The getIPAddress method comes from system/utils.php in the Minerva package
# The script also expects to have included the rest of system (e.g. browserlist.conf
# and browser_factory)

$ipaddr = getIPAddress();

   $style = $_GET['WRP000X0_style'];
   $dostyle = array_key_exists('WRP000X0_dostyle', $_GET) ? $_GET['WRP000X0_dostyle'] : "";

   switch($ipaddr) {
      case "192.168.1.132": // kitchen tablet PC (height accounts for border)
         $style = STYLE_TABLET_LARGE;
         break;

      case "192.168.1.131": // hall-mounted iPod Touch
         $style = STYLE_TABLET_SMALL;
         break;

      default:
         $browser = $_SERVER['HTTP_USER_AGENT'];
         if (strstr($browser, "iPhone")) {
            $style = STYLE_TABLET_SMALL;
         } else if (strstr($browser, "iPad")) {
            $style = STYLE_TABLET_LARGE;
         }
         break;

   }


   switch($style) {
      case STYLE_TABLET_LARGE:
         return new WebBrowser(new WAM_FactoryTouch($style), 1024, 740);

      case STYLE_TABLET_SMALL:
         return new WebBrowser(new WAM_FactoryTouch($style), 480, 320);

      case STYLE_FULL:
      default:
         return new WebBrowser(new WAM_Factory(STYLE_FULL));
   }


?>