var mBadNumber = 'This does not appear to be a valid number.  It should have no letters or characters other than commas and periods. Please re-enter.'
var mBadCurrency = 'This does not appear to be a valid currency.  It should have no letters or characters other than commas and periods. Please re-enter.'
var mBadZip = 'This does not appear to be a valid Zip Code.  It should be in the form 99999 or 99999-9999. Please re-enter.'
var mBadEmail = 'This does not appear to be a valid Email.  It should be in the form name@domain.xxx. Please re-enter.'
var mBadURL = 'This does not appear to be a valid web URL.  It should be in the form [www or server name].site.xxx.  Please re-enter.'
var mBadDate = 'This does not appear to be a valid date.  It should be a real date in the format of MM/DD/YY or MM/DD/YYYY. Please re-enter.'
var mBadPhone = 'This does not appear to be a valid Phone Number.  It should be in the form 999-9999 or (999)999-9999 . Please re-enter.'
var jPos="Positive";
var jNeg="Negative";
var jBrowserType;
var preloadFlag = false;
var jCurrentField
var jIsOpera;
var jIsMac;
var jIsSafari;
var jDtSize=8;
var jCurrentID;

function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera'; jIsOpera=true; jDtSize=11
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari'; jIsSafari=true
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}
document.onkeypress=jsTab;  
document.onkeydown=jsTab; 
if (jBrowserType=="NS") { document.captureEvents(Event.KEYPRESS); }
 
jComputer=navigator.userAgent.toLowerCase()
if (jComputer.indexOf("mac")>-1) { jIsMac=true } else { jIsMac=false } 
jBrowserType=whichBrs()

