
function clientDetection(){
	var agt = navigator.userAgent.toLowerCase();
	
	this.platform = navigator.platform.toLowerCase();
	this.name = agt;
	
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	
	this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)));
	this.nav2 = (this.nav && (this.major == 2));
	this.nav3 = (this.nav && (this.major == 3));
	this.nav4 = (this.nav && (this.major == 4));
	this.nav6 = (this.nav && (this.major == 5));
	
	this.ie   = (agt.indexOf("msie") != -1);
	this.ie3  = (this.ie && (this.major == 2));
	this.ie4  = (this.ie && (this.major == 4));
	
	this.opera = (agt.indexOf("opera") != -1);
	
	this.nav6up = this.nav && (this.major >= 5);
	this.ie4up  = this.ie  && (this.major >= 4);
}

var browser = new clientDetection();

//--------------------
function reloadLocation() {
	location.reload();
}
//--------------------
function reloadOnResize() {
	addWinEventListener('RESIZE', 'reloadLocation');
}
//--------------------
function getClientWidth(){
	if(browser.nav4) return(window.innerWidth);
	else if(browser.ie4up) return(document.body.clientWidth);
	else if(browser.nav6up) return(window.innerWidth);
}
//--------------------
function getClientHeight(){
	if(browser.nav4) return(window.innerHeight);
	else if(browser.ie4up) return(document.body.clientHeight);
	else if(browser.nav6up) return(window.innerHeight);
}
//--------------------
function addWinEventListener(event, action){
	if(browser.nav4 || browser.ie4up){
		if(browser.nav4){
			eval("captureEvents(Event." + event + ")");
			eval("on" + event.toLowerCase() + "=" + action);
		}
		else{
			eval("document.on" + event.toLowerCase() + "=" + action);
		}
	}
	else if(browser.nav6up){
		eval("addEventListener('" + event.toLowerCase() + "', " + action + ", false)");
	}
}

function nextYear(){
  // create an instance of the Date object
  var expYear = new Date();
  // fix the bug in Navigator 2.0, Macintosh
  fixDate(expYear);
  expYear.setTime(expYear.getTime() + 365 * 24 * 60 * 60 * 1000);
	return expYear;

}
// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}