/**
 * First are the Javascript functions used on most YNLL web pages.
 *  There are some useful constants initialized at the end.
 *
 * Modifications:
 *
 *  Name    Date         Description
 *  ------  -------      ------------
 *  Bill C  2010-Jan-22  Modified line 267-285 adding baseball and banner
 * 						 for UVLL. change email line 300-302
 *                       to uvllweb for page trailer.
 *          
 *  John R  2008-Apr-14  Modified the displayGame() function so it doesn't
 *                         error out if there's no division indicator in
 *                         the team names
 *  John R  2005-Mar-25  Added the formatTeamName() function;
 *                         removed the old getTeamByName() function;
 *                         modified the displayGame() function so it
 *                         breaks up the team names from the inter-
 *                         division games for a cleaner display
 *  John R  2005-Mar-23  Modified the getDivTeamByName() function so it
 *                         can take the place of getTeamByName();
 *                         commented out the old getTeamByName() and
 *                         renamed getDivTeamByName() to getTeamByName()
 *  John R  2005-Mar-16  Added a games member to the definition of League
 *                         to hold the results of inter-division games;
 *                         added a new function getDivTeamByName
 *
 */

/**
 *
 */
function Adult( name, phone, email, title )
{
   this.name = ( arguments.length > 0 ? arguments[ 0 ] : "" );
   this.phone = ( arguments.length > 1 ? arguments[ 1 ] : "" );
   this.email = ( arguments.length > 2 ? arguments[ 2 ] : "" );
   this.title = ( arguments.length > 3 ? arguments[ 3 ] : "" );
}

/**
 *
 */
function Team( name, manager, coaches, wins, losses, ties,
               logo_sm, logo_lg, notes, hd2hds )
{
   this.name = ( arguments.length > 0 ? arguments[ 0 ] : "" );
   this.manager = ( arguments.length > 1 ? arguments[ 1 ] : null );
   this.coaches = ( arguments.length > 2 ? arguments[ 2 ] : new Array );
   this.wins = ( arguments.length > 3 ? arguments[ 3 ] : 0 );
   this.losses = ( arguments.length > 4 ? arguments[ 4 ] : 0 );
   this.ties = ( arguments.length > 5 ? arguments[ 5 ] : 0 );
   this.weight = ( arguments.length > 6 ? arguments[ 6 ] : 0 );
   this.logo_sm = ( arguments.length > 7 ? arguments[ 7 ] : "" );
   this.logo_lg = ( arguments.length > 8 ? arguments[ 8 ] : "" );
   this.notes = ( arguments.length > 9 ? arguments[ 9 ] : new Array );
   this.hd2hds = ( arguments.length > 10 ? arguments[ 10 ] : new Array );
}

/**
 *
 */
function Game( date, team_away, team_home, score_away, score_home, note )
{
   this.date = ( arguments.length > 0 ? arguments[ 0 ] : "" );
   this.team_away = ( arguments.length > 1 ? arguments[ 1 ] : "" );
   this.team_home = ( arguments.length > 2 ? arguments[ 2 ] : "" );
   this.score_away = ( arguments.length > 3 ? arguments[ 3 ] : 0 );
   this.score_home = ( arguments.length > 4 ? arguments[ 4 ] : 0 );
   this.note = ( arguments.length > 5 ? arguments[ 5 ] : null );
}

/**
 *
 */
function Division( name, coordinator, agent, teams, games )
{
   this.name = ( arguments.length > 0 ? arguments[ 0 ] : "" );
   this.coordinator = ( arguments.length > 1 ? arguments[ 1 ] : null );
   this.agent = ( arguments.length > 2 ? arguments[ 2 ] : null );
   this.teams = ( arguments.length > 3 ? arguments[ 3 ] : new Array );
   this.games = ( arguments.length > 4 ? arguments[ 4 ] : new Array );
   this.notes = ( arguments.length > 5 ? arguments[ 5 ] : new Array );
}

/**
 *
 */
function League( name, divisions )
{
   this.name = ( arguments.length > 0 ? arguments[ 0 ] : "" );
   this.divisions = ( arguments.length > 1 ? arguments[ 1 ] : new Array );
   this.games = ( arguments.length > 2 ? arguments[ 2 ] : new Array );
}

/**
 *
 */
function HeadToHead( name, score )
{
   this.name = ( arguments.length > 0 ? arguments[ 0 ] : "" );
   this.score = ( arguments.length > 1 ? arguments[ 1 ] : 0 );
}

