var arrOldValues="";
var arrNewValues="";
var fromarrnew="";
var fromarrold="";
var ccarrnew="";
var ccarrold="";
var nov=0;
var pdfW=0;
var dW=0;
var pW=0;
var AUTHORFIND=0;
var WH=screen.availHeight;
var WW=screen.availWidth/2;
var WT=0;
var WL=screen.availWidth;
var AN=0;
var EN=0;
var BN=0;
var pdfM=0;
var MSTRWW=screen.availWidth*2/5;
var MSTRWTR=MSTRWW*2;
var mymaxmen=0;
var tcount=0;
var menutimer=null;
var NN4 = document.layers? true : false;
var IE4 = document.all? true : false;
var NN6 = document.getElementById? true : false;

function docconfirm(msg) {
   var m=confirm(msg);
   if (m) return true;
   else
      return false;
}

function closeclwd()
{
   pdfW=open('https://www.discoveryforce.com/close.html','pdf','resizable,independent');
   dW=open('https://www.discoveryforce.com/close.html','htm','resizable,independent');
   if (opener && typeof(opener.closed)!='unknown' && !opener.closed)
      opener.history.go();opener.focus();
}

function helpmsg(ID,sText) 
{
   if (sText != ' ')
   {
      if (IE4)
	 document.all[ID].innerHTML = sText;
      if (NN4)
	 document.layers[ID].value=sText;
      if (NN6)
	 document.getElementById(ID).innerHTML=sText;
      document.getElementById(ID).style.visibility="visible";
   }else
      document.getElementById(ID).style.visibility="hidden"; 
} 

function pagePrint()
{
   if (window.print) window.print();
}


function resizeW(W)
{
   if (W) {
      if (!W.closed) {
	 W.resizeTo(WW,WH);
      }
   }
}

function closeW()
{
   if (pdfW)
   {

      pdfW.close();
      pdfW=0;
   }
   if (dW)
   {

      dW.close();
      dW=0;
   }
}

function leftW(W)
{
   if (W) {
      if (!W.closed) {
	 W.resizeTo(screen.availWidth-WW,WH);
	 W.moveTo(0,0);
      }
   }
}

function rightW(W)
{
   if (W) {
      if (!W.closed) {
	 W.resizeTo(screen.availWidth-WW,WH);
	 W.moveTo(screen.availWidth-WW,0);
      }
   }
}

function GetSelectValues(MULTI)
{
   var strTemp = new Array();
   var j=0;
   for(var i=0;i<MULTI.length;i++){
      if(MULTI.options[i].selected == true){
	 strTemp[j]=i;
	 j++;
      }
   }
   return strTemp;
}

function ToName(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   while (ind >= 0)
   {
      var tn=document.getElementById('idnewmembers');
      var fnd=false;
      for (var i=0;i<tn.length;i++)
	 if (MULTI.options[ind].value == tn.options[i].value)
	    fnd=true;
      if (!fnd)
      {
	 var ob1=new Option(MULTI.options[ind].value,MULTI.options[ind].value,true,true);
	 var l=tn.length;
	 tn.options[l]=ob1;
	 tn.options[l].selected=true;
      }
      MULTI.options[ind].selected=false;ind=MULTI.selectedIndex;
   }
}

function ToTag(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if (ind >= 0)
   {
      dtlfrm.ltrarea.value=dtlfrm.ltrarea.value+"<"+MULTI.options[ind].value+">\n";
   }
}

function insgltr(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if (ind >= 0)
   {
      dtlfrm.showto.value=dtlfrm.showto.value+MULTI.options[ind].value+'\n';
   }
}

function ToMail(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if (ind >= 0)
   {
      dtlfrm.showto.value=dtlfrm.showto.value+MULTI.options[ind].value+'\n';
   }
}

function ToText(myText,myMULTI)
{
   var thisText=document.getElementById(myText);
   var MULTI=document.getElementById(myMULTI);
   if (MULTI)
   {
      var ind=MULTI.selectedIndex;
      if (ind >= 0)
      {
	 if (thisText.value.length == 0)
	    thisText.value=MULTI.options[ind].value;
	 else
	    thisText.value=thisText.value+'; '+MULTI.options[ind].value;
	 thisText.scrollTop=thisText.scrollHeight;
      }
   }
}

