var LTm= new Array();var prtN = [false,false]var Ldc;var LPa;var flst = "PSurname/PFirstName/NFirstName/NMiddleNames/NSurName/NBornDte/NBornAt/nDiedDte/NDiedAt/NCEMAil/NCPhone/NTown/NCountry/nPathS/NOccupation/NTDec".split("/")var idt;function doApiAtt(f,v){	v = v.replace(/\\/g,"<b>/</b>")	var ttmp = eval ("idt." + f + " = '" + v +"';") }var blist = [];function doApiComp(){		var sum=""		var sd="";		for (i = 0 ; i<blist.length ; i++)blist[i].style.display="block"		if(document.getElementById("OSDec" ) != null) {			blist[0].value="Type another firstname or use the links to navigate ...... "			blist[0].style.color ="#F96611"							if(LDc.length >0) {				var tp = ""				var sd = ""				for (var j=0;j<LDc.length;j++)  {					var jw =  ( j==0 || tp  !=  LDc[j].NJw ) ? "(Partnering " + LDc[j].NJw + ") " : "" 					tp = LDc[j].NJw					sd +=   (j==0? "" :(j == (LDc.length-1) ? " and " : ", ") ) + jw +  "<a href=# onClick='doApiGet(\"" +LDc[j].Id+  "\")'  >" + LDc[j].Nm+ " (b:"  +   LDc[j].Yr + ")" 	+"</a>"								}				document.getElementById("OSDec" ).innerHTML = sd					document.getElementById("OSDec" ).style.backgroundImage = ""			}else			document.getElementById("OSDec" ).innerHTML	= "No recorded descendants"				}else			document.title = "Descendants of " +   idt.NFirstName + idt.NSurName		document.getElementById("OSDecOf" ).innerHTML  = LPa[0].Id == "" ?		LPa[0].DNm + "  " + LPa[0].DSur + " (b:"  +LPa[0].DYr  + ")"  :		 "<a href=# onClick='doApiGet(\"" +LPa[0].Id +  "\")'  >" + LPa[0].DNm + "  " + LPa[0].DSur + " (b:"  +LPa[0].DYr  + ")" 	+"</a>"						document.getElementById("SHP" ).innerHTML  = idt.NFirstName + " " +idt.NMiddleNames + " " + idt.NSurName		sum += "<tr><td valign=top width=40px ><u>Born:</u></td><td >" + idt.NBornDte    + "  " + idt.NBornAt + "</td></tr>"			if(idt.NTDec == "D")			sum += "<tr><td class=TCJ><u>Died:</u></td><td>" + idt.nDiedDte+ "  "  +  ( idt.NDiedAt == "" ? "":  "<br>Commemorated at:" +idt.NDiedAt )   +"</td></tr>"			else if(idt.NTown != "")			sum += "<tr><td><u>Living in:</u></td><td>" + idt.NTown   + " " + idt.NCountry  +"</td></tr>"			if(idt.NOccupation!= "")			sum += "<tr><td><u>Occupation:</u></td><td>" + idt.NOccupation   +"</td></tr>"			if(idt.PFirstName != "")			sum += "<tr><td><u>Partner:</u></td><td>" + idt.PFirstName + " " +  idt.PSurname  +"</td></tr>"			document.getElementById("SHB" ).innerHTML  ="<table width=100% align=left border=0 class=TCJ>" +sum + "</table>"		document.getElementById("SHF" ).innerHTML  =idt.nPathS		return 	( idt.NFirstName + " " +idt.NMiddleNames + " " + idt.NSurName)		}function doApiGet(id){		LTm[0].selid = id		var lst = "";		for (var k=0; k<flst.length;k++)	lst += "&" + flst[k]		getRecords(id,lst + "&CHILDREN&PHOTO&PARENTS")	}function loadTreeApi(ob,idf){	var smp = (idf == undefined) ? true : false	var Tty=["7"]	var lst = ""	for (var k=0; k<flst.length;k++)lst += "this." + flst[k] + "=''; "	idt = eval("new function() { " + lst + " }")	if(smp)		var tbod = newTable(ob,"Find a Sharrock Descendant", "90,180,180".split(","),10,MainSel)	else		var tbod = newTable(ob,"The Sharrock Family in Australia", "95,520,180".split(","),10,MainSel)	function MainSel(trgo,i){		switch (i){					case 1:				if(smp) {									var ob = trgo.appendChild(nDOMObj(null,"TD","","","","","TCG","","Descendant "));							var ob = trgo.appendChild(nDOMObj(null,"TD","","","","","TCI","",""));							ob.colSpan = 2;					var ob1 = ob.appendChild(nDOMObj(null,"Input","","TRDescription","","FName","input","",""));						ob1.style.width = 272;					ob1.style.height=18;					ob1.value="Start by typing the firstname of a descendant ...... "					ob1.style.color ="#F96611"							blist.push(ob1)					newEvent(ob1,"onfocus","if(this.value.indexOf('...') > 5) {this.value='';this.style.color = '#000000'} else {this.style.color = '#000000';	renderList(this.value,0)}")									newEvent(ob1,"onkeydown",'return(doKeydown(event,this,0))')					newEvent(ob1,"onkeyup",'lookUp(this.value,0); return true')					var ob1 = ob.appendChild(nDOMObj(null,"div","","","","BR","","",""));						var ob1 = ob.appendChild(nDOMObj(null,"div","","","","SH","","",""));									}else{					var ob = trgo.appendChild(nDOMObj(null,"TD","","","","","TCI",""," "));						ob.colSpan = 3;				}					break;							case 2:				if(!smp)  return false				var ob = trgo.appendChild(nDOMObj(null,"TD","","","","SHL","TCI","",""));						ob.colSpan = 3;				break;							case 3:				var ob = trgo.appendChild(nDOMObj(null,"TD","","","","SHP","TCG","",""));						ob.colSpan = 2;				ob.align = "center" 				ob.style.fontSize = smp ? "15px" : "28px"				var ob = trgo.appendChild(nDOMObj(null,"TD","","","","OSPhoto","TCI","","&nbsp;"));				if(!smp)ob.style.height = "240px"				ob.rowSpan = smp ? 5 : 4;						break;												case 4:						var ob = trgo.appendChild(nDOMObj(null,"TD","","","","SHB","TCG","",""));					ob.colSpan = 2				ob.style.height = "90px"					break;							case 5:							var ob = trgo.appendChild(nDOMObj(null,"TD","","","","","TCG","",""));					var ob = ob.appendChild(nDOMObj(null,"span","","","","","","","Descending from"));						ob.style.display = "none"				blist.push(ob)					var ob = trgo.appendChild(nDOMObj(null,"TD","","","","OSDecOf","TCI","",""));					ob.style.textAlign = "left"				ob.style.height = "20px"				break;							case 6:				if(!smp)  return false				var ob = trgo.appendChild(nDOMObj(null,"TD","","","","","TCG","",""));					ob.colSpan = 2					var ob = ob.appendChild(nDOMObj(null,"span","","","","","","","Descendants:"));						ob.style.display = "none"				blist.push(ob)				break;			case 7:				if(!smp)  return false				var ob = trgo.appendChild(nDOMObj(null,"TD","","","","OSDec","TCI","","<font color=red><be>Give it a go - just start typing your name&nbsp;</b></font>"));					ob.style.textAlign = "left"				ob.style.paddingLeft = "15px"					ob.style.height = "150px"					ob.style.backgroundImage ="url('/"+ APIdbname +"/OSFelix.gif ')"					ob.style.backgroundRepeat ="no-repeat"					ob.style.backgroundPosition ="top center"				ob.colSpan = 2				break;							case 8:						var ob = trgo.appendChild(nDOMObj(null,"TD","","","","","TCG","",""));						var ob = ob.appendChild(nDOMObj(null,"span","","","","","","","Linage:"));						ob.style.display = "none"				blist.push(ob)					var ob = trgo.appendChild(nDOMObj(null,"TD","","","","SHF","TCI","",""));						ob.style.textAlign = "left"				ob.colSpan = smp ? 2 : 1		//		var ob1 = ob.appendChild(nDOMObj(null,"div","","","","SHD","","","da"));									 	break;			 				case 9:						if(!smp)  return false				var ob = trgo.appendChild(nDOMObj(null,"TD","","","","","TCI","",""));				ob.style.textAlign = "right"				ob.colSpan = 3						var ob = ob.appendChild(nDOMObj(null,"span","","","","","","","<a href=# onClick='printTree()' >Click to Print/View all their descendants</a>"));										ob.style.display = "none"				blist.push(ob)///newEvent(ob,"onclick",'printTree()')								break;							case 10:							if(!smp)  return false			break;		}			return true	}		if(idf != undefined ) {doApiGet(idf);}}function printTree(){	WI = window.open("/" + APIdbname + "/test?OpenPage&OSID="+ LTm[0].selid + "",'DlgView');}var  prtAtts = ["PFirstName","PMiddleNames","PSurname","PBornDte","PBornAt","PDiedDte","PDiedAt"]function renderList(sty,fi){	if(LTm[fi].Pending == "Pending") return	if(!LTm[fi].Dirty ){		if (LTm[fi].iNum <0 ||  LTm[fi].LItem[LTm[fi].iNum].nme	!= sty) LTm[fi].selid =""		return 	}	var displayBelowThisObject = document.getElementById("" + LTm[fi].loc +"" )	if(sty == "") {		displayBelowThisObject.innerHTML=""		return	}	var x = displayBelowThisObject.offsetLeft;	var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight;	var parent = displayBelowThisObject	while (parent.offsetParent) {		parent = parent.offsetParent;	    	x += parent.offsetLeft;	    	y += parent.offsetTop;  	}	displayBelowThisObject.style.position = "absolute";	var sst=""	LTm[fi].ntms = 0;	LTm[fi].ftms = 0;		selHeight=0//	alert(sty +  "-" +   LTm[fi].LItem.length )	if(sty.length > 1){		for (var i=0 ; i< LTm[fi].LItem.length ; i++){			if(LTm[fi].LItem[i].nme.substr(0,sty.length).toUpperCase() ==sty.toUpperCase()){  //.toUpperCase() != sty.toUpperCase())				var ex = ( LTm[fi].LItem[i].dup)  ?  '<div style="height:12;font-size:10px;text-align:right;"><u>Partnering ' + LTm[fi].LItem[i].prt + "</u></div>":""				sst += "<tr><td width=210px colspan=2 id=SH" + LTm[fi].ntms + " style='padding: 1 1 1 1;color:black;font-size:11px;background-color:#FFFFFF;height:14;' onClick='sClick("+ i +","+ fi + ")'  onMouseOver='sOver (" + LTm[fi].ntms  +","+ fi + ")' onMouseOut='sOut(" +LTm[fi].ntms+","+ fi +  ")'> " + LTm[fi].LItem[i].nme +ex +  "</td>\n"				sst += "<td width=60px id=SI" + LTm[fi].ntms + " style='valign:top;padding: 1 1 1 1;color:black;font-size:11px;background-color:#FFFFFF;height:15;' onClick='sClick("+ i +","+ fi + ")'  onMouseOver='sOver(" + LTm[fi].ntms   +","+ fi + ")' onMouseOut='sOut(" + LTm[fi].ntms+","+ fi +  ")'>" + LTm[fi].LItem[i].year + (LTm[fi].LItem[i].yeard==""?"":"-") +  LTm[fi].LItem[i].yeard + "</td></tr>\n"				LTm[fi].ntms++;					selHeight +=   LTm[fi].LItem[i].dup ?2:1  			}   else				if(LTm[fi].ntms == 0)LTm[fi].ftms++;			}	}	if(LTm[fi].ntms>0){		displayBelowThisObject.innerHTML="<div style='width:270px;height:" + (selHeight >10 ? 160 : (selHeight  *16)+5) + ";overflow:auto;border: 1px solid #BDCDDD;'>" +       	"<table cellpadding=0 border=0 cellspacing=0 align=center >" + sst + "</table></div>"		      	document.getElementById("" + LTm[fi].loc1 +"" ).innerHTML= ""		LTm[fi].Sel = 0;		sSel(0,fi);		 }else{	 	if(sty.length > 1 ) document.getElementById("" + LTm[fi].loc1 +"" ).innerHTML="<Font color=red>There are NO people with a given name commencing with <u>'"  + sty + "'</u> recorded in the family tree."     	displayBelowThisObject.innerHTML=""		LTm[fi].sel = -1;  	}    }function doKeydown(e,ob,fi,man){	var Cde = e.keyCode	if(LTm[fi].Pending == "Pending") {		return false	}	if(Cde==9  ) {  // tab		sClick(LTm[fi].Sel   + LTm[fi].ftms,fi)		return true	}	if(Cde==13  ) {  // return		if(LTm[fi].Sel >= 0) {			sClick(LTm[fi].Sel + LTm[fi].ftms,fi)			document.forms[0].elements[ob.tabIndex +1].focus()			return true		}		return false	}		switch(Cde) {		case 8:  //bs		case 46:   //del			LTm[fi].Current  = ob.value			if( ! LTm[fi].Dirty  ){				LTm[fi].Dirty = true				ob.value = ob.value.substr(0,3)			}					return true		case 40: //down			LTm[fi].Current  = ob.value				sSel(+1,fi)			return true				case 38: //upo			LTm[fi].Current  = ob.value			sSel(-1,fi)			return true	}	//LTm[fi].core  &&		if( ( man == false || (LTm[fi].core && man == undefined)) &&  ob.value.length > 2  && LTm[fi].ntms == 0) 	{		document.getElementById("beep").src="/" + APIdbname + "/OSError.wav"		return false	}	if((Cde >=48 && Cde <= 63 ) ||  Cde >  90) 	return false	if(Cde == 32 || (Cde >=64 && Cde <= 90)){		if( ! LTm[fi].Dirty    ){			LTm[fi].Dirty = true			ob.value = ""		}	}	LTm[fi].Current  = ob.value	return true}function lookUp(sty,fi) {	if(LTm[fi].Current.toUpperCase() == sty.toUpperCase()) return	if(sty.length <3) LTm[fi].Dirty =true	if(!LTm[fi].Dirty) return	window.status = sty	if(sty.length < 2){		renderList(sty,fi)		return	}	if(LTm[fi].Pending  ==  sty.substr(0,2).toUpperCase()){		renderList(sty,fi)		return	}	if(sty.length> 2){		renderList(sty,fi)		 return	}//	window.status = LTm[fi].LItem.length + "-" sty +"-"+  LTm[fi].Current.toUpperCase()	var url = "/" + APIdbname+ "/(WEBLookUp)?OpenAgent&" + sty	url += "&" + Tty[0] + "&" + fi +  "&" + Math.floor(Math.random()*1111)	LTm[fi].Pending = "Pending"	LTm[fi].LItem= new Array();	document.getElementById("" + LTm[fi].loc1 +"" ).innerHTML= "<Font color=red>Fetching firstnames starting with (" + sty +  ")  <B><U>PLEASE WAIT   ........</u></B></FONT>" 	if (window.XMLHttpRequest) {		req = new XMLHttpRequest();		req.onreadystatechange = processReqChange		req.open("GET",  url, true);		req.send(null);	} else if (window.ActiveXObject) {		req = new ActiveXObject("Microsoft.XMLHTTP");		if (req) {			req.onreadystatechange = processReqChange			req.open("GET", url, true);			req.send();		}else 			return false	}			function processReqChange() {		var fi = -1		if (req.readyState == 4) {			if (req.status == 200) {							var sst=""; //alert(req.responseText)   	//			alert(req.responseXML.getElementsByTagName('ERROR'))				var x = req.responseXML.getElementsByTagName('Persons')[0].firstChild				var i = 0  				while (x !=  null){  									if (window.XMLHttpRequest) {	 					if(x.nodeName == "LookFor" )							var lu = getInnerText(x) 						else if(x.nodeName == "ResponseTo"){							fi = parseInt(getInnerText(x) , "10")						}else if ( x.nodeType == 1)  {//							if (i == 0 ) alert(	"nodeValue " + 	x.nodeValue +"\ndate " + 	x.nodedataValue + "\ntextContent  " + 	x.textContent  + "\ninnerText  " + 	x.innerText   )										var al= getInnerText(x).split("|")							if(fi >= 0 ) LTm[fi].LItem[i++] =  new NBItem(al[0],al[1],al[2],al[3],al[4],i>	1 ? LTm[fi].LItem[i-2] : null)						}	   				}else	{	   							   					if(x.nodeName == "LookFor" )							var lu = getInnerText(x) 						else if(x.nodeName == "ResponseTo") fi = parseInt(x.firstChild.data,"10") 	   					else{							var al= x.firstChild.data.split("|")								if(fi >= 0 ) LTm[fi].LItem[i++] =  new NBItem(al[0],al[1],al[2],al[3],al[4],i>1 ? LTm[fi].LItem[i-2] : null)						}					}										x=x.nextSibling;   				}   				LTm[fi].Pending = lu   				LTm[fi].LItem.sort(compare)   				document.getElementById("" + LTm[fi].loc1 +"" ).innerHTML=  LTm[fi].LItem.length + " Item(s) found."				renderList(eval("document.forms[0]." + LTm[fi].fld) .value ,fi)			}else {//			alert("There was a problem retrieving the vehicle.\nContact DCA support.\n"+ url+ "\n" + req.statusText);					}				}else{//				alert("State " + req.readyState)		}	}	function compare(a, b){//	window.status = a.nme+ "-" + b.nme  		if (a.nme < b.nme )     		return -1;  	if (a.nme > b.nme )     		return 1;  		return 0;	}		function NBItem(nme,yr,prt,id,rel,pre)  {		var yrs= yr.split("-")		this.nme = nme		this.year = yrs[0];	this.yeard =   yrs[1] //LTm[0].LItem[0] //  yrs[1];  // id + " " + pre.id  //+ " " + ;			this.id = id;			var par= prt.split("~")		this.prt = par[0]; // parent name		if( par.length > 0 ) this.pgen = par[1] // parent gender  //		/var yrs= yr.split("-")		if(pre != null && pre.id == id) {			pre.dup=true			this.dup = true		}else			this.dup = false		this.rel = rel;			} 	return true}function sClick(i,fi){	var lst = "";	if(i<0) return		LTm[fi].selid = LTm[fi].LItem[i].id 	LTm[fi].iNum = i	eval("document.forms[0]." + LTm[fi].fld) .value = LTm[fi].LItem[i].nme;	try{document.forms[0].tmpRtP.value =  LTm[fi].LItem[i].rel  } // save the relationship to the node} 	catch(e){}		if(Tty[0]!="7")   // not the api			document.getElementById((LTm[fi].core ? "S" :"C" ) + 'HL').innerHTML="<Font color=red>You have selected " +  LTm[fi].LItem[i].nme  +  " b:"+ LTm[fi].LItem[i].year+ " ("  			+ (LTm[fi].LItem[i].rel == "P"  ?  "partner of "  :  (Tty[0] != "1" ? "decending from " : "with partner " ))   + LTm[fi].LItem[i].prt +") </font>"			if(LTm[fi].core){				if(Tty[0]!="7") document.getElementById('SHP').innerHTML=   LTm[fi].LItem[i].nme   + "  ("  			+ (LTm[fi].LItem[i].rel == "P"  ?  "partner of "  :  (Tty[0] != "1" ? "decendant of " : "with partner "))   + LTm[fi].LItem[i].prt +  ")" 							switch(Tty[0]) {			case  "1":				document.getElementById('pdetails').style.display="block"				if(Tty[2] == "D"){					document.getElementById('pdead').style.display="block"					document.getElementById('pliving').style.display="none"				}else if(Tty[2] == "L"){					document.getElementById('pdead').style.display="none"					document.getElementById('pliving').style.display="block"				}						document.getElementById("SHD" ).innerHTML	=""				getRecords(LTm[fi].LItem[i].id,"&CHILDREN")					document.getElementById('nsurname').innerHTML=   LTm[fi].LItem[i].rel				break;				case "2":				document.getElementById('pdetails').style.display= "block"				document.getElementById('pdead').style.display=LTm[fi].LItem[i].yeard  == "" ? "none": "block"		//		alert(LTm[fi].LItem[i].yeard )				document.getElementById('pliving').style.display="block"				getRecords(LTm[fi].LItem[i].id,"&PARENTS")					break;			case "3":			case "4":				document.getElementById('pdetails').style.display="block"				break;			case "7":				doApiGet(LTm[fi].LItem[i].id)					break;			}	}else		getRecords(LTm[fi].LItem[i].id,Tty[0] =="5" ? "":"&N&CEmail&CPhone")		renderList("",fi)	LTm[fi].Dirty= false	}function sSel(i,fi){	if(LTm[fi].Sel == 0 && i < 0) return	if((LTm[fi].Sel + i) >= LTm[fi].ntms ) return	var OSel = LTm[fi].Sel	LTm[fi].Sel += i	sOut(OSel,fi)		document.getElementById('SH' + LTm[fi].Sel).style.backgroundColor="#DDDDDD"	document.getElementById('SI' + LTm[fi].Sel).style.backgroundColor="#DDDDDD"}function sOut(i,fi){//	setList(i)	if(i < 0 || i> LTm[fi].ntms || i== LTm[fi].Sel) return	document.getElementById('SH' + i).style.backgroundColor="#FFFFFF"	document.getElementById('SI' + i).style.backgroundColor="#FFFFFF"}function sOver(i,fi){//	resetList(i)	if(i< 0 || i> LTm[fi].ntms ||  i== LTm[fi].Sel) return	document.getElementById('SH' + i).style.backgroundColor="#EFEFEF"	document.getElementById('SI' + i).style.backgroundColor="#EFEFEF"}function doSubmit(){	var fm = document.forms[0];	if(Tty[0] != "6" ){		document.forms[0].tmpRelatesTo.value = LTm[Tty[0] == "5" ? 1:0].selid 		if(Tty[0] != "5" && document.forms[0].tmpRelatesTo.value =="") {			alert("Select the name of the person that is the subject of this request")			eval("document.forms[0]." + LTm[fi].fld) .value = eval("document.forms[0]." + LTm[fi].fld) .value.substr(0,2)			document.forms[0].elements[ob.tabIndex +1].focus()			renderList(eval("document.forms[0]." + LTm[fi].fld) .value ,fi)			}	}		document.forms[0].tmpSessid.value = sessid	OSIt= new Array();	ct=0;		if(Tty[0]=="1"){			OSIt[ct++] =  new OSItem("NFirstName","Firstname",1,fm,true)			OSIt[ct++] =  new OSItem("NBornDte","Year of Birth",3,fm,true,null,1800,2008)				OSIt[ct++] =  new OSItem("NDiedDte","Year of Death",3,fm,Tty[2]=="D",null,1800,2008)	}else if(Tty[0]=="2"){		OSIt[ct++] =  new OSItem("NFirstName","Firstname",1,fm,true)			OSIt[ct++] =  new OSItem("NSurname","Surname",1,fm,true)			OSIt[ct++] =  new OSItem("NBornDte","Year of Birth",3,fm,true,null,1800,2008)				OSIt[ct++] =  new OSItem("NDiedDte","Year of Death",3,fm,false,null,1800,2008)			}else if(Tty[0]=="4"){		OSIt[ct++] =  new OSItem("MDiedDte","Year of Death",3,fm,true,null,1800,2008)			}else if(Tty[0]=="6"){			OSIt[ct++] =  new OSItem("P_Title","Title",1,fm,true)			OSIt[ct++] =  new OSItem("P_Location","Location",1,fm,true)			OSIt[ct++] =  new OSItem("P_Year","Year the material applies to",3,fm,true,null,1800,1930)				OSIt[ct++] =  new OSItem("P_Subjects","A name to link it with the Sharrock family",1,fm,true)			OSIt[ct++] =  new OSItem("P_Description","A story",1,fm,true)		}else{//		alert("WHAT")	}	if(Tty[0] != "6"  && Tty[0] != "5"){		try{			if(prtN[0]) {				OSIt[ct++] =  new OSItem("tmpPFirstName1","Deselect this section or\nFirstname of current or most recent partner",1,fm,true)					OSIt[ct++] =  new OSItem("tmpPSurname1","Deselect or\nSurname of current or most recent partner",1,fm,true)					OSIt[ct++] =  new OSItem("tmpPBornDte1","Year of Birth",3,fm,false,null,1800,2008)					OSIt[ct++] =  new OSItem("tmpPDiedDte1","Year of Death",3,fm,false,null,1800,2008)					}				if(prtN[1]) {				OSIt[ct++] =  new OSItem("tmpPFirstName2","Deselect this section or\nFirstname of former partner",1,fm,true)					OSIt[ct++] =  new OSItem("tmpPSurname2","Deselect this section or\nSurname of former partner",1,fm,true)					OSIt[ct++] =  new OSItem("tmpPBornDte2","Year of Birth",3,fm,false,null,1800,2008)					OSIt[ct++] =  new OSItem("tmpPDiedDte2","Year of Death",3,fm,false,null,1800,2008)					}			}catch(e){	}	}	OSIt[ct++] =  new OSItem("CName","Your name",1,fm,true)		var att = ""	var the_inputs=document.getElementsByTagName("input");	for(var n=0;n<the_inputs.length;n++){		if(the_inputs[n].type=="file"  ){ //  &&  the_inputs[n].classname =="input"   ){C:\Non Work related Files\DSC_0006.JPG			 att = the_inputs[n].value 			 if (att.length  > 6 && att.substring(att.length, att.length - 4).toLowerCase() != ".jpg"  && att.substring(att.length, att.length - 5).toLowerCase() != ".jpeg" ){				alert("You must select a jpg or jpeg file containing the portrait of this family member.")				the_inputs[n].focus()				return false			}					 break		}	}	 	if(Tty[0]=="3") {		 if(att  == "") {			alert("You must select a file that contains the portrait of this family member.")			the_inputs[n].focus()			return false		} 	}	if(!OSValidate(document.forms[0])) return false	document.forms[0].submit()	return true}function doGenLookup(form,ret, flag){		var fm = document.forms[0];	var rrr = "/" + APIdbname + "/(WEBSelector)?OpenForm&" + ret  + "&" + flag +  "&" + form	WI = window.open(rrr,'DlgView','scrollbars=n,resizable=no,screenX=100, screenY=100,width=300,height=350');	WI.focus();  }function TRInit(){	var fm = document.forms[0];	if(Tty[0]=="0")	return		ct=0;	LTm[ct++] =  new  NLTm("SH","SHL",true,"FName")	LTm[ct++] =  new  NLTm("CH","CHL",false,"CName")	function NLTm(loc,loc1,cre,fld) {		this.Dirty = true;		this.loc = loc		this.loc1 = loc1		this.LItem= new Array();		this.Current = "";		this.Pending = ""		this.fld = fld;		this.Sel = -1;		this.iNum =-1;		this.ntms = 0;		this.ftms = 0;		this.interval1=0   ;		this.selid = ""		this.core = cre;	}}function getRecords(docid,lst){		var rq;	if(lst == ""  || lst== "&PARENTS") {		var tlst = lst		var the_inputs=document.getElementsByTagName("input");		for(var n=0;n<the_inputs.length;n++){			if(the_inputs[n].type=="text"   && the_inputs[n].id == "" ){ //  &&  the_inputs[n].classname =="input"   ){				tlst += "&" + the_inputs[n].name			}		}		var the_inputs=document.getElementsByTagName("select");		for(var n=0;n<the_inputs.length;n++){			if(the_inputs[n].type=="select-one"  ){ //  &&  the_inputs[n].classname =="input"   ){				tlst += "&" + the_inputs[n].name			}		}			}else tlst = lst 	//	alert(tlst)	var url = "/" + APIdbname+ "/(WEBGetDocVals)?OpenAgent&"+ docid + tlst   //?OpenAgent&NT00005ADE&Form"	url += "&" + Math.floor(Math.random()*1111)	if (window.XMLHttpRequest) {		rq = new XMLHttpRequest();		rq.onreadystatechange = processReqChange;		rq.open("GET",  url, true);		rq.send(null);		// branch for IE/Windows ActiveX version	} else if (window.ActiveXObject) {		rq = new ActiveXObject("Microsoft.XMLHTTP");		if (rq) {			rq.onreadystatechange = processReqChange;			rq.open("GET", url, true);			rq.send();		}else 			return false	}	// handle onreadystatechange event of req object	function processReqChange() {		LDc= new Array();		LPa= new Array();		var fm = document.forms[0];		var chd =""				if (rq.readyState == 4) {			if (rq.status == 200) {			//	alert(req.responseText)				var sst="";				var x = rq.responseXML.getElementsByTagName('Document')[0].firstChild				var i = 0				var ss = ""				var ct=0;				var pt = 0				while (x !=  null){						 					if(x.nodeType == 1){	 							 						if(x.tagName =="decen") LDc[ct++] =  new  NDc(getInnerText(x))	 						else if(x.tagName =="parent") LPa[pt++] =  new  NPa(getInnerText(x))	 						else if(x.tagName =="photo") {	 								document.getElementById("OSPhoto" ).style.backgroundImage ="url('/"+ APIdbname +"/" + getInnerText(x)+ "')"									document.getElementById("OSPhoto" ).style.backgroundRepeat ="no-repeat"									document.getElementById("OSPhoto" ).style.backgroundPosition ="top center"	 						}else setFld( x.tagName  ,  getInnerText(x)) 						 }					x=x.nextSibling;   				}   				if(Tty[0]=="7")   					hit("Genealogy Builder",doApiComp())   				else{	   				var sd = "";	   				document.getElementById("SHD" ).innerHTML	 = ""					if(LDc.length >0) {						for (var j=0;j<LDc.length;j++)  sd +=   (sd==""? "" :(j == (LDc.length-1) ? " and " : ", ") ) + LDc[j].Nm+ " (b:"  +   LDc[j].Yr + ")" 											document.getElementById("SHD" ).innerHTML	= sd+ " have previously been entered as decendants.<br><b>Please <u>DO NOT</u> reenter any of these names.</b>"								}					try{											prtN[0] = fm.tmpPFirstName1.value == "" ? false : true							prtN[1] = fm.tmpPFirstName2.value == "" ? false : true							renderPartner(true)											}catch(e){}					var sd = "";					if(LPa.length >1) {						for (var j=0;j<LPa.length;j++)  sd +=  '<option value="' +  LPa[j].Sur	+ '">' + LPa[j].Nm + " " + LPa[j].Sur	+ "</option>"						sd = '<select onChange=AAB(this); style="width: 120px;font-size: 11px;color: red;border: 1px solid #ff0000;padding: 0 0 0 0px;" name=DDSurname>' + sd + '</option></select>'									document.getElementById("SHD" ).innerHTML	= "Our records show " + LTm[0].LItem[LTm[0].iNum].prt + " has partnered more than once. <BR>Comfirm the " +(LTm[0].LItem[LTm[0].iNum].pgen == "M" ? "Mother":"Father")+ " to be " + sd+ " (Select).<br>"								}else if(LPa.length ==1){						try{document.getElementById("SHD" ).innerHTML	= "Our records show " +  LPa[0].Nm + " " + LPa[0].Sur+ " to be the " + (LTm[0].LItem[LTm[0].iNum].pgen == "M" ? "Mother":"Father")+ ".<br>"} catch(e){}						try{document.forms[0].NJoinedWith.value = LPa[0].Nm + " " + LPa[0].Sur} catch(e){}					} 				}				   			}else alert("There was a problem retrieving the Document \nERROR="+rq.status+ "\n"+ url);				}	}	return true		function NPa(sty) {			var arg=sty.split("|")		this.Nm = arg[0]		this.Sur = arg[1]		this.DNm = arg[2]		this.DSur = arg[3]		this.DYr = arg[4]				this.Id= arg[5]			}		function NDc(sty) {		var arg=sty.split("|")		this.Nm = arg[1]		this.Yr = arg[0]		this.NJw =  arg[2]				this.Id =  arg[3]	}		function setFld(fldn,vl){		if(Tty[0]=="7")			doApiAtt(fldn,vl)		else{					fld = eval("document.forms[0]." + fldn)		//	if(fld == null) fld = document.getElementById( fldn)			if( fld.type == "select-one") 					fld.options[fld.length] = new Option(vl , vl, fld.length == 0 ? true: false, false) 			else				fld.value =  vl		}	}		function hit(v1,v2) {		var url = "/" + dbname+ "/(WEBHit)?OpenAgent&" + sessid +"&" + myIp + "&" + v1+ "&"  +   v2		url += "&" + Math.floor(Math.random()*1111)		if (window.XMLHttpRequest) {			req = new XMLHttpRequest();			req.onreadystatechange = processReqChange;			req.open("GET",  url, true);			req.send(null);			// branch for IE/Windows ActiveX version		} else if (window.ActiveXObject) {			req = new ActiveXObject("Microsoft.XMLHTTP");			if (req) {				req.onreadystatechange = processReqChange;				req.open("GET", url, true);				req.send();			}	else 				return false		}			function processReqChange() { // nothing to process handle onreadystatechange event of req object			return true		}	}}function AAB(ob){	try{	document.forms[0].NJoinedWith.value = ob[ob.selectedIndex].text	if(LTm[0].LItem[LTm[0].iNum].pgen == "F" )document.forms[0].NSurname.value = ob[ob.selectedIndex].value	}catch(e){}	}var WI; function x3(a){	WI = window.open("/"+ APIdbname +'/WEBTree/'+ a + "?opendocument&OSSes=" + sessid ,'_new','scrollbars=no,status=no,resizable=no,screenX=100, screenY=100,width=300,height=350');	WI.focus();	return false}var tog = falsefunction x2(c,itt,sd,fn,id,ti,att,pr, resp){	var expand = ""	var args=document.URL.split("&")		newURL="(WEBTree)?OpenView"	for(var i = 0;   i< args.length ; i++){		ppar = args[i].split("=")		if(ppar.length ==  2){			if(ppar[0].toLowerCase()=="expand"){				expand = ppar[1]  			}else{				newURL+= "&" + args[i]			}		}	}		var twisty = '<img src=OSHEmpty.gif border=0>'	var idx = sd.split('.')	var st=""	var sts =""	for (var i=1; i<idx.length-1;i++) {		st+= idx[i] + ( i ==  idx.length-2 ? "" : "." );			}	for (var i=1; i<idx.length-0;i++) {		sts+= idx[i] + ( i ==  idx.length-1 ? "" : "." );			}		if(c==1){	//alert("-"+ expand + "-"+ sts +  "-" + sts.substr(0,expand.length)+ "-")		if(resp > 0){			if(sts  == expand.substr(0,sts.length) ){				//			var twisty= "<a href='" + newURL + "&expand=" + sd.substr(2) + "'><img src=OSHexpand.gif border=0></a>"	var twisty= "<a href='" + newURL + "&expand=" + st + "'><img src=OSHcollapse.gif border=0></a>"			}else{	//			var twisty= "<a href='" + newURL + "&expand=" + st + "'><img src=OSHcollapse.gif border=0></a>"	var twisty= "<a href='" + newURL + "&expand=" + sd.substr(2) + "'><img src=OSHexpand.gif border=0></a>"			} 		}else			var twisty= "<img src=OSHempty.gif border=0>"				}	var s="";	var cg=""		//alert ( i + " " + idx.length)			for (var i=2; i<idx.length;i++) s += "<td align=right  style='padding:0px;background-color:white;'>" + (i==(idx.length-1)? twisty:"") + "</td>"//	for (var i=2; i<idx.length-1;i++) s += "<td align=right  style='padding:0px;'></td>"			var p= '<tr class=' + (tog ? 'odd' : 'even') + ' >' +	s +  		'<td colspan=' + (10-idx.length) + ' valign=top  style="padding:0px">' + ( pr=="Y" ? unescape(fn) : '<a onClick="x3(\''+ id +'\');return false;"  HREF=#>'+unescape(fn) +  '</a> ')+ (resp >0 ? "(" + resp + ")" : " ") +  (att==1 ? '&nbsp;&nbsp;<img align=top src=OSPerson1.gif border=0>':'') +'</td><td width=90>'+  unescape(ti)+   '</td>';	//alert(p);sd +"/" +st + "/" + expand+ " " + sd+ "/"+ st + "/" + expand +  "-" +	//alert(p)		tog = ! tog;		if(itt=="") {		idx = expand.split(".")		for (var i=0; i<idx.length;i++) cg+="<col width=16>"//		alert("<colgroup>" + cg +"<col width=145><col width=200><col width=200px><col width=145> </colgroup> ");		document.write("<colgroup>" + cg +"<col width=145> </colgroup> ")	}	document.write(p);}function doSearch(ob){	var dlg = document.forms[0];	if(dlg.searchQuery.value == '' || dlg.searchQuery.value == 'Search...'  ) {			alert("You must enter some free text");			dlg.searchQuery.focus();				return false;	}	ss = "(FIELD NSurName CONTAINS(" + unescape(dlg.searchQuery.value) + ")) " +  	"OR(FIELD NFirstName CONTAINS(" + unescape(dlg.searchQuery.value) + "))" + 	"OR(FIELD NName CONTAINS(" + unescape(dlg.searchQuery.value) + "))" + 	"OR(FIELD NMiddleNames CONTAINS(" + unescape(dlg.searchQuery.value) + "))" + 	"OR(FIELD NOccupation CONTAINS(" + unescape(dlg.searchQuery.value) + "))" 	URLs = "/" + APIdbname +  '/(WEBDecCron)?SearchView&Query=' +  ss+  "&Start=1&Count=100&SearchFuzzy=TRUE&NKey=ELIST"	window.open(URLs,"_self");}function checkEnter(e){ 	var characterCode	 if(e && e.which){ 	 	e = e	 	characterCode = e.which //character code is contained in NN4's which property	 } else{								 	e = event							 	characterCode = e.keyCode //character code is contained in IE's keyCode property	 }	 if(characterCode == 13){ 		doSearch()	 	return false 	 }	return true }function setList(i) {	//window.status = "set " + i	//	interval1 = window.setTimeout("renderList('')", 800); }function resetList(i){	window.status = "reset " + i	window.clearTimeout( interval1)	window.clearInterval( interval1)}function getInnerText (node) {	if (typeof node.textContent != 'undefined') return node.textContent;	else if (typeof node.innerText != 'undefined') return node.innerText;		else if (typeof node.text != 'undefined') return node.text;	else {		switch (node.nodeType) {		case 3:		case 4:		return node.nodeValue;		break;		case 1:		case 11:			var innerText = '';				for (var i = 0; i < node.childNodes.length; i++) {					innerText += getInnerText(node.childNodes[i]);				}		return innerText;		break;		default:		return '';		}	}}