/*************************************************************
	Begin Browser Object
*************************************************************/	
/*
	browObj()
	heavily modified version of the lib_bwcheck() from dhtmlcentral.com
	usage: var b = new browObj(); if(b.ie5)
*/
function browObj() {
	// break up the vital info about the browser into usable chunks
	this.ver	= navigator.appVersion.toLowerCase();
	this.agent	= navigator.userAgent.toLowerCase();
	this.plat	= navigator.platform.toLowerCase();
	this.mac	= (this.agent.indexOf("mac")>-1);
	this.pc 	= (this.agent.indexOf("windows")>-1);
			
	// start specific browser testing
	this.dom	= document.getElementById ? true:false;
	this.opera5	= (this.agent.indexOf("opera")>-1 && document.getElementById) ? true:false;
	this.ie5	= (this.ver.indexOf("msie 5")>-1 && this.dom && !this.opera5) ? true:false; 
	this.ie6	= (this.ver.indexOf("msie 6")>-1 && this.dom && !this.opera5) ? true:false;
	this.ie4	= (document.all && !this.dom && !this.opera5) ? true:false;
	this.ie		= (this.ie5 || this.ie6);
	this.ieMac	= (this.ie5 && this.mac);
	this.ns6	= (this.dom && parseInt(this.ver) >= 5) ? true:false; 
	this.ns4	= (document.layers && !this.dom) ? true:false;
	
	// define what is an acceptable browser
	// for our case it must be ie5+ ns6
	this.isAcceptable = (this.ie6 || this.ie5 || this.ns6 || this.ieMac);
	return this;
} // end browObj()

// instatiate a new browser object
var b = new browObj()
/*************************************************************
	End Browser Object
*************************************************************/	

/*************************************************************
	Begin Flash objet
*************************************************************/	
/* 
	flashObj()
	builds the code to write out a flash movie based on the 
	width,height and source passed to it
*/
function flashObj(w,h,s) {
	this.width 	= w;
	this.height	= h;
	this.source = s;
	
	// build the output string
	this.output  =  "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" id=\"fla\" width=\""+this.width+"\" height=\""+this.height+"\">";
	this.output += "		<param name=\"movie\" value=\""+this.source+"\">";
	this.output += "		<param name=\"quality\" value=\"high\">";
	this.output += "		<param name=\"menu\" value=\"false\">";
	this.output += "		<embed src=\""+this.source+"\" quality=\"high\" menu=\"false\" width=\""+this.width+"\" height=\""+this.height+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed>";
	this.output += "</object>";	
	
	return this;	
} 
/*************************************************************
	End Flash objet
*************************************************************/	

/*************************************************************
	Begin Window Info Object
*************************************************************/	
// winObj()
// creates an object that stores the various properties of the window
// usage: var w = new winObj(); if(w.w > 1280)
function winObj() {
	this.screenW 			= window.screen.width;
	this.screenH			= window.screen.height;
	this.screenAvailW		= window.screen.availWidth;
	this.screenAvailH		= window.screen.availHeight;

	return this;
} 

// instatiate a new screen obj
var w = new winObj();
/*************************************************************
	Begin Window Info Object
*************************************************************/	

/*************************************************************
	Begin random image object
*************************************************************/
/*
	function _add_img(img)
	
	creates an array of images
	based on the img var passed 
	to it.
*/
function _add_img(img) {
	this.rand_img_arr[this.rand_img_arr.length] = img;
}		

/*
	random image object
	generates a random image picked from an array of images
	
	Tested in: 
	Netscape 4, IE 6, Netscape 6, Mozilla 1.0, Opera 6.4
	
	methods:
	addImg - Adds the specified image to the array of images
	rndNum - Generates a random number based on the number of 
			 images in the im_arr

*/
function oRandom() {
	this.rand_img_arr = new Array();
	this.addImg = _add_img;
	this.rndNum = "";
	this.strOut = "";
}
/*************************************************************
	End random image object
*************************************************************/

/*************************************************************
	Begin Rollover object
*************************************************************/	
/*
	function _add_img(img)
	creates an array of tops based on the img vars passed to it.
*/
function _add_roll_img(id) {
	this.ref_arr[this.ref_arr.length] = id;
}

/*	
	function _mouse_over(id)
	sets the image (id) to it's on state
*/
function _mouse_over(id) {
	for(var i=0;i<this.ref_arr.length;i++){
		if(this.ref_arr[i] == id) {
			img_to_load = i;
		}
	}
	document.images[id].src = this.path + this.ref_arr[img_to_load] + '_ov.gif';
}

/*
	function _mouse_out(id)
	sets the image (id) back to it's original state
*/
function _mouse_out(id) {
	for(var i=0;i<this.ref_arr.length;i++){
		if(this.ref_arr[i] == id) {
			img_to_load = i;
		}
	}
	document.images[id].src = this.path + this.ref_arr[img_to_load] + '.gif';
}

/*
	rollObj();
	Creates an object to handle image rollovers
*/	
function rollObj() {
	this.ref_arr = new Array();
	this.path = "";
	
	this.add_roll_img = _add_roll_img;
	this.m_over = _mouse_over;
	this.m_out = _mouse_out;
}
/*************************************************************
	End Rollover object
*************************************************************/

/*************************************************************
	Begin Open Window objet
*************************************************************/	
// open window functions... need to be documented
function _pop_win(page) {
	var s, features
	if(page) this.page_to_open = page
	s = ",width="+this.f_w+",height="+this.f_h;
	features = "'status="+this.f_s+",scrollbars="+this.f_sb+",toolbar="+this.f_t+",location="+this.f_l+",menubar="+this.f_m+",resizable="+this.f_r+",top="+this.f_x+",left="+this.f_y+""+s+"'";
	window.open(this.page_to_open,this.win_name,features);
}
/*
	popup window object
	generates a pop up window
	
	methods:
	_pop_win - opens the window
*/
function popObj() {
	this.page_to_open = "";
	this.win_name = "";
	
	this.f_w = "";
	this.f_h = "";
	this.f_x = "";
	this.f_y = "";
	// these defaults can be overridden
	this.f_s = "no"; // status bar
	this.f_sb = "yes"; // scrollbars
	this.f_t = "no"; // titlebar
	this.f_l = "no"; // location bar
	this.f_m = "no"; // menu?
	this.f_r = "no"; // resizable
	
	this.pop_win = _pop_win;

}
/*************************************************************
	End Open Window objet
*************************************************************/	