// This file contains intellectual property and artistic creations 
// by Dennis Sandow and is copyright 2000-2010 by the author. 
// For use only on websites maintained by Dennis Sandow, or with
// specific permission.  Do not remove this notice.

if ( typeof acornAmt == udf || ! acornAmt ) var acornAmt=10000;
if ( typeof acornTarg == udf || ! acornTarg ) var acornTarg=500000;
var acornPct;

function acornPrep(){
  if( ! acornAmt ) return false;
  Captn['akorn'] = 'Update';
  Mesage['akorn'] = '<form action="http://www.longhillnj.info/cgi-local/admin/acorn.cgi" method="post"><center><input type=text name=acornAmt value="'+acornAmt+'"><br><input type=text name=acornTarg value="'+acornTarg+'"><br><input type=submit value="Update"></center></form><!-- href= -->'
  acornPct=Math.round(100*acornAmt/acornTarg);
  return true;
};

function Acorn(rl,thermHt,thermWd,thermColorImageFile1,thermColorImageFile2){
  if( ! acornPrep() ) return;
  if ( typeof thermWd == udf || thermWd == '' ) thermWd = 20;
  if ( typeof thermColorImageFile1 == udf || thermColorImageFile1 == '' ) {
     thermColorImageFile1 = 'picts/red.jpg';
  };
  if ( typeof thermColorImageFile2 == udf || thermColorImageFile2 == '' ) {
     thermColorImageFile2 = 'picts/red.jpg';
  };
  acornBarHt= Math.round(thermHt*acornPct/100);
  if ( rl ) rlAlign=' align='+rl; else rlAlign='';
  acornWord = '<b>Acorn';
// declare acornLink='acorn.htm' in main to get a link here. Else plain-text.  
  if ( typeof acornLink != udf ) { acornWord = '<b><a href='+acornLink+'>Acorn</a>'; };
  document.write(''+
    '<table name=akorn bgcolor=#ffffff '+rlAlign+' width=1% border=1 cellpadding=3 cellspacing=0>'+
    '<tr><td align=center class=v10>'+acornWord+'<br>Status</b><br><span class=v8>'+acornPct+'%</span>'+
    '<table bgcolor=#ffffff width='+thermWd+' height='+thermHt+' border=1 cellpadding=0 cellspacing=0>');
  if( acornPct > 100 ) {
  acornBarHtOF = Math.round(thermHt* (acornPct-100)/acornPct);
    document.write('<tr valign=bottom><td>'+
      '<img src="'+thermColorImageFile2+'" width="'+thermWd+'px" height="'+acornBarHtOF+'px">'+
      '</td></tr>');
    thermWd -=4; acornBarHt = thermHt - acornBarHtOF;
  };

  document.write('<tr valign=bottom><td align=center>');
  if ( isWeb && ( isExpress || mySpecial ) ) {
    document.write('<a href="javascript:void(0)" onmouseout="xnd()"onclick="return HintPop(\'akorn\',\'\')"><img src="'+thermColorImageFile1+'" width="'+thermWd+'px" height="'+acornBarHt+'px" border=0></a></td>');
  } else if ( isWeb ) {
    document.write('<a href="javascript:void(0)" onclick="alert(\'Not Priviledged\')"><img src="'+thermColorImageFile1+'" width="'+thermWd+'px" height="'+acornBarHt+'px" border=0></a></td>');
  } else {
    document.write('<a href="javascript:void(0)" onclick="alert(\'Not on-line\')"><img src="'+thermColorImageFile1+'" width="'+thermWd+'px" height="'+acornBarHt+'px" border=0></a></td>');
  };
  document.write('</td></tr></table></td></tr></table>');
};

function AcornPix(k12){
  if( ! acornPrep() ) return;

  acornBarHt1= Math.min(193, Math.round(193*acornPct/100) );
  acornBarHt2= Math.max( 0, Math.round(193*acornPct/100)-193 );
  
//  alert('<td valign=bottom background="../lht/picts/libthebg.jpg">'+
//         '<img src="../lht/picts/libtherv.jpg" width="27px" height="'+acornBarHt1+'px"></td>'+
//         '<td valign=bottom background="../lht/picts/libthetc.jpg">'+
//         '<img src="../lht/picts/red.jpg" width="27px" height="'+acornBarHt2+'px"></td>');
  
//  document.write( '<td valign=bottom bgcolor="#c0c060">'+
  if (k12==1) {
    if ( isWeb && ( isExpress || mySpecial ) ) {
      document.write( '<td valign=bottom background="picts/libthebg.jpg">'+
         '<a href="javascript:void(0)" onmouseout="xnd()"onclick="return HintPop(\'akorn\',\'\')"><img src="picts/libtherv.jpg" width="27px" height="'+acornBarHt1+'px" border=0></a></td>');
    } else if ( isWeb ) {
      document.write( '<td valign=bottom background="picts/libthebg.jpg">'+
           '<a href="javascript:void(0)" onclick="alert(\'Not Priviledged\')"><img src="picts/libtherv.jpg" width="27px" height="'+acornBarHt1+'px" border=0></a></td>');
    } else {
      document.write( '<td valign=bottom background="picts/libthebg.jpg">'+
           '<a href="javascript:void(0)" onclick="alert(\'Not on-line\')"><img src="picts/libtherv.jpg" width="27px" height="'+acornBarHt1+'px" border=0></a></td>');
    };
  };
  if (k12==2 && ! acornBarHt2 ) document.write( '<td>'+
         '<img src="picts/libthetc.jpg" width="27px" height="83px"></td>');
  if (k12==2 && acornBarHt2 ) document.write( '<td valign=bottom background="picts/libthetc.jpg">'+
         '<img src="picts/red.jpg" width="27px" height="'+acornBarHt2+'px"></td>');
};

function comma3(arg) {
  d3 = 3; arg += ''; Len = arg.length; OutC = ''
  for ( c = Len-d3; c >=0; c-=d3 ) {
    OutC = arg.substr(c,d3)+ (OutC?','+OutC:'') ;
  };
  if ( d3+c ) OutC = arg.substr(0,d3+c)+ (OutC?','+OutC:'');
  return OutC;
};
