
/* Javascript functions for wjca website */

<!-- Escape from domain owner s frameset
function burstframe() {
	if (window != window.top)
	   top.location.href.replace(self.location.href);
};
//-->

<!-- Countdown to next meeting
function countdown(NextMtg)
{
var months = new Array ( "January", "February", "March", "April", "May", "June",
	"July", "August", "September", "October", "November", "December" );
var weekdays = new Array ( "Sunday", "Monday", "Tuesday", "Wednesday",
	"Thursday", "Friday", "Saturday" );

today = new Date();
todayMilliseconds = today.getTime();

target = new Date(NextMtg);
targetMilliseconds = target.getTime();
targetHours = target.getHours();

/*
if ( targetMilliseconds > todayMilliseconds )
{
	document.write("<p>Owing to the bad weather, the meeting on 10th February 2007 is cancelled. The new meeting the the Captains' Challenge ");
}
else
{

	target = new Date("17 February 2007 10:00");
	targetMilliseconds = target.getTime();
	document.write( "<p>The next meeting is " );
}
 */
document.write( "<p>The next meeting is " );

while ( targetMilliseconds < todayMilliseconds )
{
	targetMilliseconds += (1000*60*60*24*7);	// Add one week of milliseconds
	target = new Date( targetMilliseconds );
	target.setHours( targetHours );			// Fix hour discrepancy which occurs at DST change
}

document.write( "on " + weekdays[ target.getDay() ] + " " + target.getDate() );

switch ( target.getDate() )
{
case 1:
case 21:
case 31:
	document.write( "st " );
	break;
case 2:
case 22:
	document.write( "nd " );
	break;
case 3:
case 23:
	document.write( "rd " );
	break;
default:
	document.write( "th " );
	break;
}

document.write( months[ target. getMonth() ] +  " " +target.getFullYear() + " at " + target.getHours() + ":" );
if( target.getMinutes() <= 9)
	document.write( "0" );
document.write( target.getMinutes() );
document.write( "</p>" );

minutes = (targetMilliseconds - todayMilliseconds) /60/1000;
daysLeft = Math.floor(minutes /24/60);
hoursLeft= Math.floor(( minutes - ( daysLeft *24*60 )) /60);
minsLeft = Math.floor( minutes - ( daysLeft *24*60 ) - ( hoursLeft*60 ));
if ( minutes >= 0 )
{
document.write( "<strong>" );
document.write( daysLeft + " days " + hoursLeft + " hours " + minsLeft + " minutes to go" );
document.write( "<\/strong>" );
}
}
//-->

function nomeeting( message, noMeetingDate )  // print a message about a cancelled meeting
{						// (if in the future)
today = new Date();
target = new Date(noMeetingDate);

if ( target > today )
{
document.write( message );
}

targetHours = target.getHours();


}

<!-- Hide my email from robots
function lastupdate()
{
var date = new Date( document.lastModified );
document.write( "<small>" );
document.write( "Last updated " + date );
document.write( " by <a href=\"mailto:webmaster" );
document.write( "&#64;wjca.org.uk\">Webmaster</a><br />" );
document.write( "<\/small>" );
}
-->
