//<script>
<!--

/* --------------------------------------------------------------------------------
		APCI Common Script Library
		C. Daubenspeck, Revised March 2002
		Version 03062002.3
		Questions, Problems, Concerns - daubenc@apci.com
-------------------------------------------------------------------------------- */

// 29Nov2004:  Per C. Daubenspeck, checks for browser type no longer required.
// 01102005: Un-Commented. No longer necessary in this library, but used elsewhere.
//		retained for backward compatibility for the time being. - CAD
//
// 10 May 2005: Modified by G.Butler for project 14901, in order to correctly identify non-IE browers
//
//	Check browser type
	var ie = 0;
	var ns = 0;
	var IE60;
	var IE50;
	var IE55;
	var IE4;
	var NS4;

	IE60 = (navigator.appVersion.indexOf("MSIE 6.0") > -1)?true:false;
	IE50 = (navigator.appVersion.indexOf("MSIE 5.0") > -1)?true:false;
	IE55 = (navigator.appVersion.indexOf("MSIE 5.5") > -1)?true:false;
	IE4 = (document.all && !document.getElementById)?true:false;
	var IE4 = (document.all && !document.getElementById) ? true:false;
	var IE5 = (document.all && document.getElementById) ? true:false;
	
	//Added 10 May 2005 G.Butler
	ns = (!document.all) ? 1:0;

	ie = (IE4 || IE60 || IE55 || IE50) ? 1:0;


var currentPage = '';
var NS4 = false;  //Commented out by GButler 10 May 2005: (document.layers) ? true:false;

document.lyrs = new Array();	// Array of pending timeouts
var lyrs = document.lyrs;

var SELF = self;
var tempLayers = '';

//window.alert(ns + ' ' + ie);


//Add the following code to support innertext in non-IE browsers:

if(ns)
	{
		HTMLElement.prototype.__defineGetter__("innerText", function () {
			var r = this.ownerDocument.createRange();
			r.selectNodeContents(this);
			return r.toString();
		});

		HTMLElement.prototype.__defineSetter__("innerText", function (sText) {
			this.innerHTML = sText.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
		});
	}



// END - Commented out

var currentPage = '';
var NS4 = (document.layers) ? true:false;

document.lyrs = new Array();	// Array of pending timeouts
var lyrs = document.lyrs;

var SELF = self;
var tempLayers = '';

//window.alert(ns + ' ' + ie);


/* --------------------------------------------------------------------------------
	Change cursor to hand or arrow
-------------------------------------------------------------------------------- */
function APCI_ChangeCursor(obj, type) {
	if(!NS4)
		obj.style.cursor = type;
//	}else{
//		obj.cursor = type;
//	}
}

/* --------------------------------------------------------------------------------
	Show all properties of obj
	This for debugging only
-------------------------------------------------------------------------------- */
function show_props(obj, obj_name, newLineChar) {
	var result = ""
	for (var i in obj)
		result += obj_name + "." + i + " = " + obj[i] + newLineChar;
	return result
	}

//window.alert(show_props(document, 'document', '\n'));


/* --------------------------------------------------------------------------------

-------------------------------------------------------------------------------- */
function killFrame(){
	if (SELF != top) top.location.href = location.href;
}

/* --------------------------------------------------------------------------------
	Used for debugging the fly out left nav menu
-------------------------------------------------------------------------------- */
/*
function writeDebugLog(strMessage){
	var loggingForm;
	var loggingDiv;

	loggingDiv = document.createElement('div');
	loggingDiv.setAttribute('id','loggingDiv');
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		loggingForm = document.myForm;
	}
	else {
		loggingForm = document.forms["myForm"];
	}
	loggingDiv.innerHTML = strMessage;
	loggingForm.appendChild(loggingDiv);
}
*/

