// THIS SCRIPT INSERTS:
// Get & Set Cookie
// Open PopUp Window
// Send Email
// Set all required variables

// Original JavaScript code by Duncan Crombie: dcrombie@chirp.com.au
// Please acknowledge use of this code by including this header.

var bikky = document.cookie;

function getCookie(name) { // use: getCookie("name");
    var index = bikky.indexOf(name + "=");
    if (index == -1) return null;
    index = bikky.indexOf("=", index) + 1;
    var endstr = bikky.indexOf(";", index);
    if (endstr == -1) endstr = bikky.length;
    return unescape(bikky.substring(index, endstr));
  }

var days=60

function setCookie(name, value,days) { // use: setCookie("name", value,days);

  var today_c = new Date();
  var expiry = new Date(today_c.getTime() + days * 24 * 60 * 60 * 1000); // plus given # of days
  var expired = new Date(today_c.getTime() - 1 * 24 * 60 * 60 * 1000); // less 1 day

    if (value != null && value != "")
      document.cookie=name + "=" + escape(value) + "; path=/ ; expires=" + expiry.toGMTString();
    bikky = document.cookie; // update bikky
    return getCookie(name) != null; // return false if the cookie was refused
  }


function StatusMsg(Text) {  // present information in Windows status bar
	self.defaultStatus=Text;
}

// display given file in a new windows
// Adrian Skeates May 1999

   function PopUp(name) { // use: FileMsg("filename");
window.open(name,"PopUp","resizable=yes,scrollbars=yes,menubar=no,width=350,height=250")
}

// Email function - get it off the web page!

function EMail() {
name = "webmaster";
domain = "paulnichollsonline.co.uk";
location.href='mailto:' + name + '@' + domain;
}

function EMailgreeny() {
name = "greeny-owner";
domain = "yahoogroups.com";
location.href='mailto:' + name + '@' + domain;
}

function EMailJRL() {
name = "dearborn";
domain = "ihug.co.nz";
location.href='mailto:' + name + '@' + domain;
}

//Get selection cookie and convert to array of Standard Links
var selection = getCookie("portal")
if (selection) {
	pageSelect=selection.split(",")
}


//Standard Date Assignment variables
// Array for months.
Month= new Array(12)
Month[0]="January";
Month[1]="February";
Month[2]="March";
Month[3]="April";
Month[4]="May";
Month[5]="June";
Month[6]="July";
Month[7]="August";
Month[8]="September";
Month[9]="October";
Month[10]="November";
Month[11]="December";


var today = new Date();
var mod = document.lastModified;
var moddate = Date.parse(mod);
var lastmod = new Date(Date.parse(mod))
var day = lastmod.getDate();
var UTCday = lastmod.getUTCDate();
var month = lastmod.getMonth();
var UTCmonth = lastmod.getUTCMonth();
var year = lastmod.getYear();
var hours = lastmod.getHours();
var UTChours = lastmod.getUTCHours();
var minutes = lastmod.getMinutes();
var UTCminutes = lastmod.getUTCMinutes();
var seconds = lastmod.getSeconds();
var ylen = year.length;

var gmtdate = lastmod.toGMTString();
var utcdate = lastmod.toUTCString();
var localedate = lastmod.toLocaleString();

if (minutes < 10) {
	minutes = "0"+minutes
}
if (seconds < 10) {
	seconds = "0" + seconds
}

//Fix for IE4 Y2K bug - buggers up Netscape :-(

var Syear = year.toString()

if (Syear.length < 4) {
	if (year < 80) year = eval("2000 + year");
	else year = eval("1900 + year")
}