function showhide(layer) 
{
   var mstr;
   dtlfrm.showto.value='';
   for (var i=1;i<3;i++) {
      mstr='Lv'+i;
      document.getElementById(mstr).style.visibility='hidden';
   }
   document.getElementById(layer).style.visibility='visible';
}

function hidemsg(layer) 
{
   var mstr;
   for (var i=1;i<5;i++) {
      mstr='Iv'+i;
      document.getElementById(mstr).style.visibility='hidden';
   }
}

function showmsg(layer) 
{
   var mstr;
   for (var i=1;i<5;i++) {
      mstr='Iv'+i;
      document.getElementById(mstr).style.visibility='visible';
   }
}

function insmeta(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if (ind >= 0)
   {
      dtlfrm.ltrarea.value=dtlfrm.ltrarea.value+"<%"+MULTI.options[ind].value+"%>";
   }
}

function insltr(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if (ind >= 0)
   {
      dtlfrm.ltrarea.value=dtlfrm.ltrarea.value+"<%"+MULTI.options[ind].value+"%>";
   }
}

function findauth(myMULTI)
{
   if (AUTHORFIND)
      return;
   var e=window.event;
   var fnd=0;
   var ind=0;
   var stest;
   var MULTI = document.getElementById(myMULTI);
   if (e.keyCode >= 32 && e.keyCode <=126)
   {
      stest = dtlfrm.authadd.value+String.fromCharCode(e.keyCode);
      var nf=false;
      fnd=-1;
      if (stest.length)
      {
	 if ((ind=MULTI.selectedIndex) >= 0)
	    MULTI.options[ind].selected=false;
	 if (ind < 0)
	    ind=0;
	 for (var j=0;j<stest.length && j <0;j++)
	    if(MULTI.options.value.charAt(j) != stest.charAt(j))
	       ind=0;
      }
      for (var i=0;i< MULTI.options.length && !nf;i++)
      {
	 if (MULTI.options[i].value.indexOf(stest) == 0)
	    fnd=i;
	 if (fnd >= 0)
	    nf=true;
      }
      if (fnd >= 0)
	 MULTI.options[fnd].selected=true;
   }
}

function popauthchange(myMULTI)
{
   AUTHORFIND=1;var e=window.event;
   var fnd=0;
   var ind=0;
   var stest;
   var MULTI = document.getElementById('idSelAuth');
   if ((ind=MULTI.selectedIndex) >= 0)
   {dtlfrm.authadd.value=MULTI.options[ind].value+' TO: '+MULTI.options[ind].value;
   }
}

function ToName(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if(ind >= 0)
   {
      var tn=document.getElementById('idToAuthor');
      var fnd=false;
      for (var i=0;i<tn.length;i++)
	 if (MULTI.options[ind].value == tn.options[i].value)
	    fnd=true;
      if (!fnd)
      {
	 var ob1=new Option(MULTI.options[ind].value,MULTI.options[ind].value,true,true);
	 var l=tn.length;
	 tn.options[l]=ob1;
	 tn.options[l].selected=true;
      }
      dtlfrm.authadd.value="";}
}

function FromName(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if(ind >= 0)
   {
      var tn=document.getElementById('idFromAuthor');
      var fnd=false;
      for (var i=0;i<tn.length;i++)
	 if (MULTI.options[ind].value == tn.options[i].value)
	    fnd=true;
      if (!fnd)
      {
	 var ob1=new Option(MULTI.options[ind].value,MULTI.options[ind].value,true,true);
	 var l=tn.length;
	 tn.options[l]=ob1;
	 tn.options[l].selected=true;
      }
      dtlfrm.authadd.value="";}
}

