var T = ( 1 == 1 );
var t = T;
var F = ( 1 == 0 );
var f = F;
var PgNm = "";
var PgCl = "";
var PnPc = F;
var PnBn = F;
var PcBn = F;

var m2pf = "";

var dowSht = new Array( "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" );
var dowLng = new Array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" );

var mthSht = new Array( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" );
var mthLng = new Array( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" );

var kMSperD = ( 1000 * 60 * 60 * 24 ) - 1;        // K milliseconds per Day (less one)

function UserInfo()
{
  this.AppNam = navigator.appName.toLowerCase();
  this.AppVer = navigator.appVersion.toLowerCase();

  this.UsrAgt = navigator.userAgent.toLowerCase();

  this.VerMjr = parseInt(this.AppVer);
  this.VerMnr = parseFloat(this.AppVer);

  this.BrIsMZ = ( this.UsrAgt.indexOf('mozilla') > -1 && this.UsrAgt.indexOf('gecko') > -1 );

  if ( this.BrIsMZ )
  {
    this.VerMjr = 5;
    if ( this.UsrAgt.indexOf('rv:1.8') > -1 )   this.VerMnr = 5.180;
    if ( this.UsrAgt.indexOf('rv:1.7') > -1 )   this.VerMnr = 5.170;
    if ( this.UsrAgt.indexOf('rv:1.6') > -1 )   this.VerMnr = 5.160;
    if ( this.UsrAgt.indexOf('rv:1.5') > -1 )   this.VerMnr = 5.150;
    if ( this.UsrAgt.indexOf('rv:1.4') > -1 )   this.VerMnr = 5.140;
    if ( this.UsrAgt.indexOf('rv:1.3') > -1 )   this.VerMnr = 5.130;
    if ( this.UsrAgt.indexOf('rv:1.0.0') > -1 ) this.VerMnr = 5.100;
    if ( this.UsrAgt.indexOf('rv:0.9.9') > -1 ) this.VerMnr = 5.099;
    if ( this.UsrAgt.indexOf('rv:0.9.8') > -1 ) this.VerMnr = 5.098;
    if ( this.UsrAgt.indexOf('rv:0.9.7') > -1 ) this.VerMnr = 5.097;
    if ( this.UsrAgt.indexOf('rv:0.9.6') > -1 ) this.VerMnr = 5.096;
    if ( this.UsrAgt.indexOf('rv:0.9.5') > -1 ) this.VerMnr = 5.095;
    if ( this.UsrAgt.indexOf('rv:0.9.4') > -1 ) this.VerMnr = 5.094;
  }

  this.BrIsNS = ( this.BrIsMZ ? F : this.UsrAgt.indexOf('mozilla') > -1 && this.UsrAgt.indexOf('spoofer') == -1 && this.UsrAgt.indexOf('compatible') == -1 );

  this.BrIsIE = ( this.BrIsMZ || this.BrIsNS ? F : this.UsrAgt.indexOf('msie') > -1 )

  if ( this.BrIsIE )
  {
         if ( this.UsrAgt.indexOf( 'msie 8.0;'  ) > -1 ) { this.VerMjr = 8; this.VerMnr = '8.0';  }
    else if ( this.UsrAgt.indexOf( 'msie 7.0;'  ) > -1 ) { this.VerMjr = 7; this.VerMnr = '7.0';  }
    else if ( this.UsrAgt.indexOf( 'msie 6.0;'  ) > -1 ) { this.VerMjr = 6; this.VerMnr = '6.0';  }
    else if ( this.UsrAgt.indexOf( 'msie 5.5;'  ) > -1 ) { this.VerMjr = 5; this.VerMnr = '5.5';  }
    else if ( this.UsrAgt.indexOf( 'msie 5.01;' ) > -1 ) { this.VerMjr = 5; this.VerMnr = '5.01'; }
    else if ( this.UsrAgt.indexOf( 'msie 5.0;'  ) > -1 ) { this.VerMjr = 5; this.VerMnr = '5.0';  }
    else if ( this.UsrAgt.indexOf( 'msie 4.01;' ) > -1 ) { this.VerMjr = 4; this.VerMnr = '4.01'; }
    else if ( this.UsrAgt.indexOf( 'msie 4.0;'  ) > -1 ) { this.VerMjr = 4; this.VerMnr = '4.0';  }
    else if ( this.UsrAgt.indexOf( '3.02;' ) > -1 )      { this.VerMjr = 3; this.VerMnr = '3.02'; }
    else if ( this.UsrAgt.indexOf( '3.01;' ) > -1 )      { this.VerMjr = 3; this.VerMnr = '3.01'; }
    else if ( this.UsrAgt.indexOf( '3.0;'  ) > -1 )      { this.VerMjr = 3; this.VerMnr = '3.0';  }
  }

  this.OisWin = ( this.UsrAgt.indexOf("win") > -1 );
  this.OisMac = ( this.UsrAgt.indexOf("mac") > -1 );
  this.OisUnx = ( this.UsrAgt.indexOf("x11") > -1 );

  this.ScnWid = screen.width;
  this.ScnHgt = screen.height;

  this.AvlWid = undefined;
  this.AvlHgt = undefined;

  if (document.documentElement && document.documentElement.offsetHeight) // DOM1
  {
    this.AvlWid = ( window.innerWidth )  ? window.innerWidth  : document.documentElement.offsetWidth - 20 ;
    this.AvlHgt = ( window.innerHeight ) ? window.innerHeight : document.documentElement.offsetHeight - 4 ;
  }
  else if (document.body)  // IE in old mode
  {
    this.AvlWid = document.body.offsetWidth - 20;
    this.AvlHgt = document.body.offsetHeight - 4;
  }
  else if (window.innerWidth)
  {
    this.AvlWid = window.innerWidth ;
    this.AvlHgt = window.innerHeight;
  }

  this.PlxDom = ( document.domain == "www.wnysorc.org" || document.domain == "wnysorc.org" );
  this.LclDom = ( document.domain == "localhost" || !( this.PlxDom ) );

  this.DldPth = ".";
  this.BasPth = ".";
  this.IcnPth =  this.BasPth + '/_img/';

  //                                    0, Tny;                       1, Sml;                       2, Med;                       3, Lrg;                                              4, Xlg;                      5, Gar
  this.DocSty = ( this.ScnWid <  640 ? "0" : ( this.ScnWid ==  640 ? "1" : ( this.ScnWid ==  800 ? "2" : ( this.ScnWid == 1024 ? "3" : ( this.ScnWid >= 1152 && this.ScnWid <= 1280 ? "4" : ( this.ScnWid > 1280 ? "5" : "2" ) ) ) ) ) )
  this.IcnSiz = ( this.ScnWid <= 800 ? 16 : ( this.ScnWid <= 1024 ? 18 : 24 ) );
  this.LgoSiz = ( this.ScnWid <= 800 ? 32 : ( this.ScnWid <= 1024 ? 48 : 64 ) );

  this.DbgAlt = true;
  return this;
}

var z0ui = new UserInfo();


function da( fnPar0 )
{
  if ( z0ui.DbgAlt )
  {
    alert( unescape( fnPar0 ) );
  }
}


function dm( faPar0 )
{
  if( faPar0.length > 0 )
  {
    var lnLen = faPar0.length;
    var lcMsg = faPar0[0] + "=[" + eval(faPar0[0]) + "]"
    if( lnLen > 1 ) { for( var lnIdx = 1; lnIdx < lnLen; lnIdx++ ) { lcMsg = lcMsg + ",\r\n" + faPar0[lnIdx] + "=[" + eval(faPar0[lnIdx]) + "]" } }
    alert( unescape(lcMsg) );
  }
}

function dw(c)
{
  document.writeln(c);
}


function dwbr()
{
  dw( "<br>" );
}

function min( v0, v1 )
{
  return ( v0 < v1 ? v0 : v1 )
}


function max( v0, v1 )
{
  return ( v0 > v1 ? v0 : v1 )
}


function snr( schWht, schFor, repWth )
{
  hitPsn = schWht.indexOf( schFor );
  while( hitPsn > -1 && hitPsn < schWht.length )
  {
    schWht = schWht.substring( 0, hitPsn ) + repWth + schWht.substring( hitPsn + schFor.length, schWht.length );
    hitPsn = schWht.indexOf( schFor );
  }
  return schWht;
}


function ReplaceThisUrl(rUrl)
{
  if ( rUrl != "" )
  {
    location.replace(rUrl);
  }
}


function SelectThisUrl(sUrl)
{
  if ( sUrl != "" )
  {
    location.href = sUrl;
  }
}


function FullName( fnPar0 )
{
  var m2fn = fnPar0;
  if ( fnPar0.length > 1 )
  {
    m2cp = m2fn.indexOf(", ");
    if( m2cp >= 0 )
    {
      m2na = m2fn.split(", ");
      m2fn = m2na[1]+" "+m2na[0];
    }
  }
  return m2fn
}

function dwlngdte( fnPar0 )
{
  dw( LongDate( fnPar0 ) );
}

function dwshtdte( fnPar0 )
{
  dw( ShrtDate( fnPar0 ) );
}


function LongDate( fnPar0 )
{
  var lngDte = new Date()
  lngDte.setFullYear(fnPar0.substr(0,4)-0,fnPar0.substr(5,2)-1,fnPar0.substr(8,2)-0);
  return dowLng[lngDte.getDay()] + ",&nbsp;" + mthLng[lngDte.getMonth()] + "&nbsp;" + lngDte.getDate() + ",&nbsp;" + lngDte.getFullYear()
}


function ShrtDate( fnPar0 )
{
  var shtDte = new Date()
  shtDte.setFullYear(fnPar0.substr(0,4)-0,fnPar0.substr(5,2)-1,fnPar0.substr(8,2)-0);
  return dowSht[shtDte.getDay()] + ",&nbsp;" + mthSht[shtDte.getMonth()] + "&nbsp;" + shtDte.getDate() + ",&nbsp;" + shtDte.getFullYear()
}


var emat = "(a)";


function m2( m2full, m2domn, m2subj, m2acct, m2ltxt )
{
  dw( m2acct.length <1 || m2domn.length<1 ? "&nbsp;" : "<a href=\"javascript:m2c('"
    + m2full
    + "','"
    + m2domn
    + "','"
    + m2subj
    + "','"
    + m2acct
    + "')\" onMouseover='window.status=\"Send email to "+m2full+"\";return true;' onMouseout='window.status=\"\";return true' title='Send email to <" + m2acct + " (at) " + m2domn + "> about [" + m2subj + "].'>"
    + ( m2ltxt.length>0 ? m2ltxt : m2acct + "<span class=\"emat\">" + emat + "</span>" + m2domn )
    + "</a>" + " <small>(email via "+m2domn+")</small>" );
}


function m2c( m3full, m3domn, m3subj, m3acct )
{
  sUrl = m3acct + "@" + m3domn;
  sUrl = ( m3full.length = 0 ? "" : '"' + m3full + '" <' )
       + sUrl
       + ( m3full.length = 0 ? "" : ">" );
  sUrl = sUrl + ( m3subj.length > 0 ? "?subject=" + escape(m3subj) : "" );
  sUrl = "mai"+"lto:" + sUrl;
  location.href = sUrl;
}


  function m2_cc( m4subj ) { m2( "Mike MacLean VE3VCY, WNYSORC Chairman",                 "yahoo.ca",    m4subj, "ve3vcy",               "Mike MacLean VE3VCY"     ); }
  function m2_st( m4subj ) { m2( "Tom Kennedy VA3TVK, WNYSORC Secretary/Treasurer",       "i-zoom.net",  m4subj, "tvkennedy",            "Tom Kennedy VA3TVK"      ); }
  function m2_ts( m4subj ) { m2( "Tom Kennedy VA3TVK, WNYSORC Secretary/Treasurer",       "hotmail.com", m4subj, "tv.kennedy",           "Tom Kennedy VA3TVK"      ); }
  function m2_db( m4subj ) { m2( "Rich Poczkalski WB2DSS, WNYSORC Database Mgr (Temp)",   "verizon.net", m4subj, "wnysorc",              "Rich Poczkalski WB2DSS"  ); }
//function m2_db( m4subj ) { m2( "Ben Bass N2YDM, WNYSORC Frequency Database Manager",    "verizon.net", m4subj, "wnysorc_database",     "Ben Bass N2YDM"          ); }
  function m2_fc( m4subj ) { m2( "Rich Poczkalski WB2DSS, WNYSORC Frequency Coordinator", "verizon.net", m4subj, "wnysorc",              "Rich Poczkalski WB2DSS"  ); }
  function m2_wm( m4subj ) { m2( "Web Master",                                            "wnysorc.org", "WNYSORC "+m4subj, "webmaster", "Web Master"              ); }


function dwNewTil( endNew )
{

  var dteNow = new Date();
  var dteEnd = new Date();
  dteEnd.setTime( Date.parse( endNew ) )
  if( dteNow <= dteEnd )
  {
    dw( "<img "
      +  "src='./_img/_ico/NEW.gif' "
      +  "alt='new' "
      +  "align=absmiddle "
      +  "border=0>" );
  }
}