<!--/* --------------------------------------------------------------------------------		APCI Common Script Library		C. Daubenspeck, Revised March 2002		Version 03062002.3		Questions, Problems, Concerns - daubenc@apci.com-------------------------------------------------------------------------------- */// Check browser typevar ie = 0;var ns = 0;var currentPage = '';		var IE4 = (document.all && !document.getElementById) ? true:false;var NS4 = (document.layers) ? true:false;var IE5 = (document.all && document.getElementById) ? true:false;var NS6 = (document.getElementById && !document.all) ? true:false;if (NS4)	ns=1;else if (IE4 || IE5 || NS6)	ie=1;document.lyrs = new Array();	// Array of pending timeoutsvar lyrs = document.lyrs;var SELF = self;var tempLayers = '';//alert(ns + ' ' + ie);/* --------------------------------------------------------------------------------	Change cursor to hand or arrow-------------------------------------------------------------------------------- */function APCI_ChangeCursor(obj, type) {   if(ie){     obj.style.cursor = type;   }}/* --------------------------------------------------------------------------------	Show all properties of obj	This for debuging 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;}/* --------------------------------------------------------------------------------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-------------------------------------------------------------------------------- */function APCI_onMouseover(obj,strClr,strImg,objImg,strLyr,strVis,iOffX,iOffY){	var x;	var strLayers = new String(strLyr);	var arLyrs = new Array();	if(strLyr !=''){		if(strLyr!='layersoff'){			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(ie){				obj.style.background=strClr;			}else if(ns){				obj.bgColor=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-------------------------------------------------------------------------------- */function APCI_onMouseout(obj,strClr,strImg,objImg,strLyr) {	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(ie){				obj.style.background=strClr;			}else if(ns){				obj.bgColor=strClr;				}			}		if(strImg != ''){			APCI_swapImage(objImg,strImg);			}		}	}/* --------------------------------------------------------------------------------	Shows a layer (timed)	*Revised 03/06/2002 - C. Daubenspeck-------------------------------------------------------------------------------- */function 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){	var intHideDelay = 60;	// hide delay in milliseconds	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){	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;	}	objLyr.visibility=strVis;	}	}/* --------------------------------------------------------------------------------	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 'about_us':			currentPage = 'about_us';			APCI_swapImage('about_us','/medical/UK/img/healthcare_uk_topnav/about_us_x.gif');			break;		case 'home_care':			currentPage = 'home_care';			APCI_swapImage('home_care','/medical/UK/img/healthcare_uk_topnav/home_care_x.gif');			break;		case 'primary_care':			currentPage = 'primary_care';			APCI_swapImage('primary_care','/medical/UK/img/healthcare_uk_topnav/primary_care_x.gif');			break;		case 'hospital_care':			currentPage = 'hospital_care';			APCI_swapImage('hospital_care','/medical/UK/img/healthcare_uk_topnav/hospital_care_x.gif');			break;		case 'special_interest':			currentPage = 'special_interest';			APCI_swapImage('special_interest','/medical/UK/img/healthcare_uk_topnav/special_interest_x.gif');			break;		case 'health_safety':			currentPage = 'health_safety';			APCI_swapImage('health_safety','/medical/UK/img/healthcare_uk_topnav/health_safety_x.gif');			break;		case 'home':			currentPage = 'home';			APCI_swapImage('home','/medical/UK/img/healthcare_uk_topnav/home_x.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-------------------------------------------------------------------------------- */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-------------------------------------------------------------------------------- */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-------------------------------------------------------------------------------- */function APCI_adjustLayer(objTemp, strLayer,offX,offY) {	var tempObj = APCI_getObjectRef(strLayer);	if (ie) {		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;}//-->