function CCName(myMULTI)
{
   var MULTI=document.getElementById(myMULTI);
   var ind=MULTI.selectedIndex;
   if(ind >= 0)
   {
      var tn=document.getElementById('idCCAuthor');
      var fnd=false;
      for (var i=0;i<tn.length;i++)
	 if (MULTI.options[ind].value == tn.options[i].value)
	    fnd=true;
      if (!fnd)
      {
	 var ob1=new Option(MULTI.options[ind].value,MULTI.options[ind].value,true,true);
	 var l=tn.length;
	 tn.options[l]=ob1;
	 tn.options[l].selected=true;
      }
      dtlfrm.authadd.value="";}
}

function FillListValues(MULTI)
{
   var intNewPos=(-1);
   var count=0;
   var ncount=0;
   var i;
   var fnd;
   arrNewValues = GetToSelectValues(MULTI);
   count=arrNewValues.length;
   for(i=0;i<count;i++)
   {
      intNewPos=arrNewValues[i];
      fnd=false;
      for (var j=0;j<arrOldValues.length;j++)
      {
	 if (arrOldValues[j] == arrNewValues[i])
	 {
	    arrOldValues[j]=(-1);
	    fnd=true;
	 }
      }
      if(!fnd)
      {
	 ncount=arrOldValues.length;
	 arrOldValues[ncount]=intNewPos;
      }
      else
      {
	 MULTI.options[intNewPos].selected=false;
      }
   }
   fnd=true;
   if (count == 0)
      fnd=false;
   count=arrOldValues.length;
   for (i=0;i<count;i++)
   {
      intNewPos=arrOldValues[i];
      if (intNewPos >= 0)
      {
	 if (fnd)
	    MULTI.options[intNewPos].selected=true;
	 else
	 {
	    MULTI.options[intNewPos].selected=false;
	    arrOldValues[i]=(-1);
	 }
      }
   }
}

function FromFillListValues(MULTI)
{
   var intNewPos=(-1);
   var count=0;
   var ncount=0;
   var i;
   var fnd;
   fromarrnew = GetSelectValues(MULTI);
   count=fromarrnew.length;
   for(i=0;i<count;i++)
   {
      intNewPos=fromarrnew[i];
      fnd=false;
      for (var j=0;j<fromarrold.length;j++)
      {
	 if (fromarrold[j] == fromarrnew[i])
	 {
	    fromarrold[j]=(-1);
	    fnd=true;
	 }
      }
      if(!fnd)
      {
	 ncount=fromarrold.length;
	 fromarrold[ncount]=intNewPos;
      }
      else
      {
	 MULTI.options[intNewPos].selected=false;
      }
   }
   fnd=true;
   if (count == 0)
      fnd=false;
   count=fromarrold.length;
   for (i=0;i<count;i++)
   {
      intNewPos=fromarrold[i];
      if (intNewPos >= 0)
      {
	 if (fnd)
	    MULTI.options[intNewPos].selected=true;
	 else
	 {
	    MULTI.options[intNewPos].selected=false;
	    fromarrold[i]=(-1);
	 }
      }
   }
}

function CCFillListValues(MULTI)
{
   var intNewPos=(-1);
   var count=0;
   var ncount=0;
   var i;
   var fnd;
   ccarrnew = GetSelectValues(MULTI);
   count=ccarrnew.length;
   for(i=0;i<count;i++)
   {
      intNewPos=ccarrnew[i];
      fnd=false;
      for (var j=0;j<ccarrold.length;j++)
      {
	 if (ccarrold[j] == ccarrnew[i])
	 {
	    ccarrold[j]=(-1);
	    fnd=true;
	 }
      }
      if(!fnd)
      {
	 ncount=ccarrold.length;
	 ccarrold[ncount]=intNewPos;
      }
      else
      {
	 MULTI.options[intNewPos].selected=false;
      }
   }
   fnd=true;
   if (count == 0)
      fnd=false;
   count=ccarrold.length;
   for (i=0;i<count;i++)
   {
      intNewPos=ccarrold[i];
      if (intNewPos >= 0)
      {
	 if (fnd)
	    MULTI.options[intNewPos].selected=true;
	 else
	 {
	    MULTI.options[intNewPos].selected=false;
	    ccarrold[i]=(-1);
	 }
      }
   }
}

