<!--
/**
 * browsercheck.js detects for browser compatibility and DOM features required for topbar.
 * Places a cookie on users computer which alerts user if browser is out of date, once every 12 days (configureable)
 *
 * $Id: browsercheck.js,v 1.1.1.1 2005/06/23 06:43:23 john Exp $
 */

function checkBrowser()
{
	this.opera= (navigator.userAgent.indexOf('Opera')>-1);
	this.ie4= (document.all && !document.getElementById);
	this.ie5= (document.all && document.getElementById && !this.opera);
	this.ns4= (document.layers && !document.getElementById);
	this.ns6= (!document.all && document.getElementById && !this.opera);
	this.mac= (navigator.userAgent.indexOf('Mac')>-1 && this.ie4);
	this.ok= (this.ie4 || this.ie5 || this.ns4 || this.ns6 || this.opera);
}
br=new checkBrowser();


function openWin(url, width, height) {
	var win = window.open(url, '_blank','resizable=no,scrollbars=no,status=0,directories=no,toolbar=no,menubar=no,width='+width+',height='+height);
}

function Get_Cookie(name) {
	var start = document.cookie.indexOf(name+"=");
	var len = start+name.length+1;
	if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	if (start == -1) return null;
	var end = document.cookie.indexOf(";",len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires,path,domain,secure) {
	document.cookie = name + "=" +escape(value) +
		( (expires) ? ";expires=" + expires.toGMTString() : "") +
		( (path) ? ";path=" + path : "") + 
		( (domain) ? ";domain=" + domain : "") +
		( (secure) ? ";secure" : "");
}

function Delete_Cookie(name,path,domain) {
	if (Get_Cookie(name)) document.cookie = name + "=" +
		( (path) ? ";path=" + path : "") +
		( (domain) ? ";domain=" + domain : "") +
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

var warningUrl = '/upgrade.html';
var days = 14; // valid two weeks from now

function isCookieEnabled() {
   if (document.all) return navigator.cookieEnabled;
   Set_Cookie('testcookie',today.getTime());
   var tc = Get_Cookie('testcookie');
   Delete_Cookie('testcookie');
   return (tc == today.getTime());
}

var today = new Date();
var zero_date = new Date(0,0,0);
today.setTime(today.getTime() - zero_date.getTime());

var todays_date = new
Date(today.getYear(),today.getMonth(),today.getDate(),0,0,0);
var expires_date = new Date(todays_date.getTime() + (days * 86400000));

if(br.ns4||br.ie4) {
	var amUpgrade = Get_Cookie('amUpgrade');
	if (amUpgrade != 'yes') {
		if (isCookieEnabled()) {
			Set_Cookie('amUpgrade','yes',expires_date,'/');
			openWin('/upgrade.html',400,150);
		}
	}
}

// -->
