//******************************************//
//**    Javascript Business Objects       **//
//**      (C) Copyright 2000-2002         **//
//**           By Level 2 Labs            **//
//**          All Rights Reserved         **//
//** Copying this web page, its content,  **//
//** code, images, or any other item      **//
//** in it without the expressed written  **//
//** permission from Level 2 Labs is      **//
//** strictly prohibited.                 **//
//******************************************//

//***************//
//** Browser() **//
//***************//
function Browser()
{
	//** Assign Browser Brand **//
	this.brand = "UNKNOWN";
	this.brief = "UNKNOWN";
	var ck = navigator.appName.toUpperCase();
	if (ck.indexOf("MICROSOFT") != -1) { this.brand = "MICROSOFT"; this.brief = "IE"; }
	if (ck.indexOf("NETSCAPE") != -1) { this.brand = "NETSCAPE"; this.brief = "NS"; }

	//** Assign Browser Full Version **//
	this.fullVersion = navigator.appVersion.toUpperCase();

	//** Assign the userAgent variable **//
	this.agent = navigator.userAgent.toUpperCase();

	//** Figure out if is a custom browser **//
	this.custom = false;
	if (this.fullVersion.indexOf("C-") !=-1) { this.custom = true; }

	//** Figure out what minor version it is **//
	this.minorVersion = "UNKNOWN";
	if (this.fullVersion.indexOf(".00;") != -1) { this.minorVersion = ".0"; }
	if (this.fullVersion.indexOf(".0;") != -1) { this.minorVersion = ".0"; }
	if (this.fullVersion.indexOf(".00") != -1) { this.minorVersion = ".0"; }
	if (this.fullVersion.indexOf(".0 ") != -1) { this.minorVersion = ".0"; }
	if (this.fullVersion.indexOf(".01") != -1) { this.minorVersion = ".01"; }
	if (this.fullVersion.indexOf(".02") != -1) { this.minorVersion = ".02"; }
	if (this.fullVersion.indexOf(".03") != -1) { this.minorVersion = ".03"; }
	if (this.fullVersion.indexOf(".04") != -1) { this.minorVersion = ".04"; }
	if (this.fullVersion.indexOf(".05") != -1) { this.minorVersion = ".05"; }
	if (this.fullVersion.indexOf(".06") != -1) { this.minorVersion = ".06"; }

	//** Figure out what major version it is **//
	this.majorVersion = "UNKNOWN";
	if (this.brand != "MICROSOFT")
	{
		if (this.fullVersion.indexOf("1.") !=-1) { this.majorVersion = "1"; this.brief += "1"; }
		if (this.fullVersion.indexOf("2.") !=-1) { this.majorVersion = "2"; this.brief += "2"; }
		if (this.fullVersion.indexOf("3.") !=-1) { this.majorVersion = "3"; this.brief += "3"; }
		if (this.fullVersion.indexOf("4.") !=-1) { this.majorVersion = "4"; this.brief += "4"; }
		if (this.fullVersion.indexOf("5.") !=-1) { this.majorVersion = "5"; this.brief += "5"; }
		if (this.fullVersion.indexOf("6.") !=-1) { this.majorVersion = "6"; this.brief += "6"; }
	} else {
		if (this.fullVersion.indexOf("MSIE 1.") != -1) { this.majorVersion = "1"; this.brief += "1"; }
		if (this.fullVersion.indexOf("MSIE 2.") != -1) { this.majorVersion = "2"; this.brief += "2"; }
		if (this.fullVersion.indexOf("MSIE 3.") != -1) { this.majorVersion = "3"; this.brief += "3"; }
		if (this.fullVersion.indexOf("MSIE 4.") != -1) { this.majorVersion = "4"; this.brief += "4"; }
		if (this.fullVersion.indexOf("MSIE 5.") != -1) { this.majorVersion = "5"; this.brief += "5"; }
		if (this.fullVersion.indexOf("MSIE 6.") != -1) { this.majorVersion = "6"; this.brief += "6"; }
	}		

	//** Figure version **//
	this.version="UNKNOWN";
	if (this.majorVersion == "UNKNOWN" && this.minorVersion != "UNKNOWN") { this.version = "x" + this.minorVersion; }
	if (this.majorVersion != "UNKNOWN" && this.minorVersion == "UNKNOWN") { this.version = this.majorVersion + ".x"; }
	if (this.majorVersion != "UNKNOWN" && this.minorVersion != "UNKNOWN") { this.version = this.majorVersion +""+ this.minorVersion; }

	//** Figure out what the operating system is **//
	this.os = "UNKNOWN";
	if (this.fullVersion.indexOf("WIN95") != -1) { this.os = "WIN95"; }
	if (this.fullVersion.indexOf("WIN 95") != -1) { this.os = "WIN95"; }
	if (this.fullVersion.indexOf("WINDOWS 95") != -1) { this.os = "WIN95"; }
	if (this.fullVersion.indexOf("WIN16") != -1) { this.os = "WIN3.1"; }
	if (this.fullVersion.indexOf("MAC") != -1) { this.os = "MAC"; }
	if (this.fullVersion.indexOf("X11") != -1) { this.os = "UNIX"; }
	if (this.fullVersion.indexOf("WINNT") != -1) { this.os = "NT"; }
	if (this.fullVersion.indexOf("WIN NT") != -1) { this.os = "NT"; }
	if (this.fullVersion.indexOf("WINDOWS NT") != -1) { this.os = "NT"; }
	
	//** Figure out if DHTML is supported **//
	this.dhtml = "NONE";
	if (document.all) { this.dhtml = "IE"; }
	if (document.layers) {this.dhtml = "COMMUNICATOR"; }
	
	//** return all variables **//
	return this.brand, this.brief, this.fullVersion, this.agent, this.custom,
		   this.minorVersion, this.majorVersion, this.version, this.os, this.dhtml;
}