function GetSelectValues(MULTI)
{
   var strTemp = new Array();
   var j=0;
   for(var i=0;i<MULTI.length;i++){
      if(MULTI.options[i].selected == true){
	 strTemp[j]=i;
	 j++;
      }
   }
   return strTemp;
}

function GetToSelectValues(MULTI)
{
   var strTemp = new Array();
   var j=0;
   for(var i=0;i<MULTI.length;i++){
      if(MULTI.options[i].selected == true){
	 strTemp[j]=i;
	 j++;
      }
   }
   return strTemp;
}

function GetCurrentTo(MULTI){
   arrOldValues=GetSelectValues(MULTI);
}

function GetToListValues(MULTI){
   FillListValues(MULTI);
   dtlfrm.ToPick.value=GetToAuthorSelect(MULTI);
}

function GetToAuthorSelect(MULTI){
   var strTemp="";
   var ind;
   for (var i=0;i<arrOldValues.length;i++)
   {
      ind=arrOldValues[i];
      if (ind >= 0)
	 strTemp += MULTI.options[ind].value+"\n";
   }
   return strTemp;
}

function GetCurrentFrom(MULTI){
   fromarrold=GetSelectValues(MULTI);
}

function GetFromListValues(MULTI){
   FromFillListValues(MULTI);
   dtlfrm.FromPick.value=GetFromAuthorSelect(MULTI);
}

function GetFromAuthorSelect(MULTI){
   var strTemp="";
   var ind;
   for (var i=0;i<fromarrold.length;i++)
   {
      ind=fromarrold[i];
      if (ind >= 0)
	 strTemp += MULTI.options[ind].value+"\n";
   }
   return strTemp;
}

function GetCurrentCC(MULTI){
   ccarrold=GetSelectValues(MULTI);
}

function GetCCListValues(MULTI){
   CCFillListValues(MULTI);
   dtlfrm.CCPick.value=GetCCAuthorSelect(MULTI);
}

function GetCCAuthorSelect(MULTI){
   var strTemp="";
   var ind;
   for (var i=0;i<ccarrold.length;i++)
   {
      ind=ccarrold[i];
      if (ind >= 0)
	 strTemp += MULTI.options[ind].value+"\n";
   }
   return strTemp;
}

function GetChkboxSelectValues(MULTI){
   for(var i=0;i<MULTI.length;i++){
      if(MULTI.options[i].selected == true){
	 dtlfrm.addgroup.value=MULTI.options[i].value;
      }
   }
}

function GetLetterSelectValues(MULTI){
   for(var i=0;i<MULTI.length;i++){
      if(MULTI.options[i].selected == true){
	 dtlfrm.newltr.value=MULTI.options[i].value;
      }
   }
}

function SelNames(session,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfnames.cgi?nextscript=none&dfsession='+session+'&id='+next,'htm','resizable,scrollbars,dependent');
   leftW(pdfW);
   pdfW.focus();
}

function sendtifonce(action,session,tif,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=gettiff&dfsession='+session+'&tif='+tif+'&next='+next,'TIF','resizable,scrollbars,dependent');
   leftW(pdfW);
   pdfW.focus();
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&tif='+tif+'&next='+next,'htm','resizable,scrollbars,dependent');
   rightW(dW);
   dW.focus();
}

function getpdfile(action,session,pdf,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfpdffile&dfsession='+session+'&did='+pdf+'&next='+next,'pdf','resizable,scrollbars,independent');
}

function getsmfile(action,session,pdf,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfsmfile&dfsession='+session+'&did='+pdf+'&next='+next,'pdf','resizable,scrollbars,independent');
}

function showorig(action,session,pdf,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfpdffile&dfsession='+session+'&did='+pdf+'&next=0&orig='+next,'pdf','resizable,scrollbars,independent');
}

function launchredact(action,session,pdf)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfredact&dfsession='+session+'&did='+pdf,'pdf','resizable,scrollbars,independent');
}

function bresizeW(W)
{
   if (W) {
      if (!W.closed) {
	 W.resizeTo(WW+100,WH);
      }
   }
}