/* --------------------------------------------------------------------------------
Function:

	APCI_onMouseover(obj,strClr, strImg, objImg, strLyr, strVis, iOffX, iOffY)

Where:

	obj - Always pass the reference 'this' (no quotes)
	strClr - Pass swap color (if desired i.e. leftnav or flyout) in form #FFFFFF
	objImg - Pass IE reference to image (i.e. 'myImageName' )
	strImage - Pass string filespec to image to swap (i.e. '/images/bt_submit_on.gif' - must 
	use single quotes)
	*strLyr - Pass layer name(s) (if applicable, i.e. leftnav or topnav) (i.e. 'myLayer') 
	to activate (i.e. perants, etc) or '' to shut down all layers. This accepts a comma 
	delimited list of layers.
	strVis - Pass visibility action for layer (i.e. either 'show', or 'hide')
	*iOffX - Pass x Offset for flyout (if applicable)
	*iOffY - y offset

Notes: 

	If you do not pass a layer name you do not need to pass any of the remaining 
	layer info. Likewise, if you do not pass an image filespec you do not need to 
	pass any of the remaining image info. Any unused param must be either '' for 
	strings values or 0 for integer values. *If you intend to change the color of 
	a layer and keep it exposed you must pass the comma delimited list of layer
	names for strLyr and pass 0's for iOffX and iOffY.

	*Revised 03/06/2002 - C. Daubenspeck
	*Revised 29Nov2004 - G.Shay, C.Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_onMouseover(obj,strClr,strImg,objImg,strLyr,strVis,iOffX,iOffY){
	
	var x;
	var strLayers = new String(strLyr);
	var arLyrs = new Array();

	//writeDebugLog('APCI_onMouseover: ' + obj.tagName);

	if(strLyr !=''){
		if(strLyr!='layersoff'){
			clearTimeout(document.seid);
			// MTW - make sure timeout does not already exist
			if (document.heid != null)
				clearTimeout(document.heid);
			document.heid = setTimeout('APCI_ShowHideAllDropdowns(\'hide\')',50)

			arLyrs = strLayers.split(',');
			for(x=0;x<arLyrs.length;x++){
				APCI_stop(arLyrs[x]);
				}
			if(iOffX!=0||iOffY!=0){
				strLyr = arLyrs[0];
				APCI_adjustLayer(obj,strLyr,iOffX,iOffY);
				APCI_show(strLyr);
				}					
			for(x=1;x<arLyrs.length;x++){
				APCI_show(arLyrs[x]);
				}
		}else{
			APCI_hideAll();
		}
	}else{
		APCI_stopAll();
		}
	if(currentPage == '' || objImg != currentPage){
		if(strClr != ''){
			if(NS4){
				obj.bgColor=strClr;
			}else{
				obj.style.background=strClr;
				}
			}
		if(strImg != ''){
			APCI_swapImage(objImg,strImg);
			}
		}
	}
/* --------------------------------------------------------------------------------
Function:

	APCI_onMouseout(obj,strClr,strImg,objImg,strLyr)

Where:

	obj - Always pass the reference 'this' (no quotes)
	strClr - Pass swap color (if desired i.e. leftnav or flyout) in form #FFFFFF
	strImage - Pass string filespec to image to swap (i.e. '/images/bt_submit_on.gif' - must 
	objImg - Pass IE reference to image (i.e. 'myImageName' )
*	strLyr - Pass the name of any layers you wish to shut down. Empty string '' results
	in all layers being shut down.

Notes:

	If you do not pass an image filespec you do not need to pass any of the remaining 
	image info. Any unused param must be either '' for strings values or 0 for integer values
	
	*Revised 03/06/2002 - C. Daubenspeck
	*Revised 29Nov2004 - G.Shay, C.Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_onMouseout(obj,strClr,strImg,objImg,strLyr) {
	
	clearTimeout(document.heid);
	// MTW - make sure timeout does not already exist
	if (document.seid != null)
		clearTimeout(document.seid);
	document.seid = setTimeout('APCI_ShowHideAllDropdowns(\'show\')',300);

	//writeDebugLog('APCI_onMouseout: ' + obj.tagName);
	
	var x;
	if(strLyr!=''){
		var strLayers = new String(strLyr);
		var arLyrs = new Array();
		arLyrs = strLayers.split(',');
		for(x=0;x<arLyrs.length;x++){
			APCI_hide(arLyrs[x]);
			}
	}else{
		APCI_hideAll();
		}
	if(currentPage == '' || objImg != currentPage){
		if(strClr != ''){
			if(NS4){
				obj.bgColor=strClr;
			}else{
				obj.style.background=strClr;
				}
			}
		if(strImg != ''){
			APCI_swapImage(objImg,strImg);
			}
		}
	}

/* --------------------------------------------------------------------------------
	Shows a layer (timed)
	*Revised 03/06/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_show(strLyr){
	//writeDebugLog('APCI_show: ' + strLyr);

	var intShowDelay = 50;	// show delay in milliseconds
	document.lyrs[strLyr] = setTimeout('APCI_showHideLayers(\''+strLyr+'\',\'show\')',intShowDelay)
	}

/* --------------------------------------------------------------------------------
	Hides a layer (timed)
	*Revised 03/06/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_hide(strLyr){
	//writeDebugLog('APCI_hide: ' + strLyr);

	var intHideDelay = 50;	// hide delay in milliseconds

	// Fix FireFox to prevent single level menu from being hidden incorrectly
	if (document.lyrs[strLyr] != null)
		APCI_stop(strLyr);

	document.lyrs[strLyr] = setTimeout('APCI_showHideLayers(\''+strLyr+'\',\'hide\')',intHideDelay)
	}

/* --------------------------------------------------------------------------------
	Stops the timer on a layer pending show/hide
	*Revised 03/06/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_stop(strLyr){
	//writeDebugLog('APCI_stop: ' + strLyr);

	clearTimeout(document.lyrs[strLyr]);
	document.lyrs[strLyr]=null;
	}

/* --------------------------------------------------------------------------------
	Stops the timer on all layers pending show/hide
	*Revised 03/06/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_stopAll(){
	var x;
	var arLayers = new Array();
	var strLayers = new String(tempLayers);
	arLayers = strLayers.split(',');
	for(x=0;x<arLayers.length;x++){
		strLyr = arLayers[x];
		clearTimeout(document.lyrs[strLyr]);
		document.lyrs[strLyr]=null;
		}
	}

/* --------------------------------------------------------------------------------
	Hides all layers pending timeout
	*Revised 03/06/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_hideAll(){
	var x;
	var arLayers = new Array();
	var strLayers = new String(tempLayers);
	arLayers = strLayers.split(',');
	for(x=0;x<arLayers.length;x++){
		strLyr = arLayers[x];
		APCI_hide(strLyr);
		}
	}

/* --------------------------------------------------------------------------------
	Shows/Hides the specified layer
	strLyr - layer name to show/hide
	strDummy - 
	strVis - visibility action (i.e. show/hide)
	*Revised 03/06/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_showHideLayers(strLyr,strVis){
	if((objLyr=APCI_getObjectRef(strLyr))!=null){
	if(objLyr.style){
		objLyr=objLyr.style;
		strVis=(strVis=='show')?'visible':(strVis=='hide')?'hidden':strVis;
		}
	
	//writeDebugLog('APCI_showHideLayers : ' + strVis);

	objLyr.visibility=strVis;
	}	
}

/* --------------------------------------------------------------------------------
	Shows the element specified in obj
	*Revised 02/10/2005 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_ShowElementObj(obj)
{
	if(obj.style){
		obj=obj.style;
		strVis='visible';
	}
	else
	{
		strVis='show';
	}
	obj.visibility=strVis;
}

/* --------------------------------------------------------------------------------
	Hides the element specified in obj
	*Revised 02/10/2005 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_HideElementObj(obj)
{
	if(obj.style){
		obj=obj.style;
		strVis='hidden';
	}
	else
	{
		strVis='hide';
	}
	obj.visibility=strVis;
}

/* --------------------------------------------------------------------------------
	Shows/Hides All dropdowns on the page
	*Revised 02/10/2005 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_ShowHideAllDropdowns(strVis)
{
	var vForms = document.forms;
	var fl = vForms.length
	for(x=0;x<fl;x++)
	{
		var vForm = document.forms[x];
		var vElements = vForm.elements;
		var el = vElements.length;
		for(y=0;y<el;y++)
		{
			var vElement = vElements[y];
			if(vElement.tagName=='SELECT')
			{
				if(strVis=='show')
				{
					APCI_ShowElementObj(vElement);
				}
				if(strVis=='hide')
				{
					APCI_HideElementObj(vElement);
				}
			}
		}
	}
}

/* --------------------------------------------------------------------------------
	Preloads the supplied image(s)
	Usage: APCI_preloadImages('myImage1.gif','myImage2.gif',...)
	*Revised 3/7/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_preloadImages() {
	var x;
	if (document.images){
		if (typeof(document.cache) == 'undefined'){
			document.cache = new Object();
		}
		if(!document.cache.preloadedImages){
			document.cache.preloadedImages = new Array();
		}
		for(x=0;x<APCI_preloadImages.arguments.length;x++) {
			document.cache.preloadedImages[x] = new Image();
			document.cache.preloadedImages[x].src = APCI_preloadImages.arguments[x];
		}
	}
}

/* --------------------------------------------------------------------------------
	Swaps image(s)
	strImageName - name of image on page (i.e. top_gases)
	strImageSrc - full path to image to swap (i.e. /images/myImage.gif)

	*Revised 3/7/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_swapImage(strObj,swapImageSrc){
	var objImg;
	if((objImg=APCI_getObjectRef(strObj))!=null){
		objImg.src=swapImageSrc;
	}
}

/* --------------------------------------------------------------------------------
	This highlights the button (on initial load only) for the page currently loading. 
	This could probably be automated to some degree looking for key words in the title
	of the current document. 
-------------------------------------------------------------------------------- */
function HighlightSection(SiteSection){

	switch(SiteSection){
	
		case 'chemicals':
			currentPage = 'top_chem';
			APCI_swapImage('top_chem','/img/topnavigation/topnav_chemicals_on.gif');
			break;
		case 'gases':
			currentPage = 'top_gases';
			APCI_swapImage('top_gases','/img/topnavigation/topnav_gases_on.gif');
			break;
		case 'technology':
			currentPage = 'top_tech';
			APCI_swapImage('top_tech','/img/topnavigation/topnav_tech_on.gif');
			break;
		case 'corporate':
			currentPage = 'top_corpover';
			APCI_swapImage('top_corpover','/img/topnavigation/topnav_corpoverview_on.gif');
			break;
		case 'investor':
			currentPage = 'top_investor';
			APCI_swapImage('top_investor','/img/topnavigation/topnav_investinfo_on.gif');
			break;
		case 'ehs':
			currentPage = 'top_ehs';
			APCI_swapImage('top_ehs','/img/topnavigation/topnav_ehs_on.gif');
			break;
		case 'career':
			currentPage = 'top_career';
			APCI_swapImage('top_career','/img/topnavigation/topnav_careeropps_on.gif');
			break;
		case 'new':
			currentPage = 'top_whatnew';
			APCI_swapImage('top_whatnew','/img/topnavigation/topnav_whatsnew_on.gif');
			break;
		case 'apdirect':
			currentPage = 'top_apdirect';
			APCI_swapImage('top_apdirect','/img/topnavigation/topnav_apdirect_on.gif');
			break;
		default:
			break;

	}
	
}
	
