function MM_openBrWindow(theURL,winName,fures) { //v2.0(modified)
  SafeJumpSub(theURL, winName, fures, 1);
}
function closeWin() {
  if (!subWin.closed) subWin.close();
}

function SafeJump() {
  var theURL, winName;
  theURL = arguments[0];
  if (arguments.length <= 1) {
    winName = "";
  } else {
    winName = arguments[1];
  }
  SafeJumpSub(theURL, winName, "", 0);
}

var sjs_theURL, sjs_winName, sjs_features, sjs_mode;
var sjs_oeh, sjs_ehn;
var sjs_tout;
var sjs_form;

function SafeJumpSub(theURL, winName, features, mode) {
  var i, j, p, ps, rf, tf, tw, win, f, l, le, n, v, td, gt;
  var pf_winName, pf_url, pf_anc, pf_prm, prms;

  pf_winName = winName;
  ps = theURL.indexOf("?");
  if (ps >= 0) {
    rf = 0;
    if        (mode == 0) {
      if (pf_winName == "")       { pf_winName = "_self"; }
      if (pf_winName == "_blank") { rf = 1; }
    } else if (mode == 1) {
      if (pf_winName == ""      ) { rf = 1; }
    } else if (mode == 2) {
      tf = 0;
      if (pf_winName != "" && eval('(typeof(' + pf_winName + ') == "object") ? 1 : 0') == 1) {
        tw = eval(pf_winName);
        if (SJSub_chkClosed(tw) == true) {
          pf_winName = "";
        } else {
          sjs_theURL   = theURL;
          sjs_winName  = winName;
          sjs_features = features;
          sjs_mode     = mode;
          if (typeof(window.onerror) != "object" && typeof(window.onerror) != "undefined") {
            sjs_ehn = "";
          } else {
            sjs_ehn = "window.onerror";
          }
          if (sjs_ehn != "") {
            eval('sjs_oeh = ' +     sjs_ehn);
            eval( sjs_ehn     + ' = SJSub_errHandler');
          }
          if (typeof(tw.name) != "string") {
            tf = 2;
            pf_winName = "";
          } else {
            tf = 1;
            pf_winName = tw.name;
          }
          SJSub_restoreEH();
        }
      }
      if (pf_winName == "")       { rf = 1; }
    } else if (mode == 12) {
      tw = eval(pf_winName);
      tf = 2;
      pf_winName = "";
      rf = 1;
      mode = 2;
    }

    if (rf == 1) {
      td = new Date();
      gt = td.getTime();
      pf_winName = gt.toString() + Math.ceil(Math.random() * 100).toString();
      if(pf_winName.substring(0, 1) == "-") {
        pf_winName = pf_winName.substring(1, pf_winName.length - 1);
      }
    }

    l = document.forms.length
    for(i = l - 1; i >= 0; i--) {
      f = document.forms[i];
      if (f.name == "PFSafe") {
        break;
      }
    }

    le = f.elements.length
    for(i = 0; i < le; i++) {
      f.elements[i].name  = "";
      f.elements[i].value = "&&&NULL&&&";
    }

    pf_url = theURL.substring(0, ps);
    pf_anc = "";
    pf_prm = theURL.substring(ps + 1, theURL.length);
    p = pf_prm.indexOf("#");
    if (p >= 0) {
      pf_anc = "#" + pf_prm.substring(p + 1, pf_prm.length);
      pf_prm = pf_prm.substring(0, p);
    }

    prms = new Array();
    prms = pf_prm.split("&");
    l = prms.length
    for(i = 0; i < l; i++) {
      p = prms[i].indexOf("=");
      if (p >= 0) {
        n = prms[i].substring(0, p);
        v = prms[i].substring(p + 1, prms[i].length);
        f.elements[i].name  = n;
        for(j = 0; j < le; j++) {
          if (f.elements[j].name == n && f.elements[j].value == "&&&NULL&&&") {
            f.elements[j].value = v;
            break;
          }
        }
      }
    }

    for(i = 0; i < le; i++) {
      if (f.elements[i].name == "" && f.elements[i].value == "&&&NULL&&&") {
        f.elements[i].value = "";
      }
    }

    if        (mode == 0) {
      if (pf_winName != "" &&  pf_winName != "_self") {
        window.open("", pf_winName);
      }
    } else if (mode == 1) {
      window.open("", pf_winName, features);
    } else if (mode == 2) {
      if (tf == 1 || tf == 2) {
        tw.name = pf_winName;
      } else {
        window.open("", pf_winName);
      }
    }

    f.action = pf_url + pf_anc;
    f.target = pf_winName;
    sjs_form = f;
    sjs_tout = setTimeout('SJSub_submit()', 1);
  } else {
    if        (mode == 0) {
      if (pf_winName != "" &&  pf_winName != "_self") {
        if (pf_winName == "_blank") {
          pf_winName = "";
        }
        window.open(theURL, pf_winName);
      } else {
        sjs_theURL = theURL;
        setTimeout('SJSub_go()', 1);
      }
    } else if (mode == 1) {
      window.open(theURL, pf_winName, features);
    } else if (mode == 2) {
      if (pf_winName == "") {
        pf_winName = "self";
      }
      if (SJSub_chkClosed(pf_winName) == true) {
        win = window.open(theURL, pf_winName);
        win.location.href = theURL;
      } else {
        eval(pf_winName + '.location.href="' + theURL + '"');
      }
    }
  }
}

function SJSub_go() {
  location.href = sjs_theURL;
}

function SJSub_submit() {
  clearTimeout(sjs_tout);
  sjs_form.submit();
  setTimeout('SJSub_clean()', 500);
}

function SJSub_clean() {
  var i, le;

  le = sjs_form.elements.length
  for(i = 0; i < le; i++) {
    sjs_form.elements[i].name  = "";
    sjs_form.elements[i].value = "";
  }
}

function SJSub_errHandler(msg, url, lno) {
  SJSub_restoreEH();
  SafeJumpSub(sjs_theURL, sjs_winName, sjs_features, 12)
  return true;
}

function SJSub_restoreEH() {
  if (sjs_ehn != "") {
    eval(sjs_ehn + ' = sjs_oeh');
  }
}

function SJSub_chkClosed(win) {
  var ua;

  if (typeof(win) == "string") {
    if (eval('(typeof(' + win + ') == "object") ? 1 : 0') == 1) {
      win = eval(win);
    } else {
      win = null;
    }
  }
  if (!!win) {
    ua = navigator.userAgent;
    if ((ua.indexOf('Gecko') != -1 || ua.indexOf('MSIE 4') != -1) && ua.indexOf('Win') != -1) {
      return win.closed;
    } else {
      return typeof(win.document) != "object";
    }
  } else {
    return true;
  }
}
