<!--
  var prev = "x", prevX=0, prevY=0;
  function getPerson() {
    var cur = document.myApplet.getPersonID();
    var curPG = document.myApplet.getPedigreeID();
    if (prev != cur) {
      //document.write(cur);
      prev = cur;
      document.forms['Trans'].PID.value = cur;
//      document.forms['Trans'].CurTID.value = curPG;
      document.forms['Trans'].submit();
//      loadInfo("info.php?PID=" + cur);
    }
    timer2 = window.setTimeout("getPerson()",100);
  }

  function printGraph() {
    document.myApplet.printGraph();
  }

  function ReSizeGraph() {
    var posX = document.myApplet.getSizeX();
    if (prevX != posX) {
      document.applets["myApplet"].width = eval(document.myApplet.getSizeX());
      prevX = posX;
    }
    var posY = document.myApplet.getSizeY();
    if (prevY != posY) {
      document.applets["myApplet"].height = eval(document.myApplet.getSizeY());
      prevY = posY;
    }
    timer3 = window.setTimeout("ReSizeGraph()",1000);
  }

  function loadInfo(url) {
    eval("parent.frames['info'].location='"+url+"'");
  }

  function setExec(ival) {
    document.forms['inf'].exec.value = ival;
  }

  function ChangeFamily() {
//    if (document.forms['inf'].p1.selectedIndex > 1)	// exclude first 2 elements
//      document.forms['inf'].p2.value = document.forms['inf'].p1.item(document.forms['inf'].p1.selectedIndex).text;
  }

  function setIDs() {
    var LstVal = document.forms['inf'].PIDList.value;
    document.forms['inf'].TID.value = eval(LstVal.substring(0, LstVal.indexOf('_')));
    document.forms['inf'].PID.value = eval(LstVal.substring(LstVal.indexOf('_')+1));
  }

  function PicListElem() {
    var i;
    document.forms["selTree"].TID.value = "";
    for (i=0; i < document.forms["selTree"].TIDList.length; i++) {
      if (document.forms["selTree"].TIDList.item(i).selected == true) {
        document.forms["selTree"].TID.value = document.forms["selTree"].TID.value + 
        		"," + document.forms["selTree"].TIDList.item(i).value;
      }
    }
    document.forms["selTree"].TID.value = (document.forms["selTree"].TID.value).substring(1);
  }

  function DirectionChk(chVal) {
    document.forms['mail'].pr1.item(chVal).checked = true;
  }

  function ConcatChk(chVal) {
    document.forms['mail'].pr2.item(chVal).checked = true;
  }

  function BlackWhiteChk() {
    if (document.forms['mail'].pr7.checked)
      document.forms['mail'].pr7.checked = false;
    else
      document.forms['mail'].pr7.checked = true;
  }

  function BoxShowChk() {
    if (document.forms['mail'].pr4.checked)
      document.forms['mail'].pr4.checked = false;
    else
      document.forms['mail'].pr4.checked = true;
  }

  function ShowGraph(txtTID) {
    document.forms['mail'].TID.value = txtTID;
    document.forms['mail'].pg.value = "gph";
    document.forms['mail'].act.value = 0;
    document.forms['mail'].submit();
  }

  function CopyText(Fld) {
    if (Fld == 1 && document.forms['buy_mail'].q21.value.length <= 0)
      document.forms['buy_mail'].q21.value = document.forms['buy_mail'].q11.value;
    if (Fld == 2 && document.forms['buy_mail'].q22.value.length <= 0)
      document.forms['buy_mail'].q22.value = document.forms['buy_mail'].q12.value;
    if (Fld == 3 && document.forms['buy_mail'].q23.value.length <= 0)
      document.forms['buy_mail'].q23.value = document.forms['buy_mail'].q13.value;
  }

  function CalcPrice() {
    var pr = 0;
    var pg = document.forms['buy_mail'].q3.value;
    var usr = document.forms['buy_mail'].q4.value;
    var idx = 0;
    var may = false;
    for (i=0; i < pg.length; i++) {
      if (pg.charAt(i) == ',') {
        if (may)
          idx = idx + 1;
        may = false;
      }
      else {
        if (pg.charAt(i) >= 'A')
          may = true;
      }
    }
    if (may)
      idx = idx + 1;
    if (idx > 0)
      pr = idx * 100 + 100;

    idx = 0;
    may = false;
    for (i=0; i < usr.length; i++) {
      if (usr.charAt(i) == '\r' || usr.charAt(i) == '\n') {
        if (may)
          idx = idx + 1;
        may = false;
      }
      else {
        if (usr.charAt(i) >= 'A')
          may = true;
      }
    }
    if (may)
      idx = idx + 1;
    if (idx > 3)
      pr = pr + (idx-3) * 5;

    document.forms['buy_mail'].price.value = pr;
  }
//-->