function getgopdfile(action,session)
{
   var pdf=dtlfrm.gorec.value;
   var next=0;
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfpdffile&dfsession='+session+'&did='+pdf+'&next='+next,'pdf','resizable,scrollbars,independent');
}

function sendtifdqn(action,session,tif,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=getdqntiff&dfsession='+session+'&tif='+tif+'&next='+next,'TIF','resizable,scrollbars,dependent');
   leftW(pdfW);
   pdfW.focus();
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&tif='+tif+'&next='+next,'htm','resizable,scrollbars,dependent');
   rightW(dW);
   dW.focus();
   if (!opener)
   {opener=self;
      opener.pdfW=pdfW;
      opener.dW=dW;
   }
}

function sendtiffqr(action,session,tif,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=getfqrtiff&dfsession='+session+'&tif='+tif+'&next='+next,'TIF','resizable,scrollbars,dependent');
   leftW(pdfW);
   pdfW.focus();
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&tif='+tif+'&next='+next,'htm','resizable,scrollbars,dependent');
   rightW(dW);
   dW.focus();
}

function sendtiffac(action,session,tif,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=getfactiff&dfsession='+session+'&tif='+tif+'&next='+next,'TIF','resizable,scrollbars,dependent');
   leftW(pdfW);
   pdfW.focus();
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&tif='+tif+'&next='+next,'htm','resizable,scrollbars,dependent');
   rightW(dW);
   dW.focus();
}

function sendtifdow(action,dfsession,tif,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=getdowtif&dfsession='+session+'&tif='+tif+'&next='+next,'TIF','resizable,scrollbars,dependent,location=0');
   leftW(pdfW);
   pdfW.focus();if (opener != null)
      opener.pdfW=pdfW;

   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&tif='+tif+'&next='+next,'htm','resizable,scrollbars,dependent');
   rightW(dW);
   dW.focus();if (opener != null)
      opener.dW=dW;
}

function sendtifdcl(action,session,tif,next)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=getdfltif&dfsession='+session+'&tif='+tif+'&next='+next,'TIF','resizable,scrollbars,dependent,location=0');
   leftW(pdfW);
   pdfW.focus();
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&tif='+tif+'&next='+next,'htm','resizable,scrollbars,dependent');
   rightW(dW);
   dW.focus();
}

function sendpull(session)
{
   pW=opener.open('dfproc.cgi?nextscript=tifloctsk&'+session,'htm','resizable,scrollbars,dependent');
   pW.focus();
}

function printpage()
{
   window.print();
}

function checkit()
{
   if (document.dtlfrm.ckbeg_nbr.checked)
   {
      BN=document.dtlfrm.pg.value;
      document.dtlfrm.beg_nbr.value=BN;
   }
   if (document.dtlfrm.chabeg_nbr.checked)
   {
      AN=document.dtlfrm.pg.value
	 document.dtlfrm.abeg_nbr.value=AN;
   }
   if (document.dtlfrm.chaend_nbr.checked)
   {
      EN=document.dtlfrm.pg.value;
      document.dtlfrm.aend_nbr.value=EN;
   }
}

function showm(base,layer,top,left) 
{
   tcount=1;
   var divref;
   var tmp;
   var mstr;
   var i;
   var ja;
   var sk;
   var a1=new Array();
   a1=base.split(',');
   for (i=2;i<=mymaxmen;i++) {
      sk=0;
      for (ja=0;ja<a1.length;ja++) {
	 tmp=a1[ja].substring(3);
	 if (tmp == i)
	    sk=1;
      }
      if (sk == 1)
	 continue;
      mstr='divshim-'+i;
      if (document.getElementById(mstr)) {
	 divref=document.getElementById(mstr);
	 divref.style.display='none';
      }
   }
   for (i=2;i<=mymaxmen;i++)
   {

      sk=0;
      for (ja=0;ja<a1.length;ja++) {
	 tmp=a1[ja].substring(3);
	 if (tmp == i)
	    sk=1;
      }
      if (sk == 1)
	 continue; mstr='mu-'+i;
      if (document.getElementById(mstr))
	 document.getElementById(mstr).style.visibility='hidden';
   }
   for (ja=a1.length-1;ja<a1.length;ja++) {
      mstr = a1[ja].substring(0,2);
      if (mstr  == 'mu' && a1[ja] != 'mu-1')
      {
	 document.getElementById(a1[ja]).style.top=top;
	 document.getElementById(a1[ja]).style.left=left;
	 tmp='divshim-'+a1[ja].substring(3);
	 divref=document.getElementById(tmp);
	 mstr=document.getElementById(a1[ja]);
	 tmp=a1[ja].substring(3);
	 divref.style.width=mstr.offsetWidth;
	 divref.style.height=mstr.offsetHeight;
	 divref.style.top=top;
	 divref.style.left=left;
	 divref.style.zIndex=tmp-1;
	 mstr.style.visibility='visible';
	 mstr.style.display='block';
	 divref.style.display='block';
      }
   }
}