/**
 *
 */
function byName( a, b )
{
   if ( ! a.name && ! b.name )
      return 0;
   if ( ! a.name )
      return -1;
   if ( ! b.name )
      return 1;

   var out = 0;
   var len = (a.name.length < b.name.length ? a.name.length : b.name.length);
   for ( var nIdx = 0; 0 == out && nIdx < len; nIdx++ )
   {
      if ( a.name.charAt( nIdx ) < b.name.charAt( nIdx ) )
         out = -1;
      if ( b.name.charAt( nIdx ) < a.name.charAt( nIdx ) )
         out = 1;
   }

   if ( 0 == out )
   {
      if ( a.name.length < b.name.length )
         out = -1;
      if ( b.name.length < a.name.length )
         out = 1;
   }

   return out;
}

/**
 *
 */
function getTeamByName( arTeams, tmName, divInd )
{
  arTeams = ( arguments.length > 0 ? arguments[ 0 ] : new Array );
  tmName = ( arguments.length > 1 ? arguments[ 1 ] : '' );
  divInd = ( arguments.length > 2 ? arguments[ 2 ] : '' );

  var suffix = '^' + ( divInd.length > 0 ? divInd.slice(0,1) + '\\s+' : '' );

  // For each team in the array...
  for ( var nIdx = 0; nIdx < arTeams.length; nIdx++ )
  {
    var re = new RegExp( suffix + arTeams[ nIdx ].name );
    if ( re.test( tmName ) )
      break;
  }

  return ( nIdx < arTeams.length ? nIdx : -1 );
}

/**
 *
 */
function Item( name, url )
{
   this.name = ( arguments.length > 0 ? arguments[ 0 ] : '?' );
   this.url = ( arguments.length > 1 ? arguments[ 1 ] : null );
}

/**
 *
 */
function buildNavColumn()
{
  putMenuItems( arrMainItems, 'm' );
//  document.writeln( getListBox( arRules, 'Rules, etc.' ) );
  putMenuItems( arrCalItems, 'm' );
//  document.writeln( '<br>' );
  putMenuItems( arrMtgItems, 'm' );
//  document.writeln( getListBox( arMinutes, 'More Minutes...' ) );
<!--  document.writeln( '<br>' ); -->
  putMenuItems( arrGenItems, 'm' );
}

/**
 *
 */
function putMenuItems( arMenuItems, style )
{
  this.arMenuItems = ( arguments.length > 0 ? arguments[ 0 ] : new Array );
  this.style = ( arguments.length > 1 ? arguments[ 1 ] : 'l' );

  if ( ! this.webHome )
    this.webHome = '';

  if ( 0 == arMenuItems.length )
    return;

  // First item is set off like a title
  document.writeln( '<div class="' + style + '1">' +
                    ( null != arMenuItems[ 0 ].url ?
                      '<a href="' +
                      ( -1 < arMenuItems[ 0 ].url.search(/^javascript/) ?
                          '' : webHome ) +
                      arMenuItems[ 0 ].url + '">' :
                      '' ) +
                    arMenuItems[ 0 ].name +
                    ( null != arMenuItems[ 0 ].url ? '<\/a>' : '' ) +
                    '<\/div>' );

  // Remainder of items
  for (var nIdx = 1; nIdx < arMenuItems.length; nIdx++ )
  {
    document.writeln( '<div class="navdiv"><\/div>' );
    document.writeln( '<div class="' + style + '2">' +
                      ( null != arMenuItems[ nIdx ].url ?
                        '<a href="' +
                      ( -1 < arMenuItems[ nIdx ].url.search(/^javascript/) ?
                          '' : webHome ) +
                        arMenuItems[ nIdx ].url + '">' :
                        '' ) +
                      arMenuItems[ nIdx ].name +
                      ( null != arMenuItems[ nIdx ].url ? '<\/a>' : '' ) +
                      '<\/div>' );
  }
}

/**
 *
 */
