/* Date format routines */

/* Thanks to:  http://www.javascript-page.com & http://www.irt.org */

function makeArray0() {
     for (i = 0; i<makeArray0.arguments.length; i++)
          this[i] = makeArray0.arguments[i];
}

var months = new makeArray0('January','February','March',
    'April','May','June','July','August','September',
    'October','November','December');

function nths(day) {
     if (day == 1 || day == 21 || day == 31) return 'st';
     if (day == 2 || day == 22) return 'nd';
     if (day == 3 || day == 23) return 'rd';
     return 'th';
}

function correctedYear(year) {
// required for Netscape
    year = year - 0;
    if (year < 70) return (2000 + year);
    if (year < 1900) return (1900 + year);
    return year;
}

function formatDate(date) {
    var newYear = correctedYear(date.getYear());
    var newDate = new Date(newYear,date.getMonth(),date.getDate());
    return newDate.getDate() /* +  nths(newDate.getDate()) */ + " " + months[newDate.getMonth()] + " " + newYear;
}

function thisYear() {
    date = new Date();
    return correctedYear(date.getYear());
}

/* roll over routines for menu */

on = new Image; on.src = 'graphics/square.gif';
off = new Image; off.src = 'graphics/blank.gif';
function imgOn(page) {
  if (document.images) {
    document[page].src = on.src;
  }
}
function imgOff(page) {
  if (document.images && page != mypage) {
    document[page].src = off.src;
  }
}

/* checkFields for logo order */

function logoCheckFields() {
missinginfo = "";
if(document.form.realname.value == "") {
missinginfo += "\n     -  Your name";
}
if (document.form.TELEPHONE.value == "") {
missinginfo += "\n     -  Your telephone number";
}
if (document.form.DESCRIBE_BUSINESS.value == "") {
missinginfo += "\n     -  Description of your business";
}
if (document.form.LOGO_EXACTWORDS.value == "") {
missinginfo += "\n     -  Exact words for your logo";
}
if ((document.form.email.value == "") || (document.form.email.value.indexOf('@') == -1) || (document.form.email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  A valid email address";
}
if (missinginfo != "") {
missinginfo = "You failed to correctly fill in:\n" +
missinginfo + "\n\nPlease re-enter and submit again.";
alert(missinginfo);
return false;
}
else return true;
}

/* NEW WINDOW FOR LINK */

function newopen(url) {
   newwin = parent.open(url,'new','menubar,toolbar,scrollbars,resizable');
   newwin.focus()
}