function postpage(title) {
   document.forms['subform1'].title.value=title;
   return true;
}


function closeMW()
{
   if (pdfM)
   {
      pdfM.close();
      pdfM=0;
   }
   if (pdfW)
   {
      pdfW.close();
      pdfW=0;
   }
   if (dW)
   {
      dW.close();
      dW=0;
   }
}

function leftLW(W)
{
   if (W) {
      if (!W.closed) {
	 var x=Math.floor(screen.availWidth*2/5);
	 W.resizeTo(x,WH);
	 W.moveTo(0,0);
      }
   }
}

function leftMW(W)
{
   if (W) {
      if (!W.closed) {
	 W.resizeTo((screen.availWidth*2/5),WH);
	 W.moveTo(0+MSTRWW,0);
      }
   }
}

function rightTR(W)
{
   if (W) {
      if (!W.closed) {
	 W.resizeTo((screen.availWidth/5),WH/2);
	 W.moveTo(0+MSTRWTR,0);
      }
   }
}

function setbrange()
{
   var MULTI=document.getElementById('brange');
   var ind=MULTI.selectedIndex;
   if (ind >= 0)
   {
      var b1=new Array();
      b1=MULTI.options[ind].value.split(';');
      var j;
      j=parseInt(b1[0]);if (j > 0){
	 dtlfrm.batesname.value=b1[2];
	 j=parseInt(b1[1]);
	 j++;
	 dtlfrm.batesno.value=j;
      }
      else
      {
	 dtlfrm.batesname.value='';
	 dtlfrm.batesno.value='1'
      }
   }
}

function shp(layer) {
   var mstr;
   for (var i=1;i<=5;i++) {
      mstr='Ph'+i;
      document.getElementById(mstr).style.visibility='hidden';
   }
   document.getElementById(layer).style.visibility='visible';
}


function initdupeimg(action,session,master,pdf,next)
{
   var md=new Date();
   var t=md.valueOf();
   pdfM=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfdupfile&dfsession='+session+'&did='+master+'&next='+next,'master','resizable,scrollbars,independent');
   leftLW(pdfM);
   if (pdfM && typeof(pdfM.closed)!='unknown' && !pdfM.closed)
      pdfM.focus();
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfdupfile&dfsession='+session+'&did='+pdf+'&next='+next,'pdf','resizable,scrollbars,independent');
   leftMW(pdfW);
   if (pdfW && typeof(pdfW.closed)!='unknown' && !pdfW.closed)
      pdfW.focus();
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&did='+pdf+'&next='+next+'&t='+t,'htm','resizable,scrollbars,independent');
   rightTR(dW);
   if (dW && typeof(dW.closed)!='unknown' && !dW.closed)
      dW.focus();
}

function metasendpdfile(action,session,pdf,next)
{
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&did='+pdf+'&next='+next,'htm','resizable,scrollbars,independent');
   rightW(dW);
   if (dW && typeof(dW.closed)!='unknown' && !dW.closed)
      dW.focus();
}

function folderfunc(action,session,did,fnc)
{
   var mystamp=new Date();dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&did='+did+'&fnc='+mystamp,'htm','resizable,scrollbars,independent');
   rightWQ(dW);
   if (dW && typeof(dW.closed)!='unknown' && !dW.closed)
      dW.focus();
}

