/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function getClientSize(formID)
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' )
  {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
  {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  document.getElementById(formID).aW.value=myWidth;
  document.getElementById(formID).aH.value=myHeight;
}

function goPage(nextPage,thisPage)
{   var loadPage=nextPage;
    var k=nextPage.indexOf("?",0);
    if (k>0)
    {   loadPage=nextPage.substring(0,k);
        var n=nextPage.length-k;
        var paras=nextPage.substr(k+1,n);
        var para=paras.split('&');
        var pN=para.length;
        var p;
        for (p=0;p<pN;p++)
        {   var pair=para[p].split('=');
            if (pair[0]=='only1') document.getElementById('Only').only1.value=pair[1];
            if (pair[0]=='only2') document.getElementById('Only').only2.value=pair[1];
            if (pair[0]=='only3') document.getElementById('Only').only3.value=pair[1];
        }
    }
    document.getElementById('Only').pID.value=loadPage;
    if (thisPage!="-") document.getElementById('Only').lastpID.value=thisPage;
    document.getElementById('Only').submit();
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

var popped=new Array();   // list of dynamic popups
var poppedH=new Array();  // matching list of original heights
var poppedR=new Array();  // matching list of remaining heights (0 if hidden)
var poppedF=new Array();  // matching list of flags  K=keep
var poppedP=new Array();  //                  parent being Kept
var buttonOnEntry="*new*";

function popBack(zz,id,hiteRemaining)
{
/*    var z=document.getElementById('trace').innerHTML;
    z='PopBack: '+zz+','+id+','+hiteRemaining+'<br />'+z;
    document.getElementById('trace').innerHTML=z;
*/
    var hiteOriginal=100;
    var n=popped.length;
    var empty=n;
    var hit=-1;
    if (n>0)
    {   for (i=0;i<n;i++)
        {   if (popped[i]==id)
            {   hiteRemaining=poppedR[i];
                hiteOriginal =poppedH[i];
                hit=i;
                if (poppedF[i]=='K') return;
            }
        }
    }

    if (hiteRemaining==-999)
    {   hitepx=document.getElementById(id).style.height;
        if (hitepx.length==0) hitepx=hiteOriginal+'px';
        hiteRemaining=parseFloat(hitepx);
        hiteOriginal=hiteRemaining;
    }

    if (hit<0)
    {   //alert('Missing '+id);  this happens - why?
        popped[empty] =id;
        poppedH[empty]=hiteOriginal;
        poppedR[empty]=0;
        poppedF[empty]="-";
        poppedP[empty]="-";
        hit=empty;
    }

    hiteRemaining-=10;
    if (hiteRemaining<1)
    {   document.getElementById(id).style.height=hiteOriginal+'px';
        poppedR[hit]=0;
        document.getElementById(id).style.display='none';
        var parentID=poppedP[hit];
        if (parentID!='-')
        {   var doThis="popKill('BACK','"+parentID+"');";
            setTimeout(doThis,1);
        }
    } else
    {   document.getElementById(id).style.height=hiteRemaining+'px';
        poppedR[hit]=hiteRemaining;
        var doThis="popBack('recurse','"+id+"',"+hiteRemaining+");";
        setTimeout(doThis,1);
    }

/*  z2='';
    var zn=popped.length;
    if (zn>0)
    {   for (iz=0;iz<zn;iz++)
        {   z2=z2+popped[iz]+'  '+poppedR[iz]+'   '+poppedH[iz]+'   '+poppedF[iz]+'   '+poppedP[iz]+'<br />';
        }
    }
    document.getElementById('trace2').innerHTML=z2;
*/
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function popKill(zz,id)
{
/*  var z=document.getElementById('trace').innerHTML;
    z='PopKill: '+zz+','+id+'<br />'+z;
    document.getElementById('trace').innerHTML=z;
*/
    var hiteOriginal=200;
    var n=popped.length;
    if (n>0)
    {   for (i=0;i<n;i++)
        {   if (popped[i]==id)
            {   poppedR[i]=0;
                poppedF[i]='-';
                hiteOriginal=poppedH[i];
            }
            if (poppedP[i]==id)
            {   popKill("Child",popped[i]);
            }
        }
    }

    document.getElementById(id).style.height=hiteOriginal+'px';
    document.getElementById(id).style.display='none';

/*  z2='';
    var zn=popped.length;
    if (zn>0)
    {   for (iz=0;iz<zn;iz++)
        {   z2=z2+popped[iz]+'  '+poppedR[iz]+'   '+poppedH[iz]+'   '+poppedF[iz]+'   '+poppedP[iz]+'<br />';
        }
    }
    document.getElementById('trace2').innerHTML=z2;
*/
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function popKillAll()
{   var n=popped.length;
    if (n>0)
    {   for (i=0;i<n;i++)
        {   if (poppedR[i]>0)
            {   popKill('All',popped[i]);
            }
        }
    }
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function popUp(ev,zz,parentID,keepParent,showID,left,top)
{
/*  var z=document.getElementById('trace').innerHTML;
    z='PopUp: '+zz+','+parentID+','+keepParent+','+showID+','+left+','+top+','+buttonOnEntry+'<br />'+z;
    document.getElementById('trace').innerHTML=z;
*/
    if (buttonOnEntry=='*new*')
    {   buttonOnEntry=parentID;
        return;
    }
    if (buttonOnEntry==parentID) return;

    buttonOnEntry='*over*'

    /* start killing other pop-ups other than parent sub-menu (if any)*/
    if (keepParent=='-') parentID='-';
    var n=popped.length;
    if (n>0)
    {   for (i=0;i<n;i++)
        {   if (poppedR[i]>0)
            {   if (popped[i]!=showID)
                {   if (parentID==popped[i]) poppedF[i]='K'; else popKill('UP',popped[i]);
                }
            }
        }
    }

    var hitepx=document.getElementById(showID).style.height;
    if (hitepx.length==0) hitepx='400px';
    var hiteRemaining=parseFloat(hitepx);

    var hit=-1;
    var empty=n;
    if (n>0)
    {   for (i=0;i<n;i++)
        {   if (popped[i]==showID) hit=i;
        }
    }
    if (hit<0)
    {   popped[empty]=showID;
        poppedH[empty]=hiteRemaining;
        poppedR[empty]=hiteRemaining;
        poppedF[empty]='-';
        hit=empty;
    } else
    {   poppedR[hit]=poppedH[hit];
    }
    poppedP[hit]=parentID;

/*  z2='';
    var zn=popped.length;
    if (zn>0)
    {   for (iz=0;iz<zn;iz++)
        {   z2=z2+popped[iz]+'  '+poppedR[iz]+'   '+poppedH[iz]+'   '+poppedF[iz]+'   '+poppedP[iz]+'<br />';
        }
    }
*/
    var leftOff=left+ 7 /*" + offsetLeft.ToString() + @"*/;
    var topPx  =top+  0 /*" + offsetTop.ToString()+ @"*/+'px';
    var leftPx=leftOff+'px';

    document.getElementById(showID).style.top    =topPx;
    document.getElementById(showID).style.left   =leftPx;

    document.getElementById(showID).style.height =poppedH[hit]+'px';
    document.getElementById(showID).style.display='block';

    if (!ev) var ev = window.event;
	if (ev.stopPropagation) ev.stopPropagation();
	ev.cancelBubble = true;

/*	z=document.getElementById('trace').innerHTML;
    z='PopUp: '+zz+' Bubble Stopped<br />'+z;
    document.getElementById('trace').innerHTML=z;
*/
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function mouseOnPage()
{
    if (buttonOnEntry=='*new*')
    {   buttonOnEntry='wholePage';
    }
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function sH(obj)
{
    if (buttonOnEntry=='*new*')
    {   buttonOnEntry=obj.id;
        return;
    }
    obj.className='staticHover';
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function sHH(obj)
{
    if (buttonOnEntry=='*new*')
    {   buttonOnEntry=obj.id;
        return;
    }
    obj.className='staticHoverHand';
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function sO(obj) {obj.className='static';}
function dHH(obj){obj.className='dynamicHoverHand';}
function dH(obj) {obj.className='dynamicHover';}
function dO(obj) {obj.className='dynamic';}
function nHH(obj){obj.className='newsHoverHand';}
function nO(obj) {obj.className='news';}
function HH(obj) {obj.className='hoverHand';}
function nH(obj) {obj.className='noHover';}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

function missive(tcIn1,tcIn2)
{   var lcIn1=tcIn1;
    while ( lcIn1.indexOf(';')>-1 ) lcIn1=lcIn1.replace(';','.');
    var lcIn2=tcIn2;
    while ( lcIn2.indexOf(';')>-1 ) lcIn2=lcIn2.replace(';','.');
    while ( lcIn2.indexOf('|')>-1 ) lcIn2=lcIn2.replace('|','%0d%0a');
    var lcPepys3='xxtxox';
    var lcPepys2='xilx';
    var lcPepys1='xmxxxxaxxx';
    var lcPepys4=String.fromCharCode(64,58);
    var lcPepys=lcPepys1+lcPepys2+lcPepys3;
    while ( lcPepys.indexOf('x')>-1 ) lcPepys=lcPepys.replace('x','');
    parent.location=lcPepys+lcPepys4.charAt(1)+lcIn1+lcPepys4.charAt(0)+lcIn2;
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
