var agt = navigator.userAgent.toLowerCase();
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);
var unix = ((agt.indexOf("x11")!=-1) || (agt.indexOf("sunos")!=-1) || (agt.indexOf("irix") !=-1) || (agt.indexOf("hp-ux")!=-1) || (agt.indexOf("sco")!=-1) || (agt.indexOf("unix")!=-1) || (agt.indexOf("ncr")!=-1) || (agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alpha")!=-1) || (agt.indexOf("sinix")!=-1) || (agt.indexOf("aix") !=-1) || (agt.indexOf("inux")!=-1) || (agt.indexOf("bsd")!=-1));
var ns = (agt.indexOf("mozilla")!=-1 && agt.indexOf("compatible")==-1);
var ie = (agt.indexOf("msie")!=-1);
var ver = (agt.indexOf("msie 5")!=-1) ? 5 : parseInt(navigator.appVersion);


var popupwindow = null;
function poppage(site, w, h, func, resizer, statuser, loc, scroller) {

	if (ns && (ver < 4)) {
		w += 20;
		h += 20;
	}
	windowparams = "resizable="+resizer+",status="+statuser+",location="+loc+",scrollbars="+scroller+",width="+w+",height="+h;
	if (ver >= 4) {
		_left = ((screen.width - w) >>1);
		_top = ((screen.height - h) >> 1);
	} else {
		_left = ((648 - w) >> 1);
		_top = ((324 - h) >> 1);
	}
	if (ie) {
		windowparams += ",top=" + _top + ",left=" + _left;
	} else if (ns) {
		windowparams += ",screenX=" + _left + ",screenY=" + _top;
	}

	popupwindow = window.open(site, "powindow" + func, windowparams);
	setTimeout("popupwindow.focus()", 100);
}


function ChangeImage(strImageName, objImageSrc) {
	if (document.images) {
		document.images[strImageName].src = objImageSrc;
	}
}

// Browser Info
function UFcheckBrowser(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase();
	this.dom=document.getElementById?1:0
	this.all=document.all?1:0;
	this.layers=document.layers?1:0;
	this.images=document.images?1:0;
	this.IE = navigator.appName=="Microsoft Internet Explorer"?1:0;
	this.NS = navigator.appName=="Netscape"?1:0;
	this.MAC = (this.agent.indexOf("mac")!=-1);

	return this
}

oUFBrowser=UFcheckBrowser();


//*****************************************************************************
//Function	: UFGetDivTop(String)
//Author	: Brendon Stepanian
//Date/Time	: 01-10-2003
//Purpose	: Gets the top pixel position of the specified div
//Parameters: String - ID of the <SPAN> or <DIV> tag to query
//Returns	: N/A
//Revisions	: N/A
//*****************************************************************************
function UFGetDivTop(sLayerName) {

	oUFBrowser=UFcheckBrowser();

	if (oUFBrowser.dom) {
		if (document.getElementById(sLayerName)) {
			return(document.getElementById(sLayerName).style.top);
		}
	} else if (oUFBrowser.layers) {
		if (document.layers[sLayerName]) {
		        return(document.layers[sLayerName].top);
		}
	}  else if (oUFBrowser.all) { // Internet Explorer
		if (document.all[sLayerName]) {
		    return(document.all[sLayerName].style.top);
		}
	}

    //incase the attribute name is not found
	return '';
}


//*****************************************************************************
//Function	: UFGetDivLeft(String)
//Author	: Brendon Stepanian
//Date/Time	: 01-10-2003
//Purpose	: Gets the left pixel position of the specified div
//Parameters: String - ID of the <SPAN> or <DIV>
//Returns	: N/A
//Revisions	: N/A
//*****************************************************************************
function UFGetDivLeft(sLayerName) {

	oUFBrowser=UFcheckBrowser();

	if (oUFBrowser.dom) {
		if (document.getElementById(sLayerName)) {
			return(document.getElementById(sLayerName).style.left);
		}
	} else if (oUFBrowser.layers) {
		if (document.layers[sLayerName]) {
		        return(document.layers[sLayerName].left);
		}
	}  else if (oUFBrowser.all) { // Internet Explorer
		if (document.all[sLayerName]) {
		    return(document.all[sLayerName].style.left);
		}
	}

    //incase the attribute name is not found
	return '';
}


//*****************************************************************************
//Function	: UFHideLayer(String)
//Author	: Steven Green
//Date/Time	: 06-20-2002
//Purpose	: This function will change the style of a <SPAN> or <DIV> tag to
//            hidden so it will disappear from the page
//Parameters: String - ID of the <SPAN> or <DIV> tag that should disappear
//
//Returns	: N/A
//Revisions	: N/A
//*****************************************************************************
function UFHideLayer(sLayerName) {

	oUFBrowser=UFcheckBrowser();

	if (oUFBrowser.dom) {
		if (document.getElementById(sLayerName)) {
			document.getElementById(sLayerName).style.visibility = 'hidden';
		}
	} else if (oUFBrowser.layers) {
		if (document.layers[sLayerName]) {
	        document.layers[sLayerName].visibility = 'hide';
		}
	} else if (oUFBrowser.all)  {
		if (document.all[sLayerName]) {
	        document.all[sLayerName].style.visibility = 'hidden';
	       	document.all[sLayerName].style.zIndex = -100;
		}
	}

}


//*****************************************************************************
//Function	: UFShowLayer(String)
//Author	: Steven Green
//Date/Time	: 06-20-2002
//Purpose	: This function will change the style of a <SPAN> or <DIV> tag
//            to visible so it will appear on the page
//Parameters	: String - ID of the <SPAN> or <DIV> tag that should appear
//
//Returns	: N/A
//Revisions	: N/A
//*****************************************************************************
function UFShowLayer(sLayerName) {

	oUFBrowser=UFcheckBrowser();

	if (oUFBrowser.dom) {
		if (document.getElementById(sLayerName)) {
			document.getElementById(sLayerName).style.visibility = 'visible';
		}
	} else if (oUFBrowser.layers) {
		if (document.layers[sLayerName]) {
		        document.layers[sLayerName].visibility = 'visible';
		}
	}  else if (oUFBrowser.all) { // Internet Explorer
		if (document.all[sLayerName]) {
		    document.all[sLayerName].style.visibility = 'visible';
		    document.all[sLayerName].style.zIndex = 100;
		}
	}
}


//*****************************************************************************
//Function	: UFChangeDivText(String , String)
//Author	: Bradley Stone
//Date/Time	: 06-10-2002
//Purpose	: This function will change the text contained within a <SPAN> or
//            <DIV> tag
//Parameters: String - ID of the <SPAN> or <DIV> tag to alter the contents of
//			  String - Text to replace within the specified <SPAN> or <DIV> tag
//Returns	: N/A
//Revisions	: N/A
//*****************************************************************************
function UFChangeDivText(sName , sText) {

	oUFBrowser=UFcheckBrowser();

	if (oUFBrowser.dom)  {
		if (document.getElementById(sName)) {
			document.getElementById(sName).innerHTML = '';
			document.getElementById(sName).innerHTML = sText;
		}
	} else if (oUFBrowser.all) {
		if (document.all[sName]) {
			document.all[sName].innerHTML = '';
			document.all[sName].innerHTML = sText;
		}
	} else if (oUFBrowser.layers) {
		if (document.layers[sName]) {
			document.layers[sName].document.open();
			document.layers[sName].document.writeln('');
			document.layers[sName].document.writeln(sText);
			document.layers[sName].document.close();
		}
	}
}


//****************************************************************************************************
//Function	: UFChangeImage(String , String , String)
//Author	: Bradley Stone
//Date/Time	: 06-03-2002
//Purpose	: This function will swap out an image and replace it with another image
//Parameters: String - Name of image as defined by the 'name' attribute in the HTML image tag
//			  String - Path of image to replace swapped out image with (can be relative or absolute url)
//			  String - [Optional] name of the layer which the image exists on, if any
//Returns	: N/A
//Revisions	: N/A
//'****************************************************************************************************
function UFChangeImage(sIMGName , sImageSRC , sLayerName) {

	oUFBrowser=UFcheckBrowser();

	var sLayerPrepend = "";

	if (typeof(sLayerName) != 'undefined' && sLayerName != '') {
		if ( (oUFBrowser.dom) && ("" + document.getElementsByName(sIMGName).item(0).src != 'undefined') ) { 
			// Since we're doing getElementsByName, we don't need to get the layer document
		} else if (oUFBrowser.layers) { 
			sLayerPrepend = "document.layers[sLayerName].";
		} else if (oUFBrowser.all) {
			sLayerPrepend = "document.all[sLayerName].";
		}
	}

	if (oUFBrowser.images) {
		if ( (oUFBrowser.dom) && ("" + document.getElementsByName(sIMGName).item(0).src != 'undefined') ) { 
			// For these, we're still using getElementsByName which returns a collection
			// However, since we're supporting older browsers, we don't want to give each image a "name" AND "id"
			// So, since there is only one element with this name (or else the older browser functionality would not work properly),
			// We'll just grab the first element of the collection
			eval(sLayerPrepend + "document.getElementsByName(sIMGName).item(0).src = sImageSRC");
		} else if (oUFBrowser.layers) { 
			eval(sLayerPrepend + "document.images[sIMGName].src = sImageSRC");
		} else if (oUFBrowser.all) {
			eval(sLayerPrepend + "document.images[sIMGName].src = sImageSRC");
		}
	}

}