
  var month           = new Array(12);

  month[0]            = "January";
  month[1]            = "February";
  month[2]            = "March";
  month[3]            = "April";
  month[4]            = "May";
  month[5]            = "June";
  month[6]            = "July";
  month[7]            = "August";
  month[8]            = "September";
  month[9]            = "October";
  month[10]           = "November";
  month[11]           = "December";

  var monthabbr       = new Array(12);

  monthabbr[0]        = "Jan";
  monthabbr[1]        = "Feb";
  monthabbr[2]        = "Mar";
  monthabbr[3]        = "Apr";
  monthabbr[4]        = "May";
  monthabbr[5]        = "Jun";
  monthabbr[6]        = "Jul";
  monthabbr[7]        = "Aug";
  monthabbr[8]        = "Sep";
  monthabbr[9]        = "Oct";
  monthabbr[10]       = "Nov";
  monthabbr[11]       = "Dec";

  var day             = new Array(7);

  day[0]              = "Sunday";
  day[1]              = "Monday";
  day[2]              = "Tuesday";
  day[3]              = "Wednesday";
  day[4]              = "Thursday";
  day[5]              = "Friday";
  day[6]              = "Saturday";

  var dayabbr         = new Array(7);

  dayabbr[0]          = "Sun";
  dayabbr[1]          = "Mon";
  dayabbr[2]          = "Tue";
  dayabbr[3]          = "Wed";
  dayabbr[4]          = "Thu";
  dayabbr[5]          = "Fri";
  dayabbr[6]          = "Sat";

  var now             = new Date();
  var now_Y           = now.getFullYear();
  var now_M           = ((now.getMonth() + 1).toString().length == 2) ? (now.getMonth() + 1) : '0' + (now.getMonth() + 1) ;
  var now_txtofmonth  = month[now.getMonth()];
  var now_abbrofmonth = monthabbr[now.getMonth()];
  var now_D           = (now.getDate().toString().length == 2) ? now.getDate() : '0' + now.getDate() ;
  var now_day         = now.getDay();
  var now_txtofday    = day[now.getDay()];
  var now_abbrofday   = dayabbr[now.getDay()];
  var now_hr          = (now.getHours().toString().length == 2) ? now.getHours() : '0' + now.getHours() ;
  var now_min         = (now.getMinutes().toString().length == 2) ? now.getMinutes() : '0' + now.getMinutes() ;
  var now_sec         = (now.getSeconds().toString().length == 2) ? now.getSeconds() : '0' + now.getSeconds() ;
  var now_time        = now_hr+':'+now_min+':'+now_sec;
  var now_today       = now_M+'/'+now_D+'/'+now_Y;
  var now_print       = now_today+' '+now_time;

  function chgclass(id, newClass)
    {
     // ## Create Object from ID
     if (document.getElementById(id))
       {obj = document.getElementById(id);}
     else if (document.getElementsByName(id))
       {obj = document.getElementsByName(id);}
     else
       {return;}

     obj.className = newClass;
    }

  function chgvalue(id, newValue)
    {
     // ## Create Object from ID
     if (document.getElementById(id))
       {obj = document.getElementById(id);}
     else if (document.getElementsByName(id))
       {obj = document.getElementsByName(id);}
     else
       {return;}

     obj.value = newValue;
    }

  function noenter() 
    {
     if (window.event.keyCode == 13)
     window.event.keyCode =0;
    }

  function entersubmit(id) 
    {
     if (window.event.keyCode == 13)
       {
        document.frm.submit();
    }  }

  function textLimit(form, field, maxlen)
    {
     if (field.value.length > maxlen)
       {
        field.value = field.value.substring(0, maxlen);
        alert('You have exceeded the maximum length of '+maxlen+' characters for this field!');
       }
    }

 function stayTOP(id,loc)
  {
   obj = document.getElementById(id).style;
   off = (window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;

   obj.top = loc+off;
   
   fnc = "stayTOP('"+id+"',"+loc+")";
   setTimeout(fnc,0);
  }

 function stayBOTTOM(id,loc)
  {
   // ## Retrieve Browser Height
   if (self.innerWidth)
     {bht = self.innerHeight;}
   else if (document.documentElement && document.documentElement.clientWidth)
     {bht = document.documentElement.clientHeight;}
   else if (document.body)
     {bht = document.body.clientHeight;}
   else
     {return;}

   // ## Retrieve OffSet
   if (window.pageYOffset)
     {off = window.pageYOffset;}
   else if (document.documentElement)
     {off = document.documentElement.scrollTop;}
   else if (document.body.scrollTop)
     {off = document.body.scrollTop;}
   else
     {return;}

   // ## Create Object from ID
   if (document.getElementById(id).style)
     {obj = document.getElementById(id).style;}
   else if (document.getElementsByName(id).style)
     {obj = document.getElementsByName(id).style;}
   else
     {return;}

   if (obj.top) {obj.top = (bht + off) - (loc);} // ## Set New Location
   setTimeout("stayBOTTOM('"+id+"',"+loc+")",0); // ## Repeat Function
  }


  function toggle()
    {
     var argv = toggle.arguments;
     var argc = argv.length;
     for (var arg = 0; arg < argc; arg++)
       {
        var i = 1;
        var x = true;
        var id = argv[arg];

        cme = document.getElementById('SeeMee');
        if (cme)
          {
           seen = cme.value.indexOf(id);
           if (seen < 0)
             {cme.value += id;}
           else
             {cme.value = cme.value.replace(id, '');}
          }

        obj = document.getElementById(id);
        if (!obj)
          {
           while (x == true)
             {
              togid = id+'_'+i;

              obj = document.getElementById(togid);
              if (!obj) {x = false; continue;}
         
              hid = obj.className.indexOf('hidden');
              if (!hid)
                {obj.className = ' '; hid = 0;}

              if (hid < 0)
                {obj.className += ' hidden';}
              else
                {obj.className = obj.className.replace('hidden', '');}
  
              i++;
              if (i > 3000) {x = false; continue;}
             }
          }
        else
          {
           hid = obj.className.indexOf('hidden');
           if (!hid)
             {obj.className = ' '; hid = 0;}

           if (hid < 0)
             {obj.className += ' hidden';}
           else
             {obj.className = obj.className.replace('hidden', '');}       
       }  }
   document.body.className = 'refresh';
  }

 function updDATE(frm,fld,int)
  {
   var htp = './inc/upd_cal.php?';
 
   htp += (frm) ? '&Form='+escape(frm) : '' ;
   htp += (fld) ? '&Field='+escape(fld) : '' ;
   htp += (int) ? '&Int='+escape(int) : '' ;

   var updwin = window.open(htp, "Cal", "width=200px,height=312px,top=20,left=20,scrollbars=0,resizable=no");
  }

 function updADDR(frm,int)
  {
   var htp  = './inc/upd_adr.php?';
   var id   = (int) ? 'Account_'+int : 'Account' ;
   var acct = document.getElementById(id).value;
   
   htp += (acct) ? '&Account='+escape(acct) : '' ;
   htp += (frm) ? '&Form='+escape(frm) : '' ;
   htp += (int) ? '&Int='+escape(int) : '' ;

   var updwin = window.open(htp, "Addr", "width=10px,height=10px,top=9000px,left=9000px,scrollbars=1,resizable=1");
  }

 function updITEM(frm,fld,int)
  {
   var htp = './inc/upd_itm.php?Submit=1';
   var id = (int) ? fld+'_'+int : fld ;
   var itm = document.getElementById(id).value;

   htp += (frm) ? '&Form='+escape(frm) : '' ;
   htp += (fld) ? '&Field='+escape(fld) : '' ;
   htp += (int) ? '&Int='+escape(int) : '' ;
   htp += (itm) ? '&Model='+escape(itm) : '' ;

   var updwin = window.open(htp, "Item", "width=10px,height=10px,top=9000px,left=9000px,scrollbars=1,resizable=1");
  }

 function lookup(htp, id)
  {
   if (document.getElementById(id))
     {
      obj = document.getElementById(id);
      htp += (obj.value != null) ? '?'+id+'='+obj.value : null ;
     }

   var lookwin = window.open(htp, "Lookup", "width=10px,height=10px,top=9000px,left=9000px,scrollbars=1,resizable=1");
  }  

  function updTODAY(id)
    {
     if (document.getElementById(id))
       {
        obj = document.getElementById(id);
        if (obj.value == '')
          {
           obj.value = now_today;
    }  }  }

  function toggle_chk()
    {
     var argv = toggle_chk.arguments;
     var argc = argv.length;
     for (var arg = 0; arg < argc; arg++)
       {
        var i = 1;
        var x = true;
        var id = argv[arg];

        clst = document.getElementById('ChkList');
        if (clst)
          {
           ckd = clst.value.indexOf(id);
           if (ckd < 0)
             {clst.value += id;}
           else
             {clst.value = clst.value.replace(id, '');}
          }

        obj = document.getElementById(id);
        if (!obj)
          {
           while (x == true)
             {
              togid = id+'_'+i;

              obj = document.getElementById(togid);
              if (!obj) {x = false; continue;}
         
              chk = obj.className.indexOf('unchecked');
              if (!chk)
                {obj.className = ' '; chk = 0;}

              if (chk < 0)
                {obj.className = obj.className.replace(' checked', ' unchecked');}
              else
                {obj.className = obj.className.replace(' unchecked', ' checked');}
  
              i++;
              if (i > 1000) {x = false; continue;}
             }
          }
        else
          {
           chk = obj.className.indexOf('unchecked');
           if (!chk)
             {obj.className = ' '; chk = 0;}

           if (chk < 0)
             {obj.className = obj.className.replace(' checked', ' unchecked');}
           else
             {obj.className = obj.className.replace(' unchecked', ' checked');}      
       }  }
   document.body.className = 'refresh';
  }

  function toggle_chkall(id, allid)
    {
     var i = 1;
     var x = true;

     objall = document.getElementById(allid);
     if (!objall) {return;}

     alloff = objall.className.indexOf('unchecked');
     if (!alloff) {objall.className = ' '; alloff = 0;}

     clst = document.getElementById('ChkList');
     if (clst)
       {
        obj = document.getElementById(id);
        if (!obj)
          {
           while (x == true)
             {
              togid = id+'_'+i;

              obj = document.getElementById(togid);
              if (!obj) {x = false; continue;}

              if (alloff < 0)
                { 
                 obj.className = obj.className.replace(' checked', ' unchecked');
                 objall.className = objall.className.replace(' checked', ' unchecked');
                 clst.value = clst.value.replace(togid, '');
                }
              else
                {
                 obj.className = obj.className.replace(' unchecked', ' checked');
                 objall.className = objall.className.replace(' unchecked', ' checked');
                 clst.value = clst.value.replace(togid, '');
                 clst.value += togid;
                }
              i++;
              if (i > 1000) {x = false; continue;}
       }  }  }
     document.body.className = 'refresh';
    }