var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                      (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_gecko = (agt.indexOf('gecko') != -1);
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
var is_nav4down = (is_nav && (is_major <= 4))
var is_ie5down = (is_ie && !is_ie6up)

var ns6=document.getElementById&&!document.all
var ie5=document.all

var i_right2 = new Image()
var i_left2 = new Image() 

var regexpNumber = /^\d{1,4}(\.\d{1,2})?$/;

function InitialiseSiteJS()
{
  i_left2.src = '../1gfx/left2.gif'
  i_right2.src = '../1gfx/right2.gif'
}

//pre-process string
function ppStr(str)
{
  var re = /'/g
  str = str.replace(re, "&#39;")
  re = /"/g
  str = str.replace(re, "&#34;")
  //re = /&/g
  //str = str.replace(/&/g, "&amp";)
  re = /£/g
  return str.replace(re, "&#163;")
}
function ppHtmlAreaStr(str)
{
  return ppStr(str)
}

function ov1(obj){obj.style.background="#ddddff"; return true;}
function ou1(obj){obj.style.background="#cccccc"; return true;}
function ou1a(obj){obj.style.background="#ffffff"; return true;}
function ovEmph1(obj){obj.style.background="#d0ccff"; return true;}
function ouEmph1(obj){obj.style.background="#ffcccc"; return true;}
function ov2(obj){obj.style.border="1px solid #ff0000";obj.style.background="#cccccc"; return true;}
function ou2(obj){obj.style.border="1px solid #000000";obj.style.background="#ffffff"; return true;}
function ovt2(obj){return true;}
function out2(obj){return true;}

/* Cookies */
function ReadCookie(cookieName) 
{
  var CookieString = document.cookie
  var CookieSet = CookieString.split (';')
  var SetSize = CookieSet.length
  var CookiePieces
  var ReturnValue = ""
  var x = 0;

  for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) 
  {
    CookiePieces = CookieSet[x].split('=')
    if (CookiePieces[0].substring(0,1) == ' ') 
      CookiePieces[0] = CookiePieces[0].substring(1, CookiePieces[0].length)
    if (CookiePieces[0] == cookieName) 
      ReturnValue = unescape(CookiePieces[1])
  }
  return ReturnValue
}

function WriteCookie(cookieName, cookieValue, expiry) 
{
  var expDate = new Date()

  if(expiry)
  {
    expDate.setTime (expDate.getTime() + expiry)
    document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString()
  }
  else
  {
    document.cookie = cookieName + "=" + escape (cookieValue)
  }
}
function WriteToLayer(id, content) {if (document.getElementById(id))  document.getElementById(id).innerHTML = content;}

function popup1(mylink, windowname, bath_name)
{
WriteCookie("BathName", bath_name)
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
mywindow=window.open(href, windowname, 'width=600,height=700, resizable=yes,scrollbars=yes');
mywindow.focus();
return false;
}

function popup2DS(mylink, windowname, bath_name)
{
WriteCookie("BathName", bath_name)
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
mywindow=window.open(href, windowname, 'resizable=yes,scrollbars=yes');
mywindow.focus();
return false;
}

function SaveTitle(title)
{
WriteCookie("Title", title)
return true;
}

function SetWindowAndTitle(wnd)
{
SaveTitle("Double Ended Baths");
window.location = wnd;
return true;
}

onload=InitialiseSiteJS