function getListBox( listItems, title, style )
{
  this.listItems = ( arguments.length > 0 ? arguments[ 0 ] : new Array );
  this.title = ( arguments.length > 1 ? arguments[ 1 ] : '' );
  this.style = ( arguments.length > 2 ? arguments[ 2 ] : 'l' );

  if ( ! this.webHome )
    this.webHome = '';

  var reply = '';
  reply += '<div><form>\n' +
           '<select name="' + ( title.length > 0 ? title : '' ) + '"' +
           ' onChange="gotosite( this.options[ this.selectedIndex ].value )"' +
           ' class="selform">\n';

  if ( title.length > 0 )
    reply += '<option selected value="">' + title + '<\/option>\n';

  for ( var nIdx = 0; nIdx < listItems.length; nIdx++ )
    reply += '<option value="' +
             ( listItems[ nIdx ].url != null ?
               ( -1 < listItems[ nIdx ].url.search(/^javascript/) ?
                 '' : webHome ) + listItems[ nIdx ].url.replace(/\"/g, '\'') : '' ) +
             '">' + listItems[ nIdx ].name + '<\/option>\n';
  reply += '<\/select><\/form><\/div>\n';

  return reply;
}

/**
 *
 */
function putPageHeader()
{
  if ( ! this.webHome )
    this.webHome = '';

  document.writeln( '<td align="center" bgcolor="#FCFCFC" height="126" width="126">' +
                    '<a href="' + webHome + 'index.html">' +
                    '<img border="0" width="160" height="126"' +
                    ' src="' + webHome + 'webimages/uvlllogo.png"' +
                    //' alt="Upper Valley Little League"><\/a>' +
                    '<\/td>' +
                    '<td align="right" bgcolor="#FCFCFC" valign="bottom" width="10">' +
                    '<img border="0"' +
                    ' src="' + webHome + 'webimages/corner_br_50A0E0.gif" alt="">' +
                    '<\/td>' +
                    '<td align="center" bgcolor="#FCFCFC" colspan="2">' +
					'<a href="' + webHome + 'index.html">' +
                    '<img border="0" width="600" height="75"' +
                    ' src="' + webHome + 'webimages/uvll_top_banner.png"' +
					//'<a href="http://www.ssgecom.com/ssgpartner/associate_entry.asp?' +
                    //'&ID=YNL"><img border="0"' +
                    //' src="' + webHome + 'webimages/Team_Store_468x60.gif">' +
                    '<\/a>' +
                    '<\/td>' );
}

/**
 *
 */
function putPageTrailer()
{
   var dtMod = new Date( document.lastModified );
   document.writeln( '<p>&nbsp;<\/p>' );
   document.writeln( '<p align="center" class="highlight">' +
                     'Last Updated: ' +
                     dtMod.getDate() + ' ' +
                     arrMonths[ dtMod.getMonth() ] + ' ' +
                     dtMod.getFullYear() +
                     '<br>Direct comments to: ' +
                     '<a href="mailto:uvllweb@yahoo.com">' +
                     'uvllweb@yahoo.com<\/a><\/p>' );
   document.writeln( '<p>&nbsp;<\/p>' );
}

/**
 *
 */
function putLeagueIndexCell( objLeague )
{
   this.objLeague = ( arguments.length > 0 ? arguments[ 0 ] : new League );

  if ( ! this.webHome )
    this.webHome = '';

   var strLeague = objLeague.name + ' League';
   //
   document.writeln( '<td>' );
   document.writeln( '<p class="minortitle"><font color="green">' +
                     strLeague + '<\/font><\/p>' );
   document.writeln( '<table width="100%" border="0" cellpadding="5"' +
                     ' cellspacing="1" background="' + webHome + 'webimages/tab_bg.gif">' );
   document.writeln( '<tr align="center">' );
   for ( var nIdx = 0; nIdx < objLeague.divisions.length; nIdx++ )
   {
      var strDiv = objLeague.divisions[ nIdx ].name;
      document.writeln( '<td><a href="#' + strLeague + ' - ' +
                        strDiv + '">' + strDiv + '<\/a><\/td>' );
   }
   document.writeln( '<\/tr>' );
   document.writeln( '<\/table>' );
   document.writeln( '<\/td>' );
}

/**
 *
 */
function putTitleBar( strTitle, arColors, strTitleColor )
{
  this.strTitle = ( arguments.length > 0 ? arguments[ 0 ] : "" );
  this.arColors = ( arguments.length > 1 ? arguments[ 1 ] :
                      new Array  );
  this.strTitleColor = ( arguments.length > 2 ? arguments[ 2 ] : "black" );

//  var strImage = "http://www.ynll.org/webimages/clearpixel.gif";
  var strImage = "webimages/clearpixel.gif";

  document.writeln( '<table border="0" cellpadding="0" cellspacing="0" width="100%">' );
  document.writeln( '<tr bgcolor="' + arColors[ 0 ] + '"><td>' +
                    '<img src="' + strImage + '" height="1"><\/td><\/tr>' );
  document.writeln( '<tr bgcolor="' + arColors[ 1 ] + '"><td>' +
                    '<img src="' + strImage + '" height="1"><\/td><\/tr>' );
  document.writeln( '<tr bgcolor="' + arColors[ 2 ] + '"><td>' +
                    '<img src="' + strImage + '" height="1"><\/td><\/tr>' );
  document.writeln( '<tr align="center" bgcolor="' + arColors[ 2 ] + '">' +
                    '<td><p class="minortitle">' +
                    '<font color="' + strTitleColor + '">' + strTitle +
                    '<\/font><\/p><\/td><\/tr>' );
  document.writeln( '<tr bgcolor="' + arColors[ 2 ] + '"><td>' +
                    '<img src="' + strImage + '" height="1"><\/td><\/tr>' );
  document.writeln( '<tr bgcolor="' + arColors[ 3 ] + '"><td>' +
                    '<img src="' + strImage + '" height="1"><\/td><\/tr>' );
  document.writeln( '<tr bgcolor="' + arColors[ 4 ] + '"><td>' +
                    '<img src="' + strImage + '" height="1"><\/td><\/tr>' );
  document.writeln( '<\/table>' );
}

/**
 *
 */
function putRecentGames( arLeagues, dtRecent )
{
  arLeagues = ( arguments.length > 0 ? arguments[ 0 ] : new Array );
  dtRecent = ( arguments.length > 1 ? arguments[ 1 ] : new Date );

  var nDayMillis = 1000 * 60 * 60 * 24;       // # of milliseconds in a day

  // Section Title
  var arTitle = new Array;
  arTitle[ 0 ] = new Item( '<div align="center">Game Scores</div>' );
  putMenuItems( arTitle, 'm' );
//  putTitleBar( 'Game Scores',
//               new Array( "white", "#B6DCD0", "#489980", "#2F6253", "black" ),
//               "white" );

  // Recent games Table
  document.writeln( '<table border="0" cellpadding="3"' +
                    ' cellspacing="0" width="100%">' );

  // For as many days as requested...
  for ( var nDay = 0; nDay < nGameDays; nDay++ )
  {
    var dtDay = new Date( dtRecent.getTime() - ( nDay * nDayMillis ) );
    var nGameCnt = 0;

    // For each league (i.e. Major or Minor)...
    for ( var lIdx = 0; lIdx < arLeagues.length; lIdx++ )
    {
      // For each division (i.e. North, West, or South)...
      for ( var dIdx = 0; dIdx < arLeagues[lIdx].divisions.length; dIdx++ )
      {
        // Display the intra-division games
        var objDiv = arLeagues[lIdx].divisions[dIdx];
        for ( var gIdx = 0; gIdx < objDiv.games.length; gIdx++ )
        {
          if ( dtDay.getTime() == new Date( objDiv.games[ gIdx ].date ).getTime() )
          {
            if ( nGameCnt == 0 )
            {
              // Day Title
              document.writeln( '<tr><th align="center">' +
                                formatGameDate( dtDay ) +
                                '<\/th><\/tr>' );
              nGameCnt++;
            }

            document.writeln( '<tr><td>' );
            displayGame( objDiv.games[ gIdx ],
                         arLeagues[lIdx].name.slice( 0, 3 ),
                         objDiv.name.slice( 0, 1 ) );
            document.writeln( '<\/td><\/tr>' );
          }
        }
      }

      // Display the inter-division games
      for ( var gIdx = 0; gIdx < arLeagues[lIdx].games.length; gIdx++ )
      {
        if ( dtDay.getTime() == new Date( arLeagues[lIdx].games[ gIdx ].date ).getTime() )
        {
          if ( nGameCnt == 0 )
          {
            // Day Title
            document.writeln( '<tr><th align="center">' +
                              formatGameDate( dtDay ) +
                              '<\/th><\/tr>' );
            nGameCnt++;
          }

          document.writeln( '<tr><td>' );
          displayGame( arLeagues[lIdx].games[ gIdx ],
                       arLeagues[lIdx].name.slice( 0, 3 ) );
          document.writeln( '<\/td><\/tr>' );
        }
      }
    }
  }

  // Trailer Row
  document.writeln( '<tr><td align="center">' +
                    '<a href="team_results.html">' +
                    '<p class="css-title">All game results<\/p><\/a>' +
                    '<\/td><\/tr>' );

  document.writeln( '<\/table>' );
}

/**
 *
 */
function displayGame( game, lgInd, divInd )
{
  game = ( arguments.length > 0 ? arguments[ 0 ] : new Game );
  lgInd = ( arguments.length > 1 ? arguments[ 1 ] : '' );
  divInd = ( arguments.length > 2 ? arguments[ 2 ] : '' );

  var teamAway = game.team_away;
  var teamHome = game.team_home;
  var divAway = divInd;
  var divHome = divInd;

  // If not an intra-division game...
  if ( '' == divInd )
  {
    // Separate the division indicator and the team name
    var re = new RegExp( '^([WSN])\\s+([A-Za-z].*)$' );

    var result = re.exec( game.team_away );
    if ( null != result )
    {
      divAway = result[ 1 ];
      teamAway = result[ 2 ];
    }
    else
    {
      divAway = "";
      teamAway = game.team_away;
    }

    result = re.exec( game.team_home );
    if ( null != result )
    {
      divHome = result[ 1 ];
      teamHome = result[ 2 ];
    }
    else
    {
      divHome = "";
      teamHome = game.team_home;
    }
  }

  document.writeln( '<table border="0" cellpadding="0"' +
                    ' cellspacing="0" width="100%">' );
  document.writeln( '<tr>' +
                    '<td rowspan="2" width="20%"><p align="left" class="css-items">' + lgInd +
                      '<\/p><\/td>' +
                    ( divInd.length > 0 ?
                      '<td align="left" rowspan="2" width="11%"><p class="css-items">' + divInd +
                        '<\/p><\/td>' :
                      '<td align="left" width="11%"><p class="css-items">' + divAway +
                        '<\/p><\/td>' ) +
                    '<td align="left"' +
                      ' width="51%"><p class="css-items">' + formatTeamName( teamAway ) +
                      '<\/p><\/td>' +
                    '<td align="right"><p class="css-items">' + game.score_away + '<\/p><\/td>' +
                    '<\/tr>' );
  document.writeln( '<tr>' +
                    ( divInd.length == 0 ?
                      '<td align="left"><p class="css-items">' + divHome + '<\/p><\/td>' :
                      '' ) +
                    '<td align="left"><p class="css-items">' + formatTeamName( teamHome ) +
                      '<\/p><\/td>' +
                    '<td align="right"><p class="css-items">' + game.score_home + '<\/p><\/td>' +
                    '<\/tr>' );
  document.writeln( '<\/table>' );
}

/**
 *
 */
function formatGameDate( dtGame )
{
  this.dtGame = ( arguments.length > 0 ? arguments[ 0 ] : new Date );

  return ( 
//           arrDays[ dtGame.getDay() ] + ', ' + 
           dtGame.getDate() + ' ' +
           arrMonths[ dtGame.getMonth() ] );
}

/**
 *
 */
function formatTeamName( teamName )
{
  if ( teamName == "Diamondbacks" )
    teamName = "D'backs";
  
  return teamName;
}

/**
 *
 */
function openCalendar( calType )
{

  if ( ! this.webHome )
    this.webHome = '';

  window.open( webHome + 'calendars/' + calType + '/Calendar.htm',
               'calWindow',
               'menubar=yes,location=yes,'+
               'resizable=yes,scrollbars=yes,'+
               'status=yes,titlebar=yes,'+
               'toolbar=yes' );
}

/**
 *
 */
function getArg( name )
{
  this.name = ( arguments.length > 0 ? arguments[ 0 ] : 'undef' );

  var argIdx = document.URL.indexOf( '?' ) + 1;

  if ( 0 < argIdx )
  {
    var start = document.URL.indexOf( name + '=', argIdx );
    var end = document.URL.indexOf( '&', start + name.length + 1 );
    if ( -1 < start )
    {
      if ( -1 == end )
        end = document.URL.length;

      return document.URL.substring( start + name.length + 1, end );
    }
  }

  return '';
}

function detectBrowser()
{
  var oldOnError = window.onerror;
  var element = null;
    
  window.onerror = defaultOnError;

  navigator.OS        = '';
  navigator.version   = 0;
  navigator.org       = '';
  navigator.family    = '';

  var platform = window.navigator.platform.toLowerCase();
  if ( platform.indexOf( 'win' ) != -1 )
    navigator.OS = 'win';
  else if ( platform.indexOf( 'mac' ) != -1 )
    navigator.OS = 'mac';
  else if ( platform.indexOf( 'unix' ) != -1 || platform.indexOf( 'linux' ) != -1 )
    navigator.OS = 'nix';

  var i = 0;
  var ua = window.navigator.userAgent.toLowerCase();
    
  if ( ua.indexOf( 'opera' ) != -1 )
  {
    i = ua.indexOf('opera');
    navigator.family    = 'opera';
    navigator.org       = 'opera';
    navigator.version   = parseFloat( '0' + ua.substr( i + 6 ), 10 );
  }
  else if ( ( i = ua.indexOf( 'msie' ) ) != -1 )
  {
    navigator.org       = 'microsoft';
    navigator.version   = parseFloat( '0' + ua.substr( i + 5 ), 10 );
        
    if ( navigator.version < 4 )
      navigator.family = 'ie3';
    else
      navigator.family = 'ie4'
  }
  else if ( typeof( window.controllers ) != 'undefined' &&
            typeof( window.locationbar ) != 'undefined' )
  {
    i = ua.lastIndexOf('/');
    navigator.version = parseFloat( '0' + ua.substr( i + 1 ), 10 );
    navigator.family = 'gecko';

    if ( ua.indexOf( 'netscape' ) != -1 )
      navigator.org = 'netscape';
    else if ( ua.indexOf( 'compuserve' ) != -1 )
      navigator.org = 'compuserve';
    else
      navigator.org = 'mozilla';
  }
  else if ( ( ua.indexOf( 'mozilla' ) != -1 ) && ( ua.indexOf( 'spoofer' ) == -1 ) &&
            ( ua.indexOf( 'compatible' ) == -1 ) && ( ua.indexOf( 'opera' ) == -1 ) &&
            ( ua.indexOf( 'webtv' ) == -1 ) && ( ua.indexOf( 'hotjava' ) == -1 ) )
  {
    i = ua.lastIndexOf( '/' );
    navigator.version = parseFloat( '0' + ua.substr( i + 1 ), 10 );
    navigator.org = 'netscape';
    navigator.family = 'nn' + parseInt( '0' + ua.substr( i + 1 ), 10 );
  }
  else if ( ( i = ua.indexOf( 'aol' ) ) != -1 )
  {
    // aol
    navigator.family    = 'aol';
    navigator.org       = 'aol';
    navigator.version   = parseFloat( '0' + ua.substr( i + 4 ), 10 );
  }

  navigator.DOMCORE1  = ( typeof(document.getElementsByTagName) != 'undefined' &&
                          typeof(document.createElement) != 'undefined' );
  navigator.DOMCORE2  = ( navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined' &&
                          typeof(document.createElementNS) != 'undefined' );
  navigator.DOMHTML   = ( navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined' );
  navigator.DOMCSS1   = ( navigator.family == 'gecko' || navigator.family == 'ie4' );

  navigator.DOMCSS2   = false;
  if ( navigator.DOMCORE1 )
  {
    element = document.createElement( 'p' );
    navigator.DOMCSS2 = ( typeof( element.style ) == 'object' );
  }

  navigator.DOMEVENTS = ( typeof( document.createEvent ) != 'undefined' );

  window.onerror = oldOnError;
}

function gotosite( site )
{
  this.site = ( arguments.length > 0 ? arguments[ 0 ] : "" );

  // If the site is something...
  if ( site != "" )
  {
    // Set the window location to that URL
    self.location = site;
  }
}

function defaultOnError( msg, url, line )
{
  window.onerror = null;
  top.onerror = null;
  top.document.location = '/devedge/xbProjects/_files/errors/not-supported.html';
}

   detectBrowser();

   /**
    *  Useful constants
    */
   var arrMonths = new Array("January","February","March",
                             "April","May","June",
                             "July","August","September",
                             "October","November","December");
   var arrDays = new Array( "Sunday", "Monday", "Tuesday", "Wednesday",
                            "Thursday", "Friday", "Saturday" );
   var MAJOR = 0, MINOR = 1;
   var NORTH = 0, WEST = 1, SOUTH = 2;
   var ZERO = 0;

