 // 1 through 12 or '*' within the next month, '0' for the current month
   // day of month or + day offset
var Bdow = 0;     // day of week sun=1 sat=7 or 0 for whatever day it falls on
    // 0 through 23 for the hour of the day
var Btz = 0;     // offset in hours from UTC to your timezone
var Blab = 'Bcountdown';  // id of the entry on the page where the counter is to be inserted

function Bcheck(){
if (Bactive == '1')
Bstart()
}

function Bstart() {
BdisplayCountdown(BsetCountdown(Bmonth,Bday,Bhour,Btz),Blab);
}

Bloaded(Blab,Bcheck);

// Countdown Javascript
// copyright 20th April 2005, 4th October 2006 by Stephen Chapman
// permission to Be this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is Bed without any alteration
// you may change the start function if required
var pageLoaded = 0;

window.onload = function() {
pageLoaded = 1;
}

function Bloaded(Bi,Bf) {
if (document.getElementById && document.getElementById(Bi) != null)
 Bf();
 else if (!pageLoaded)
 setTimeout('Bloaded(\''+Bi+'\','+Bf+')',100);
}

function BsetCountdown(Bmonth,Bday,Bhour,Btz) {
var Bm = Bmonth;
 if (Bmonth=='*')
 Bm = 0;
  var Bc = BsetC(Bm,Bday,Bhour,Btz);
 if (Bmonth == '*' && Bc < 0)
  Bc = BsetC('*',Bday,Bhour,Btz);
 return Bc;
} 

function BsetC(Bmonth,Bday,Bhour,Btz) {
var BtoDate = new Date();
if (Bday.substr(0,1) == '+') {
var Bday1 = parseInt(Bday.substr(1));
BtoDate.setDate(BtoDate.getDate()+Bday1);
} else{
BtoDate.setDate(Bday);
}
if (Bmonth == '*')
BtoDate.setMonth(BtoDate.getMonth() + 1);
else if (Bmonth > 0) { 
if (Bmonth <= BtoDate.getMonth())
BtoDate.setYear(BtoDate.getYear() + 1);
BtoDate.setMonth(Bmonth-1);
}
if (Bdow >0)
 BtoDate.setDate(BtoDate.getDate()+(Bdow-1-BtoDate.getDay())%7);
BtoDate.setHours(Bhour);
BtoDate.setMinutes(0-(Btz*60));
BtoDate.setSeconds(0);
var BfromDate = new Date();
BfromDate.setMinutes(BfromDate.getMinutes() + BfromDate.getTimezoneOffset());
var BdiffDate = new Date(0);
BdiffDate.setMilliseconds(BtoDate - BfromDate);
return Math.floor(BdiffDate.valueOf()/1000);
}

function BdisplayCountdown(Bcountdn,Bcd) {
if (Bcountdn < 0){
 document.getElementById(Bcd).innerHTML = "<font style=\"font-size: 20px\"><b>The Mission is underway</b></font>";
 }else {
var Bsecs = Bcountdn % 60;
 if (Bsecs < 10)
 Bsecs = '0'+Bsecs;
var Bcountdn1 = (Bcountdn - Bsecs) / 60;
var Bmins = Bcountdn1 % 60;
 if (Bmins < 10)
 Bmins = '0'+Bmins;
Bcountdn1 = (Bcountdn1 - Bmins) / 60;
var Bhours = Bcountdn1 % 24;
var Bdays = (Bcountdn1 - Bhours) / 24;
document.getElementById(Bcd).innerHTML = '<font style="font-size: '+Bsize+'px; font-color: #E3FFFF"><b>'+Bdays+' Days '+Bhours+' Hours '+Bmins+' Minutes '+Bsecs+' Seconds Until Next Mission</b></font>';
setTimeout('BdisplayCountdown('+(Bcountdn-1)+',\''+Bcd+'\');',999);
}
}