function checkScroll() {
setInterval("scrollFrame()",10);
}
function jsChgChkVal(t,f) {
e=document.getElementById(f)
if (e) {
	v=e.value
	if ((v=="") || (v=="ON")) { e.value='OFF' } else { e.value='ON' }
	}
}
function jsEditThis(f,v) {
parent.frNav.location="nav.asp?T=MAIN&ID=" + v
document.thisForm.hdnNextMode.value="EDIT"
document.thisForm.hdnCurIDFld.value=f
document.thisForm.hdnNextID.value=v
document.thisForm.submit()
}
function jsSearchByForm() {
document.thisForm.hdnNextMode.value="FORMSEARCH"
document.thisForm.submit()
}
function jsFormSearch() {
document.thisForm.hdnNextMode.value="FORMSEARCHDATA"
document.thisForm.submit()
}
function jsShowRows(t) {
document.thisForm.hdnNextOp.value="SHOWROWS"
document.thisForm.hdnShowRows.value=t
document.thisForm.submit()
}
function jsSaveCallPage(t,p,m,g) {
document.thisForm.hdnGotoPage.value=p + t.value
document.thisForm.hdnSaveThis.value="SAVE"
document.thisForm.submit()
}
function jsHideShow(l,hs) {
v=document.getElementById(l); v.style.visibility=hs
}
function noenter() {
  return !(window.event && window.event.keyCode == 13); 
}
function jsSubmitQPD(t,q) {
document.thisForm.hdnGotoPage.value="_Submit.asp?QHID=" + q
document.thisForm.hdnNextOp.value="SUBMIT"
rv=jsRecalcQPD()
rv=jsSaveRec(t,"","")
}
function jsTab(t,e) {
if (jBrowserType!="Internet Explorer" ){
	if ((e==undefined) || (!(e))) { e=window.event; } 
	if ((e==undefined) || (!(e))) { return } 
	var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
//	if (jBrowserType=="Safari") {	alert(keyCode) }
//	if ((keyCode==13) || (keyCode==8) || (keyCode==3)) {
	if ((keyCode==13) || (keyCode==3)) {
		x=t.tabIndex
		els=document.getElementsByTagName("INPUT")
		for (j=1;j<20;j++) {
			z=new Number(x)+j
			for (i=0;i<els.length;i++) {
				y=els[i].tabIndex;
				y=new Number(y) 
				if (jBrowserType=="Safari") { 
					//window.event.preventDefault(); 
					//window.event.stopPropagation(); 
					if (y==z) { els[i].focus(); return false; }
					}
				else {
					if (y==z) { els[i].select(); return false; }
					}
				}
			}
		return false;
		}
	}
else {
	if (event.keyCode==13) { event.keyCode=9 }
	}
}
function zzjsTab(t,e) {
if (jBrowserType!="Internet Explorer" ){
//if ((jIsOpera==true) || (jIsMac==true) || (jBrowserType=="NS")) {
	if (!jIsMac) { if ((e==undefined) || (!(e))) { return } }
	var keyCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
	if (keyCode==13) {
		if (jBrowserType=="NS") {
			x=t.tabIndex
			}
		else {
			x=e.srcElement.tabIndex
			}
		els=document.getElementsByTagName("INPUT")
		for (j=1;j<20;j++) {
			z=new Number(x)+j
			for (i=0;i<els.length;i++) {
				y=els[i].tabIndex;
				y=new Number(y) 
				if (y==z) { els[i].select(); return false; }		
				}
			}
		return false;
		}
	}
else {
	if (event.keyCode==13) { event.keyCode=9 }
	}
}
function jsShowCols(t) {
document.thisForm.hdnNextOp.value="SHOWCOLS"
document.thisForm.hdnShowCols.value=t
document.thisForm.submit()
}
function jsGotoPageNbr(t) {
document.thisForm.hdnNextOp.value="GOTOPAGE"
document.thisForm.hdnStartPage.value=t.value
document.thisForm.submit()
}
function jsSort(f,d) {
document.thisForm.hdnNextOp.value="SORT"
document.thisForm.hdnSortFld.value=f
document.thisForm.hdnSortDir.value=d
document.thisForm.submit()
}
function jsFilter(t1,t2) {
document.thisForm.hdnNextOp.value="FILTER"
document.thisForm.hdnVal1.value=t1.value
document.thisForm.hdnVal2.value=t2.value
document.thisForm.submit()
}
function jsClearFilter(t,p,m,jTblName) {
document.thisForm.hdnNextOp.value="FILTER"
document.thisForm.hdnVal1.value=""
document.thisForm.hdnVal2.value=""
document.thisForm.submit()
}
function jsListSelect(f) {
if (f.selectedIndex==-1) { alert("Please select a " + f.name); return }
v=f.options[f.selectedIndex].value
x=f.options[f.selectedIndex].text
if (v=="") { alert("Please select a " + f.name); return }
document.thisForm.hdnGotoPage.value=jGotoPage
document.thisForm.hdnSaveThis.value="SAVE"
document.thisForm.submit()
}
function jsIsMT(s) {
if (s==null) { return true }
if (s=="") { return true }
if (s==0) { return true }
}
function jsCheckSave() {
if (!document.thisForm.hdnSaveThis) { return }
v=document.thisForm.hdnSaveThis.value
if (v!="SAVE") {
	return "!WARNING!  Have you saved your work?  Select Cancel now and press the Save button before closing.  IF YOU WISH TO UPDATE YOUR WORK: please hit Cancel and use the Recalc button.  IF YOU HAVE HIT THE BROWSER'S REFRESH BUTTON - you will be brought back to the login screen.  If this is not what you want to do, please hit Cancel." 
	document.thisForm.hdnSaveThis.value="SAVE"
	document.thisForm.submit();
	}
}
function jsFindArrayMatch(jArray,jVal) {
var i
for (i=1;i<=jArray.length;i++) {
	if (jArray[i]==jVal) {
		return i
		}
	}
}
function jsEnter2Tab() {
if (event.keyCode==13) { event.keyCode=9 }
}
function jsSaveRec(t,vPageToCall,jMsg) {
jCurID=t.value;
for (eli=0;eli<document.thisForm.elements.length;eli++) { 
	var e=document.thisForm.elements[eli]
	if (!e.dataFld=="") { 
		vc=e.dataFld
		vn=e.name
		vv=e.value
		if (vn.substr(0,4)=="DOM_") { vn=vn.substr(4) }
		if ((vv=="") && (vc.indexOf(":VC_WARNING:")>-1)) { 
			alert("Entry warning.  " + vn + " requires a value."); 
			}
		if ((vv=="") && (vc.indexOf(":VC_REQUIRED:")>-1)) { 
			alert("Entry error.  " + vn + " requires a value."); e.focus(); e.select();
			return
			}
		if ((vv!="") && (vc.indexOf(":VC_NUMBER:")>-1)) { 
			rv=isNumber(e.value);
			if (rv!="") { alert(mBadNumber + ":" + e.name + ":" + rv); e.select(); return; }
			e.value=MakeNumber(e)
			}
		if ((vv!="") && (vc.indexOf("|VC_CURRENCY|")>-1)) { 
			rv=isCurrency(e.value);
			if (rv!="") { alert(mBadCurrency + ":" + e.name + ":" + rv); e.select(); return; }
			e.value=MakeNumber(e)
			}
		if ((vv!="") && (vc.indexOf(":VC_DATE:")>-1)) { 
			rv=couldBeDate(e.value);
			if (rv!="") { alert(mBadDate + ":" + e.name + ":" + rv); e.select(); return; }
			}
		if ((vv!="") && (vc.indexOf(":VC_ZIP:")>-1)) { 
			rv=isZip(e);
			if (rv!="") { alert(mBadZip + ":" + e.name + ":" + rv); e.select(); return; }
			}
		if ((vv!="") && (vc.indexOf(":VC_PHONE:")>-1)) { 
			rv=isPhone(e);
			if (rv!="") { alert(mBadPhone + ":" + e.name + ":" + rv); e.select(); return; }
			}
		if ((vv!="") && (vc.indexOf(":VC_EMAIL:")>-1)) { 
			rv=isEmail(e);
			if (rv!="") { alert(mBadEmail + ":" + e.name + ":" + rv); e.select(); return; }
			}
		if ((vv!="") && (vc.indexOf(":VC_URL:")>-1)) { 
			rv=isURL(e);
			if (rv!="") { alert(mBadURL + ":" + e.name + ":" + rv); e.select(); return; }
			}
		if ( (vv!="") && (vc.indexOf(":VC_STRIPQUOTES:")>-1) ) { 
			v=e.value;
			x=""
			for (iz=0;iz<v.length;iz++) {
				if ((v.charCodeAt(iz)!=34) && (v.charCodeAt(iz)!=39)) { x=x + v.charAt(iz) }
				}
			e.value=x;
			}
		}
	}
rv=true;
if (jMsg!="") { rv=confirm(jMsg) }
if (rv) {
	document.thisForm.hdnSaveThis.value="SAVE"
	if (vPageToCall!="") { document.thisForm.hdnGotoPage.value=vPageToCall }
	document.thisForm.submit()
	}
}
function jsGetMonthInQuarter(d) {
nd=new Date(d)
m=nd.getMonth()
if ((m==0) || (m==3) || (m==6) || (m==9)) { return 1 }
if ((m==1) || (m==4) || (m==7) || (m==10)) { return 2 }
if ((m==2) || (m==5) || (m==8) || (m==11)) { return 3 }
}
function jsMakeNbr(x) {
if ((x==undefined) || (x==null) || (x=="") || (x==Number.NaN) || (x==" ") || (x=="NaN")) { return 0 }
//alert(x + ":" + (x.substr(0,1)) + ":" + (x.length) + ":" + (x.substr(0,1)=="-"))
//x=TrimAll(x)
if (x=="-") { return 0 }
if ((x=="-" + String.fromCharCode(160,160,160,160,160) )) { return 0 }
if ((x=="-" + String.fromCharCode(32,32,32,32,32) )) { return 0 }
if (x.length>0) { if (x.substr(0,1)=="-") { return 0 } }
x=x.toString()
if (x.charCodeAt(0)==160) { return 0 }
//alert(x)
z=""
for (i=0;i<x.length;i++) {
	y=x.substr(i,1)
	xx=y.charCodeAt(0)
	if ((y!="-") && ((xx<48) || (xx>57))) {
		}
	else {
		z=z + y;
		}
	}
//	alert(z)
//if (z.charCodeAt(0)==160) { return 0 }
z=new Number(z)	
if (z==Number.NaN) { z=0 }
return z
}
function jsFormatNbr(x) {
z=""
k=x.toString()
m=k.substr(0,1)
if (m=="-") { k=k.substr(1); } else { m="" }
p=k.indexOf(".")
d=0
jAddOne=0
if (p>-1) { 
	d=k.substr(p+1); 
	k=k.substr(0,p); 
	if (d.length>0) {
		y=d.substr(0)
		y=new Number(y)
		if (y>4) { jAddOne=1; }
		}
	}
z=k
z=new Number(z)
z=z + jAddOne
if (k.length>3) {
	if (k.length<=6) {
		l=(k.length-3)
		z=k.substr(0,l) + "," + k.substr(l,3) 
		return (m + z)
		}
	if (k.length<=9) {
		l=(k.length-6)
		z=k.substr(0,l) + "," + k.substr(l,3) + "," + k.substr(k.length-3,3)
		}
	}
return (m + z)
}
function jsGotoRec(r) {
document.thisForm.hdnSaveThis.value="SAVE";
document.thisForm.hdnNextOp.value="GOTOREC";
document.thisForm.hdnGotoRec.value=r;
document.thisForm.submit()
}
function jsSaveAndGotoPage(vCall,vx) {
if (document.thisForm.Recalc) { 
	vOriginalVal=document.thisForm.Recalc.value
	document.thisForm.Recalc.value="ON"
	document.thisForm.Recalc.value=vOriginalVal
	}
document.thisForm.hdnSaveThis.value="SAVE";
document.thisForm.hdnGotoPage.value=vCall + vx;
document.thisForm.submit()
}
function jsExport(t,pg) {
document.thisForm.hdnNextOp.value="EXPORT";
document.thisForm.submit()
}
function jsReport(t,pg) {
document.thisForm.hdnNextOp.value="REPORT";
document.thisForm.submit()
}
function jsDelRec(t,pg) {
if (pg.indexOf("?")==-1) { ad="?" } else { ad="&" }
if (confirm("Please confirm deleting this record?")) {
	document.thisForm.hdnNextOp.value="DELETE";
	document.thisForm.submit()
	}
}
function jsAddRec(t,pg) {
if (pg.indexOf("?")==-1) { ad="?" } else { ad="&" }
if (confirm("Please confirm adding a record.")) {
	document.thisForm.hdnSaveThis.value="SAVE";
	document.thisForm.hdnNextOp.value="ADD";
	document.thisForm.submit()
	}
}
function jsChgMode(m) {
document.thisForm.hdnSaveThis.value="SAVE";
document.thisForm.hdnNextMode.value=m
document.thisForm.submit()
}
function jsChangeListFontSize(v) {
document.thisForm.hdnNextOp.value="FONTSIZE"
document.thisForm.hdnFromVal.value=v
document.thisForm.submit()
}
function jsSaveUserRec() {
e=document.thisForm.Email; if (e.value=="") { alertm("",e); return }; if (e.value=="NEW") { alertm("Please provide a valid User Name.",e); return };
e=document.thisForm.Phone; 
if (e.value!="") { rv=isPhone(e); if (rv!="") { alertm("Please provide a valid phone.  " + rv,e); return } }
e=document.thisForm.Email; if (e.value=="") { alertm("",e); return };
rv=isEmail(e); if (rv!="") { alertm("Please provide a valid email address.  " + rv,e); return }
e=document.thisForm.ConfirmEmail; if (e.value=="") { alertm("",e); return };
rv=isEmail(e); if (rv!="") { alertm("Please provide a valid email address.  " + rv,e); return }
if (e.value!=document.thisForm.Email.value) { alertm("Your email and your confirm email values do not match.",e); return }
e=document.thisForm.UserPW; if (e.value=="") { alertm("",e); return };
e=document.thisForm.ConfirmPW; if (e.value=="") { alertm("",e); return };
if (e.value!=document.thisForm.UserPW.value)  { alertm("Your password and your confirm password values do not match.",e); return }
document.thisForm.hdnNextMode.value="SAVE";
document.thisForm.submit();
}
function jsLogin() {
jUN=document.thisForm.UserName;
jPW=document.thisForm.UserPW;
if (jUN.value=="") { alert("Please enter an Email Address"); jUN.select(); return; }
if (jPW.value=="") { alert("Please enter a Password"); jPW.select(); return; }
document.thisForm.hdnNextOp.value="LOGIN"
document.thisForm.submit();
}
function jsForgotPW() {
jUN=document.thisForm.Email;
if (jUN.value=="") { alert("Please enter an Email Address"); jUN.select(); return; }
rv=isEmail(jUN)
if (rv!="") { alert("Please enter a valid Email Address " + rv); jUN.select(); return; }
document.thisForm.hdnNextOp.value="SENDPW"
document.thisForm.submit();
}
function jsRegister() {
document.thisForm.hdnNextOp.value="REGISTER"
document.thisForm.submit();
}
function test() {
alert("You have called the Test function.")
}
function jsTest() {
alert("You have called the jsTest function.")
}
function jsTurnOn(vID) {
var p1,vN
p1=vID.indexOf("_")
vN=vID.substr(p1)
var e=document.getElementById(vID)
if (e) { 
	e.style.color='white'
	e.style.backgroundColor='FireBrick'
	e.style.fontWeight='bolder' 
	}
if (e) { 
	var e=document.getElementById("hrfMenu" + vN)
	e.style.fontWeight='bolder'
	e.style.color='white'
	}
var e=document.getElementById("imgMenu" + vN)
if (e) { e.src='imgs/squares_2_hl.gif' }
}
function jsTurnOff(vID) {
p1=vID.indexOf("_")
vN=vID.substr(p1)
vLvl=vN.substr(1,1)
var e=document.getElementById(vID)
if (e) { 
	e.style.color='navy' 
	if (vLvl=="1") { e.style.backgroundColor='#dde1ec' } else { e.style.backgroundColor='#b5c0e0' } 
	e.style.fontWeight='lighter' 
	}
var e=document.getElementById("hrfMenu" + vN)
if (e) { 
	e.style.fontWeight='lighter'
	e.style.color='navy'
	}
var e=document.getElementById("imgMenu" + vN)
if (e) { e.src='imgs/squares_2.gif' }
}
function jsHighlight(t) {
var i,vLvl,vLen,vID
vID=t.id
p=vID.lastIndexOf("_")
vLvl=vID.substr(0,p)
vLen=vID.length
var aDivs=document.getElementsByTagName("DIV");
for (i=0;i<aDivs.length;i++) {
	vID=aDivs[i].id
	if ((vID.length==vLen) && (vLvl==vID.substr(0,p))) {
		rv=jsTurnOff(vID)
		}
	}
rv=jsTurnOn(t.id)
}
function jsShowMenu(t,jMenu) {
var vMainLevel,vNextLevel
vID=t.id
p=vID.indexOf("_")
vMainLevel=vID.substr(p+1,1)
z=new Number(vMainLevel)
rv=jsHideMenus(t,z+1)
vNextLevel=z+1
if (jMenu) {
	jMenu.style.visibility="visible"
	jMenu.style.zIndex=10
	if (vMainLevel==1) { 
		jMenu.style.left=divTop.offsetLeft+t.offsetLeft+1
		jMenu.style.top=(divTop.offsetTop+t.offsetHeight+1)
		}
	else	{
		jMenu.style.left=(t.parentElement.offsetLeft+t.offsetLeft+t.offsetWidth-5) 
		jMenu.style.top=(t.parentElement.offsetTop+t.offsetTop)
		}
	for (i=0;i<jMenu.children.length;i++) {
		jMenu.children(i).style.visibility="visible"
		}
	}
if (t) { rv=jsHighlight(t) }
}
function jsMouseOut(t) {
vID=t.id
p=vID.indexOf("_")
vN=vID.substr(p)
l=vN.length
vL=vN.substr(0,l-1)
var aDivs=document.getElementsByTagName("DIV");
for (i=0;i<aDivs.length;i++) {
	vID=aDivs[i].id
	if (vID.indexOf("divMenu"+vL)>-1) {
		var e=document.getElementById(vID)
		e.style.color='navy'
		e.style.backgroundColor='#b5c0e0'
		e.style.fontWeight='lighter' 
		var e=document.getElementById("hrfMenu" + vN)
		e.style.fontWeight='lighter'
		e.style.color='navy'
		var e=document.getElementById("imgMenu" + vN)
		e.src='imgs/squares_2.gif'
		}
	}
}
function jsHideMenus(t,vLvl) {
vNP=t.id
p=vNP.indexOf("_")
vNP=vNP.substr(p)
x=vNP.substr(1,1)
vMainLevel=new Number(x)
lNP=vNP.length
var aDivs=document.getElementsByTagName("DIV");
z=new Number(vLvl)
for (i=0;i<aDivs.length;i++) {
	vID=aDivs[i].id
	if (vID.substr(0,9)=="divGMenu_") {
		x=vID.substr(9,1)
		vL=new Number(x)
		if (vL>=z) {
			if (aDivs[i]) {
				aDivs[i].style.visibility="hidden" 
				for (x=0;x<aDivs[i].children.length;x++) {
					aDivs[i].children(x).style.visibility="hidden"
					}
				}
			}
		}
    }
}
function jsCallPage(vFrame,vPage) {
if (vFrame!="") { 
	jFrame=findFrame(vFrame);
	if (typeof(jFrame)!="undefined") { 
		rv=eval("parent." + vFrame + ".location.href=vPage") 
		} 
	}
else { window.location.href=vPage }
}
function jsFieldListChange(t,p,m,jTblName) {
jFld=t.value
jVal=document.thisForm.txtFilterVal.value
window.location=p + "?TBL=" + jTblName + "&FFLD=" + jFld + "&FVAL=" + jVal + "&MD=" + m
}
function alertm(m,f) {
if (m=="") { m="Please provide a value for " + f.name }
alert(m);
f.select();
}
function jsChgRdoVal(t,f) {
v=t.dataFld
rv=eval("document.thisForm." + f + ".value='" + v + "'") 
}
function jsShowAlert(m) {
alert(m)
}
function jsOpenWin2(p,h,w,t,l) {
if (h==0) {h=400}
if (w==0) {w=500}
if (t==0) {t=500}
if (l==0) {l=500}
if (whichBrs()=="Safari") { t=t-550; l=l-100; }
//vProps="titlebar:no;resizable:no;menu:no;status:no;scrollbars:no;dialogHeight:" + h + "px;width:" + w + ";top:" + t + ";left:" + l + ";"
vProps="titlebar=no,resizable=no,menu=no,status=no,scrollbars=yes,height=" + h + ",width=" + w + ",top=" + t + ",left=" + l + ""
//alert(vProps)
rv=window.open(p,'Explain',vProps,true)
rv.focus()
//rv=window.showModalDialog(p,'',vProps)
//return rv
}
function jsOpenWin(e,dis,p,h,w,t,l) {
v=dis.value
if (h==0) {h=400}
if (w==0) {w=500}
if (t==0) {t=500}
if (l==0) {l=500}
if (whichBrs()=="Safari") { t=t-550; l=l-100; }
vProps='titlebar=no,resizable=yes,menu=no,status=no,scrollbars=yes,height=' + h + ',width=' + w + ',top=' + t + ',left=' + l
rv=window.showModalDialog(p + "&FLDVAL=" + v,'Edit',vProps)
return rv
}
function jsOpenSmallWin(e,dis,p,h,w,t,l) {
v=dis.value
if (v=="") { alert("No data available."); return; }
if (h==0) {h=450}
if (w==0) {w=650}
t=e.screenY
if (t==0) {t=500}
l=e.screenX
if (l==0) {l=500}
if (whichBrs()=="Safari") { t=t-550; l=l-100; }
vProps='titlebar=no,resizable=yes,menu=no,status=no,scrollbars=yes,height=' + h + ',width=' + w + ',top=' + t + ',left=' + l
//+ "&ID=" + v + "&FLDVAL=" + v
rv=window.open(p + "&ID=" + v,'Edit',vProps)
//rv=window.open(p,'Edit',vProps)
rv.focus()
}
function jsOpenSmallWin2(dis,p,h,w,t,l) {
v=dis
if (v=="") { alert("No data available."); return; }
if (h==0) {h=450}
if (w==0) {w=650}
if (t==0) {t=500}
if (l==0) {l=500}
if (whichBrs()=="Safari") { t=t-550; l=l-100; }
vProps='titlebar=no,resizable=yes,menu=no,status=no,scrollbars=yes,height=' + h + ',width=' + w + ',top=' + t + ',left=' + l
rv=window.open(p + "&ID=" + v,'Edit',vProps)
rv.focus()
}
function jsLoadFlds(IDf,IDv,DSPf,DSPv) {
if (IDf!="") {
	e=document.getElementById(IDf)
	e.value=IDv
	}
if (DSPf!="") {
	e=document.getElementById(DSPf)
	e.value=DSPv
	}
}
function jsOpenMedWin(w) {
vHeight=500
vWidth=700
vProps='resizable=yes,location=no,menubar=no,menu=no,scrollbars=yes,height=' + vHeight + ',width=' + vWidth
window.open(w,'View',vProps)
}
function jsMoveUpList(f) {
x=f.selectedIndex
if (x<0) { return }
if (!f.options[x]) { return }
t=f.options[x].text
v=f.options[x].value
x=x-1
for (i=0;i<f.options.length;i++) {
	t2=f.options[i].text
	v2=f.options[i].value
	if (i==x) {
		f.options[i].innerText=t
		f.options[i].value=v
		for (j=i+1;j<f.options.length;j++) {
			f.options[j].innerText=t2
			f.options[j].value=v2
			if (j+1<f.options.length) {
				t2=f.options[j+1].text
				v2=f.options[j+1].value
				}
			}
		i=j;
		}		
	} 
f.selectedIndex=x
}
function jsMoveDownList(f) {
x=f.selectedIndex
if (x<0) { return }
if (x==f.options.length) { return }
t=f.options[x].text
v=f.options[x].value
x=x+1
for (i=f.options.length-1;i>-1;i--) {
	t2=f.options[i].text
	v2=f.options[i].value
	if (i==x) {
		f.options[i].innerText=t
		f.options[i].value=v
		for (j=i-1;j>-1;j--) {
			f.options[j].innerText=t2
			f.options[j].value=v2
			if (j-1>-1) {
				t2=f.options[j-1].text
				v2=f.options[j-1].value
				}
			}
		i=j;
		}		
	} 
f.selectedIndex=x
}
function jsAddToListTo(f,t) {
for (i=0;i<f.options.length;i++) {
	if (f.options(i).selected) { 
		x=f.options[i].text
		v=f.options[i].value
		var oOption = document.createElement("OPTION");
		t.options.add(oOption);
		oOption.innerText = x
		oOption.value = v
		}
	} 
return
if (f.selectedIndex<0) { return }
}
function jsDelFromListTo(f) {
for (i=f.options.length-1;i>-1;i--) {
	if (f.options(i).selected) { 
		x=f.options.remove(i)
		}
	} 
return
if (f.selectedIndex<0) { return }
x=f.options.remove([f.selectedIndex])
}
function CleanChrs(s) {
x=""
for (i=0;i<s.length;i++) {
	y=s.charCodeAt(i)
	if ((y==47) || (y==40) || (y==41) || (y==32) || (y==37) || (y==38) || (y==31) || (y==44) || (y==39) || (y==31)) {}
	else { x=x + s.charAt(i) } 
	}
return x;
}
function findFrame(jFrame) {
if (jFrame=="_self") { return "window" }
p="";
if ((jBrowserType=="NS") || (jBrowserType=="ESCAPE")) {
	for (ffj=0;ffj<6;ffj++) {
		rv=eval("var frm=window." + p + "frames")
		for (ffj=0;ffj<frm.length;ffj++) {
			if (frm[ffj].name.toUpperCase()==jFrame.toUpperCase()) {
				return p + jFrame
				}
			}
		p="parent." + p;
		}
	return;
	}
else {
	p="";
	for (j=0;j<6;j++) {
		v="window." + p + "document.frames"
		var frm=eval(v)
		rv=eval(v + "[jFrame]")
		if (typeof(rv)!="undefined") { 
			return p + jFrame 
			}
		p="parent." + p;
		}
	p="";
	p="parent.fraView.document.frames"
	if (!parent.fraView) { return "" }
	if (parent.fraView.document.frames[jFrame]) { return "parent.fraView.document.frames['" + jFrame + "']" } 
	p="parent.fraView.frames['fControlFrames'].document.frames"
	if (!parent.fraView.frames['fControlFrames']) { return "" }
	if (parent.fraView.document.frames['fControlFrames'].document.frames[jFrame]) { return "parent.fraView.document.frames['fControlFrames'].document.frames['" + jFrame + "']" } else { return "" };
	return;
	for (i=0;i<10;i++) {
		for (j=0;j<10;j++) {
			rv=eval(v + "[jFrame]")
			if (typeof(rv)!="undefined") { 
			alert("##" + v)
				return v + "['" + jFrame + "']"
				}
			}
		v=p + "[" + i + "].frames";
		}
	return "";
	}
}
function getDate() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
return (month + "/" + day + "/" + year)
}
function ShowTime() {
d = new Date();
t = d.toLocaleString();
p1 = t.lastIndexOf(" ");
p2 = t.lastIndexOf(":");
p3 = t.lastIndexOf(":",p2-1);
p4 = t.lastIndexOf(" ",p3-1);
AMPM = t.substr(p1+1);
vSeconds = t.substr(p2+1,p1-p2-1);
vMinutes = t.substr(p3+1,p2-p3-1);
vHours = t.substr(p4+1,p3-p4-1);
vHours = Math.round(vHours)
if ((AMPM != "AM") && (AMPM != "PM")) {
	x = t.substr(p1+1);
	p = x.indexOf(":");
	z = x.substr(p+1)
	x = x.substr(0,p);
	vSeconds = t.substr(p2+1,t.length-p2);
	var y = new Number(vHours);
	if (y>12) {
		AMPM = "PM";
		y = y-12;
		t = y.toString() + ":" + z;
		}
	else {
		t = AMPM;
		AMPM = "AM";
		}
	}
else {
	t = t.substr(0,p1);
	p1 = t.lastIndexOf(" ");
	t = t.substr(p1+1);
	}
if (vHours>12) { vHours=vHours-12 }
tdTime.style.fontSize="xx-small"
tdTime.style.fontFamily="Arial"
tdTime.style.color="black"
tdTime.innerText = vHours + ":" + vMinutes + ":" + vSeconds + " " + AMPM;
}
function jsNotToExceed(t,x) {
v=new Number(t.value)
if (v>x) { alert("Sorry, value of " + t.name + " cannot exceed " + x); event.returnValue=false; t.select(); }
}
function jsMinMax(t,vMin,vMax) {
v=new Number(t.value)
if ((v<vMin) || (v>vMax)) { alert("Sorry, value of " + t.name + " must be between " + vMin + " and " + vMax + "."); event.returnValue=false; t.select(); }
}
function jsMakeAbbr(t,fAbbr) {
vValue=t.value;
vValue=CleanChrs(vValue);
vValue=vValue.toUpperCase();
vValue=vValue.substr(0,10);
if (fAbbr.value=="") { fAbbr.value=vValue; }
}
function jsGetNameValue(vParam,vLookFor) {
var p1=0
var p2=0
var l=0
var p3=0
p1=vParam.indexOf(vLookFor)
l=vLookFor.length
if (p1>-1) { p2=vParam.indexOf(";",p1+l+1); }
if ((p1>-1) && (p2==-1)) { p2=vParam.indexOf("^",p1+l+1); }
if ((p1>-1) && (p2==-1)) { p2=vParam.length+1 }
if (p2>-1) { 
	p3=p2-(p1+l+1)
	v=vParam.substr(p1+l+1,p3) 
	} 
else 
	{
	v="" 
	}
return v	
}
function jsSaveAndAdd(t,vPageToCall,jMsg) {
document.thisForm.hdnNextOp.value="ADD"
document.thisForm.hdnNextMode.value="ADD"
if (t) { rv=jsSaveRec(t,vPageToCall,jMsg) } 
}
function jsDeleteRecord(t,vPageToCall,jMsg) {
if (confirm("Please confirm deleting this record.")) {
	document.thisForm.hdnSaveThis.value=""
	document.thisForm.hdnNextMode.value=""
	document.thisForm.hdnNextOp.value="DEL"
	document.thisForm.submit()
	}
}
function jsToggleBtn(jBtn,jColor) {
v=jBtn.src
if (!v) { return }
p=v.indexOf("_BC_")
if (p>0) {
	p2=v.indexOf("_",p+4)
	x = v.substr(p+4,p2-p-4);
	x=jColor
	v=v.substr(0,p+4) + x + v.substr(p2);
	jBtn.src=v
	}
}
function ChgMode(lMode,nMode,cID) {
if (parent.fParent) { 
	parent.fParent.thisForm.hdnLastMode.value = lMode;
	parent.fParent.thisForm.hdnCurMode.value = nMode;
	}
}
function CallIt(jType,jMode,jID,jFS) {
if (parent.fParent) { 
	parent.fParent.thisForm.hdnCurID.value=jID
	parent.fParent.thisForm.hdnCurMode.value=jMode
	parent.fParent.thisForm.hdnFieldSet.value=jFS
	parent.fParent.thisForm.submit();
	}
}
function getCookies() {
var dWrite, dUID, dDONE
dWrite = "";
if ((document.cookie != "")) {
	vUID = "";
	cookieArray = document.cookie.split(";");
	for (i=0;i<cookieArray.length;i++) {
		vCookieName = cookieArray[i].split("=")[0];
		if (vCookieName.indexOf("UserID")>-1) {
			vUID = cookieArray[i].split("=")[1];
			dUID = vUID;
			dDONE = "Yes";
			}
		if (vCookieName.indexOf("UserName")>-1) {
			vUNM = cookieArray[i].split("=")[1];
			dWrite = "<font face=arial size=1>Welcome back, " + vUNM + ".  If you're not " + vUNM + " then click <a target=fParent href=AppLogin.asp?T=FORCE>here</a></font>.  Click <a href=SysEdit.asp?P=Members&ID=" + vUID + " target=fParent>here</a> to edit your Member record";
			}
		}
	parent.fParent.location = "Home.asp?UID=" + vUID
	}
}
function ToggleBtns(t) {
for (imgs in document.images) {
	if ((imgs!="length") && (document.all(imgs))) { 
		v=document.all(imgs).src; 
		p=v.indexOf("_BC_");
		if (p>0) {
			p2=v.indexOf("_",p+4);
			v=v.substr(0,p+4) + jBtnMainColor + v.substr(p2);
			document.all(imgs).src=v;
			}
		}
	}
v=t.src; 
p=v.indexOf("_BC_");
if (p>0) {
	p2=v.indexOf("_",p+4);
	v=v.substr(0,p+4) + jBtnSelectedColor + v.substr(p2);
	t.src=v;
	}
}
function windowUnload() {
if (window.opener) {
//	window.opener.location.reload();
	}
}
function btnAddAnother_onclick(N,jCurID) {
if (parent.fParent) { 
	parent.fParent.thisForm.hdnCurID.value=jCurID
	}
if (btnSave_onclick(true)) {
	if (parent.fParent) { 
		ChgMode(parent.fParent.thisForm.hdnCurMode.value,"FORCEADD",0);
		parent.fParent.thisForm.hdnCurID.value=jCurID
		}
	btnSave_onclick(true);
	}
}
function btnSaveAndEdit_onclick(N,jCurID) {
if (parent.fParent) { 
	parent.fParent.thisForm.hdnCurID.value=jCurID
	}
if (btnSave_onclick(true)) {
	if (parent.fParent) { 
		ChgMode(parent.fParent.thisForm.hdnCurMode.value,"FORCEEDIT",0);
		parent.fParent.thisForm.hdnCurID.value=jCurID
		}
	btnSave_onclick(true);
	}
}
function chkSystemType(N,c) {
if (N.checked) {
	SaveAndCall(c,N); 
	}
else {
	rv = confirm("You are deselecting " + N.name + ".  Should I delete all associated records?")
	if (rv) {
		SaveAndCall("SysEdit.asp?MD=FORCEDEL&T=" + N.name,N); 
		}
	}
}
function isPhone(vField) {
v = vField.value;
n = ''
for (i=0;i<v.length;i++) {
	if ((v.charCodeAt(i)!=32) && (v.charCodeAt(i)>47) && (v.charCodeAt(i)<58)) {
		n = n + v.charAt(i);
		}
	}
if ((n.length != 7) && (n.length != 10)) { 
	return "Phone numbers should be 7 or 10 digits long"
	}
if (n.length==7) {
	n = n.substr(0,3) + '-' + n.substr(3,4);
	vField.value=n;
	}
else { 
	if (n.length==10) {
		n = '(' + n.substr(0,3) + ')' + n.substr(3,3) + '-' + n.substr(6,4);
		vField.value=n;
		}
	}
return "";
}
function isZip(vField) {
v = vField.value;
for (iz=0;iz<v.length;iz++) {
	if ((v.charCodeAt(iz) != 45) && ((v.charCodeAt(iz)<48) || (v.charCodeAt(iz)>57))) {
		return ' (not a number)'
		}
	}
if (v.length<5) {
	return ' (length is less than 5)'
	}
if (v.length>5) {
	if (v.indexOf("-")==-1) { 
		v=v.substr(0,5) + "-" + v.substr(5) 
		vField.value=v;
		}
	if (v.length != 10) {
		return ' (length is less than 10)'
		}
	if (v.indexOf('-') != 5) {
		return ' (no dash)'
		}
	}
return "";
}	
function isURL(vField) {
v=vField.value
u = v.toUpperCase();
if (u.substr(0,5) != 'HTTP:') {
	vField.value = 'http://' + vField.value;
	}
ct = 0;
for (i=0;i<v.length;i++) {
	if (v.charAt(i) == '.') {
		ct = ct + 1;
		}
	}
if (ct<2) {
	return " (missing periods) ";
	}
return "";
}
function OKtoValidate(vField) {
if (vField) {
	t = vField.type;
	v = vField.value;
	if (v != '') {
		if ((t != 'checkbox') && (t != 'button') && (v.length>0)) {
			return true;
			}
		}
	}
return false;
}
function MakeNumber(vField) {
v = vField.value;
p = v.indexOf('.');
if (p>0) {
	vdollars = v.substr(0,p);
	vcents = v.substr(p+1);
	}
else { 
	vdollars = v;
	vcents = '';
	}
n1 = '';
n2 = '';
for (i=0;i<vdollars.length;i++) {
	if ((vdollars.charCodeAt(i)>47) && (vdollars.charCodeAt(i)<58)) {
		n1 = n1 + vdollars.charAt(i);
		}	
	}
	for (i=0;i<vcents.length;i++) {
		if ((vcents.charCodeAt(i)>47) && (vcents.charCodeAt(i)<58)) {
			n2 = n2 + vcents.charAt(i);
			}
		}
v = n1;
if (n2 != '') { v = n1 + '.' + n2 }
return v;
}
function MakeCurrency(vField) {
v = vField.value;
p = v.indexOf('.');
if (p>0) {
	vdollars = v.substr(0,p);
	vcents = v.substr(p+1);
	}
else { 
	vdollars = v;
	vcents = '';
	}
n1 = '';
n2 = '';
for (i=0;i<vdollars.length;i++) {
	if ((vdollars.charCodeAt(i)>47) && (vdollars.charCodeAt(i)<58)) {
		n1 = n1 + vdollars.charAt(i);
		}	
	}
	for (i=0;i<vcents.length;i++) {
		if ((vcents.charCodeAt(i)>47) && (vcents.charCodeAt(i)<58)) {
			n2 = n2 + vcents.charAt(i);
			}
		}
v = n1;
if (n2 == '') { n2 = '00'; }
if (n2.length == 1) { n2 = n2 + '0'; }
n2 = n2.substr(0,2);
if (n2 != '') { v = n1 + '.' + n2 }
return v;
}
function btnCheckFileType(f,t) {
if (t.value == "") {
	alert("Please select a file to upload by pressing the Browse button.");
	t.select;
	return;
	}
v = t.value;
p = v.lastIndexOf(".");
if (p == 0) {
	alert("Sorry, I cannot determine the file type without an extension.  Try again.");
	t.select;
	return;
	}
x=""
z=""	
if (1==0) {
	p=v.lastIndexOf("/")
	if (p==-1) {
		s=String.fromCharCode(92)
		p=v.lastIndexOf(s)
		}
	if (p>-1) {
		n=v.substr(p+1)
		for (i=0;i<n.length;i++) {
			x=n.substr(i,1)
			if (x==" ") { x="_" }
			z=z + x
			}
		v=v.substr(0,p+1) + z
		}
	t.value=v
	}
p = v.lastIndexOf(".");
x=v.substr(p+1)
x=x.toUpperCase()
if ((x != "ZIP") && (x != "MDB") && (x != "DOC") && (x != "GIF") && (x != "JPG") && (x != "BMP") && (x != "TXT") && (x != "RTF")) {
	alert("Sorry, I can only upload files with an extension of .zip, .mdb, .txt, .doc, .rtf, .gif, .jpg, or .bmp.  Try again.");
	document.forms[f].txtUploadFile.select();
	return;
	}
document.forms[f].submit();	
}
function isEmail(v) {
n=v.value
if (n.indexOf('.')==-1) { return " (missing period)" }
if (n.indexOf('@')==-1) { return " (missing @)" }
return "";
}
function isNumber(v) {
for (iN=0;iN<v.length;iN++) {
	x=v.charCodeAt(iN)
	if ( (x!=44) && (x!=46) && ( (x<48) || (x>57) ) ) {
		return "Non-numeric character.";
		}
	}
return "";
}
function isCurrency(v) {
for (iN=0;iN<v.length;iN++) {
	x=v.charCodeAt(iN)
	if ( (x!=36) && (x!=44) && (x!=46) && ( (x<48) || (x>57) ) ) {
		return "Non-currency character.";
		}
	}
return "";
}
function isChar(v) {
for (iN=0;iN<v.length;iN++) {
	if ((v.charCodeAt(iN)<65) || (v.charCodeAt(iN)>90)) {
		if ((v.charCodeAt(iN)<97) || (v.charCodeAt(iN)>122)) {
			return 0;
			}
		}
	}
return 1;
}
function couldBeDate(v) {
if (v.length>10) {
	return "Too Long";
	}
nn=""
for (iN=0;iN<v.length;iN++) {
	if ((v.charCodeAt(iN)<48) || (v.charCodeAt(iN)>57)) {
		if ((v.charCodeAt(iN) != 32) && (v.charCodeAt(iN) != 47) && (v.charCodeAt(iN) != 92) && (v.charCodeAt(iN) != 46) && (v.charCodeAt(iN) != 45)) { 		//back/forward slash, period, dash
			return "Illegal Characters (" + v.charCodeAt(iN) + ")";
			}
		else
			nn = nn + "/";
		}
	else	{
		nn = nn + v.charAt(iN);
		}
	}
p = nn.indexOf("/");
m = nn.substr(0,p);
if ((m<1) || (m>12)) { return "Bad Month"; }
y = nn.substr(nn.lastIndexOf("/")+1)
if (y.length==3) { return "Bad Year"; }
var ny = new Number(y)
if (y.length<3) {
	if ((ny>50) && (ny<100) && (y.length=2)) { y = "19" + y }
	if ((ny<50) && (ny<100) && (y.length=2)) { y = "20" + y }
	}
var ny = new Number(y)
if (y.length=4) {
	if ((ny<1900) || (ny>2100)) { return "Bad Year"; }
	}
d = nn.substr(nn.indexOf("/")+1,nn.lastIndexOf("/")-nn.indexOf("/")-1);
var ny = new Number(d)
if ((ny>31) || (ny<1)) { return "Day out of range"; }
if (d == "31") { if ((m != 1) && (m != 3) && (m != 5) && (m != 7) && (m != 8) && (m != 10) && (m != 12)) { return "Day out of range"; } else { return ""; }	}
if (d == "30") { if (m==2) { return "Day out of range"; }	}
if (d == "29") { if ((m == 2)) { return "Day out of range"; }	}
return "";
}
function cp(N,A) { 
N.src="images/" + N.name + A + ".gif"; 
}
function chgPix(img,a) {
s = img.src;
x = s.lastIndexOf(".")-1;
y = s.lastIndexOf("/")+1;
z = s.substr(y,x-y);
if (document.images) {
	for (imgi = 0; imgi < iCt; imgi++) {
		if (pix[imgi][3] == z) { img.src = pix[imgi][a].src }
		}
	}
}
function btnGetTitle_onclick(){
if (parent.fParent) { 
	vURL = parent.fParent.thisForm.URL.value;
	}
if (vURL == "") { return 0 }
if (vURL.substr(0,5) != "http:") { vURL = "http://" + vURL }
parent.botFrame.location.href = "_blank.htm";
parent.botFrame.location.href = "gMbrGetURLInfo.asp?U=" + vURL;
}
var pix;
pix = new Array();
function preload(name) {
if (document.images) {
	pix[iCt] = new Array(4);
	pix[iCt][0] = new Image();
	pix[iCt][0].src = "images/" + name + ".gif";
	pix[iCt][1] = new Image();
	pix[iCt][1].src = "images/" + name + "_over.gif";
	pix[iCt][2] = new Image();
	pix[iCt][2].src = "images/" + name + "_down.gif";
	pix[iCt][3] = name;
	iCt++;
	}
}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImagesArray(array) {
	if (preloadFlag == true) {
		var d = document; var img;
		for (var i=0; i<array.length; i+=2) {
			img = null; var n = array[i];
			if (d.images) {img = d.images[n];}
			if (!img && d.getElementById) {img = d.getElementById(n);}
			if (img) {img.src = array[i+1];}
		}
	}
}
function changeImages() {
	changeImagesArray(changeImages.arguments);
}
function SaveAndCall(p,jCurID) {
if (parent.fParent) { 
	parent.fParent.thisForm.hdnLastMode.value=parent.fParent.thisForm.hdnCurMode.value;
	parent.fParent.thisForm.hdnNextMode.value="";
	parent.fParent.thisForm.hdnGotoPage.value=p;
	}
btnSave_onclick(true);
}
function retrieveURL(url,nameOfFormToPost) {
url=url+getFormAsString(nameOfFormToPost);
if (window.XMLHttpRequest) { 
	// Non-IE browsers
	req = new XMLHttpRequest();
	req.onreadystatechange = processStateChange;
	try { req.open("GET", url, true); } catch (e) { alert("Server Communication Problem\n"+e); }
	req.send(null);
	} 
else if (window.ActiveXObject) {
	req = new ActiveXObject("Microsoft.XMLHTTP");
	if (req) {
		req.onreadystatechange=processStateChange;
		req.open("GET", url, true);
		req.send();
		}
	}
}
function getFormAsString(formName){
returnString ="";
formElements=document.forms[formName].elements;
//loop through the array, building up the url in the format '/strutsaction.do&name=value'
for (var i=formElements.length-1;i>=0; --i ) {
	//we escape (encode) each value
	returnString+="&" +escape(formElements[i].name)+"=" +escape(formElements[i].value);
	}
return returnString; 
}
function processStateChange() {
if (req.readyState == 4) { // Complete
	if (req.status == 200) { // OK response
		//Split the text response into Span elements
		spanElements = 
		splitTextIntoSpan(req.responseText);
		//Use these span elements to update the page
		replaceExistingWithNewHtml(spanElements);
		} 
	else {
		alert("Problem with server response:\n " + req.statusText);
		}
	}
}
function replaceExistingWithNewHtml(newTextElements) {
//loop through newTextElements
for(var i=newTextElements.length-1;i>=0;--i) {
	//check that this begins with <span
	if(newTextElements[i].indexOf("<span")>-1) {
		//get the span name - sits between the 1st and 2nd quote mark
		//Make sure your spans are in the format <span id="someName">NewContent</span>
		startNamePos=newTextElements[i].indexOf('"')+1;
		endNamePos=newTextElements[i].indexOf('"',startNamePos);
		name=newTextElements[i].substring(startNamePos,endNamePos);
		//get the content - everything after the first > mark
		startContentPos=newTextElements[i].indexOf('>')+1; 
		content=newTextElements[i].substring(startContentPos);
		//Now update the existing Document with this element, checking that this element exists in the document
		if(document.getElementById(name)) {
			document.getElementById(name).innerHTML = content;
			}
		}
	}
}
function splitTextIntoSpan(textToSplit){
returnElements=textToSplit.split("</span>")
for (var i=returnElements.length-1;i>=0;--i) {
	//Remove everything before the 1st span
	spanPos = returnElements[i].indexOf("<span");               
	//if we find a match, take out everything before the span
	if (spanPos>0) {
		subString=returnElements[i].substring(spanPos);
		returnElements[i]=subString;
		}
	}
return returnElements;
}
//function LTrimAll(str) {
//	if (str==null){return str;}
//	for (var i=0; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i++);
//	return str.substring(i,str.length);
//	}
//function RTrimAll(str) {
//	if (str==null){return str;}
//	for (var i=str.length-1; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i--);
//	return str.substring(0,i+1);
//	}
//function TrimAll(str) {
//	return LTrimAll(RTrimAll(str));
//	}