//***********//
//** Today **//
//***********//
function Today()
{
	//** Get today's date on user's machine **//
	var today = new Date();
	var iDay = today.getDay();
	var iMonth = today.getMonth();
	var iDate = today.getDate();
	var iYear = new Number(today.getYear());
	
	//** Assign long names to months **//
	var monthName = new Array();
	monthName[0] = "January";
	monthName[1] = "February";
	monthName[2] = "March";
	monthName[3] = "April";
	monthName[4] = "May";
	monthName[5] = "June";
	monthName[6] = "July";
	monthName[7] = "August";
	monthName[8] = "September";
	monthName[9] = "October";
	monthName[10] = "November";
	monthName[11] = "December";
    
	//** Assign short names to months **//
	var monthShortName = new Array();
	monthShortName[0] = "Jan";
	monthShortName[1] = "Feb";
	monthShortName[2] = "Mar";
	monthShortName[3] = "Apr";
	monthShortName[4] = "May";
	monthShortName[5] = "Jun";
	monthShortName[6] = "Jul";
	monthShortName[7] = "Aug";
	monthShortName[8] = "Sep";
	monthShortName[9] = "Oct";
	monthShortName[10] = "Nov";
	monthShortName[11] = "Dec";
	
  	//** Assign names to days **//
	var dayShortName = new Array();
	dayShortName[0] = "Sun";
	dayShortName[1] = "Mon";
	dayShortName[2] = "Tue";
	dayShortName[3] = "Wed";
	dayShortName[4] = "Thu";
	dayShortName[5] = "Fri";
	dayShortName[6] = "Sat";
    
	//** Assign names to days **//
	var dayName = new Array();
	dayName[0] = "Sunday";
	dayName[1] = "Monday";
	dayName[2] = "Tuesday";
	dayName[3] = "Wednesday";
	dayName[4] = "Thursday";
	dayName[5] = "Friday";
	dayName[6] = "Saturday";

	//** Set values to return **//
	this.date = iDate;
	this.day = dayName[iDay];
    this.dayShort = dayShortName[iDay];
	this.month = monthName[iMonth];
    this.monthShort = monthShortName[iMonth];
	
	//** Check for 2 year (<2000) years and make proper assignment **//
	this.year = (iYear.toString().length == 2) ? "19"+iYear : iYear;
	
	//** Set complete date in format of Day Month Date, Year **//
	this.fullDate = this.day + ", " + this.month + " " + this.date + ", " + this.year;

    //** Set complete date in format of Day Month Date, Year **//
	this.fullDateShort = this.dayShort + ", " + this.monthShort + " " + this.date + ", " + this.year;
	
	//** return all variables **//
	return this.date, this.day, this.month, this.year, this.today, this.todayShort, this.monthShort, this.dayShort;
}


//***********//
//** Video **//
//***********//
function Video()
{
	//** Check for browser support of screen object **//
	if (window.screen)
	{
		//** Check for video specs **//
		this.height = screen.height;
		this.width = screen.width;
		this.colorBits = screen.colorDepth;
		this.colors = Math.pow(16, (screen.colorDepth / 4));
	} else {
		this.height = "Unable to read.";
		this.width = "Unable to read.";
		this.colorBits = "Unable to read.";
		this.colors = "Unable to read.";
	}	

	//** return all variables **//
	return this.height, this.width, this.colors, this.colorBits;
}

