function getBrowserObj() {
  var _browser = new Object()
  var browser_type = window.navigator.appName
  var browser_version = window.navigator.appVersion
  
  if (browser_version.indexOf("MSIE")<0) {
    browser_version=parseFloat(browser_version)
    _browser.ie = false
  } else {
    _browser.ie = true
    browser_version=parseFloat(browser_version.substring(browser_version.indexOf("MSIE")+5,browser_version.indexOf("MSIE")+10))
  }
  _browser.type = browser_type
  _browser.version = browser_version
  return _browser
}
function interrogate(what) {
  var output = '';
  for (var i in what) {
    ee = eval('what.'+i);
    ee = ''+ee;
    if (ee.length > 20) ee = '[too long]';
    //      ee = what;
    output += i + '='+ee+ '; ';
  }
  alert(output);
}

var popupxCookieName;
function openPopup(theURL)
        {
                var x = GetCookie(popupxCookieName);
                if (x == null) x = (screen.width - 640) / 2;
                var h = screen.height - 70;
                var properties = "width=610,toolbar=no,menubar=yes,status=yes,resizable=yes,scrollbars=yes";
                var y = 0;
                properties += ",height=" + h + ",left=" + x + ",top=" + y + ",screenX=" + x + ",screenY=" + y;

                uploadWindow = window.open(theURL, "ShowPhoto", properties);
               if (uploadWindow.opener == null)
                        uploadWindow.opener = window;
               uploadWindow.opener.name = "opener";
               uploadWindow.focus();
        }

function closeWin()  {
    if (window.screenX != null) {
         SetCookie(popupxCookieName,window.screenX,365);
         }
    else {
         if (window.screenLeft != null) {
          if (window.screenLeft-4 >=0) SetCookie(popupxCookieName,window.screenLeft-4,365);
          else SetCookie(popupxCookieName,1,365);
         }
    }
    window.close();
}

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 SetCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function DeleteCookie (name) {
        var exp = new Date();
        exp.setTime (exp.getTime() - 1);
        // This cookie is history
        var cval = GetCookie (name);
        document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}