/* --------------------------------------------------------------------------------
	Add new layers to temporary layer string
	I know, your thinking 'Why create a comma delimited string only to convert it to an 
	array later ... well, this way you could pass several on the same call to addLayer
	(i.e. addLayer('myLayer1,myLayer2,myLayer3');
	*Revised 5/22/2001 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_addLayer(objLayers) {
	if (tempLayers != '') {
		tempLayers = tempLayers + ',' + objLayers;
	}else{
		tempLayers = objLayers;
		}
	}

/* --------------------------------------------------------------------------------
	Does nothing, here to maintain backward compatibility with existing pages
	*Revised 03/06/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_createTimeline() {

		// Do nothing
	}

/* --------------------------------------------------------------------------------
	Returns the absolute X position (from left) of an object in IE
	*Revised 5/22/2001 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function IEgetLeft(objElem) {
	xPos = eval(objElem).offsetLeft;
	tempEl = eval(objElem).offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
		}
	return xPos;
	}

/* --------------------------------------------------------------------------------
	Returns the absolute Y position (from left) of an object in IE
	*Revised 5/22/2001 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function IEgetTop(objElem) {
	yPos = eval(objElem).offsetTop;
	tempEl = eval(objElem).offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
		}
	return yPos;
	}

/* --------------------------------------------------------------------------------
	Returns the absolute X position in Netscape (even in layer)
	*Revised 5/22/2001 - C. Daubenspeck
	*Revised 29Nov2004 - G.Shay, C.Daubenspeck
-------------------------------------------------------------------------------- */
// No longer supported. 29Nov2004
function NSgetLeft(objElem) {
	if(eval(objElem).x){
		return eval(objElem).x;
	}else if(eval(objElem).pageX){
		return eval(objElem).pageX;
	}else{
		return 0;
		}
	}


