
function loginwindow()
{
    in_x = 350;
    in_y = 250;
    newwin = window.open("/login/login.php", "information_window", "toolbar=0,resizable=1,scrollbars=1,directories=0,status=0,menubar=0,width="+in_x+",height="+ in_y);
    newwin.moveTo(50,50);
}


function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;

  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0)
      break;
  }

  return null;
}

function popup_mail() {

  var ulaccount;
  var url;

  ulaccount = GetCookie("ULAccount");
  if (ulaccount) {
    url=GetCookie("mailcentre");
    if (! url) {
      url = 'http://www.breathe.com/mail/login.html';
    }
  } else {
    url = 'http://www.breathe.com/mail/login.html';
  }
  handle= window.open(url,'mailpopup','toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,width=700,height=510');
  handle.focus();

}


function popup_mail_login() {

  var ulaccount;
  var url;

  url = 'http://www.breathe.com/mail/login.html';
  handle= window.open(url,'mailpopup','toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,width=700,height=510');
  handle.focus();

}




function popup_bookmarks() {

  var ulaccount;
  var url;

  if (ulaccount = GetCookie("ULAccount")) {
    url='/services/bookmarks.cgi';
    handle = window.open(url,'bookmarkspopup','toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,width=700,height=510');
    handle.focus();
  } else {
       top.location="/services/";
  }

}

function getMyCookie(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { // if there are any cookies
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset)
      // set index of end of cookie value
      if (end == -1) {
        end = document.cookie.length
      }
      return unescape(document.cookie.substring(offset, end))
    }
  }
}

function updateForm() {
  var account = getMyCookie('ULAccount');
  var ddate = new Date();
  var passwd = getMyCookie('ULPassword');

  document.emuform.user_name.value = account;
  document.emuform.password.value = passwd;
  document.emuform.sessionID.value = ddate.getTime();
}