function GetCCType(MULTI) 
{ 
   var strLv=new Array();
   strLv[0]=1;
   strLv[1]=1;
   strLv[2]=1;
   strLv[3]=1;
   strLv[4]=2;
   strLv[5]=3;
   strLv[6]=4;
   var i=0;
   ind=MULTI.selectedIndex;
   var thisLv='Lv'+strLv[ind];
   var mstr;
   for (i=1;i<=4;i++) { 
      mstr='Lv'+i;
      document.getElementById(mstr).style.visibility='hidden';
   }
   document.getElementById(thisLv).style.visibility='visible';
   return true;
}

function setcptitle(mytitle) {
   compdtl.title.value=mytitle;
   return true;
}

function hidem(layer) {
   var divref;
   var i; var mstr;
   for (i=2;i<=mymaxmen;i++) {
      mstr='divshim-'+i;
      if (document.getElementById(mstr)) {
	 divref=document.getElementById(mstr);
	 divref.style.display='none';
      }
   } if (menutimer != null) {
      clearTimeout(menutimer);
      menutimer=null;
   }
   document.getElementById(layer).style.visibility='hidden';
   for (i=2;i<=mymaxmen;i++)
   {
      mstr='mu-'+i;
      if (document.getElementById(mstr))
	 document.getElementById(mstr).style.visibility='hidden';
   }
}

function showmenu(layer,mm) {
   mymaxmen=mm;
   if (tcount == 0) {
      if (menutimer == null);
      menutimer=setTimeout('goaway()',3000);}
      var divref;
      var i; var mstr;
      for (i=2;i<=mymaxmen;i++) {
	 mstr='divshim-'+i;
	 if (document.getElementById(mstr)) {
	    divref=document.getElementById(mstr);
	    divref.style.display='none';
	 }
      }
      document.getElementById(layer).style.visibility='visible';
      for (i=2;i<=mymaxmen;i++)
      {
	 mstr='mu-'+i;
	 if (document.getElementById(mstr))
	    document.getElementById(mstr).style.visibility='hidden';
      }
}


function dectcount() { 
   if (tcount > 0) tcount=0;
}

function goaway() { 
   if (tcount <= 0) {
      hidem('mu-1');
      menutimer=setTimeout('goaway()',3000);
   }
}

function sendpdfile(action,session,pdf,next)
{
   var md=new Date();
   var t=md.valueOf();
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfpdffile&dfsession='+session+'&did='+pdf+'&next='+next,'pdf','resizable,scrollbars,independent');
   leftW(pdfW);
   if (pdfW && typeof(pdfW.closed)!='unknown' && !pdfW.closed)
      pdfW.focus();
   dW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript='+action+'&dfsession='+session+'&did='+pdf+'&next='+next+'&t='+t,'htm','resizable,scrollbars,independent');
   rightW(dW);
   if (dW && typeof(dW.closed)!='unknown' && !dW.closed)
      dW.focus();
}


function opnjavapageupload(session)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfup&dfsession='+session,'htm','resizable,scrollbars,dependent');
   pdfW.focus();
}

function opnjavapagetreeview(session)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfuprep&dfsession='+session,'htm','resizable,scrollbars,dependent');
   pdfW.focus();
}

function opnjavapagetreeconv(session)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dftreetoconv&dfsession='+session,'htm','resizable,scrollbars,dependent');
   pdfW.focus();
}

function refreshtreepage(session)
{
   window.location='https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfupre&dfsession='+session;
}

function opninvshow(session,invid)
{
   pdfW=open('https://www.discoveryforce.com/cgi-bin/dfproc.cgi?nextscript=dfinvshow&dfsession='+session+'&invid='+invid,'mth','resizable,scrollbars,dependent');
   pdfW.focus();
}

function entersubmit(myfield,e)
{
   var keycode;
   if (window.event) 
      keycode = window.event.keyCode;
   else if (e) 
      keycode = e.which;
   else 
      return true;

   if (keycode == 13)
   {
      myfield.form.submit();
      return false;
   }
   else
      return true;
}