/* --------------------------------------------------------------------------------
	Returns the absolute Y position in Netscape (even in layer) - cad
	*Revised 5/22/2001 - C. Daubenspeck
	*Revised 29Nov2004 - G.Shay, C.Daubenspeck
-------------------------------------------------------------------------------- */
// No longer supported. 29Nov2004
function NSgetTop(objElem) {
	if(eval(objElem).y){
		return eval(objElem).y;
	}else if(eval(objElem).pageY){
		return eval(objElem).pageY;
	}else{
		return 0;
		}
	}


/* --------------------------------------------------------------------------------
	Adjusts the layer (menu fly-out) to always appear next to it's calling anchor 
	tag (objTemp). Using the spiffy new MM_findObj() from the MM library functions 
	*Revised 5/22/2001 - C. Daubenspeck
	*Revised 29Nov2004 - G.Shay, C.Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_adjustLayer(objTemp, strLayer,offX,offY) {
	var tempObj = APCI_getObjectRef(strLayer);
	if (!NS4) {
//		if(NS6){
//			tempObj.style.top = offY;
//			tempObj.style.left = IEgetLeft(objTemp) + offX;
//		}
//		else{
			tempObj.style.top = IEgetTop(objTemp) + offY;
			tempObj.style.left = IEgetLeft(objTemp) + offX;
//		}
	}else{
		tempObj.top = NSgetTop(objTemp) + offY;
		tempObj.left = NSgetLeft(objTemp) + offX;
		}
	}

/* --------------------------------------------------------------------------------
	pstrObj - object to 'find' reference to
	pobjDoc - document reference, primarily for documents within layers
	*Revised 3/7/2002 - C. Daubenspeck
-------------------------------------------------------------------------------- */
function APCI_getObjectRef(pstrObj,pobjDoc){
	var objRef;
	var indx;
	
	if(!pobjDoc){
		pobjDoc=document;
	}

	// Simple get ref from main document - IE 
	if(pobjDoc.all){
		objRef=pobjDoc.all[pstrObj];
	}

	// get ref from objects embedded in forms and layers - Netscape only
	if(!objRef && pobjDoc.layers){
		objRef=pobjDoc[pstrObj]
		for (indx=0;!objRef && indx<pobjDoc.forms.length;indx++){ 
			window.status='Loop #1: '+indx;
			objRef=pobjDoc.forms[indx][pstrObj];
		}
		for(indx=0;((!objRef)&&(indx<pobjDoc.layers.length));indx++){
			window.status='Loop #2: '+indx;
			objRef=APCI_getObjectRef(pstrObj,pobjDoc.layers[indx].document);
		}
	}
	// get ref from new W3c compliant versions of IE 6+ and Netscape 6+
	if(!objRef && pobjDoc.getElementById){
		objRef=pobjDoc.getElementById(pstrObj); 
	}
	return objRef;
}

/* --------------------------------------------------------------------------------
	Return the passed object's background color
	el - Object ID on current page
	*Added 29Nov2004 - G. Shay
-------------------------------------------------------------------------------- */
function APCI_getBGColor(el)
{
	var x=APCI_getObjectRef(el,document);

	if (NS4)
		var y = x.bgColor;
	else if (window.getComputedStyle)
		var y = window.getComputedStyle(x,null).getPropertyValue("background-color");
	else if (x.currentStyle)
		var y = x.currentStyle.backgroundColor;
	
	return y;
}

//-->