// <SCRIPT LANGUAGE="JavaScript" type="text/javascript">

function check_mobile()
{
  var ns4 = (document.layers)? true:false;
  var ie4 = (document.all)? true:false;

  // this seems to work with Palm Web and Safari in most cases
  var winW = (ns4)? window.innerWidth-16 : document.body.clientWidth-20;

  // this works with Safari but not with Palm Web
  if (isNaN (winW))
    winW = (ns4)? window.innerWidth-16 : document.body.scrollWidth-20;

  // winW = (ns4)? window.innerWidth-16 : document.width-20;

  // document.write (ns4);
  // document.write (ie4);
  // document.write (window.innerWidth-16);
  // document.write (winW);

  // document.write (navigator.userAgent);

  // special check for iPhone or iPod Touch
  var nSafari = navigator.userAgent.indexOf ("Safari");
  var nMobile = navigator.userAgent.indexOf ("Mobile");
  var bMobileSafari = nSafari > -1 && nMobile > -1;

  if ((winW < 400) || bMobileSafari) {
    u = document.URL;
    re = /.*\?.*/
    if (re.test (u))
      uu = u + "&Palm=1";
    else
      uu = u + "?Palm=1";
    window.location = uu;
    // document.write (uu);
    exit;
  }
}

check_mobile();

// </SCRIPT>

