//	Common Javascript - Copyright (C) 2003-2010 Charles A Upsdell, All Rights Reserved; www.upsdell.com


if ( typeof(cFilenameList) != 'undefined' )
	var myGallery = new cFilenameList ( [ '01 The Pitch (2004)', '02 Strike-Out! (2004)', '03 Will He? (2007)', '04 Right At You (2005)', '05 Strike! (2005)', '06 Out At First (2005)', '07 The Hurler (2007)', '08 Pop Fly (2005)', '09 Out At Third (2005)', '10 Safe On Third (2005)',
		'11 Night Magic (2006)', '12 Mosaic (2006)', '13 Change-Up (2006)', '14 Me and My Shadow ... (2007)', '15 Ready at First (2004)', '16 Ready at Third (2006)', '17 Ball, High (2007)', '18.png Slide! (2007)', '18 Catch! (2007)', '19 Out at Third! (2007)',
		'20 Ready to Play (2007)', '21 Safe, But Weary (2007)', '22 7 League Cleats (2007)', '23 Lithograph (2007)', '24 Lithograph (2007)', 'img/pic/ww_remington_art Remington Park, Windsor (2008)', '25 Oakes Park, Niagara Falls (2007)', '26 Brooke High School, West Virginia (2007)', '27 A Misty Muddy Morn (2007)',
		'28 Parc Moussette, Qu&eacute;bec (2007)', '29 Strike! (2008)', '30 Leap (2008)', '31 Dervish (2008)', '32 By the Ottawa River #1 (2008)', '33 By the Ottawa River #2 (2008)', '34 Infield Fly (2008)', '35 Wind-Up (2008)',
		'36 Casting a Giant Shadow (2009)', '37 Canadian Graffiti (2009)' ], '', 'img/pic/pic_', '.jpg', '', 'textSplit randomStack' );

// If local file, reveal item
// Else if IE 5 or 6, hide item
function myShowItem ( id, display_type )
{
if ( String(window.location).indexOf('file:') == 0 )
  {
	var o = getElement( id );
	if ( o )
	  {
		o.style.display = display_type;
		o.style.color = 'green';
	  }
	return;
  }
if ( typeof(isIE5or6) === typeof(noSuchData) )
	return;
var o = getElement( id );
if ( o )
	o.style.display = 'none';
}


//	OnLoad Function
function myOnLoad( nTimeLimit )
{
oPageStyle.setActiveStylesheet();
// Enable hovers over LI's (IE workaround)
startList( "hormenu0", "hormenu" );
myGetPhoto();
myGetGallery();
myInsertClickImage();
myShowItem( 'hidden', 'list-item' );
myShowCalendarOptions();
myShowNewsPageOptions();
myShowCookiesEnabled();
myShowJavaScriptEnabled();
if ( typeof(myReportAnyBrowserUpdate) !== typeof(noSuchFunction) )
	myReportAnyBrowserUpdate( '../BrowserNews/', 'ins_BrowserUpdate' );
}

// Function to write code to display a gallery
function myGetGallery ( )
{
var o = getElement( 'ins_HomePagePhotoList' );
if ( o )
  {
	var sHTML = '';
	for ( var i = 1; i < myGallery.aFile.length; ++i )
	  {
		var sPhoto = myGallery.name( i );
		var sTitle = myGallery.text( i );
		if ( oAgent.isIE && (oAgent.version<=6) )
			sHTML += '<table summary="Photo" align="center" class="center">';
		else
			sHTML += '<table summary="Photo" class="center">';
		sHTML += '<tr><td><div class="random_img"><p class="small">';
		sHTML += '<strong><img src="' + sPhoto + '" alt="Baseball photo" style="margin-left:auto; margin-right:auto;" />';
		if ( sTitle != '' )
			sHTML += '<span class="title">&nbsp;' + sTitle + '&nbsp;</span>';
		sHTML += '</strong></p></div></td></tr></table>\n';
	  }
	o.innerHTML = sHTML;
  }
}

// Function to write code to display a randomly-selected photo for home page
function myGetPhoto ( nOldImage )
{
var o = getElement( 'ins_HomePagePhoto' );
if ( o )
  {
	if ( arguments.length < 1 )
		nOldImage = 0;
	var nImage;
	do { nImage = myGallery.stack.draw() }
		while (nImage == nOldImage);
	var sPhoto = myGallery.name( nImage );
	var sTitle = myGallery.text( nImage );
	var sHTML = '<div class="random_img random_float"><p class="small">';
	sHTML += '<strong><img src="' + sPhoto + '" onclick="myGetPhoto(' + nImage + ');" alt="Baseball photo" />';
	if ( sTitle != '' )
		sHTML += '<span class="title">&nbsp;' + sTitle + '&nbsp;</span>';
	sHTML += '</strong></p><div class="but_next"><img src="img/but_next.png" width="13" height="21" onclick="myGetPhoto( ' + nImage + ');" title="Next random picture" /></div></div>\n';
	o.innerHTML = sHTML;
  }
}

// Function to write code to tell user they can click painting
function myInsertClickImage ( sID )
{
if ( arguments.length < 1 )
	sID = 'ins_clickimage';
var o = getElement( sID );
if ( o == null )
	return;
o.innerHTML = '<p><em class="note">Note</em> : the image above at the right is a photo taken at a game, transformed to resemble a painting. Click the image to view a random image in this gallery.</p>';
}

// Function to write code to tell user what the calendar options are
function myShowCalendarOptions ( id )
{
if ( arguments.length < 1 )
	id = 'ins_holydays';
var o = getElement( id );
if ( o )
  {
	if ( (typeof(oPageStyle.aCookie['CalCultural']) != 'undefined') && (oPageStyle.aCookie['CalCultural'] == 1) )
		o.innerHTML = '';
	else
		o.innerHTML = '<strong>not</strong>';
  }
}

// Function to write code to tell user whether cookies are enabled
function myShowCookiesEnabled ( id )
{
if ( arguments.length < 1 )
	id = 'ins_cookies_enabled';
var o = getElement( id );
if ( o )
  {
	if ( (typeof(oPageStyle) != 'undefined') && oPageStyle.aCookie.isEnabled() )
		o.innerHTML = '';
	else
		o.innerHTML = '<strong>not</strong>';
  }
}

// Function to write code to tell user whether JavaScript is enabled
function myShowJavaScriptEnabled ( id )
{
if ( arguments.length < 1 )
	id = 'ins_js_enabled';
var o = getElement( id );
if ( o )
	o.innerHTML = '';
}

// Function to write code to tell user what the calendar options are
function myShowNewsPageOptions ( id )
{
if ( arguments.length < 1 )
	id = 'ins_all_upcoming';
var o = getElement( id );
if ( o )
  {
	if ( (typeof(oPageStyle.aCookie['CalUpcoming']) != 'undefined') && (oPageStyle.aCookie['CalUpcoming'] == 1) )
		o.innerHTML = '<strong>not</strong> ';
	else
		o.innerHTML = '';
  }
}

