<!--
    // These utilities are written by Daniel Glynn for 1way2God.net; and can be used freely by others
    //  WITH ATTRIBUTATION - a link on their site would be nice (to http://www.1way2god.net or
    //   http://www.1way2god.net/wmresources.html); but in their code is all that is required.
    //
    //

ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
if (ns4 == false) {
  ns6 = (document.getElementById) ? true:false;
}

// loads str into position pos
function writediv(pos,str) {
  if (ns4) {
    document.layers[pos].document.open();
    document.layers[pos].document.write(str);
    document.layers[pos].document.close();
  }
  else if (ie4) { document.all[pos].innerHTML = str; }
  else if (ns6) { document.getElementById(pos).innerHTML = str; }
}

//returns the number of years since the given year.
function yearcount(year) {
    var _date = new Date();
    var curr_year = _date.getYear();
    document.write(curr_year - year);      
}

//returns the number of years since the given year.
function year_count(day,month,year) {
    var _date = new Date();
    var curr_year = _date.getYear();
    var curr_month = _date.getMonth();
    var curr_date = _date.getDate();
    var diff = 0;
    if (curr_month < month) diff=-1;
    else if (curr_month == month && curr_date < day) diff = -1;
    document.write(curr_year - year+diff);      
}

// yearsSince returns the numer of years since the given date to two decimal places. Note 
//  well that the day is the first argument, then month. This is the Australian AND logical way
//  of writing the date.
function yearsSince(day,month, year) {
    var _date = new Date(); 
    var curr_year = _date.getYear();
    if (curr_year < 2000) curr_year += 1900; //cover possible older versions
    var curr_month = _date.getMonth() + 1;
    var curr_day = _date.getDate();
    var num = curr_year - year;
    var diff = (curr_month-month)*100/12;
    diff += (curr_day-day)*100/365;
    var res = num*100 + diff;
    res = Math.round(res);
    res = res/100;
    document.write(res);
}


// returns the current date
function currentDate() {
    var _date = new Date(); 
    var year = _date.getYear();
    if (year < 2000) year += 1900; //cover possible older versions
    var curr_month = _date.getMonth();
    var month= "";
    if (curr_month == 0) month = "January";
    if (curr_month == 1) month = "February";
    if (curr_month == 2) month = "March";
    if (curr_month == 3) month = "April";
    if (curr_month == 4) month = "May";
    if (curr_month == 5) month = "June";
    if (curr_month == 6) month = "July";
    if (curr_month == 7) month = "August";
    if (curr_month == 8) month = "September";
    if (curr_month == 9) month = "October";
    if (curr_month == 10) month = "November";
    if (curr_month == 11) month = "December";
    var date = _date.getDate();
    var curr_day = _date.getDay();
    var day = "";
    if (curr_day == 0) day = "Sunday";
    if (curr_day == 1) day = "Monday";
    if (curr_day == 2) day = "Tuesday";
    if (curr_day == 3) day = "Wednesday";
    if (curr_day == 4) day = "Thursday";
    if (curr_day == 5) day = "Friday";
    if (curr_day == 6) day = "Saturday";
    document.write(day + ", " + date + " " + month + " " + year);
}

// if the str contains a domain (indicated by the presence of an '@' symbol, return the string again. if not, add the given domain.
// if the str is empty, return def(ault)
function addDomain(login,dom,def) {
    var str = login.toString();
    if (login.length == 0) return def;
    else {
        for (i=0; i< login.length; i++) {
              if (str.charAt(i) == '@') return login; 
        }
        return login+dom;
    }
}

function sepCSSfiles(moz_css,ie_css) {
    if (ns6) 
        {document.write("<link rel=\"stylesheet\" href=\""+moz+"\"/>")}
    else 
         {document.write("<link rel=\"stylesheet\" href=\""+ie_css+"\"/>")}  
}

//-->













