function popup(URL)
{
window.open(URL,"","scrollbars,resizable,width=400,height=450,left=200,top=150");
}

function ProgUp(aURL)
	{
	var pwidth=550;
    var pheight=600;
    var wintop = screen.height-pheight-250;
    var winleft = screen.width-pwidth-575;
    var settings = 'toolbar=no, menubar=no, resizable=yes, scrollbars=yes';
    var progwin = null;
        if (!progwin || progwin.closed )
        {
          settings += ',' + 'top=' + wintop;
          settings += ',' + 'left='+ winleft;
          settings += ',' + 'width='+ pwidth;
          settings += ',' + 'height='+ pheight;
          progwin=window.open(aURL,'program', settings);
          progwin.focus();
        }
        else
        {
          progwin.location=aURL;
          program.focus();
        }
    }

function Windup(aURL)
	{
	var pwidth=750;
    var pheight=600;
    var wintop = screen.height-pheight-250;
    var winleft = screen.width-pwidth-375;
    var settings = 'toolbar=no, menubar=no, resizable=yes, scrollbars=yes';
    var progwin = null;
        if (!progwin || progwin.closed )
        {
          settings += ',' + 'top=' + wintop;
          settings += ',' + 'left='+ winleft;
          settings += ',' + 'width='+ pwidth;
          settings += ',' + 'height='+ pheight;
          progwin=window.open(aURL,'program', settings);
          progwin.focus();
        }
        else
        {
          progwin.location=aURL;
          program.focus();
        }
    }

function PopNew(bURL)
	{
    var settings = 'resizable=yes, scrollbars=yes, toolbar=yes, menubar=yes, status=yes';
    var popwin = null;
        if (!popwin || popwin.closed )
        {
          popwin=window.open(bURL,'newwin', settings);
          popwin.focus();
        }
        else
        {
          popwin.location=bURL;
          newwin.focus();
        }
    }

function opennewwindow(strUrl)
{
	var newwindow = null; // global variable
	var PreviousUrl; /* global variable which will store the
                    url currently in the secondary window */
  if(newwindow === null || newwindow.closed)
  {
   newwindow = window.open(strUrl, "newwin",
         "resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,status=yes");
  }
  else if(newwindow)
  {
   newwindow = window.open(strUrl, "newwin",
      "resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,status=yes");
    /* if the resource to load is different,
       then we load it in the already opened secondary window and then
       we bring such window back on top/in front of its parent window. */
   newwindow.focus();
  }
  else
  {
    newwin.focus();
  }
  PreviousUrl = strUrl;
  /* explanation: we store the current url in order to compare url
     in the event of another call of this function. */
}

function countdown()
{
var date = new Date(party);
var description = "the party";
var now = new Date();
var diff = date.getTime() - now.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
when = days+1;
if (days > 1) {
document.write("Only " + when + " days until " + description + "!");
}
else if (days == 1) {
document.write("Only two days until " + description + "!");
}
else if (days == 0) {
document.write("The " + description + "'s tomorrow!");
}
else if (days == -1) {
document.write("The " + description + "'s today!");
}
else {
document.write("The " + description + "'s over!");
}
}

function countdown2()
{
var date = new Date(thedate);
var description = (event);
var now = new Date();
var diff = date.getTime() - now.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
when = days+1;
if (days > 1) {
document.write("Only " + when + " days until " + description + "!");
}
else if (days == 1) {
document.write("Only two days until " + description + "!");
}
else if (days == 0) {
document.write("The " + description + "'s tomorrow!");
}
else if (days == -1) {
document.write("The " + description + "'s today!");
}
else {
document.write("The " + description + "'s over!");
}
}

function countdown3()
{
var date = new Date(deadline);
var description = (event);
var now = new Date();
var diff = date.getTime() - now.getTime();
var days = Math.floor(diff / (1000 * 60 * 60 * 24));
calcdays = days+1;
if (days > 1) {
document.write(calcdays + " days to " + description + "!");
}
else if (days == 1) {
document.write("2 days to " + description + "!");
}
else if (days == 0) {
document.write("Tomorrow is " + description + "!");
}
else if (days == -1) {
document.write("Today is " + description + "!");
}
else {
document.write("It's past " + description + "!");
}
}

function gotop() 
{
        self.scrollTo(0, 0);
}

