window.isDOM	= document.getElementById	? true : falsevar sname="searchwebsite.gif";// ----------------------------------------------- LOADS  --------------------------------------function loadWebPage() {	var JOT = getCookie('JOT');	var C = getCookie('C');	var N = getCookie('N');	//alert('JOT='+JOT+' C='+C+' N='+N);	if (JOT=='C') { Collapse('Join Our Team') } 	if (C=='C') { Collapse('Clients') } 	if (N=='C') { Collapse('News') } 	onLoadTranslate();	//lyrShow('Page1',false);	//ShowPage();}function onLoadTranslate() {	TranslatePage(false);	//TranslatePage(true);	//if (sDocEdit=="1") {	//TranslateField("Country",false);	//}	//UnTranslatedListPage();	//TranslateListPage();	//alert('show');	Hide('bDot');}// ----------------------------------------------- SEARCH VALIDATES  --------------------------------------function checksearch(searchfield) {   tmpSearch = trim(searchfield.value)  //alert('Search for ' + tmpSearch);   if (tmpSearch=="") { 		alert('Please a word to search for');	   document.forms[0].wordtosearch.select();	   return false;	}	//alert('1')   if(checkinvalid(searchfield)) {   		ser = searchfield.value ; 	var cC='&country='+sCountry;	var cc='&cc='+sCC;	var cL='&Lang='+sLang;	location = sWebDbName+ 'vaWebSearchView?SearchView&Query='+escape(ser)+'&SearchOrder=1&SearchMax=20&SearchWV=FALSE&SearchThesaurus=TRUE'+cc+cC+cL;   } else {   //alert('3')        //location=sWebDbName+ 'weben/searchinvalid';        alert('Invalid search arguments, please try again');        document.forms[0].wordtosearch.select();      //  return;   }   //alert('4');    //return false;}function checkinvalid(searchfield) {   tmpSearch = searchfield.value;   var regExpOK = /\Wfield\W|\Wtopic\W|\Wtermweight\W|\Wexactcase\W|\Wcontains\W|\Wsentence\W|\Wparagraph\W/i;   var regExp1 = /\bfield\b|\btopic\b|\btermweight\b|\bexactcase\b|\bcontains\b|\bsentence\b|\bparagraph\b/i;   var regExp2 =  /[{}#%&=\<\>\[\]]/; // invalid values   var regExpNeedQt = /[()]/;  // need quotes   var regExpTestQt = /^"\b/;  // test for quote at the beginning   if(typeof regExp1.source != 'undefined' ) { // check to make sure regexp work     if (regExpOK.test(tmpSearch)) {        // skip words if quotes around them     } else if (regExp1.test(tmpSearch) || regExp2.test(tmpSearch)) {        return false;     }     if (regExpTestQt.test(tmpSearch)) {        // continue, quote found at the beginning     } else if (regExpNeedQt.test(tmpSearch)) {       searchfield.value = '"' + tmpSearch + '"';     }   }   return true; // return true if not already exited at this point   }// ----------------------------------------------- SELECTORS  --------------------------------------function switchCountry(){    var chosen = document.forms[0].Country.selectedIndex;    //var country = document.forms[0].Country.options[chosen].text;    var gotoPage = document.forms[0].Country.options[chosen].value;    //alert('Computer says go to ' + gotoPage);    //if (country=="United Kingdom") { gotoPage="/myiuk.nsf/Webpages/Locations?open&L=london" }    self.location.href=gotoPage;}function SetLanguage(whichLang) {	if (whichLang=="") { return null; }	goUrl = sPath + '?open&country='+sCountry+'&Lang='+whichLang;	alert('goUrl = ' + goUrl );	location = goUrl;}function insertLayout(dowhat){//Insert Standard Template Page into RichText Appletvar where_to= confirm("Inserting a new page layout will clear all current Rich Text data and re-open this document using the inserted page layout.  Do you want to continue and insert a the new page layout?");if (where_to== true) { 	//get HTML1 Text Area	//insert HTML Code	document.forms[0].OpenInEdit.value=1;	document.forms[0].Insert.value=dowhat;	document.forms[0].submit();}}function saveonly(){document.forms[0].OpenInEdit.value=1;document.forms[0].Insert.value="0";document.forms[0].submit();}function getNewsOld() {	var NS = lboxGetSelectedItem(document.forms[0].News)	var cc='&cc='+sCC;	var cL='&Lang='+sLang;	if (NS.text == "") { return } else {		var goUrl  =sWebDbName+ 'LookupNewsCountry?open&country='+NS.value+cc+cL;		//alert("Go to " + goUrl )		document.location.href=goUrl;	}}function goOrder(where) {var o=where;window.open(o,'','status,scrollbars,width=780,height=500,resizable=yes,left=200,top=200,screenX=0,screenY=0');return;}function getNews() {	var NS = lboxGetSelectedItem(document.forms[0].News)	//if last 2 chars = current lang then use that else EN	var NSSel = NS.value;	var NSSelL = Right(NSSel,2);	NSSelL=NSSelL.toUpperCase();	sL = sLang.toUpperCase();	var NSLang = "which"	if (NS.text == "") { return } else {		if (NSSelL==sL) {			var cc='&cc='+sCC;			var cL='&Lang='+sLang;			var goUrl  =sWebDbName+ 'LookupNewsCountry?open&country='+NSSel+sL+cc+cL;		} else {			var cc='&cc='+Right(NSSel,2);			var cL='&Lang=en'			var goUrl  =sWebDbName+ 'LookupNewsCountry?open&country='+NSSel+"EN"+cc+cL;		}		//alert("Go to " + goUrl )		document.location.href=goUrl;	}}function rPageLevel2Selector() {//alert('Get Page Selector');var item = document.forms[0].PageLevel2Selector;document.forms[0].PageNumberLevel2.value = item.selectedIndex + 1;//alert(item.selectedIndex);}function ShowHide(item,divtag) {		if (item.selectedIndex==-1) {			var Sel = ""		} else {			var Sel = item[item.selectedIndex].text;		}		if (Sel!="") { 		//alert('Sel='+Sel + ' divtag='+divtag);			if (Sel=="yes") { Show(divtag)}			if (Sel=="no") { Hide(divtag)}		}}function ShowHideChoices(item) {		if (item.selectedIndex==-1) {			var Sel = ""		} else {			var Sel = item[item.selectedIndex].value;		}		if (Sel!="") { 		//alert('Sel='+Sel + ' divtag='+divtag);		//Standard - Add to Cart|0 //View Choices Categories|1 //View Choices Link|2 //Purchase Button Link|3 //Order Button Link|4			//LinkC1 //LinkC2			if (Sel=="0") { Hide('LinkC1'); Hide('LinkC2'); }			if (Sel=="1") { Show('LinkC1'); Hide('LinkC2'); }			if (Sel=="2") { Hide('LinkC1'); Show('LinkC2'); }			if (Sel=="3") { Hide('LinkC1'); Show('LinkC2'); }			if (Sel=="4") { Hide('LinkC1'); Show('LinkC2'); }		}}function RefreshPageSelector() {	if (IsEditing == "1") {		var PLSelect = document.forms[0].PageSectionSelector		if (PLSelect.selectedIndex==-1) {			PLS = ""		} else {			var PLS = PLSelect[PLSelect.selectedIndex].text;		}	} else {		var PLS= sPageSelector ;	}	//alert("PLS="+PLS)	if (PLS=="News") {		Show("PSS3");		Show("PSS4");		//Hide("PSSL1")		//Hide("PSSL2")		//Hide("PSSL3")	} else {		Hide("PSS3");		Hide("PSS4");	}}function PLangShowLinks() {	var PLSL = document.forms[0].PageLangShowLinks	var vPLSL = PLSL[PLSL.selectedIndex].value;	//alert('=>'+vPLSL);	if ( vPLSL=="1") { Show('LangLinks') }	if ( vPLSL=="0") { Hide('LangLinks') }}function RefreshPageLevel() {	if (IsEditing == "1") {		//var PL=cboxGetCheckedValues(document.forms[0].PageLevel);		var PLField = document.forms[0].PageLevel		var PL = PLField[PLField.selectedIndex].value;	} else {		var PL= sPageLevel ;	}	RefreshPage(PL);}function Expand(what) {	if (what == "Join Our Team") {		Hide("JOTC");		Show("JOTE");		setCookie('JOT','E',365);	}	if (what == "Clients") {		Hide("CC");		Show("CE");		setCookie('C','E',365);	}		if (what == "News") {		Hide("NC");		Show("NE");		setCookie('N','E',365);	}	}function Collapse(what) {	if (what == "Join Our Team") {		Show("JOTC");		Hide("JOTE");		setCookie('JOT','C',365);	}	if (what == "Clients") {		Show("CC");		Hide("CE");		setCookie('C','C',365);	}	if (what == "News") {		Show("NC");		Hide("NE");		setCookie('N','C',365);	}}function RefreshPage(PL) {	//alert("PL="+PL);	if (PL=="level_0" || PL=="level_4") { Hide("PSSL1") } else { Show("PSSL1") }	if (PL=="level_1") { Show("PSSL2") } else { Hide("PSSL2") }	if (PL=="level_2") {		Show("PSSL3");		Show("PSSMC1");		Show("PSSMC2");	} else {		Hide("PSSL3");		Hide("PSSMC1");		Hide("PSSMC2");	}	if (PL=="level_4") {		Hide("PSS1");		Hide("PSS2");	} else {		Show("PSS1");		Show("PSS2");	}	if (PL=="level_5"){		Show("PSS3");		Show("PSS4");	} else {		Hide("PSS3");		Hide("PSS4");	}	var InPortlet = 0;	if (PL=="level_11") {InPortlet=1}	if (PL=="level_12") {InPortlet=1}	if (InPortlet==1) {		Show("PSS1");		Show("PSS2");		Show("PSSL2");	} }/* Directory Calls */function PageRedirectChg() {	var Re = lboxGetSelectedItem(document.forms[0].PageRedirect)	var Sec = lboxGetSelectedItem(document.forms[0].PageSectionSelector)	var Se = lboxGetSelectedItem(document.forms[0].PageLevel)	//alert('Re='+Re.value+' Se='+Se.value + ' Sec=' + Sec.value);	if (Re.value=="yes" && Sec.value=="none~0") {		alert('Please select which Main Button to use before selecting Page ReDirect to yes.');	}	if (Re.value=="yes" && Se.value=="level_4") {		alert('Sorry, you cannot turn on the Re-Direct option for a Linked Page');	}}function WrP(item,dis,cur) {		if (dis=='0') { document.write("<span class='ShopPrice'>Price: "+cur+" " +item+"</span><br>") } 		else { 			var dC = parseFloat(dis) + 0;			dC = dC/100;			item=item.replace(',','');			var nItem = parseFloat(item); 			var Pr = nItem - (nItem * dC);			Pr = CurrencyFormatted(Pr);			document.write("<span class='ShopPrice'><s>Price: "+cur+" " +item+"</s> Discounted " + dis + "% - Your Price: "+cur+" " +Pr+"</span><br>")	 	}}function WrD(item,dis,cur) {		if (dis=='0') { document.write("<span class=\"ShopPrice\">"+item+"</span><br>") } 		else { 			document.write("<span class=\"ShopPrice\"><s>"+item+"</s> - Discounted "+dis+"%</span><br>")	 	}}function WrB(link,but,dis,sDb) {	var nLink = link.replace('PayPalCat?','PayPalCatDiscount?');	nLink = link.replace('PayPal?','PayPalCatDiscount?');	if (but=="1") {		document.write("<a href='"+nLink+"&d="+dis+"' target='_Blank'><img border='0' src='"+sDb+"/ShopVCButton.gif' alt='Click to view further choices'/></a>")	}	if (but=="2") {		document.write("<a href='"+nLink+"&d="+dis+"' target='_Blank'><img border='0' src='"+sDb+"/ShopVCButton.gif' alt='Click to view further choices'/></a>")	}	if (but=="3") {		document.write("<a href='"+nLink+"&d="+dis+"' target='_Blank'><img border='0' src='"+sDb+"/PurchaseButton.gif' alt='Click to view further choices'/></a>")	}	if (but=="4") {		document.write("<a href='"+nLink+"&d="+dis+"' target='_Blank'><img border='0' src='"+sDb+"/SubscribeButton.gif' alt='Click to view further choices'/></a>")	}}function DisN(item,dis) {		if (dis=='0') { document.write("<input type='hidden' name='item_name' value='"+item+"'>") } 		else { document.write("<input type='hidden' name='item_name' value='"+item+" (Inc. "+dis+"% discount)'>") 	}}function DisP(item,dis) {		if (dis=='0') {  document.write("<input type='hidden' name='amount' value='"+item+"'>") } 		else {			var dC = parseFloat(dis);			dC = dC/100;			//item=item.replace(',','');			//var nItem = parseFloat(item); 			//alert('item='+item);			var Pr = item - (item * dC);			//Pr = CurrencyFormatted(Pr);			document.write("<input type='hidden' name='amount' value='"+Pr+"'>")		}	}function CurrencyFormatted(amount){	var i = parseFloat(amount);	if(isNaN(i)) { i = 0.00; }	var minus = '';	if(i < 0) { minus = '-'; }	i = Math.abs(i);	i = parseInt((i + .005) * 100);	i = i / 100;	s = new String(i);	if(s.indexOf('.') < 0) { s += '.00'; }	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }	s = minus + s;	return s;}// ----------------------------------------------- TOOLS HIDEWHENS  --------------------------------------function trim(inputstringTrim) {   fixedTrim = "";   lastCh = " ";   for (x=0; x < inputstringTrim.length; x++) {      ch = inputstringTrim.charAt(x);      if ((ch != " ") || (lastCh != " ")) {         fixedTrim += ch;       }      lastCh = ch;   }   if (fixedTrim.charAt(fixedTrim.length - 1) == " ") {      fixedTrim = fixedTrim.substring(0, fixedTrim.length - 1);   }   return fixedTrim;}function RateThisPage(unid,p){javascript:NewWindow(sWebDbName+'RatePageForm?OpenForm&unid='+unid+'&p='+p, 'rate', 450, 250); }function NewWindow(mypage, myname, w, h) {  if (window.pup && !window.pup.closed){	pup.window.focus();	pup.window.location.href = mypage;	}  else {    var winl = (screen.width - w) / 2;    var wint = (screen.height - h) / 2;    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',status=no,resizable=no,scrollbars=yes'    pup = window.open(mypage, myname, winprops)    pup.window.focus()    return;  }}function getItem(id) { // IE5+, Mozilla, NS5 if (document.getElementById)   return document.getElementById(id);// IE4if (document.all)   return document.all.item(id);// NS4   return eval("document."+ id + ".document." + id);}function Hide(GetID){	var content = getItem(GetID);	if (content == null) { return;}	content.style.display = "none"}function Show(GetID){	var content = getItem(GetID);	if (content == null) {return;}	content.style.display = "block";}/* subform */function sendAT(c,i){	c = unescape(c);	if (document.forms[0].PageENHost.value=="") { document.forms[0].PageENHost.value=window.location.hostname;}	var d = sDate();	if (document.forms[0].PageSendAlert.value==1) {  		var o=sWebDbName+"SendEmailSubscribers?OpenAgent&d="+d+"&cat=[TEST:"+c+"]&UNID=["+i+"]";  		document.forms[0].PageSendAlert.value=0;   		window.open(o,'','status,scrollbars,width=680,height=400,resizable=yes,left=200,top=200,screenX=0,screenY=0');	}	if (document.forms[0].PageSendAlert.value==4) {  		var o=sWebDbName+"SendEmailGroups?OpenAgent&d="+d+"&cat=[TEST:"+c+"]&UNID=["+i+"]";  		document.forms[0].PageSendAlert.value=0;   		window.open(o,'','status,scrollbars,width=680,height=400,resizable=yes,left=200,top=200,screenX=0,screenY=0');	}	if (document.forms[0].PageSendAlert.value==2) {		var sendto= confirm("Ask - are you sure you want to send to Subscribers in the Catorgy '"+c+"'?");		if (sendto== true) {   			var o=sWebDbName+"SendEmailSubscribers?OpenAgent&d="+d+"&cat=["+c+"]&UNID=["+i+"]";  			document.forms[0].PageENewsSentDate.value=d;  			document.forms[0].PageSendAlert.value=0; 	  		window.open(o,'','status,scrollbars,width=680,height=400,resizable=yes,left=200,top=200,screenX=0,screenY=0');				}		if (sendto== false) { 			document.forms[0].PageSendAlert.value=0; 		}	}	if (document.forms[0].PageSendAlert.value==3) {		var sendto= confirm("Ask - are you sure you want to send to the Members Group '"+c+"'?");		if (sendto== true) {   			var o=sWebDbName+"SendEmailGroups?OpenAgent&d="+d+"&cat=["+c+"]&UNID=["+i+"]";  			document.forms[0].PageENewsSentDate.value=d;  			document.forms[0].PageSendAlert.value=0; 	  		window.open(o,'','status,scrollbars,width=680,height=400,resizable=yes,left=200,top=200,screenX=0,screenY=0');				}		if (sendto== false) { 			document.forms[0].PageSendAlert.value=0; 		}	}}function subAttach(item){document.forms[0].OpenInEdit.value=1;document.forms[0].AutoInsert1.value=item;document.forms[0].submit();}function asksubAttach(item) {var where_to= confirm("Auto Inserting will save this document and re-open.  Do you want to upload & save changes to this document?");if (where_to== true) { subAttach(item);}}function subImage(item){document.forms[0].OpenInEdit.value=1;document.forms[0].AutoInsert2.value=item;document.forms[0].submit();}function asksubImage(item) {var where_to= confirm("Auto Inserting will save this document and re-open.  Do you want to upload & save changes to this document?");if (where_to== true) { subImage(item);}}var wkArray = new Array('t1','t2','t3','t4','t5','t6','t7','t8','t9','t10');var wkHArray = new Array('t1H','t2H','t3H','t4H','t5H','t6H','t7H','t8H','t9H','t10H');var wkHaArray = new Array('t1Ha','t2Ha','t3Ha','t4Ha','t5Ha','t6Ha','t7Ha','t8Ha','t9Ha','t10Ha');function tVis(w){//alert('togle = ' + w );setCookie('TAB',w,365);	togTab(w);	togHead(w+'H')	togHeadA(w+'Ha')}function togTab(w){	for(x=0; x < (wkArray.length) ; x++){		if(w == wkArray[x]){			document.getElementById(wkArray[x]).style.display='block';		}else{			document.getElementById(wkArray[x]).style.display='none';		}	}}function togHead(w){	for(x=0; x < (wkHArray.length) ; x++){		if(w == wkHArray[x]){			document.getElementById(wkHArray[x]).style.display='block';		}else{			document.getElementById(wkHArray[x]).style.display='none';		}	}}function togHeadA(w){	for(x=0; x < (wkHaArray.length) ; x++){		if(w == wkHaArray[x]){			document.getElementById(wkHaArray[x]).style.display='none';		}else{			document.getElementById(wkHaArray[x]).style.display='block';		}	}}/*	set background color of a layer*/function lyrSetBgColor(hLyr, sColor) {	if (isDOM) {		hLyr.style.backgroundColor = sColor	} else {		if (sColor == '') sColor = null		hLyr.bgColor = sColor	}}/*	set the position of a layer*/function lyrSetPos(hLyr, iTop, iLeft) {	if (isDOM) {		hLyr.style.top		= iTop		hLyr.style.left	= iLeft	} else {		hLyr.top	= iTop		hLyr.left	= iLeft	}}/*	show/hide a layer*/function lyrShow(hLayer, isVisible) {	if (isDOM) {		hLayer.style.visibility	= isVisible ? 'inherit' : 'hidden'	} else {		hLayer.visibility		= isVisible ? 'inherit' : 'hidden'	}}function lyrWriteLabel(hLayer, sLabel, sWidth) {	// Netscape 4.x: hLayer MUST NOT be in a table cell, it would CRASH the browser	if (isDOM) {		hLayer.innerHTML = sLabel			} else {			var tagwidth = ""		if(sWidth == "" ? tagwidth = "" : tagwidth = "width='" + sWidth + "'")		var hDoc = hLayer.document				hDoc.close()		hDoc.open("text/html","replace")		hDoc.write("<span><table " + tagwidth + " cellspacing=0 cellpadding=0 border=0><tr><td>" + sLabel + "</td></tr></table></span>")		hDoc.close()		hLayer.visibility = 'inherit'	}}// ----------------------------------------------- CHECKBOX  --------------------------------------function cboxGetCheckedValues(hChkBox) {	// return an array with the values of all checked checkboxes		var aReturn = []		if (hChkBox.length) {			// loop: all checkbox elements		for (var iChkIdx = 0; iChkIdx < hChkBox.length; iChkIdx++) {			if (hChkBox[iChkIdx].checked) {				aReturn[aReturn.length] = hChkBox[iChkIdx].value			}		}	} else {		// TBD if needed	}		return aReturn}function cboxSetCheckedFromArray(hChkBox, aValues) {	// set all checkboxes to checked, if their value is in aValues	if (hChkBox.length) {		// multiple checkboxes are available				// loop: all checkbox elements		for (var iChkIdx = 0; iChkIdx < hChkBox.length; iChkIdx++) {					var hChk = hChkBox[iChkIdx]					hChk.checked = false						for (var iValIdx = 0; iValIdx < aValues.length; iValIdx++) {							if (aValues[iValIdx] == hChk.value) {					hChk.checked = true				}			}					}			} else {		// TBD if needed		}}function Right(str, len) {  // Rightmost len characters  return(str.substring(str.length - len, str.length));}// ----------------------------------------------- LISTBOX  --------------------------------------/*	create a listbox from a one or two dimensional array*/function lboxCreateFromArray(hListbox, hArray, isDelEntries, sDefaultSelected) {	if (isDelEntries) {		hListbox.options.length = 0			// delete old entries	}	var iLBoxOffset = hListbox.options.length		if (hArray) {			// create the listbox		// check if this a one or two dimensional array		var is2D = (typeof hArray[0] == 'object')				for (var iIdx = 0; iIdx < hArray.length; iIdx++) {			var isSelected = (hArray[iIdx][1] == sDefaultSelected)			var hOption	= new Option(is2D ? hArray[iIdx][0] : hArray[iIdx], 								   is2D ? hArray[iIdx][1] : hArray[iIdx], 								   isSelected)						hListbox.options[iIdx + iLBoxOffset] = hOption						}				// select the first entry in the listbox		if (hArray.length > 0 && sDefaultSelected == 0) {			hListbox.options[0].selected = true		}	}}/*  deselects all entries in a listbox*/function lboxDeselectAll(hListbox) {	for (var iX = 0; iX < hListbox.length; iX++) {		hListbox[iX].selected = false	}}/*  selects all entries in a listbox*/function lboxSelectAll(hListbox) {	for (var iX = 0; iX < hListbox.length; iX++) {		hListbox[iX].selected = true	}}/*  return all items in a listbox in a two dimensional array*/function lboxGetAllItems(hListbox) {	var aReturn = []		for (var iX = 0; iX < hListbox.length; iX++) {		aReturn[aReturn.length] = [hListbox.options[iX].text, hListbox.options[iX].value]	}		return aReturn}function lboxGetAllItemsText(hListbox) {	// return text of all items in a listbox		var aReturn = []		for (var iX = 0; iX < hListbox.length; iX++) {		aReturn[aReturn.length] = hListbox.options[iX].text	}		return aReturn}function lboxGetAllItemsValue(hListbox) {	// return value of all items in a listbox	var aReturn = []		for (var iX = 0; iX < hListbox.length; iX++) {		aReturn[aReturn.length] = hListbox.options[iX].value	}		return aReturn}/*	lookup the text value in a listbox and return the index*/function lboxGetIndexByText(hListbox, sEntryValue) {	// return 	index of sEntryValue in the hListbox 	// 			-1 if not found		// loop: all entries in the listbox	for (var iIdx=0; iIdx < hListbox.options.length; iIdx++) {		if (hListbox.options[iIdx].text == sEntryValue) {			return iIdx		}	}		return -1}/*	lookup a value in a listbox and return the index*/function lboxGetIndexByValue(hListbox, sEntryValue) {	// return 	index of sEntryValue in the hListbox 	// 			-1 if not found		// loop: all entries in the listbox	for (var iIdx=0; iIdx < hListbox.options.length; iIdx++) {		if (hListbox.options[iIdx].value == sEntryValue) {			return iIdx		}	}		return -1}/*	return the selected item in a listbox*/function lboxGetSelectedItem(hListbox) {	return hListbox.options[hListbox.selectedIndex]}/*  returns an array of all selected items in a listbox*/function lboxGetSelectedItems(hListbox) {	// add all selected to the return array		var aReturn = []		for (var iX = 0; iX < hListbox.length; iX++) {			if (hListbox.options[iX].selected) {			aReturn[aReturn.length] = [hListbox.options[iX].text, hListbox.options[iX].value]		}	}		return aReturn}/*  returns an array with only the text of all selected items in a listbox*/function lboxGetSelectedItemsText(hListbox) {		var aReturn = []		for (var iX = 0; iX < hListbox.length; iX++) {			if (hListbox.options[iX].selected) {			aReturn[aReturn.length] = hListbox.options[iX].text		}	}		return aReturn}/*  returns an array with only the text of all selected items in a listbox*/function lboxGetSelectedItemsValue(hListbox) {		var aReturn = []		for (var iX = 0; iX < hListbox.length; iX++) {			if (hListbox.options[iX].selected) {			aReturn[aReturn.length] = hListbox.options[iX].value		}	}		return aReturn}/*	return the selected entry value from a listbox*/function lboxGetSelectedText(hListbox) {	if (hListbox.selectedIndex == -1) {		return null	} else {		return hListbox.options[hListbox.selectedIndex].text	}}/*	return the selected entry value in a listbox*/function lboxGetSelectedValue(hListbox) {	if (hListbox.selectedIndex == -1) {		return null	} else {		return hListbox.options[hListbox.selectedIndex].value	}}/*	select a listbox entry by text, add the item if it was not found in the list*/function lboxSelectByText(hListbox, sText, sAddItemValue) {	var iIdx = lboxGetIndexByText(hListbox, sText)		if (iIdx > -1) {			hListbox.options[iIdx].selected = true			} else {		// entry was not found, add it to the list if it was provided and select it		if (sAddItemValue) {					hListbox.options[hListbox.options.length] = new Option(sText, sAddItemValue)			hListbox.options[hListbox.options.length -1].selected = true		}	}		return iIdx}/*	select a listbox entry by value, add the item sAddItemText if it was not found in the list		return index of the selected entry, -1 if sValue was not in the listbox*/function lboxSelectByValue(hListbox, sValue, sAddItemText) {	var iIdx = lboxGetIndexByValue(hListbox, sValue)		if (iIdx > -1) {		hListbox.options[iIdx].selected = true	} else {		// entry was not found, add it to the list if it was provided and select it		if (sAddItemText) {					hListbox.options[hListbox.options.length] = new Option(sAddItemText, sValue)			hListbox.options[hListbox.options.length -1].selected = true		}	}		return iIdx}	/*	removes all entries in a listbox*/function lboxRemoveAll(hListbox) {	hListbox.options.length = 0}/*	removes the selected entries in a listbox*/function lboxRemoveAllSelected(hListbox) {	var iLength = hListbox.length		for (var iX = (iLength - 1); iX > -1; iX--) {		if (hListbox.options[iX].selected) {			hListbox.options[iX] = null		}	}}/*	removes the selected entries in listbow from listbox1*/function lboxRemoveAllSelected1(hListbox,hListbox1) {	var iLength = hListbox.length		for (var iX = (iLength - 1); iX > -1; iX--) {		if (hListbox.options[iX].selected) {			hListbox1.options[iX] = null		}	}}/*	remove currently selected entry*/function lboxRemoveSelectedEntry(hListbox, isSelectNext) {	var iLastIdx = hListbox.selectedIndex		// do nothing if nothing is selected	if (iLastIdx == -1) {		return -1	}	hListbox[iLastIdx] = null		// select next entry if flag is set	if (isSelectNext) {			// do nothing if listbox is empty		if (hListbox.options.length == 0) {			return -1		}				var iIdxNext = (iLastIdx == hListbox.options.length ? iLastIdx - 1 : iLastIdx)				hListbox[iIdxNext].selected = true		return iIdxNext	}		return -1}// ----------------------------------------- ARRAY ----------------------------------------function arrJoin(hArray, sSeparator, iDimension) {	// join array but only one dimension	var sReturn = ''		for (var iIdx = 0; iIdx < hArray.length; iIdx++) {			sReturn += (iIdx == 0 ? '' : sSeparator) + hArray[iIdx][iDimension]	}		return sReturn}/*  removes all duplicate elements from an array, key is the first element in an array  returns the new array*/function arrMakeUnique(aFirst, aSecond, isSort) {	var aTemp		= []	var aReturn	= []	// check if this a one or two dimensional array	var is2D = (typeof aFirst[0] == 'object')		for (var iX = 0; iX < aFirst.length; iX++) {		var hEntry = aFirst[iX]				if (is2D) {			aTemp[hEntry[0]] = hEntry		} else {			aTemp[hEntry] = hEntry				}	}	for (var iX = 0; iX < aSecond.length; iX++) {		var hEntry = aSecond[iX]		if (is2D) {			aTemp[hEntry[0]] = hEntry		} else {			aTemp[hEntry] = hEntry				}	}			for (var sKey in aTemp) {		aReturn[aReturn.length] = aTemp[sKey]	}		if (isSort == false) {		return aReturn	} else if (is2D) {		return aReturn.sort(sort2DArrayNoCaseOn0)	} else {		return aReturn.sort(sortArrayNoCase)	}		}function arrRemoveEntryByIndex(hArray, iPos) {	// removes one entry from an array	var aNew = hArray.slice(0, iPos);		for (var iOld = iPos + 1; iOld < hArray.length; iOld++) {			aNew[aNew.length] = hArray[iOld];	}		return aNew;}		// ------------------------------------------- SORTING ---------------------------------------function sortArrayNoCase(a, b) {	// sort callback which ignores case		var aUp = a.toUpperCase()	var bUp = b.toUpperCase()		if (aUp < bUp) return -1	if (aUp > bUp) return 1	return 0}/*  sort callback function for a 2 dimensional array, sorts on the first dimension*/function sort2DArrayNoCaseOn0(a, b) {	var aUp = a[0].toUpperCase()	var bUp = b[0].toUpperCase()		if (aUp < bUp) return -1	if (aUp > bUp) return 1	return 0}/*  sort callback function for a 2 dimensional array, sorts on the second dimension*/function sort2DArrayNoCaseOn1(a, b) {	var aUp = a[1].toUpperCase()	var bUp = b[1].toUpperCase()		if (aUp < bUp) return -1	if (aUp > bUp) return 1	return 0}// ------------------------------------------ STRING -----------------------------function strUrlParam(sUrl, sParam) {	// extract a url parameter from an href		var sParam	= sParam.toUpperCase()	var aUrl		= sUrl.split('&')		for (var iIdx = 0; iIdx < aUrl.length; iIdx++) {			if ((aUrl[iIdx].toUpperCase()).indexOf(sParam) > -1) {			var aParam = aUrl[iIdx].split('=')			return aParam[1] == null ? '' : aParam[1]		}	}		return ''}function strEscapeParam(sParam) {	return(escape(strEscapePassthrough(sParam)))}function strEscapePassthrough(sParam) {	// $n are reserved words in regular expressions, so we do a roundtrip with ~~	sParam = sParam.replace(/&/,	'~~1')	sParam = sParam.replace(/~~/,	'$')	sParam = sParam.replace(/=/,	'~~2')	sParam = sParam.replace(/~~/,	'$')		return(sParam)}function strEscapeFT(sQuery) {	var aResWords	= ['field', 'contain', 'topic', 'not', 'sentence', 'near', 'paragraph', 'accrue']	var aEscWords	= ['f?eld', 'c?ntain', 't?pic', 'n?t', 's?ntence', 'n?ar', 'p?ragraph', 'a?crue']				for(var iWord = 0; iWord < aResWords.length; iWord++) {		var re = new RegExp(aResWords[iWord] + '\\b', 'i')		sQuery = sQuery.replace(re, aEscWords[iWord])	}		return escape(sQuery)}function strPrintf() {	// usage:		strPrintf("Trust in %s2, but lock your %s1.", "car", "god")	// output:	"Trust in god, but lock your car."	var insert	= ''	var source	= strPrintf.arguments[0]	for (i = 1; i < strPrintf.arguments.length; i++) {		insert	= strPrintf.arguments[i]		source	= source.replace('%s' + i, insert)	}	return source}function strTrim(sSource) {	// remove leading and trailing blanks from a string		var sSubStr		// remove leading blanks	for (var iIdx = 0; iIdx < sSource.length; iIdx++) {		if (sSource.substr(iIdx, 1) != ' ') break	}		sSubStr = sSource.substring(iIdx, sSource.length)			// remove trailing blanks	for (iIdx = sSubStr.length; iIdx > 0; iIdx--) {		if (sSubStr.substr(iIdx-1, 1) != ' ') break	}		return (sSubStr.substring(0, iIdx))}// --------------------------------------- MISC ----------------------------------------------function syncFields(hForm, sFieldName) {	// sync textarea field with text field, both have the same name	var hField = hForm.elements[sFieldName]	if (hField && hField.length) {		hField[1].value = hField[0].value;	}		return true}/*	return absolute x,y coordinates of an element*/function domOffsetAbs(hElement) {	var top	= 0	var left	= 0		do {		top	+= hElement.offsetTop		left	+= hElement.offsetLeft	}	while ((hElement = hElement.offsetParent))		return {top: top, left: left}}function findPos(obj) {	var curleft = curtop = 0;	if (obj.offsetParent) {		curleft = obj.offsetLeft		curtop = obj.offsetTop		while (obj = obj.offsetParent) {			curleft += obj.offsetLeft			curtop += obj.offsetTop		}	}	return [curleft,curtop];}function setLanLyr(obj,lyr,adjustTop,adjustLeft) {	if (window.isIE=document.all) {		//IE alert('Is IE!');		var aT = adjustTop;		var aL = adjustLeft;	} else {		//Others alert('Is NOT IE!');		var aT = adjustTop;		var aL = adjustLeft;	}	var coors = findPos(obj);	var x = document.getElementById(lyr);	x.style.top = (coors[1]-aT) + 'px';	x.style.left = (coors[0]-aL) + 'px';	x.style.visibility = 'visible';}function setLanLyr(obj,lyr,adjustTop,adjustLeft) {	if (window.isIE=document.all) {		//IE alert('Is IE!');		var aT = adjustTop;		var aL = adjustLeft;	} else {		//Others alert('Is NOT IE!');		var aT = adjustTop;		var aL = adjustLeft;	}	var coors = findPos(obj);	var x = document.getElementById(lyr);	x.style.top = (coors[1]-aT) + 'px';	x.style.left = (coors[0]-aL) + 'px';	x.style.visibility = 'visible';}function setLyr(obj,lyr,adjustTop,adjustLeft) {return	if (window.isIE=document.all) {		//IE alert('Is IE!');		var aT = adjustTop;		var aL = adjustLeft;	} else {		//Others alert('Is NOT IE!');		var aT = adjustTop;		var aL = adjustLeft;	}	var coors = findPos(obj);	var x = document.getElementById(lyr);	x.style.top = (coors[1]-aT) + 'px';	x.style.left = (coors[0]-aL) + 'px';	x.style.visibility = 'visible';}function report1(thisspot){	var r=findPos(thisspot);	alert('l='+r[0] + ' r='+r[1]);}function uDate() {   var day = new Date();   var hr = day.getHours();   var dy = day.getDate();   var yr = day.getYear();   var mn = day.getMonth();   mn = mn + 1   var min = day.getMinutes();   //alert('&uD='+ 'year='+yr + 'month='+mn + 'date='+dy + 'hour='+hr + 'min='+min);   return('&At='+ yr +'-'+ mn + '-'+dy + '.'+hr + ':'+min);}function sDate() {  var day = new Date();   var hr = Right("0" + day.getHours(),2);   var min = Right("0" + day.getMinutes(),2);   var dy = Right("0" + day.getDate(),2);   var yr = day.getFullYear();   var mn = Right("0" + day.getMonth(),2);   return( yr + "-" + mn + "-" + dy + "  " + hr + ":" + min);}function getCookie(NameOfCookie) {    if (document.cookie.length > 0) {         begin = document.cookie.indexOf(NameOfCookie+"=");         if (begin != -1) {             begin += NameOfCookie.length+1;             end = document.cookie.indexOf(";", begin);            if (end == -1) {end = document.cookie.length;                return unescape(document.cookie.substring(begin, end));            }            else {                return unescape(document.cookie.substring(begin, end));            }         }    }    else {        return null;    }}function setCookie(NameOfCookie, value, expiredays) {    var ExpireDate = new Date ();    ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));    document.cookie = NameOfCookie + "=" + escape(value) +"; path=/" + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());}function delCookie (NameOfCookie) {     if (getCookie(NameOfCookie)) {    document.cookie = NameOfCookie + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT";    }}function Left(str, len) {  // Leftmost len characters  return(str.substring(0, len));}function Right(str, len) {  // Rightmost len characters  return(str.substring(str.length - len, str.length));}