
/* header.js */
if("undefined"==typeof TGN){TGN={}}if("undefined"==typeof TGN.Header){TGN.Header={}}if("undefined"==typeof TGN.Header.Drawer){TGN.Header.Drawer={}}if("undefined"==typeof TGN.Header.Navigation){TGN.Header.Navigation={}}if("undefined"==typeof _HDrwr){_HDrwr=TGN.Header.Drawer}if("undefined"==typeof _HNav){_HNav=TGN.Header.Navigation}if("undefined"==typeof _YDom){_YDom=YAHOO.util.Dom}if("undefined"==typeof _YConn){_YConn=YAHOO.util.Connect}if("undefined"==typeof _YDDM){_YDDM=YAHOO.util.DragDropMgr}if("undefined"==typeof _YEvent){_YEvent=YAHOO.util.Event}if("undefined"==typeof _YAnim){_YAnim=YAHOO.util.Anim}var _drawerObjs;var _addQlDialog;var _showTodosView=true;var _favsDrwr;var _todoDrwr;var _myAcctHovering=false;var _lameChomeCounter=0;var _HNavTreeMoreString;var _HNavTreeError;var _HNavAddQlErrorMessage;var _HNavAddQlSuccess;var _HNavGetQlSuccess;var _HNavTodoSuccess;var _HNavCompletedTodos;var _HNavCompletedCount=0;var _HNavSubZIndex=99;var _HNavTrees=[];var treesMnu;var searchMnu;var communityMnu;var learningMnu;_HNav.callLoader=function(e,d,f,b){var a=new YAHOO.util.YUILoader({onSuccess:f});var c;if(d!=null){c=_HNavServicePath+"?f="+e+d}else{c=_HNavServicePath+"?f="+e}a.addModule({name:e,type:"js",fullpath:c});a.require(e);a.insert()};_HNav.AncMenu=function(f,e,d,b,a){this.headerObj=_YDom.get(f);this.mnuContainerObj=_YDom.get(e);this.mnuContentObj=_YDom.get(d);var c=_YDom.get(f).offsetWidth+1;if(c<185){c=185}this.mnuContainerObj.style.width=c+"px";this.mnuContentObj.style.width=c+"px";this.recentHover=false;this.isHovering=false;this.isOpen=false;this.dynamicContentLoaded=true;this.height=_HNav.getElementHeight(e);this.callbackFn=b;this.callbackPm=a};_HNav.toggleSitesBox=function(a){if(_YDom.get("ftrSitesContainer").style.display=="block"){_YDom.get("ftrSitesContainer").style.display="none"}else{_YDom.get("ftrSitesContainer").style.display="block"}};_YEvent.addListener("ftrNavDD","click",_HNav.toggleSitesBox);_YEvent.addListener("closeFtrSitesX","click",_HNav.toggleSitesBox);_HNav.dynamicCallBack=function(a){this.func=a};_HNav.animColorMouseOver=function(c){var b={backgroundColor:{from:"#fcfff3",to:"#e8eebb"}};var a=new YAHOO.util.ColorAnim(this.id,b,0.3);a.animate()};_HNav.animColorMouseOut=function(c){var b={backgroundColor:{from:"#e8eebb",to:"#fcfff3"}};var a=new YAHOO.util.ColorAnim(this.id,b,0.3);a.animate()};_HNav.open=function(b,a){a.isHovering=true;a.recentHover=true;a.mnuContainerObj.style.zIndex=_HNavSubZIndex++;setTimeout(function(){_HNav.getDynamicContent(a)},250)};_HNav.close=function(b,a){a.headerObj.style.backgroundColor="";a.isHovering=false;setTimeout(function(){_HNav.animClose(a)},500)};_HNav.getDynamicContent=function(c){if(c.isHovering==true&&c.isOpen==false){if(_HNavUserLoggedIn=="True"&&c.callbackFn!=null){try{c.dynamicContentLoaded=false;setTimeout(function(){_HNav.startSpinner(c)},1000);var b=new _HNav.dynamicCallBack(c.callbackFn);b.func()}catch(a){}}else{_HNav.animOpen(c)}}};_HNav.startSpinner=function(a){if(!a.dynamicContentLoaded){a.headerObj.className+=" G-NavItemLoading";setTimeout(function(){_HNav.stopSpinnerOpenMenu(a)},2000)}};_HNav.stopSpinnerOpenMenu=function(a){a.dynamicContentLoaded=true;a.headerObj.className=a.headerObj.className.replace("G-NavItemLoading","");_HNav.animOpen(a)};_HNav.animOpen=function(d){if(d.isHovering==true&&d.isOpen==false){d.mnuContainerObj.style.height="1px";var a=_HNav.getElementHeight(d.mnuContentObj.id);d.mnuContainerObj.style.display="block";var b={height:{from:0,to:a}};var c=new _YAnim(d.mnuContainerObj.id,b,0.4,YAHOO.util.Easing.easeOut);c.animate();d.isOpen=true}};_HNav.animClose=function(d){if(d.recentHover==true){setTimeout(function(){_HNav.animClose(d)},1000);d.recentHover=false}else{if(d.isHovering==false&&d.isOpen==true){d.isOpen=false;var a=_HNav.getElementHeight(d.mnuContainerObj.id);var b={height:{from:a,to:0}};var c=new _YAnim(d.mnuContainerObj.id,b,0.3,YAHOO.util.Easing.easeIn);c.animate()}}};_HNav.getTrees=function(){_HNav.callLoader("GetTrees",null,_HNav.getTreesSuccess,null)};_HNav.getTreesSuccess=function(){if(!_HNavTreeError){var b=_HNavTrees;try{var a=_HNavTreeTotalCount;var g=_HNavTreesDomain;if(b!=undefined&&b.length>0){var f="";for(var c=0;c<b.length;c++){f+='<li id="'+b[c].tid+'">';f+='<a href="http://'+g+"/pt/pedigree.aspx?tid="+b[c].tid+'">'+b[c].name+"</a>";f+="</li>"}if(a!=undefined&&a>b.length){f+='<li id="moreTrees">';f+='<a href="http://'+g+'/pt/treelist.aspx">'+_HNavTreeMoreString+"...</a>";f+="</li>"}document.getElementById("loadTrees").innerHTML=f}_HNav.stopSpinnerOpenMenu(treesMnu)}catch(d){_HNav.stopSpinnerOpenMenu(treesMnu)}}else{_HNav.stopSpinnerOpenMenu(treesMnu)}};_HNav.getTreesFail=function(){_HNav.stopSpinnerOpenMenu(treesMnu)};_HNav.MouseOverMyAcctDD=function(){_myAcctHovering=true;setTimeout("_HNav.OpenMyAcctDD()",300)};_HNav.MouseOutMyAcctDD=function(){_myAcctHovering=false;setTimeout("_HNav.CloseMyAcctDD()",600)};_HNav.OpenMyAcctDD=function(){if(_myAcctHovering==true){var a=document.getElementById("acctDD");a.style.display=""}};_HNav.CloseMyAcctDD=function(){if(_myAcctHovering!=true){var a=document.getElementById("acctDD");a.style.display="none"}};_HNav.getElementHeight=function(a){var b;if(document.getElementById){b=document.getElementById(a);b.style.overflow="scroll"}else{if(document.all){b=document.all[a]}}b.style.overflow="hidden";return b.scrollHeight-8};_HNav.subMenuHover=function(b){var c=document.getElementById(b);c.style.backgroundColor="#fcfff3";var a=c.style.backgroundColor};_HNav.initMenus=function(){try{treesMnu=new _HNav.AncMenu("treesNav","treesSubNav","treesContent",_HNav.getTrees);_YEvent.on("treesNav","mouseover",_HNav.open,treesMnu);_YEvent.on("treesNav","mouseout",_HNav.close,treesMnu);_YEvent.on("treesSubNav","mouseover",function(){_HNav.subMenuHover("treesNav")})}catch(b){}try{searchMnu=new _HNav.AncMenu("searchNav","searchSubNav","searchContentNav",null);_YEvent.on("searchNav","mouseover",_HNav.open,searchMnu);_YEvent.on("searchNav","mouseout",_HNav.close,searchMnu);_YEvent.on("searchSubNav","mouseover",function(){_HNav.subMenuHover("searchNav")})}catch(d){}try{communityMnu=new _HNav.AncMenu("communityNav","communitySubNav","communityContentNav",null);_YEvent.on("communityNav","mouseover",_HNav.open,communityMnu);_YEvent.on("communityNav","mouseout",_HNav.close,communityMnu);_YEvent.on("communitySubNav","mouseover",function(){_HNav.subMenuHover("communityNav")})}catch(c){}try{learningMnu=new _HNav.AncMenu("learningNav","learningSubNav","learningContentNav",null);_YEvent.on("learningNav","mouseover",_HNav.open,learningMnu);_YEvent.on("learningNav","mouseout",_HNav.close,learningMnu);_YEvent.on("learningSubNav","mouseover",function(){_HNav.subMenuHover("learningNav")})}catch(a){}};_YEvent.onDOMReady(_HNav.initMenus);_HDrwr.Drawer=function(o,c,e,f,n,k,d,h,a,b,g,m,j,l){this.isOpen=false;this.li=_YDom.get(o);this.left=_YDom.get(c);this.right=_YDom.get(e);this.container=_YDom.get(f);this.link=_YDom.get(n);this.em=_YDom.get(k);this.span=_YDom.get(d);this.top=_YDom.get(h);this.content=_YDom.get(a);this.noContent=_YDom.get(b);this.altContent=null;if(g!=null){this.altContent=_YDom.get(g)}this.noAltContent=null;if(m!=null){this.noAltContent=_YDom.get(m)}this.callbackFn=l;this.spinner=_YDom.get(j);this.openTab=function(){_YDom.get(o).style.marginTop="-4px";_YDom.get(c).className="DrwSelectL";_YDom.get(e).className="DrwSelectR";_YDom.get(f).className="DrwSelect";_YDom.get(n).className="CalloutActive";_YDom.get(k).className="CallbublActv";_YDom.get(d).className="CallBublLeftActv";_YDom.get(h).style.display="block";_YDom.get(a).style.display="block"};this.close=function(){_YDom.get(o).style.marginTop="0px";_YDom.get(c).className="";_YDom.get(e).className="";_YDom.get(f).className="";_YDom.get(n).className="Callout";_YDom.get(k).className="Callbubl";_YDom.get(d).className="";_YDom.get(b).style.display="none";_YDom.get(j).style.display="none";if(g!=null){_YDom.get(g).style.display="none"}if(m!=null){_YDom.get(m).style.display="none"}this.isOpen=false}};_HDrwr.closeDrwrTop=function(a){a.top.style.display="none";a.content.style.display="none"};_HDrwr.openDrawerTab=function(b,a){_HDrwr.closeAllDrawerTabs();a.openTab();_HDrwr.getDynamicContent(a)};_HDrwr.animOpenDrawer=function(b){b.top.style.display="block";b.content.style.display="block";var a=_HNav.getElementHeight("DrwWrapper")+11;if(b.isOpen==false){var c=new YAHOO.util.Anim("DrwSlider",{height:{to:a}},0.5,YAHOO.util.Easing.easeOut);c.animate();setTimeout(function(){b.spinner.style.display="none"},500)}else{_YDom.get("DrwSlider").style.height=a+"px"}b.isOpen=true};_HDrwr.closeAllDrawerTabs=function(){if(_drawerObjs){for(var a=0;a<_drawerObjs.length;a++){_drawerObjs[a].close()}}};_HDrwr.animClose=function(){_HDrwr.closeAllDrawerTabs();var a=_HNav.getElementHeight("DrwWrapper")+11;var b=new YAHOO.util.Anim("DrwSlider",{height:{from:a,to:0}},0.5,YAHOO.util.Easing.easeIn);b.animate()};_HDrwr.dynamicCallBack=function(a){this.func=a};_HDrwr.getDynamicContent=function(c){if(c.callbackFn!=null){try{var b=new _HDrwr.dynamicCallBack(c.callbackFn);b.func()}catch(a){}}};_HDrwr.DragDrop={initHdrTodo:function(){var d=new YAHOO.util.DDTarget("hdrTodos","hdrTdList");var c=document.getElementById("hdrTodos");d.unlock();if(c){var a=c.getElementsByTagName("li");for(var b=0;b<a.length;b=b+1){var e=new _HDrwr.DDList(a[b].id,"hdrTdList")}}},initHdrQuickLinks:function(){var e=new YAHOO.util.DDTarget("hdrFavs","hdrFavList");var d=document.getElementById("hdrFavs");e.unlock();if(d){var b=d.getElementsByTagName("li");for(var c=0;c<b.length;c=c+1){var a=new _HDrwr.DDList(b[c].id,"hdrQLList")}}}};_HDrwr.DDList=function(d,a,b){_HDrwr.DDList.superclass.constructor.call(this,d,a,b);this.logger=this.logger||YAHOO;var c=this.getDragEl();_YDom.setStyle(c,"opacity",0.67);this.goingUp=false;this.lastY=0};YAHOO.extend(_HDrwr.DDList,YAHOO.util.DDProxy,{startDrag:function(b,d){this.logger.log(this.id+" startDrag");var a=this.getDragEl();var c=this.getEl();_YDom.setStyle(c,"visibility","hidden");a.innerHTML=c.innerHTML;_YDom.setStyle(a,"color",_YDom.getStyle(c,"color"));_YDom.setStyle(a,"backgroundColor",_YDom.getStyle(c,"backgroundColor"));_YDom.setStyle(a,"border","2px solid gray")},endDrag:function(h){var d=this.getEl();var f=this.getDragEl();_YDom.setStyle(f,"visibility","");var b=new YAHOO.util.Motion(f,{points:{to:_YDom.getXY(d)}},0.2,YAHOO.util.Easing.easeOut);var c=f.id;var j=this.id;b.onComplete.subscribe(function(){_YDom.setStyle(c,"visibility","hidden");_YDom.setStyle(j,"visibility","")});b.animate();var g=d.parentNode;if(g.id=="hdrTodos"||g.id=="hdrFavs"){_HDrwr.reorderDrwrItems(g.id)}},onDragDrop:function(f,g){if(_YDDM.interactionInfo.drop.length===1){var d=_YDDM.interactionInfo.point;var c=_YDDM.interactionInfo.sourceRegion;if(!c.intersect(d)){var a=_YDom.get(g);var b=_YDDM.getDDById(g);a.appendChild(this.getEl());b.isEmpty=false;_YDDM.refreshCache()}}},onDrag:function(a){var b=_YEvent.getPageY(a);if(b<this.lastY){this.goingUp=true}else{if(b>this.lastY){this.goingUp=false}}this.lastY=b},onDragOver:function(f,g){var c=this.getEl();var b=_YDom.get(g);if(b.nodeName.toLowerCase()=="li"){var a=c.parentNode;var d=b.parentNode;if(this.goingUp){d.insertBefore(c,b)}else{d.insertBefore(c,b.nextSibling)}_YDDM.refreshCache()}}});_HDrwr.reorderDrwrItems=function(a){try{var e=_YDom.get(a);var d=e.getElementsByTagName("li");var f="";for(i=0;i<d.length;i++){f+=d[i].id+","}var b="&orderedStr="+f;_HNav.callLoader("ReorderDrawerItems",b,_HDrwr.reorder_Success,null)}catch(c){this.dump(c)}};_HDrwr.reorder_Success=function(){var a=_HNavReorderSuccess};_HDrwr.QuickLink=function(c,b,a){this.id=c;this.linkName=b;this.linkUrl=a;this.draw=function(){var d;var e=_YDom.get("favs_template");d=e.innerHTML;d=d.replace("__favId__",this.id);d=d.replace("__favId2__",this.id);d=d.replace("__favName__",unescape(this.linkName));d=d.replace("__favName2__",this.linkName);d=d.replace("__favURL__",this.linkUrl);return d}};_HDrwr.getQuickLinks=function(){setTimeout(function(){if(!_favsDrwr.isOpen){_favsDrwr.spinner.style.display="block"}},500);var a="&partnerId="+_HNavPartnerId+"&subType="+_HNavSubType+"&lameChrome="+_lameChomeCounter++;_HNav.callLoader("GetQuickLinks",a,_HDrwr.getQuickLinks_Success,null)};_HDrwr.getQuickLinks_Success=function(){if(_HNavGetQlSuccess){_YDom.get("drwrError").style.display="none";_HDrwr.drawQuickLinks(_HNavGetQlSuccess,_HNavQuickLinks,_HNavQlTotalCount)}else{_YDom.get("drwrError").style.display="block"}_HDrwr.closeDrwrTop(_todoDrwr);_HDrwr.animOpenDrawer(_favsDrwr);_favsDrwr.spinner.style.display="none"};_HDrwr.drawQuickLinks=function(g,f,d){var c=_YDom.get("hdrFavs");c.innerHTML="";if(g){_YDom.get("favCount").innerHTML="("+d+")";if(f.length>0){_YDom.get("noQuickLinks").style.display="none";var b;var a;for(var e=0;e<f.length;e++){b=f[e];a=new _HDrwr.QuickLink(b.id,b.linkName,b.linkUrl);c.innerHTML+=a.draw()}_HDrwr.DragDrop.initHdrQuickLinks()}else{_YDom.get("noQuickLinks").style.display="block"}}};_HDrwr.addNewQuickLink=function(){var d=_YDom.get("ql_urlTxt");var c=_YDom.get("ql_nameTxt");if(d.value!=""&&c.value!=""){if(d.value.indexOf("http://")!=0&&d.value.indexOf("https://")!=0){d.value="http://"+d.value}var a=encodeURIComponent(d.value);var b="&linkName="+c.value+"&partnerId="+_HNavPartnerId+"&subType="+_HNavSubType+"&linkUrl="+a;_HNav.callLoader("AddQuickLink",b,_HDrwr.addQuickLink_Success,null)}else{_YDom.get("addHdrQuickLink_needInfo").style.display="inline"}};_HDrwr.addQuickLink_Success=function(){if(_HNavAddQlSuccess!=null&&_HNavAddQlSuccess=="true"){_YDom.get("ql_urlTxt").value="http://";_YDom.get("ql_nameTxt").value="";_HDrwr.toggleAddQuickLink();_HDrwr.getQuickLinks()}};_HDrwr.deleteQuickLink=function(d,c){var a=_HNavDeleteItemConf;if(confirm(a+"\n\n"+unescape(c))){var b="&linkId="+d;_HNav.callLoader("DeleteQuickLink",b,_HDrwr.deleteQuickLink_Success,null)}};_HDrwr.deleteQuickLink_Success=function(){_HDrwr.getQuickLinks()};_HDrwr.toggleAddQuickLink=function(b){var a=_YDom.get("addHdrQuickLink");if(b){var e=location.href;var c=document.title;a.style.display="block";_YDom.get("ql_urlTxt").value=e;_YDom.get("ql_nameTxt").value=c;_YDom.get("addHdrQuickLink_needInfo").style.display="none"}else{if(a.style.display=="none"){a.style.display="block";var f=_YDom.get("ql_urlTxt");f.focus();if(f.createTextRange){var d=f.createTextRange();d.moveStart("character",f.value.length);d.collapse();d.select()}_YDom.get("addHdrQuickLink_needInfo").style.display="none"}else{a.style.display="none"}}return false};_HNav.QuickLink={};_HNav.QuickLink.isFireFox=function(){return navigator.userAgent.indexOf("Firefox")!=-1};_HNav.QuickLink.ancestryDomain="www.ancestry.com";_HNav.QuickLink.show=function(n){if(n!="undefined"&&n.length>0){_HNav.QuickLink.ancestryDomain=n}var e;var p;var h=document.createElement("div");h.setAttribute("id","ql_dropSheet");if(_HNav.QuickLink.isFireFox()){e=document.body.scrollWidth;p=document.body.scrollHeight}else{e=document.body.clientWidth;p=document.body.clientHeight}h.style.width=e+"px";h.style.height=p+"px";var g="370px";var m="180px";var j=document.createElement("div");j.setAttribute("id","ql_dialog");var o=document.getElementById("ql_dialogTemplate");j.innerHTML=o.innerHTML;j.style.display="none";j.style.width=g;j.style.height=m;var c=document.getElementsByTagName("body")[0];c.insertBefore(j,c.firstChild);c.insertBefore(h,j);var d;var b;var a=370;var f=180;if(_HNav.QuickLink.isFireFox()){d=window.innerWidth;b=window.innerHeight}else{if(document.documentElement.clientHeight>0){b=document.documentElement.clientHeight}else{b=document.body.clientHeight}if(document.documentElement.clientWidth>0){d=document.documentElement.clientWidth}else{d=document.body.clientWidth}}j.style.display="block";j.style.left=((d-a)/2)+"px";j.style.top=((b-f)/2)+"px";var l=document.getElementsByTagName("title")[0];var k=document.getElementById("ql_name");if(typeof TGN.KeyWatcher!="undefined"){TGN.KeyWatcher.addListener(k)}k.value=l.innerHTML};_HNav.QuickLink.addQuickLink=function(){_YDom.get("ql_content").style.display="none";_YDom.get("ql_buttons").style.display="none";_YDom.get("ql_result").style.display="block";_YDom.get("ql_image").style.display="none";var c=document.location;var b=document.getElementById("ql_name");if(c!=""&&b.value!=""){var a="&linkName="+b.value+"&partnerId="+_HNavPartnerId+"&subType="+_HNavSubType+"&linkUrl="+encodeURIComponent(c.href);_HNav.callLoader("AddQuickLink",a,_HNav.QuickLink.addQuickLink_Success,null)}};_HNav.QuickLink.addQuickLink_Success=function(){if(_HNavAddQlErrorMessage==null){if(_HNavAddQlSuccess=="true"){_YDom.get("ql_AddSuccess").style.display="block";_YDom.get("ql_AddFail").style.display="none"}else{_YDom.get("ql_AddSuccess").style.display="none";_YDom.get("ql_AddFail").style.display="block"}}else{_YDom.get("ql_AddSuccess").style.display="none";_YDom.get("ql_AddFail").style.display="block"}};_HNav.QuickLink.closeDialog=function(){var a=document.getElementsByTagName("body")[0];a.removeChild(document.getElementById("ql_dropSheet"));a.removeChild(document.getElementById("ql_dialog"))};_HDrwr.Todo=function(c,a,b){this.todoName=a;this.id=c;this.draw=function(){var d;var e=_YDom.get("todo_template");d=e.innerHTML;d=d.replace("__todoItemId__",this.id);d=d.replace("__todoItemTxt__",unescape(this.todoName));d=d.replace("__todoItemId2__",this.id);d=d.replace("__todoItemTxt2__",this.todoName);d=d.replace("__todoChBId__","chB_"+this.id);d=d.replace("__todoId__",this.id);if(b){d=d.replace("__checked__",'checked="checked"');d=d.replace("__callbackFn__","_HDrwr.retaskTodo")}else{d=d.replace("__checked__","");d=d.replace("__callbackFn__","_HDrwr.completeTodo")}return d}};_HDrwr.getTodos=function(){setTimeout(function(){if(!_todoDrwr.isOpen){_todoDrwr.spinner.style.display="block"}},500);var a="&lameChrome="+_lameChomeCounter++;_HNav.callLoader("GetTodos",a,_HDrwr.getTodos_Success,null)};_HDrwr.getTodos_Success=function(){if(_HNavTodoSuccess){_YDom.get("drwrError").style.display="none";_HDrwr.drawTodos(_HNavTodoSuccess,_HNavTodos,_HNavTodoCount,_HNavCompletedTodos,_HNavCompletedCount)}else{_YDom.get("drwrError").style.display="block"}_HDrwr.closeDrwrTop(_favsDrwr);_HDrwr.changeTodoView();_todoDrwr.spinner.style.display="none"};_HDrwr.drawTodos=function(n,a,p,c,m){if(n){var e=_YDom.get("hdrTodos");e.innerHTML="";if(_YDom.get("todoViewDD").value=="todos"){if(p==0){_YDom.get("noTodos").style.display="block"}else{_YDom.get("noTodos").style.display="none"}}else{if(m==0){_YDom.get("noCompletedItems").style.display="block"}else{try{_YDom.get("noCompletedItems").style.display="none"}catch(o){}}}var f;var d;for(var h=0;h<a.length;h++){f=a[h];d=new _HDrwr.Todo(f.id,f.todoName,false);e.innerHTML+=d.draw()}_HDrwr.DragDrop.initHdrTodo();var k=_YDom.get("hdrCompletedItems");k.innerHTML="";var b;var l;for(var g=0;g<m;g++){b=c[g];l=new _HDrwr.Todo(b.id,b.todoName,true);k.innerHTML+=l.draw()}_YDom.get("todoCount").innerHTML="("+p+")";_YDom.get("completedCount").innerHTML="("+m+")";if(_showTodosView){e.style.display="block";k.style.display="none"}else{e.style.display="none";k.style.display="block"}}};_HDrwr.saveNewTodo=function(){var a=_YDom.get("addTodoTxt");if(a.value!=""){var c=encodeURIComponent(a.value);var b="&subject="+c+"&partnerId="+_HNavPartnerId+"&subType="+_HNavSubType;_HNav.callLoader("AddTodo",b,_HDrwr.getTodos,null);_YDom.get("addTodoTxt").value=""}_HDrwr.toggleAddTodo();_HDrwr.getTodos()};_HDrwr.completeTodo=function(b){var a="&todoId="+b;_HNav.callLoader("CompleteTodo",a,_HDrwr.getTodos,null)};_HDrwr.completeTodo_success=function(){_HDrwr.getTodos()};_HDrwr.deleteTodo=function(d,b){var a=_HNavDeleteItemConf;if(confirm(a+"\n\n"+unescape(b))){var c="&todoId="+d;_HNav.callLoader("DeleteTodo",c,_HDrwr.deleteTodo_Success,null)}};_HDrwr.deleteTodo_Success=function(){_HDrwr.getTodos()};_HDrwr.retaskTodo=function(b){var a="&todoId="+b;_HNav.callLoader("ReTaskTodo",a,_HDrwr.retaskTodo_success,null)};_HDrwr.retaskTodo_success=function(){_HDrwr.getTodos()};_HDrwr.toggleAddTodo=function(){var a=_YDom.get("addTodoBox");if(a.style.display=="none"){a.style.display="block";_YDom.get("addTodoTxt").focus()}else{a.style.display="none"}return false};_HDrwr.changeTodoView=function(){if(_YDom.get("todoViewDD").value=="todos"){_YDom.get("hdrTodos").style.display="block";_YDom.get("hdrCompletedItems").style.display="none";_YDom.get("addTodoBtn").style.display="block";_YDom.get("todoCount").style.display="inline";_YDom.get("completedCount").style.display="none";_YDom.get("noCompletedItems").style.display="none";_YDom.get("todoInstruction").style.display="block";if(_HNavTodoCount==0){_YDom.get("noTodos").style.display="block"}_HDrwr.animOpenDrawer(_todoDrwr)}else{_YDom.get("hdrCompletedItems").style.display="block";_YDom.get("hdrTodos").style.display="none";_YDom.get("addTodoBtn").style.display="none";_YDom.get("todoCount").style.display="none";_YDom.get("completedCount").style.display="inline";_YDom.get("noTodos").style.display="none";_YDom.get("todoInstruction").style.display="none";if(_HNavCompletedCount==0){_YDom.get("noCompletedItems").style.display="block"}var a=_HNav.getElementHeight("DrwWrapper")+11;_YDom.get("DrwSlider").style.height=a+"px";setTimeout(function(){_todoDrwr.spinner.style.display="none"},500)}};_HDrwr.initDrawers=function(){_todoDrwr=new _HDrwr.Drawer("todosLi","todosLeft","todosRight","todosContainer","todosLink","todosEm","todosSpan","todoTop","hdrTodos","noTodos","hdrCompletedItems","noCompletedItems","todoSpinner",_HDrwr.getTodos);_YEvent.on("todosLi","click",_HDrwr.openDrawerTab,_todoDrwr);_favsDrwr=new _HDrwr.Drawer("favsLi","favsLeft","favsRight","favsContainer","favsLink","favsEm","favsSpan","favTop","hdrFavs","noQuickLinks",null,null,"favsSpinner",_HDrwr.getQuickLinks);_YEvent.on("favsLi","click",_HDrwr.openDrawerTab,_favsDrwr);_YEvent.on("todoCloser","click",_HDrwr.animClose);_YEvent.on("favCloser","click",_HDrwr.animClose);_drawerObjs=[_todoDrwr,_favsDrwr]};_YEvent.onDOMReady(_HDrwr.initDrawers);function g_createTab(c,b,f,e){var a=_YDom.get("_HdrNav");if(a!=null&&f==true){a.innerHTML+='<li class="G-NavItem"><a href="'+b+'">'+c+"</a></li>"}else{if(!f){var d=document.getElementById("_HdrReturnBtn");d.style.display="block";d.innerHTML='<div style="position:absolute; left:0; top:0; height:30px; width:auto;"><a href="'+b+'" class="gbtn med-green"><em><span class="flat_icon arrow1left_white"></span>'+c+"</em></a></div><br>"}}}if(typeof(document.getElementsByClassName)=="undefined"){document.getElementsByClassName=function(f,d){var g=[];if(d==null){d="*"}var h=document.getElementsByTagName(d);for(var e=0;e<h.length;e++){if(h[e].className){classesList=h[e].className.split(" ");for(var c=0;c<classesList.length;c++){if(classesList[c]==f){g.push(h[e]);break}}}}return(g)}}function setButtonStates(c){if(c&&c.length>0){for(var b=0;b<c.length;b++){c[b].onmouseover=function(){this.style.backgroundPosition="left center";for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right center";break}}};c[b].onmousedown=function(){this.style.backgroundPosition="left bottom";for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right bottom";break}}};c[b].onmouseup=function(){this.style.backgroundPosition="left center";for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right center";break}}};c[b].onmouseout=function(){this.style.backgroundPosition="left top";for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right top";break}}}}}}function setTranBtnStates(c){if(c&&c.length>0){for(var b=0;b<c.length;b++){c[b].onmouseover=function(){for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="span"){this.childNodes[a].style.backgroundPosition="left center"}if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right center"}}};c[b].onmousedown=function(){for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="span"){this.childNodes[a].style.backgroundPosition="left bottom"}if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right bottom"}}};c[b].onmouseup=function(){for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="span"){this.childNodes[a].style.backgroundPosition="left center"}if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right center"}}};c[b].onmouseout=function(){for(var a=0;a<this.childNodes.length;a++){if(this.childNodes[a].nodeName.toLowerCase()=="span"){this.childNodes[a].style.backgroundPosition="left top"}if(this.childNodes[a].nodeName.toLowerCase()=="em"){this.childNodes[a].style.backgroundPosition="right top"}}}}}}_YEvent.onDOMReady(function(){var a=document.getElementsByClassName("gbtn","a");setButtonStates(a);a=document.getElementsByClassName("gbtn_in","a");setButtonStates(a);a=document.getElementsByClassName("gtbtn","a");setTranBtnStates(a)});function GetCommunicationBanner(){if(typeof clientId!="undefined"){var a=document.getElementById(clientId+"_hdnStackName").value;if(_HNavUserLoggedIn=="True"&&bannerOff.toLowerCase()=="true"&&(a=="c_lihp"||a=="c_home"||a=="c_trees"||a=="c_boards"||a=="c_search"||a=="c_learn")){var b="&stack="+a;_HNav.callLoader("GetCommunicationBanner",b,GetBannerSucc,null)}}}function GetBannerSucc(){var j=document.getElementById(clientId+"_hdnStackName").value;var a,e;var f=new String();try{if(isJewishGenCookie()&&j=="c_lihp"&&_HNavPriority!=0){a=document.getElementById(clientId+"_banComMessage");a.innerHTML="";e=document.createElement("div");e.id="wrpDiv";f="<h2>"+document.getElementById(clientId+"_lblJewishBanner").innerHTML+"&nbsp;<a href=\"javascript:TGN.Lihp.enableEdit('lihpContent','move_banner_error');\">"+document.getElementById(clientId+"_lblJewishBanner2").innerHTML+'</a></h2><a class="close" href="javascript:void(0)" onclick="CloseBannerClick();">'+closeStr+"</a>";e.className="bluWrp";f=f.concat('<div class="tl"></div><div class="tr"></div>');f=f.concat('<div class="bl"></div><div class="br"></div>');e.innerHTML=f;a.appendChild(e);document.getElementById(clientId+"_bannerCommunication").style.display="block";document.getElementById("fbanner").style.display="block"}else{if(!_HNavBannertext==""){a=document.getElementById(clientId+"_banComMessage");a.innerHTML="";var h,g;var d=new String();e=document.createElement("div");e.id="wrpDiv";f=_HNavBannertext;if(_HNavBannertext.indexOf("<LANG")>-1){f=CanadaLanguageBanner(_HNavBannertext)}if(!f==""){f=f.concat('<a class="close" href="javascript:void(0)" onclick="CloseBannerClick();">'+closeStr+"</a>");switch(_HNavColor){case"green":h="grnWrp";g="grnBtm";break;case"yellow":h="yloWrp";g="yloBtm";break;case"red":h="redWrp";g="redBtm";break;case"orange":h="orangeWrp";g="orangeBtm";break;case"blue":h="bluWrp";g="bluBtm";break;default:h="bluWrp";g="bluBtm";break}e.className=h+" gHeaderAlert";f=f.concat('<div class="tl"></div><div class="tr"></div>');document.getElementById(clientId+"_hdnbannerID").value=_HNavBannerid;if(_HNavAddtext==""){f=f.concat('<div class="bl"></div><div class="br"></div>');e.innerHTML=f;a.appendChild(e)}else{e.innerHTML=f;a.appendChild(e);var b=document.createElement("div");d=_HNavAddtext;b.ID="addDiv";b.className=g;d=d.concat('<div class="bl"></div><div class="br"></div>');b.innerHTML=d;a.appendChild(b)}document.getElementById(clientId+"_bannerCommunication").style.display="block";document.getElementById("fbanner").style.display="block"}}else{document.getElementById(clientId+"_bannerCommunication").style.display="none";document.getElementById("fbanner").style.display="none"}}}catch(c){document.getElementById(clientId+"_bannerCommunication").style.display="none";document.getElementById("fbanner").style.display="none"}}_YEvent.onDOMReady(function(){GetBannerSucc()});function isJewishGenCookie(){if(document.cookie.length>0){if((document.cookie.indexOf("JFH=")>-1)&&(document.cookie.indexOf("JFHrec=")==-1)){return true}}return false}function expireJewishGenCookie(){if(document.cookie.length>0){if(document.cookie.indexOf("JFH=")>-1){var a=new Date();a.setTime(a.getTime()+(1700*24*60*60*1000));document.cookie="JFHrec=0; expires="+a.toGMTString()}}}function CloseBannerClick(){if(isJewishGenCookie()){document.getElementById(clientId+"_bannerCommunication").style.display="none";document.getElementById("fbanner").style.display="none";expireJewishGenCookie();GetCommunicationBanner()}else{var c=document.getElementById(clientId+"_hdnbannerID").value;var b=document.getElementById(clientId+"_hdnStackName").value;document.getElementById(clientId+"_bannerCommunication").style.display="none";document.getElementById("fbanner").style.display="none";var a="&bannerId="+c+"&stack="+b;_HNav.callLoader("CommunicationBanner",a,GetBannerSucc,null)}}function CanadaLanguageBanner(f){var c=-1;var b=-1;var a="";try{var d=cultureName;c=f.indexOf("<LANG"+d+">");b=f.indexOf("</LANG"+d+">");if(c>-1&&b>-1&&b>c){a=f.substring(c+11,b)}}catch(e){}return a}if(typeof(document.getElementsByClassName)=="undefined"){document.getElementsByClassName=function(k,j,q){var p=[],o=[],n=0,m=0,l=[];if(typeof(q)=="undefined"){q=document}else{if(typeof(q)==typeof("string")){q=document.getElementById(q)}}if(typeof(j)=="undefined"){j="*"}o=q.getElementsByTagName(j);for(n=0;n<o.length;n++){if(o[n].className){l=o[n].className.split(" ");for(m=0;m<l.length;m++){if(l[m]==k){p.push(o[n]);break}}}}return(p)}}function hasClassName(d,c){return d.className.match(new RegExp("(\\s|^)"+c+"(\\s|$)"))}function addClassName(d,c){if(!hasClassName(d,c)){d.className+=" "+c;return true}return false}function removeClassName(e,d){if(hasClassName(e,d)){var f=new RegExp("(\\s|^)"+d+"(\\s|$)");e.className=e.className.replace(f,"");return true}return false};
/* searchwidgets.js */
// AutoComplete field that searches a users tree for its names, and populates form elements with the persons data
// Wraps a the YUI AutoComplete

// Global shortcuts for the YUI
$D = YAHOO.util.Dom;
$ = $D.get;

if( document.implementation.hasFeature("XPath", "3.0") ){
	if( typeof XMLDocument == "undefined" ){ XMLDocument = Document; }
  XMLDocument.prototype.selectNodes = function(cXPathString, xNode){
    if( !xNode ) { xNode = this; } 
		var oNSResolver = this.createNSResolver(this.documentElement);
		var aItems = this.evaluate(cXPathString, xNode, oNSResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
		var aResult = [];
		for( var i = 0; i < aItems.snapshotLength; i++){aResult[i] =  aItems.snapshotItem(i);	}
		return aResult;
	};
	XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode){
		if( !xNode ) { xNode = this; } 
		var xItems = this.selectNodes(cXPathString, xNode);
		if( xItems.length > 0 ){return xItems[0];	}
		else{return null;	}
	};
	Element.prototype.selectNodes = function(cXPathString){
		if(this.ownerDocument.selectNodes){	return this.ownerDocument.selectNodes(cXPathString, this);}
		else{throw "For XML Elements Only";}
	};
	Element.prototype.selectSingleNode = function(cXPathString){	
		if(this.ownerDocument.selectSingleNode){return this.ownerDocument.selectSingleNode(cXPathString, this);	}
		else{throw "For XML Elements Only";}
	};
}

if(typeof TGN == 'undefined') {
	var TGN = {};	
	TGN.Search = {};
	TGN.SearchWidget = {};
	TGN.Search.BrowseDate = {};
}

if (typeof TGN.SearchWidget == 'undefined') {
	TGN.SearchWidget = {};
}

if (typeof TGN.Search == 'undefined')
{
	TGN.Search = {};
	TGN.Search.BrowseDate = {};
}

if (typeof TGN.Search.BrowseDate == 'undefined')
{
	TGN.Search.BrowseDate = {};
}

if (typeof dbid == 'undefined' && typeof TGN.SResults != 'undefined')
{
	if (typeof TGN.SResults.Browse != 'undefined')
	{
		if (typeof TGN.SResults.Browse.dbid != 'undefined')
		{
			dbid = TGN.SResults.Browse.dbid;
		}
	}
}

//This Array contains i18n strings populated server-side for the users culture
if(typeof TGN.I18N == 'undefined'){ TGN.I18N = []; }
//static failsafe method for obtaining defined strings
TGN.I18N.getTrans = 
    function(key){
        if(TGN.I18N[key] === null || TGN.I18N[key] == 'undefined'){
            return "$" + key;
        }
        else {return TGN.I18N[key];}
    };

TGN.SearchWidget.NameChanged = 0;
TGN.SearchWidget.TreeLoadingPanel = null;
TGN.SearchWidget.PersonACHandles = {};
TGN.SearchWidget.PersonAutoComplete = 
	function(CtrlName, lNameContainer, formFieldArray, guid, cache, tid, tName)  {

		this.NameTextBox = CtrlName; // + "_TextBox";
		this.NameContainer = lNameContainer;
		
		var aCDS = new YAHOO.widget.DS_XHR('AjaxBaseHandler.ashx', ["ResultSet.Result", "Name","YearRange","tid","pid"]);
		aCDS.scriptQueryAppend = "a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|DoCallback&guid=" + guid + "&tid=" + tid;
		aCDS.responseType = YAHOO.widget.DS_XHR.TYPE_JSON;
		aCDS.connTimeout = 4000;
		aCDS.queryMatchSubset = true;
	
        this.YUI_AC = new YAHOO.widget.AutoComplete(this.NameTextBox,this.NameContainer, aCDS);
		this.YUI_AC.animVert = false;
		this.YUI_AC.minQueryLength = 3;
		this.YUI_AC.maxResultsDisplayed = 12;
		this.YUI_AC.queryDelay = 0.5;
		this.YUI_AC.useShadow = true;
		this.YUI_AC.useIFrame = true; 
		this.YUI_AC.autoHighlight = false;

		this.setTid = function(newTid){
			this.YUI_AC.dataSource.scriptQueryAppend = "a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|DoCallback&guid=" + guid + "&tid=" + newTid;
			this.YUI_AC.dataSource.flushCache();
			var nTB = $(this.NameTextBox);
			if(nTB != null) {				
				this.YUI_AC.sendQuery(nTB.value);
				nTB.focus();
			}
		};

		this.fnFormatter = function(ResultSet, query) {          
			var returnV =  "<div class='treeName'>";
			returnV += ResultSet[0] + "</div><div class='treeYears'>"+ResultSet[1]+"</div>";
			return returnV;
		};
        this.YUI_AC.formatResult = this.fnFormatter;
      
		var PopulateForm = 
		{
			success: function(o) {
				if(TGN.SearchWidget.TreeLoadingPanel != null) {
					TGN.SearchWidget.TreeLoadingPanel.destroy();
					TGN.SearchWidget.TreeLoadingPanel = null;
				}
				if(TGN.SM.TreeLoadingFader != null) { 
					TGN.SM.TreeLoadingFader.stop(); 
				}

				var theGExactCB = $(o.argument.GlobalExactCB);
				if(theGExactCB != null && theGExactCB.checked){
					TGN.SM.Clear(o.argument.FormId,"",null,false);
				}
				else TGN.SM.Clear(o.argument.FormId);

				var person = eval('(' + o.responseText + ')');
				for(FieldName in o.argument.KVPairs){
					var fId = $(FieldName);
					if( fId != null) {
						if(fId.tagName != "SPAN") { fId.value = person[o.argument.KVPairs[FieldName]]; }
						else {
							if(fId.innerHTML != 'undefined') { fId.innerHTML = person[o.argument.KVPairs[FieldName]]; }
							else if(TGN.SM.GetText(fId) != null) { TGN.SM.SetText(fId, person[o.argument.KVPairs[FieldName]]); }
						}
					}
				}
				for(FuncName in o.argument.Callbacks){
					var tCallb = o.argument.Callbacks[FuncName];
					tCallb.callback(tCallb.domId,person[tCallb.fType],tCallb.args);
				}
				
				TGN.SearchWidget.NameChanged = 0;
			},
			failure: function(o) {
				if(o.status == 500) {
					if(TGN.SearchWidget.TreeLoadingPanel != null) {
						TGN.SearchWidget.TreeLoadingPanel.setBody("<div class='g_alert'><strong>" + TGN.I18N.getTrans("treeLoadingErrorH") +"</strong><br/>" +  TGN.I18N.getTrans("treeLoadingErrorB") + "</div>");
						setTimeout('TGN.SearchWidget.TreeLoadingPanel.destroy()',5000);
					}
					if(TGN.SM.TreeLoadingFader != null) { TGN.SM.TreeLoadingFader.stop(); }
				}
			},
			argument: formFieldArray
		};
		
		this.fnItemSelectEvent = function(oSelf, eArr, oData){
			var url = 'AjaxBaseHandler.ashx?a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|GetPersonCallback&guid=';
			url += guid;
			url += "&tid=" + eArr[2][2];
			url += "&pid=" + eArr[2][3];
			
			//find the enclosing form
			if(eArr[1] != null) {
				var cEl = eArr[1];
				while (cEl != null && cEl != document){
					//if(cEl.tagName.toUpperCase() == "FORM"){
					if(cEl.className.indexOf("search-form") >= 0 || cEl.className.indexOf("search-refined") >= 0 ){
						TGN.SM.ShowTreeLoading(cEl.id, cache);
						break;
					}
					cEl = cEl.parentNode;
				}
			}

			YAHOO.util.Connect.asyncRequest('GET',url, PopulateForm);
		};
		this.YUI_AC.itemSelectEvent.subscribe(this.fnItemSelectEvent);
		
		this.fnUnmatchedEvent = function(oSelf, sQuery){
			var gsfn = $(CtrlName + "_gsfn");
			if(gsfn !== null) gsfn.value = ""; //make sure field is cleared
			var gsln = $(CtrlName + "_gsln");
			if(gsln !== null) gsln.value = ""; //make sure field is cleared
		};
		this.YUI_AC.unmatchedItemSelectEvent.subscribe(this.fnUnmatchedEvent);
};

// Sets up the section for multiple trees when using the name auto complete.
TGN.SearchWidget.GetTreeList = function(theDiv, guid, tid, personP){

	var el;
	var AddTreePicker = {
		success: function(o) {
			var resp = eval('(' + o.responseText + ')');
			if(resp != null)
			{
				var theSize = 0;
				for(el in resp)
				{
					theSize += 1;
				}
				
				if (theSize > 5)
				{
					theSize = 5;
				}
				
				var sBox = "<select style='width:225px' size='" + theSize + "' ";
				sBox += "onchange=\"TGN.SearchWidget.SetPrefTree('"+personP+"',this)\" >";								
				
				for(el in resp)
				{
					sBox += "<option value='" + resp[el];
					if(resp[el] == tid) {
						sBox += "' selected >";
					}
					else sBox += "'>";
					sBox += el + "</option>";
					
				}
				
				sBox = sBox + "</select>";

				if(sBox != "<select>") {
					var tCh = $(theDiv);
					if(tCh != null) {
						tCh.innerHTML = sBox;
					}
				}
			}
		},
		failure: function(o){
		alert('fail');
		}
	};

	YAHOO.util.Connect.asyncRequest('GET', 'AjaxBaseHandler.ashx?a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PersonAutoComplete|GetAllTrees&guid=' + guid, AddTreePicker);

};

// Used for the select list setting the treeid
TGN.SearchWidget.SetPrefTree = function(personP, sBox) {
	TGN.SearchWidget.PersonACHandles[personP].setTid(sBox.options[sBox.selectedIndex].value);
	//personP.setTid(sBox.options[sBox.selectedIndex].value);
};

TGN.SearchWidget.PlaceAutoComplete = 
	function(PlaceTextBox, PlaceContainer, GpidHidden, lcid, GpidHierHidden, doMultiGpid, dbid, eventType)  {
		if(GpidHierHidden == null || GpidHierHidden == 'undefined' || GpidHierHidden == '') 
			GpidHierHidden = null;
		
		this.aCDS = new YAHOO.widget.DS_XHR('AjaxBaseHandler.ashx', ["ResultSet.Result", "PlaceText", "Gpid", "GpidH", "HitC"]);
		var scriptUrl = "a=MFN.Shared.Search&f=MFN.Shared.Search.WebControls.PlaceTypeAheadHandler|ProcessRequest&Use302Redirect=1&lcid=" + lcid;
		if(GpidHierHidden != null){ scriptUrl += "&GetGH=1"; }
		if(doMultiGpid != 'undefined' && doMultiGpid){ scriptUrl += "&MGpid=1"; }
		if(dbid != 'undefined' && dbid != -1) {scriptUrl += "&dbid=" + dbid; }
		if(eventType != 'undefined' && eventType != 0){ scriptUrl += "&eventT=" + eventType; }

		this.aCDS.scriptQueryAppend = scriptUrl;
		this.aCDS.responseType = YAHOO.widget.DS_XHR.TYPE_JSON;
		this.aCDS.connTimeout = 4000;

		this.YUI_AC = new YAHOO.widget.AutoComplete(PlaceTextBox,PlaceContainer, this.aCDS);			
		this.YUI_AC.minQueryLength = 3;
		this.YUI_AC.maxResultsDisplayed = 15;
		this.YUI_AC.animVert = false;
		this.YUI_AC.queryDelay = 0.2;
		this.YUI_AC.useShadow = true;
		this.YUI_AC.useIFrame = true; 
		this.YUI_AC.autoHighlight = false;
		
		this.fnFormatter = function(ResultSet, query) 
		{
			var rV = '';
			if(typeof ResultSet[3] != 'undefined') {
				if(ResultSet[3] != '0') {
					rV = " <span class='hitC'>" + ResultSet[0] +"  (" + ResultSet[3] + ")</span><span class='hitCAlt'>";
					if(ResultSet[0].length > 18) {
						rV += ResultSet[0].substring(0, 18) + "...";
					}
					else rV += ResultSet[0];
					rV += " (" + ResultSet[3] + ")</span>";
				}
				else { 
					rV = "<span class='zeroH'>"+ResultSet[0]+" (" + ResultSet[3] + ")</span><span class='zeroHAlt'>";
					if(ResultSet[0].length > 18) {
						rV += ResultSet[0].substring(0, 18) + "...";
					}
					else rV += ResultSet[0];
					
					rV += ' (0)';
					rV += '</span>';
				}
			}
			else rV = ResultSet[0];
			return rV;
		};
		this.YUI_AC.formatResult = this.fnFormatter;
		
		this.fnItemSelectEvent = function(oSelf, elItem, oData){
			var gPid = $(GpidHidden);
			if(gPid != null) { 
				gPid.value = elItem[2][1]; //set the gpid field
			}

			if(GpidHierHidden != null) {
				var gPidH = $(GpidHierHidden);
				if(gPidH != null) gPidH.value = elItem[2].length > 2 ? elItem[2][2] : ""; //set the gpidHier field
			}
		};
		this.YUI_AC.itemSelectEvent.subscribe(this.fnItemSelectEvent);

		this.fnUnmatchedEvent = function(oSelf, sQuery){
			var gPid = $(GpidHidden);
			if(gPid !== null) gPid.value = ""; //make sure field is cleared
			if(GpidHierHidden != null) {
				var gPidH = $(GpidHierHidden);
				if(gPidH !== null) gPidH.value = ""; //make sure field is cleared
			}
		};
		this.YUI_AC.unmatchedItemSelectEvent.subscribe(this.fnUnmatchedEvent);
	};
	
//SearchModule Instance methods, these methods require context, as there may be more than one SearchModule on a given page.
//DOMName is the name of page.
if(typeof TGN.SM == 'undefined') { 
	TGN.SM = {}; 
}

TGN.SM.SetVarCookie = function(key,value){
	var VarCookieSet = {
		success: function(o){ },
		failure: function(o){ },
		timeout: 1500,
		cache:false
	};
	var url = 'AjaxBaseHandler.ashx?a=MFN.Shared.Search&f=MFN.Shared.Search.Modulator.ModuleTemplate|SetAdvCallback';
	url += "&k=" + key + "&v=" + value;
	YAHOO.util.Connect.asyncRequest('GET',url,VarCookieSet);
};

TGN.SM.Inst = 
	function(moduleDiv, clientId, formId, showAdvOpts)
	{
		var i = 0;
		var l = 0;
		this.initShowAdv = showAdvOpts;
		this.showAdv = showAdvOpts;
		TGN.SM.InstContainer[moduleDiv] = this;//this makes it so you can call it without the instance handle
		this.moduleDiv = moduleDiv;
		this.clientId = clientId;
		this.XCBArray = new Array();

		this.ToggleAdv = function(qString) {
			this.showAdv = !this.showAdv;//toggle the advanced flag
			if(qString == null) qString = '';
			var alltags;
			var oField;
			var smDiv = $(moduleDiv);
			var gExctb = $(this.clientId + "_xcb");
			
			if(gExctb != null && gExctb.checked){
				gExctb.checked = !gExctb.checked;
				this.AdvCBToggle(gExctb);
			}
			
			var msAvVal = "0"; 
			if(this.showAdv){
				if(gExctb != null) { msAvVal = gExctb.checked?"2":"1"; }
				else { msAvVal = this.showAdv?"1":"0"; }
			}
			TGN.SM.SetVarCookie("MSAV", msAvVal);
			var msAvHdn = $(this.clientId + "_msAV");
			if(msAvHdn != null) msAvHdn.value = msAvVal;
			
			//populate the advanced/standard fields based on the currently displayed version
			var fullNF = $(clientId+"_Name");
			var gsfn_hid = $(clientId+"_Name_gsfn");
			var gsln_hid = $(clientId+"_Name_gsln");
			if(gsfn_hid != null && gsln_hid != null && fullNF != null){
				if(this.showAdv){
					fullNF = fullNF.value;
					if(gsfn_hid.value == "" && gsln_hid.value == "") {
						if(fullNF != null){
							gsfn_hid.value = fullNF.substring(0, fullNF.lastIndexOf(" "));
							gsln_hid.value = fullNF.substring(fullNF.lastIndexOf(" ")+1);
						}
					}
				}
				else {
					fullNF.value = gsfn_hid.value;
					if(gsln_hid.value != "") {
						fullNF.value += " " + gsln_hid.value;
					}
				}
			}
			
			if(smDiv != null) {//do all the show/hide stuff
				if(this.showAdv) {
					smDiv.className = smDiv.className + " advanced";
				}
				else {
					smDiv.className = smDiv.className.replace(" advanced", "");
				}

				alltags = smDiv.getElementsByTagName("INPUT");
				if(this.showAdv) {
					for(i=0, l=alltags.length; i < l; i++){
						if(alltags[i].className.indexOf("SM_regOpt") > -1){
							oField = $(alltags[i].id + "-x");
							if(oField !== null){
								var oyear = alltags[i].value.match(/\d{4}/);
								if(oyear !== null && oyear != ""){
									oField.value = oyear;
								}
							}
						}
					}
				}
				else {
					for(i=0, l=alltags.length; i < l; i++){
						if(alltags[i].className.indexOf("SM_advOpt") > -1){
							var idName = alltags[i].id.substring(0,alltags[i].id.length-2);//strip the ending -x and look
							oField = $(idName);
							if(oField != null && oField.value == "") {
								oField.value = alltags[i].value;
							}
						}
					}
				}
			}
			var theHidden = $(clientId + "_msAV");
			if(theHidden != null) { //change the advanced search flag
				if(this.showAdv)	theHidden.value = "1";
				else theHidden.value = "0";
			}

			//This forces IE6 to repaint the open modules, IE6 doesn't reposition absolute divs(Place and Person widgets) in the flow properly when the total height of its container changes.
			if (YAHOO.env.ua.ie > 5 && YAHOO.env.ua.ie < 7) {
				alltags = YAHOO.util.Dom.getElementsByClassName("mod open");
				for(var i=0, l=alltags.length; i < l; i++){
					var cB = new TGN.SM.AdvElem(alltags[i]);
					setTimeout(cB.go,1);
				}
			}

		};
		
		this.ExactCBToggle = function(theCB){
			var gExct = $(this.clientId + "_xcb");
				if(theCB.checked == true) {
					if(this.p_CheckCB(theCB, true)){
						gExct.checked = theCB.checked;		
					}
					else gExct.checked = false;		
				}
				else {
					gExct.checked = false;		
				}
		};

		this.p_CheckCB = function(theCB, toCheckBool)
		{
			var gExct = $(this.clientId + "_xcb");
			var form = $(this.moduleDiv);
			if(form != null) {
				var alltags = form.getElementsByTagName("INPUT");
				for(var i=0, l=alltags.length; i < l; i++){  
					if(alltags[i].type == "checkbox") {
						if(alltags[i] == theCB || alltags[i] == gExct ) continue;
						if(alltags[i].checked != toCheckBool) return false;
					}
				}
			}	
			return true;
		};

		this.AdvCBToggle = function(theCB)
		{
			if (theCB == null) theCB = $(this.clientId + "_xcb");
			var form = $(this.moduleDiv);
			if(form != null) {
				var alltags = form.getElementsByTagName("INPUT");
				for(var i=0, l=alltags.length; i < l; i++){  
					if(alltags[i].type == "checkbox" && (alltags[i].name.indexOf("_x") + 2) == alltags[i].name.length ) {
						alltags[i].checked = theCB.checked;
					}
					else if(alltags[i].type == "hidden" && (alltags[i].name.indexOf("_x") + 2) == alltags[i].name.length)
					{
						alltags[i].value = theCB.checked ?"1":"";
					}
				}
				/*NOT NEEDED? 
				var ne = $(this.clientId + "_nedd");
				if (ne == null || !$D.isAncestor(form, ne))
				    ne = $(this.clientId + "_NationalityEthnicity_nedd");
				if (ne == null || !$D.isAncestor(form, ne))
				    ne = $("refineT_nedd");
				if (ne != null) ne.disabled=theCB.checked;*/
			}
			TGN.SM.SetVarCookie("MSAV", theCB.checked?"2":"1");
		};

		this.CheckBucket = function(theCB, bVal)
		{
			var subHidden = $(this.clientId + "-catBucketSubmit");
			//Check the four check boxes and make sure at least one is checked
			var subHiddenVal = "";
			var hBuck = $(this.clientId + "-catBucket-r");
			if(typeof hBuck != 'undefined' && hBuck.checked) {
				subHiddenVal += "r";
			}
			hBuck = $(this.clientId + "-catBucket-s");
			if(typeof hBuck != 'undefined' && hBuck.checked) {
				subHiddenVal += "s";
			}
			hBuck = $(this.clientId + "-catBucket-t");
			if(typeof hBuck != 'undefined' && hBuck.checked) {
				subHiddenVal += "t";
			}
			hBuck = $(this.clientId + "-catBucket-p");
			if(typeof hBuck != 'undefined' && hBuck.checked) {
				subHiddenVal += "p";
			}

			if(subHiddenVal == "") {
				alert(TGN.I18N.getTrans("catBuckErr"));
				subHidden.value = bVal;
				theCB.checked = true;
			}
			else {
				subHidden.value = subHiddenVal;
			}
		};
	};

TGN.SM.InstContainer = new Array();
TGN.SM.InstMgr = function(moduleDiv, clientId)
{
	var hasInst = TGN.SM.InstContainer[moduleDiv];
	if(hasInst == null) {
		hasInst = new TGN.SM.Inst(moduleDiv, clientId, '', true);
	}
	return hasInst;
};

TGN.SM.AdvElem = function(el){
	this.go = function(){
		el.className = "mod";
		el.className = "mod open";
	};
};
	
//array of configuration details for TG.SM static methods that is populated from server side code on init
if(typeof TGN.SM.CONFIG == 'undefined') TGN.SM.CONFIG = new Array(); 
TGN.SM.GetConfig = function(key) {return TGN.SM.CONFIG[key];};
	
//STATIC methods of SM .. No context needed for these
	TGN.SM.SyncExactCB = function(theCB,hidden){
		var theHidden = $(hidden);
		if(theHidden != null) {
			if(theCB.checked) theHidden.value = '1';
			else theHidden.value = '';
		}
	};
	TGN.SM.HideShow = function(id) {
		var module = $(id);
		var x = module.className.indexOf(' open');
		if(x > 0)
			module.className = module.className.substring(0, x);
		else
			module.className = module.className + ' open';
	};
	TGN.SM.TogSumCat = function(theDiv) {
		tEl = $(theDiv);
		if(tEl != null){
			var x = tEl.className.indexOf(' closed');
			if(x > 0)
				tEl.className = tEl.className.substring(0, x);
			else
				tEl.className = tEl.className + ' closed';
		}
	};
	TGN.SM.showMoreLocation = function(maxRes, tName, zIndex){
		var newLoc = 0;
		var maxFilled = 0;
		for(var i = 1; i <= maxRes; i++){
			var newD = $(tName+i+'_Div');
			if(newD != null) {
				if(newLoc == 0 && newD.innerHTML == ''){
					newLoc = i;	
					maxFilled = i;
					zIndex -= (newLoc-1) * 2;
				}
				else if(newD.innerHTML != ''){
					if(newD.style.display == 'none'){
						newD.style.display = 'block';
						return;
					}
					maxFilled = i;
				}
				else break;
			}	
		}
		if( (maxFilled+1) > maxRes) {
			var AddAnother = $("resAddAnother");
			if(AddAnother != null) 
				AddAnother.style.display = 'none';
		}

		if(newLoc == 0) return;

		newD = $(tName+newLoc+'_Div');
		if(newD != null){

			newD.innerHTML += "<style type='text/css'> #"+tName+newLoc+"_AutoComplete .yui-ac-content{ z-index:" + 
				zIndex + ";} #"+tName+newLoc + "_AutoComplete .yui-ac-shadow { z-index:"+(zIndex-1)+"; } #"+tName+newLoc+"_AutoComplete { z-index:"+zIndex+" } </style> " + 
				"<input type='hidden' class='clear' id='"+tName+newLoc+"_Gpid' name='msrpn"+newLoc+"' value='' />" + 
				"<div class='PlaceBox_CN'><div id='"+tName+newLoc+"_AutoComplete'><input type='text' id='"+tName+newLoc + 
				"_ftp' name='msrpn"+newLoc+"__ftp' value='' class='field' />" + 
				"<div id='"+tName+newLoc+"_ACContainer'></div> </div></div>";
			
			newD.style.display = 'block';	

			(function() {
				this.personWidget = new TGN.SearchWidget.PlaceAutoComplete(tName+newLoc+"_ftp",tName+newLoc+ "_ACContainer",tName+newLoc+"_Gpid","1033","");
			})();

			//IE has a hard time paring style declarations in innerHTML.  Add needed zIndex after insert here.
			if (YAHOO.env.ua.ie > 5 && YAHOO.env.ua.ie <= 8) {
				var t2 = $(tName+newLoc+"_AutoComplete");
				if(t2 != null) t2.style.zIndex = zIndex;
				var elArray = YAHOO.util.Dom.getElementsByClassName('yui-ac-content',null,tName+newLoc+'_AutoComplete');
				if(elArray != null && elArray.length > 0) {
					elArray[0].style.zIndex = zIndex;
				}
				//IE is also weak minded when it comes to adding elements to the dom.. help it along
				YAHOO.util.Dom.getElementsByClassName('PlaceBox_CN','div',null,function(el) {el.className=el.className + " clear"; } );
			}
			if(typeof TGN.KeyWatcher != 'undefined') {
				var nRes = $(tName+newLoc+"_ftp");
				if(nRes != null) {
					TGN.KeyWatcher.addListener(nRes);
				}
			}
		}
	};
	TGN.SM.popGenderR = function(id,value,args){
		if(value == "m") value = "f";
		else if (value == "f") value = "m";
		TGN.SM.popGender(id,value,args);
	};
	TGN.SM.popGender = function(id, value, args){
		var dd = $(id);
		//The gender dd submits the opposite of the real value as we do a 
		//not exclude filter on this value instead.  So we must reverse the stated value.
		if(value == "m") value = "f";
		else if (value == "f") value = "m";
		if(dd != null) {
			for(var iI=0, l=dd.options.length; iI < l; iI++){
				if( dd.options[iI].value == value) {
					dd.selectedIndex = iI;
					if(args[0] != null) {
						modD = $(args[0]);
						if(modD != null) {
							if(modD.innerHTML != 'undefined') { modD.innerHTML = dd.options[iI].text; }
							else if(TGN.SM.GetText(modD) != null) { TGN.SM.SetText(modD, dd.options[iI].text); }
						}
					}
					break;
				}
			}
		}
	};
	TGN.SM.cFormEl = function(name,value) {
		var kv = document.createElement("input");
		kv.setAttribute("type", "hidden");
		kv.setAttribute("name", name);
		kv.setAttribute("value", value);
		return kv;		
	};
	TGN.SM.PersonKeyPress = function(e){
		if(e.keyCode != 13 && e.keyCode != 9 && !(e.keyCode >= 37 && e.keyCode <= 40) && !(e.keyCode >= 16 && e.keyCode <= 19) ) { 
			TGN.SearchWidget.NameChanged += 1;
		}
	};
	TGN.SM.CloseSSO = function(explicit) {
		if(explicit || TGN.SM.CloseTimer != null) { //should indicate that the mouse is still over hover
			var hContent = $("startsearchoverDD");
			if(hContent != null && hContent.className.indexOf("indivHide") == -1) 
				hContent.className += ' indivHide';
			YAHOO.util.Event.removeListener("ssoClose",'blur');
		}
	};
	TGN.SM.CloseTimer = null;
	TGN.SM.CloseSSOM = function(){ TGN.SM.CloseTimer = setTimeout(function(){TGN.SM.CloseSSO(false);},3000);	};
	TGN.SM.SSOMOver = function(){ if(TGN.SM.CloseTimer != null) {clearTimeout(TGN.SM.CloseTimer); TGN.SM.CloseTimer = null; } };
	TGN.SM.InitSSOLink = function() {
		var hContent = $("startsearchoverDD");
		hContent.style.position = 'absolute';
		hContent.style.zIndex = 50;

		function AddHoverEffect(el) { el.className += ' yuimenuitem-selected'; }
		function AddHoverOut(el) { el.className = el.className.replace(' yuimenuitem-selected', ''); }
		YAHOO.util.Dom.getElementsBy(function(){return true;},'li',hContent,function(el){ YAHOO.util.Event.addListener(el,'mouseover',function(){AddHoverEffect(el);}); YAHOO.util.Event.addListener(el,'mouseout',function(){AddHoverOut(el);});} );
		
		/*
		//Disappearing facet bug.
		//After the left column controls were all wrapped in a containing div id=leftcolumn, this hack no longer was needed
		if (YAHOO.env.ua.ie > 5 && YAHOO.env.ua.ie <= 7) {
			var cat = $("categories");
			if(cat != null) { cat.style.zIndex = -1; }
		}
		*/

		function onclicker(domElem) { 
			return (function() {

				if(domElem.className.indexOf("indivHide") >= 0) {
					domElem.className = domElem.className.replace(' indivHide', '');
					YAHOO.util.Dom.setX(domElem, YAHOO.util.Dom.getX("ssoLink")-5);
					YAHOO.util.Dom.setY(domElem, YAHOO.util.Dom.getY("ssoLink")+10); 
					var closer = $("ssoClose");
					if (closer != null) closer.focus();	
					YAHOO.util.Event.addListener("ssoClose", 'blur', function(){TGN.SM.CloseSSO(false);});
				}
				
			});
		}
		var doOnclicker = onclicker(hContent);//wrap dom element in closer
		YAHOO.util.Event.addListener("ssoLink", "click", doOnclicker);

	};
	TGN.SM.ClearedValues = null;
	TGN.SM.ClearAndSave = function(id) {
		var i = 0;
		if(TGN.SM.ClearedValues == null) {
			TGN.SM.ClearedValues = new Array();
		}
		else {
			TGN.SM.Clear(id, "");//don't need to save it again. just clear um
			return;
		}

		var clearValue = "";
		var form = $(id);
		if(form != null) {
			var alltags = form.getElementsByTagName("INPUT");
			for(i=0, l=alltags.length; i < l; i++){  
				if(alltags[i].type == "checkbox") {
					if(alltags[i].id.indexOf("catBucket") < 0) {
						TGN.SM.ClearedValues[alltags[i].id] = alltags[i].checked;
						alltags[i].checked = false;
					}
				}
				else if(alltags[i].type == "text" && alltags[i].className.indexOf("field") >= 0 ) {
					TGN.SM.ClearedValues[alltags[i].id] = alltags[i].value;
					alltags[i].value = clearValue;
				}
				else if(alltags[i].type == "hidden")
				{
					if(alltags[i].className.indexOf("clear") >= 0) {
						TGN.SM.ClearedValues[alltags[i].id] = alltags[i].value;
						alltags[i].value = "";
					}
				}
			}

			alltags = form.getElementsByTagName("SELECT");
			for(i=0, l=alltags.length; i < l; i++){
				if (alltags[i].name=='ne')
					continue;

				TGN.SM.ClearedValues[alltags[i].id] = alltags[i].selectedIndex;
				alltags[i].selectedIndex = 0;
			}	
		}
	};
	TGN.SM.RestoreClear = function(id) {
		var i = 0;
		var l = 0;
		var form = $(id);
		if(TGN.SM.ClearedValues == null) return;
		var vArr = TGN.SM.ClearedValues;
		if(form != null) {
			var alltags = form.getElementsByTagName("INPUT");
			for(i=0, l=alltags.length; i < l; i++){  
				if(alltags[i].type == "checkbox" && vArr[alltags[i].id] != 'undefined') {
					alltags[i].checked = TGN.SM.ClearedValues[alltags[i].id];
				}
				else if(alltags[i].type == "text" && vArr[alltags[i].id] != 'undefined' && alltags[i].className.indexOf("field") >= 0 ) 
				{
					alltags[i].value = TGN.SM.ClearedValues[alltags[i].id];
				}
				else if(alltags[i].type == "hidden" && vArr[alltags[i].id] != 'undefined')
				{
					if(alltags[i].className.indexOf("clear") >= 0) {
						alltags[i].value =  TGN.SM.ClearedValues[alltags[i].id];
					}
				}
			}

			alltags = form.getElementsByTagName("SELECT");
			for(i=0, l=alltags.length; i < l; i++){
				if (alltags[i].name=='ne' || vArr[alltags[i].id] != 'undefined')
					continue;

				alltags[i].selectedIndex = TGN.SM.ClearedValues[alltags[i].id];
			}	
		}
	};
	TGN.SM.Clear = function(id, clearValue, showConfirm, togExtCB ) {
		var i = 0;
		var l = 0;
		if(clearValue == null) clearValue = "";//default is to clear the fields with empty
		if(togExtCB == null) togExtCB = true;
		var form = $(id);
		if(form != null) {
			if(showConfirm == null || confirm(showConfirm)) {
				var alltags = form.getElementsByTagName("INPUT");
				for(i=0, l=alltags.length; i < l; i++){  
					if(alltags[i].type == "checkbox" && togExtCB) {
						if(alltags[i].id.indexOf("catBucket") < 0) {
							alltags[i].checked = false;
						}
					}
					else if(alltags[i].type == "text" && alltags[i].className.indexOf("field") >= 0 ) {
						alltags[i].value = clearValue;
					}
					else if(alltags[i].type == "hidden")
					{
						if(alltags[i].className.indexOf("clear") >= 0) {
							alltags[i].value = "";
						}
					}
				}

				alltags = form.getElementsByTagName("SELECT");
				for(i=0, l=alltags.length; i < l; i++){
				    if (alltags[i].name=='ne')
				        continue;
					alltags[i].selectedIndex = 0;
				}
			}
		}
	};
	TGN.SM.TrackTemplate = function(isNew, isAdv) {
		var omniT=s_gi(s_account);
		var adv = "Simple";
		if(isAdv)
		{
			adv = "Advanced";
		}

		var level = "unknown";
		if(typeof TGN.Ancestry.Search.SearchInfo != 'undefined') {
			if(typeof TGN.Ancestry.Search.SearchInfo.pageType != 'undefined') {
				level = TGN.Ancestry.Search.SearchInfo.pageType;
			}
		}

		var pName = "Search:RForm:"+level+":"+adv;
		if(isNew) {
			pName = "Search:RForm:"+level+":"+adv;
		}

		s_pageName = pName;

		/*jsl:ignore*/
		void(omniT.t());
		/*jsl:end*/
	};
	TGN.SM.ToggleSearchCat = function(qString,isGlobal) {
		TGN.SM.HideNewSearch();
		TGN.SM.ShowNewSearch(qString, isGlobal, false, true);
	};
	TGN.SM.SubmitForm = function(id, btn, txt, adv, isTop){
		if(typeof isTop == 'undefined') {
			var b = $(btn);
			b.focus();
		}
		//allows a chance for any outstanding events to complete before inspecting the form for submission - team 42143
		setTimeout("TGN.SM.SubmitFormNow('"+id+"','"+btn+"','"+txt+"','"+adv+"')", 1);
	};
	TGN.SM.SubmitFormNow = function(id, btn, txt, adv) {
		var i = 0;
		var l = 0;
		//Search Buttons
		var b = $(btn);
		b.className = b.className + ' disabled';
		var topBtn = $("top_"+btn);
		if(topBtn != null) {
			topBtn.className = topBtn.className + ' disabled';
		}

		//Search Button Text
		$(txt).innerHTML = TGN.I18N.getTrans("Searching"); //'Searching...';
		var tSearchTxt = $("top_"+txt);
		if(tSearchTxt != null) {
			tSearchTxt.innerHTML = TGN.I18N.getTrans("Searching"); //'Searching...';
		}

		var form = $(id);
		//Validation code added here
		
		var advHidden = $(adv);
		var isAdv = false;
		var advClass = "SM_advOpt";
		if(advHidden != null && (advHidden.value == "1" || advHidden.value == "2")) 
		{	
			advClass = "SM_regOpt"; 
			isAdv = true;
		}

		//create form and only add those elements that should be
		//submitted to it.  (Lose empty values and hidden input elements)	
		var subForm = document.createElement("form");   
		subForm.setAttribute("method", "GET");
		subForm.setAttribute("action", form.action);
		
		alltags = form.getElementsByTagName("INPUT");
		var kv;
		for(i=0, l=alltags.length; i < l; i++){         
			if(    alltags[i].className.indexOf(advClass) > -1 || alltags[i].name == null || alltags[i].value == null || alltags[i].name == '' || alltags[i].value == '' ) 
			{   
				continue;   
			}
			if(alltags[i].type == "checkbox" || alltags[i].type == "radio") {
				if(alltags[i].checked){
					kv = TGN.SM.cFormEl(alltags[i].name,alltags[i].value);
					kv.checked = alltags[i].checked;
					subForm.appendChild(kv);
				}
			}
			else if (alltags[i].type == "hidden"){
				//clears the hidden exact cb values when query isn't an advanced query
				if(!isAdv && (alltags[i].name.indexOf("_x") + 2) == alltags[i].name.length)
				{
					if(alltags[i].className.indexOf("SM_DND") <= -1)
						continue;
				}
				kv = TGN.SM.cFormEl(alltags[i].name, alltags[i].value);
				subForm.appendChild(kv);
			}
			else {
				//Needed for IE7
				if( !isAdv && (alltags[i].name == 'gsfn' || alltags[i].name == 'gsln' ) && TGN.SearchWidget.NameChanged > 0) 
				{
					continue;	
				}

				kv = TGN.SM.cFormEl(alltags[i].name, alltags[i].value);
				subForm.appendChild(kv);
			}
		}
		
		alltags = form.getElementsByTagName("SELECT");
		for(i=0, l=alltags.length; i < l; i++){
			if(alltags[i].className.indexOf(advClass) > -1) {
				continue;
			}
			else if (alltags[i].value != ''){
				kv = TGN.SM.cFormEl(alltags[i].name, alltags[i].value);
				subForm.appendChild(kv);
			}
		}
		
		document.body.appendChild(subForm);
		subForm.submit();
		return false;
	};
	TGN.SM.RegSubmit = function(formId, submitFunc) 
	{
		var tElm = document.getElementById(formId);
		if(tElm != null) {

			var subMeth = function(e) {
				if(typeof e != 'undefined') {
					if (e.keyCode == 13) {
						submitFunc();
					}
				}
			};

			for(var i = 0; i < tElm.length; i++) {
				if(tElm[i].type == "text") {
					YAHOO.util.Event.addListener(tElm[i], 'keydown', subMeth);
				}
			}
		}
	};
	TGN.SM.ShowWaitMessage = function(msg){
		if (typeof TGN.SM.WaitPanel == 'undefined' || TGN.SM.WaitPanel == null){
			var div = document.createElement('div');
			div.setAttribute('id','waitPanel');
			document.body.appendChild(div);

			TGN.SM.WaitPanel = new YAHOO.widget.Panel('waitPanel',{
				close: false,
				draggable: false,
				modal: true,
				visible: true,
				width: 200,
				underlay:'none',
				zIndex:101});
			TGN.SM.WaitPanel.setBody(msg);
			TGN.SM.WaitPanel.render(document.body);
		}
		TGN.SM.PositionAndShow(TGN.SM.WaitPanel);
	};
	TGN.SM.TreeLoadingFader = null;
	TGN.SM.ShowTreeLoading = function(id,cache){
		if(typeof TGN.SM.TreeWaitPanel == 'undefined' || TGN.SM.TreeWaitPanel == null){
			var sTemp = $(id);
			if(sTemp != null){
				TGN.SM.TreeLoadingFader = new YAHOO.util.Anim(id, {opacity: {to:0.1}},3,YAHOO.util.Easing.easeOut);
				TGN.SM.TreeLoadingFader.onComplete.subscribe(function() { 
					sTemp.style.opacity = 1; 
					if(sTemp.style.filter != null) sTemp.style.filter = '';
				});
				TGN.SM.TreeLoadingFader.animate();

				var div = document.createElement('div');
				div.setAttribute('id','treeWaitPanel');
				sTemp.appendChild(div);
				YAHOO.util.Dom.setXY(div,YAHOO.util.Dom.getXY(sTemp));

				TGN.SearchWidget.TreeLoadingPanel = new YAHOO.widget.Panel('treeWaitPanel',
					  {constrainttoviewport: true, close:false, underlay:'none', visible:true, draggable:false} ); 
				TGN.SearchWidget.TreeLoadingPanel.setBody("<img src='" + cache + "/css/search/i/Loading32.gif' /><span class='loadingMsg'>" + TGN.I18N.getTrans("loadingMsg") + "</span>");
				TGN.SearchWidget.TreeLoadingPanel.render();
			}
		}
	};
	TGN.SM.HideWaitMessage = function(){
		if (typeof TGN.SM.WaitPanel != 'undefined' && TGN.SM.WaitPanel != null){
			TGN.SM.WaitPanel.hide();
		}
	};
	TGN.SM.ShowMore = function(id, linkId){
		var div = $(id);
		var link = $(linkId);
		if(div != null) div.style.display = 'block';
		if(link != null) link.style.display = 'none';
	};
	TGN.SM.ShowSearchPanel = function(){
		TGN.SM.PositionAndShow(TGN.SM.NewSearchPanel);
		TGN.SM.HideWaitMessage();
		TGN.SM.FocusFirstInput('newT_search-form');
	};
	TGN.SM.PositionAndShow = function(p){
		var x = $D.getDocumentScrollLeft() + (($D.getViewportWidth() -  p.element.offsetWidth) / 2);
		if (x < 10)
			x=10;
		var y = $D.getDocumentScrollTop()+50;
		p.cfg.setProperty("zIndex", 201);
		p.cfg.setProperty("x", x);
		p.cfg.setProperty("y", y);
		p.show();
	};
	TGN.SM.SetACZ = function(div,TopZ) {
		if (YAHOO.env.ua.ie > 5 && YAHOO.env.ua.ie <= 7) {
			var locA = YAHOO.util.Dom.getElementsByClassName('yui-ac','div',div);
			if(document.styleSheets && document.styleSheets.length > 0) {
				var styleNode = document.styleSheets[0];
				if(typeof(styleNode.addRule) == "object") {
					for(var i = 0; i < locA.length; i++) {
						if(locA[i].id != null && locA[i].id != ""){
								styleNode.addRule("#"+locA[i].id, "z-index:"+TopZ);
								styleNode.addRule("#"+locA[i].id+ " .yui-ac-content", "z-index:"+TopZ--);
								styleNode.addRule("#"+locA[i].id+ " .yui-ac-shadow", "z-index:"+TopZ--);
						}
					}
				}
			}
		}
	};
	TGN.SM.HandleSuccess = function(o){
		if (typeof TGN.SM.NewSearchPanel == 'undefined' || TGN.SM.NewSearchPanel == null){
			if(o.responseText != 'undefined'){
				var div = document.createElement('div');
				div.setAttribute('id','newSearch');
				//IE likes to have the element appended to the DOM first before executing
				//scripts that are added via innerHTML assignment.  Everyone doesn't like.
				if (YAHOO.env.ua.ie > 5 && YAHOO.env.ua.ie <= 7) {
					document.body.appendChild(div);
					div.innerHTML += o.responseText;
					//IE doesn't parse css declarations consistantly
					//	TGN.SM.SetACZ(div,150);
				} 
				else {
					div.innerHTML += o.responseText;
					document.body.appendChild(div);
				}
				TGN.SM.NewSearchPanel = new YAHOO.widget.Panel('newT_search-form',{
					close: true,
					draggable: true,
					modal: true,
					visible: true,
					width: 450,
					underlay:'none',
					effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.1}});

				TGN.SM.NewSearchPanel.cfg.getProperty("strings").close = " ";
				//need to do it here becuase visible=true does not fire a show event	
				if(typeof TGN.KeyWatcher != 'undefined') {
					TGN.KeyWatcher.disable();
					TGN.KeyWatcher.lockState();
				}
				TGN.SM.NewSearchPanel.hideEvent.subscribe(function() {
					if(typeof TGN.KeyWatcher != 'undefined') {
						TGN.KeyWatcher.unlockState();
						TGN.KeyWatcher.enable();
					}
				});	   
				TGN.SM.NewSearchPanel.showEvent.subscribe(function() {
					if(typeof TGN.KeyWatcher != 'undefined') {
						TGN.KeyWatcher.disable();
						TGN.KeyWatcher.lockState();
					}
				});

				TGN.SM.NewSearchPanel.element.className+=' modal';
				var p=$('newT_search-form');
				p.className = p.className.replace(' yui-panel', '');
				TGN.SM.NewSearchPanel.render(document.body);

				$('newT_mod-search').innerHTML += "<span class='lnk-cancel'>&nbsp;" + TGN.I18N.getTrans("or") +"&nbsp;<a href='javascript:TGN.SM.HideNewSearch();'>" + TGN.I18N.getTrans("newSearchCancel") + "</a></span>";
				if(o.argument[0] == 'clear'){
					TGN.SM.Clear('newT_search-form');
				}

				TGN.SM.ShowSearchPanel();

				if (YAHOO.env.ua.ie <= 7) {
					var closerF = function(divN, clZ) { return function() { TGN.SM.SetACZ(divN,clZ); }; };
					setTimeout(closerF(TGN.SM.NewSearchPanel.element,150), 1);
				}
			}
		}
		else{
			TGN.SM.ShowSearchPanel();
		}
	};
	TGN.SM.HandleFailure = function(o){
		document.location.href = '/';
	};
	TGN.SM.ShowNewSearch = function(qString, isGlobalLevel, alwaysRefreshFlg, keepFormPop){
		if(typeof isGlobalLevel == 'undefined') isGlobalLevel = true;

		// Added new var to force refresh of overlay everytime.
		if(typeof alwaysRefreshFlg == 'undefined') alwaysRefreshFlg = false;

		if(qString == null) qString = '';

		if(typeof TGN.SM.NewSAdvT == 'undefined') TGN.SM.NewSAdvT = 0;
		var rTemplate = TGN.SM.NewSAdvT;
		if(isGlobalLevel) { 
			TGN.SM.NewSAdvT= 1;
		}
		else TGN.SM.NewSAdvT = 2;

		// In case, always refresh flg is set, and newSearchPanel exists, change rTemplate to force destroying of newSearchPanel.
		if (alwaysRefreshFlg && typeof TGN.SM.NewSearchPanel != 'undefined')
			rTemplate	 = TGN.SM.NewSAdvT + 1;

		if(rTemplate != 0 && rTemplate != TGN.SM.NewSAdvT){
			//clean up the last template out of the DOM
			TGN.SM.NewSearchPanel.destroy();
			if(TGN.SM.WaitPanel != null) TGN.SM.WaitPanel.destroy();
			TGN.SM.NewSearchPanel = null;
			TGN.SM.WaitPanel = null;
		}
		if (typeof TGN.SM.NewSearchPanel == 'undefined' || TGN.SM.NewSAdvT != rTemplate || alwaysRefreshFlg){
			if (YAHOO.env.ua.ie > 5 && YAHOO.env.ua.ie <= 7) TGN.SM.ShowWaitMessage(TGN.I18N.getTrans("Loading"));

			var clear = 'clear';
			if(typeof keepFormPop != 'undefined' && keepFormPop)
				clear = 'keep';

			setTimeout("YAHOO.util.Connect.asyncRequest('GET', '/Mercury/Pages/AJAX/DefaultSearchTemplate.aspx"+qString.replace(/'/g, "&#39;")+"', {success: TGN.SM.HandleSuccess, argument:['" + clear + "'], failure: TGN.SM.HandleFailure})",1);
		}
		else {
			TGN.SM.ShowSearchPanel();
		}
	};
	TGN.SM.HideNewSearch = function(){
		if (typeof TGN.SM.NewSearchPanel != 'undefined')
			TGN.SM.NewSearchPanel.hide();
		TGN.SM.HideWaitMessage();
	};

/* Refine Search Rewrite */
	TGN.SM.HideRefineSearch = function(){
		if(typeof TGN.SM.RefineSearchPanel != 'undefined'){
			TGN.SM.RefineSearchPanel.hide();
		}
		TGN.SM.HideWaitMessage();
	};
	TGN.SM.InitRefineSearch = function() {
		TGN.SM.RefineSearchPanel = new YAHOO.widget.Panel('refineT_search-form',{
			close: true,
			draggable: true,
			modal: true,
			visible: false,
			width: 450,
			underlay:'none'});

		TGN.SM.RefineSearchPanel.cfg.getProperty("strings").close = " ";
		TGN.SM.RefineSearchPanel.hideEvent.subscribe(function() {
			if(typeof TGN.KeyWatcher != 'undefined') {
				TGN.KeyWatcher.unlockState();
				TGN.KeyWatcher.enable();
			}
		});	   
		TGN.SM.RefineSearchPanel.showEvent.subscribe(function() {
			if(typeof TGN.KeyWatcher != 'undefined') {
				TGN.KeyWatcher.disable();
				TGN.KeyWatcher.lockState();
			}
		});

		TGN.SM.RefineSearchPanel.element.className+=' modal';
		var p=$('refineT_search-form');
		p.className = p.className.replace(' yui-panel', '');
		
		TGN.SM.RefineSearchPanel.render(document.body);
		$('refineT_mod-search').innerHTML += "<span class='lnk-cancel'>&nbsp;" + TGN.I18N.getTrans("or") +"&nbsp;<a href='javascript:TGN.SM.HideRefineSearch();'>" + TGN.I18N.getTrans("newSearchCancel") + "</a></span>";
	};
	TGN.SM.LoadModTemplate = function(o) {
		var div = $('ModTemplateStore');
		if(div != null) {
			if(o.responseText != 'undefined'){

				if (YAHOO.env.ua.ie > 5 && YAHOO.env.ua.ie <= 7) {
					div.innerHTML += o.responseText;
					//Directly apply zindex styles after they have been fully parsed into the dom.
					//Inline style declarations are ignored by the tard browsers 
					//TGN.SM.SetACZ(div,150);
				}
				else {
					var ffdiv = document.createElement('div');
					ffdiv.innerHTML += o.responseText;
					div.appendChild(ffdiv);
				}

				if(typeof TGN.KeyWatcher != 'undefined') {
					TGN.KeyWatcher.addListeners();
				}

				if(o.argument[0] == 'refine') {
					TGN.SM.InitRefineSearch();
					TGN.SM.PositionAndShow(TGN.SM.RefineSearchPanel, o.argument[1]+'_search-form');
					TGN.SM.ShowMore('more_'+o.argument[1],'moreLink_'+o.argument[1]);
				}
				else {
					var it = 0;
					//TGN.SM.InitRefineSearch();
					//TGN.SM.PositionAndShow(TGN.SM.NewSearchPanel, o.argument[1]+'_search-form');
				}
				if(o.argument[2] == true){
					TGN.SM.ClearAndSave(o.argument[1]+"_search-form");
				}

				if (YAHOO.env.ua.ie == 7) {
					var closerF = function(divN, clZ) { return function() { TGN.SM.SetACZ(divN,clZ); }; };
					setTimeout(closerF(TGN.SM.RefineSearchPanel.element,150), 1);
				}
			}
		}
	};
	TGN.SM.ShowRefineLock = true;
	TGN.SM.ShowRefineSearchT = function(clearIt){
		if(clearIt) {
			TGN.SM.ShowRefineSearchImpl('true');
		}
		else {
			TGN.SM.ShowRefineSearchImpl('false');
		}
	};
	TGN.SM.ShowRefineSearch = function(evt, keypress){
		var clearP = 'false';
		if(typeof keypress != 'undefined' && keypress[1].keyCode == 78) {
			clearP = 'true';	
		}
		TGN.SM.ShowRefineSearchImpl(clearP);
	};
	TGN.SM.ShowRefineSearchImpl = function(clearP){
		if(!TGN.SM.ShowRefineLock) return;
		else {TGN.SM.ShowRefineLock = false; }

		if(typeof TGN.KeyWatcher != 'undefined') {
			TGN.KeyWatcher.disable();
		}

		var advHidden = $("refineT_msAV");
		var isAdv = false;
		if(advHidden != null && (advHidden.value == "1" || advHidden.value == "2")) 
		{	
			isAdv = true;
		}
		//don't want to slow the show template for sake of tracking, do this after
		setTimeout(function() { TGN.SM.TrackTemplate(clearP, isAdv); }, 10);

		//check for Template cached on page. 
		var qString = document.location.search;
		var Tcache = $("ModTemplateStore");
		if(Tcache != null){
			if(typeof TGN.SM.RefineSearchPanel != 'undefined') {

				TGN.SM.PositionAndShow(TGN.SM.RefineSearchPanel);
				TGN.SM.ShowMore('more_refineT','moreLink_refineT');
				if(clearP == 'true') { 
					TGN.SM.ClearAndSave('refineT_search-form');
					//TGN.SM.Clear('refineT_search-form');
				}
				else {
					TGN.SM.RestoreClear('refineT_search-form');
				}
			}
			else {
				setTimeout("YAHOO.util.Connect.asyncRequest('GET', '/Mercury/Pages/AJAX/DefaultSearchTemplate.aspx"+qString.replace(/'/g, "&#39;")+"&tDomId=refineT', {success: TGN.SM.LoadModTemplate, argument:['refine','refineT',"+clearP+"], failure: TGN.SM.HandleFailure})",1);
			}
		}
		if(typeof TGN.KeyWatcher != 'undefined') {
			TGN.KeyWatcher.enable();
		}

		TGN.SM.ShowRefineLock = true;
	};
/* Refine Search Rewrite done */

	TGN.SM.getStyle = function(el,prop){
		return null;
	};
	if (document.body.currentStyle)
		TGN.SM.getStyle = function(el,prop){
			return el.currentStyle[prop];
		};
	else if (window.getComputedStyle)
		TGN.SM.getStyle = function(el,prop){
			return document.defaultView.getComputedStyle(el,null).getPropertyValue(prop);
		};
	TGN.SM.FocusFirstInput = function(root){
		try {
			var el = $(root).getElementsByTagName('input');
			var t=null;
			for (var i = 0, l = el.length; i < l; i++) {
				t=el[i].type;
				if (!el[i].disabled && !el[i].readOnly && ('text'==t || 'password'==t)) {
					if(TGN.SM.isDisplayed(el[i])){
						var fEl = $(el[i].id);
						if(fEl.value != null && fEl.value == ""){
							setTimeout(function(){if(fEl.value == '')try{fEl.focus();}catch(e){}},1);
						}
						break;

					}
				}
			}
		} catch (e) { }
	};
	TGN.SM.isDisplayed = function(el) {
		var frm=el.form;
		while(el!= frm) {
			if(TGN.SM.getStyle(el,"display")=="none" || TGN.SM.getStyle(el,"visibility")=="hidden")
				return false;
			else
				el=el.parentNode;
		}
		return true;
	};
//SM Static Methods done

TGN.SM.GetHitReason = function(type){
	switch(type)
	{
	case "exact":
		return " matched exactly.";
		break;
	case "wildcard":
		return " matched a specified wildcard.";
		break;
	case "normalized":
		return " matched because of a normalized name match or a place authority lookup match.";
		break;
	case "initial":
		return " matched because the first letter of a specified name matches this initial.";
		break;
	case "soundex":
		return " matched based on Soundex which matches mispelled names or names that sound similar when pronounced (e.g. Smith, Smyth, and Smythe all sound alike).";
		break;
	case "proximity":
		return " matched because it was close to a date or location specified.";
		break;
	case "range":
		return " matched because it was within a range of dates, numbers, or text strings.";
		break;
	case "county":
		return " matched because the location specified does not correspond exactly but is contained within the same county.";
		break;
	case "state":
		return " matched because the location specified does not correspond exactly but is contained within the same state.";
		break;
	case "country":
		return " matched because the location specified does not correspond exactly but is contained within the same country.";
		break;
	default:
		break;
	}
	return "";
};
TGN.SM.GetHitShortReason = function(type){
	switch(type)
	{
	case "exact":
		return " matched exactly.";
		break;
	case "wildcard":
		return " matched a wildcard.";
		break;
	case "normalized":
		return " matched a normalized name or place.";
		break;
	case "initial":
		return " matched first letter of a name.";
		break;
	case "soundex":
		return " matched based on Soundex.";
		break;
	case "proximity":
		return " matched by proximity.";
		break;
	case "range":
		return " matched range of dates, numbers, or text strings.";
		break;
	case "county":
		return " matched because location is contained within the same county.";
		break;
	case "state":
		return " matched because location but is contained within the same state.";
		break;
	case "country":
		return " matched because location is contained within the same country.";
		break;
	default:
		break;
	}
	return "";
};
TGN.SM.HideRecordHits = function(){
	if (null != TGN.SM.HitDetailPanel){
		TGN.SM.HitDetailPanel.hide();
		TGN.SM.HitDetailPanel.destroy();
		TGN.SM.HitDetailPanel = null;
	}
};
TGN.SM.IndivRecCallback = {
// Callback object with success and failure members defined inline.
	success: function(o) {
		//success handler code
		var rXml = o.responseXML;
		var lbl, val;
		if(rXml != undefined){
			var fields = rXml.selectNodes("/response/record/field");
			for (var i = 0, l = fields.length; i < l; i++)
			{
				lbl = TGN.SM.GetText(fields[i].childNodes[0]);
				if (lbl != "DBTitle" && lbl != "ImageID")
				{
					val = TGN.SM.GetText(fields[i].childNodes[1]);
				}
			}
		}

	},
	failure: function(o) {/*failure handler code*/debugger;},
	argument: []
};
TGN.SM.ShowRecordHits = function(){
		var div = document.createElement('div');
		div.setAttribute('id','HitDetail');
		document.body.appendChild(div);
		var hitWid = 450;
		var hr='<table  border="0" cellpadding="0" cellspacing="0" class="srchTerms">';
		var ob = document.getElementById('searchDescCategory');
		if (null != ob)
			hr+='<tr><td>' + 'Category:' + '</td><td>' + TGN.SM.GetText(ob) + '</td></tr>';
		var ids = ['Name','Birth','Death','FamilyMembers','Migration','MilitaryService','Marriage','Other'];
		for (j in ids)
		{
			ob = document.getElementById('refine_'+ids[j]+'_mod');
			if (undefined != ob)
			{
				var lbls = ob.getElementsByTagName('strong');
				var spans = ob.getElementsByTagName('span');
				if (spans.length > 0)
				{
					var txt = TGN.SM.GetText(spans[0]);
					if (txt != null && txt.length > 0)
						hr+='<tr><td>' + TGN.SM.GetText(lbls[0]) + '</td><td>' + txt + '</td></tr>';
				}
			}
		}
		hr += '</table>';
		
		var record = $D.getAncestorByClassName(this, 'record');
		if (null != record)
		{
			var hov = $D.getElementsByClassName('srchFoundDB', 'span', record);
			if (hov.length > 0)
			{
				var hovHtml = hov[0].parentNode.innerHTML;
				var start = hovHtml.indexOf("showIndiv2(");
				if (start != -1)
				{
					start += 11;
					var end = hovHtml.indexOf(")", start);
					if (end != -1)
					{
						// params[0] = theEvent
						// params[1] =  theDB
						// params[2] =  theRec
						// params[3] =  headerTxt
						// params[4] =  subDb
						// params[5] =  iid
						// params[6] =  rc
						// params[7] =  xtraQSParam
						// params[9] =  noHover
						var params = hovHtml.slice(start, end).replace(/'/g, "").split(",");
						var ajUrl = "/Mercury/Pages/Ajax/IndivRec.aspx?IndivAjax=1&recid="+params[2]+"&db="+params[1]+"&output=xml&Use302Redirect=t";

						if(params[4]) ajUrl += "&noSub=1";
						if( params[9] ) ajUrl += "&NonHover=1";

						if(params[5] != null && params[6] != null)
							ajUrl += "&iid=" + params[5] + "&rc="+ params[6];

						if( params[7] != null) ajUrl += "&" + params[7];
						var transaction = YAHOO.util.Connect.asyncRequest('GET', ajUrl, TGN.SM.IndivRecCallback, null);  		

					}
				}
			}
			hr += '<div id="results"><div id="results-main"><table  border="0" cellpadding="0" cellspacing="0" class="s_gsResults">' + record.innerHTML + '</table></div></div><div id="hitIndiv"></div><br />';
			hitWid = record.offsetWidth + 52;
		}
		hr += TGN.SM.HitReason(this);
		hr += '<br /><a class="closeBtn btn btn-cta" href="javascript:TGN.SM.HideRecordHits()"><span>Close</span></a>';
		TGN.SM.HitDetailPanel = new YAHOO.widget.Panel('HitDetail',
		{
			close: true,
			draggable: true,
			modal: true,
			visible: true,
			width: hitWid,
			underlay:'none',
			effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.5}
		} );
		TGN.SM.HitDetailPanel.setHeader("<h3>Why Am I Seeing This Record?</h3>");
		TGN.SM.HitDetailPanel.setBody(hr);
		TGN.SM.HitDetailPanel.render(document.body);
		
		TGN.SM.PositionAndShow(TGN.SM.HitDetailPanel);

};
TGN.SM.HitReason = function(star){
	var hr="";
	var reasons=star.getElementsByTagName("hlt");
	if (reasons.length != 0){
		hr="This record is dispayed as a match for your search because the following items matched exactly or were considered similar to the terms you specified:<ul>";
		for(var r=0, l=reasons.length; r < l; r++){
			var att = reasons[r].attributes;
			hr+="<li>\"<strong>"+att['match'].nodeValue+"</strong>\" was found "+att['count'].nodeValue+" times in this record and "+TGN.SM.GetHitReason(att['type'].nodeValue)+" Total score: "+att['score'].nodeValue+"</li>";
		}
		hr += "</ul>The overall score calculated for this record was " + star.getAttribute('score');
	}
	return hr;
};


TGN.SM.HitReasonTip = function(star){
	var hr="";
	var hlts=star.getElementsByTagName("hlt");
	if (hlts != null && hlts.length > 0){
		var reasons = [];
		for (var j = 0, l = hlts.length; j < l; j++)
		{
			var itype = 99;
			switch(hlts[j].getAttribute('type'))
			{
			case "exact":
				itype = 1;
				break;
			case "wildcard":
				itype = 2;
				break;
			case "normalized":
				itype = 3;
				break;
			case "initial":
				itype = 4;
				break;
			case "soundex":
				itype = 5;
				break;
			case "proximity":
				itype = 6;
				break;
			case "range":
				itype = 7;
				break;
			case "county":
				itype = 8;
				break;
			case "state":
				itype = 9;
				break;
			case "country":
				itype = 10;
				break;
			default:
				itype = 99;
				break;
			}
			hlts[j].setAttribute('itype', itype);
			reasons.push(hlts[j]);
		}
		reasons.sort(function(a,b){
			var at=a.getAttribute('itype');
			var bt=b.getAttribute('itype');
			if (at == bt)
				return b.getAttribute('score') - a.getAttribute('score');
				
			return at - bt;
			});
		var lastType = "";
		hr += "<ul>";
		for(var r in reasons){
			var att = reasons[r].attributes;
			var t = att['type'].nodeValue;
			var m = "\"<strong>"+att['match'].nodeValue+"</strong>\"";
			var c = att['count'].nodeValue != null ? 1*att['count'].nodeValue : 0;
			if (c > 1)
				m += " (" + c + " occurrences)";
			if (lastType == t)
			{
				var n = r*1;
				if (n == reasons.length - 1 || t != reasons[n + 1].getAttribute('type'))
					hr+=" and " + m;
				else
					hr+=", " + m;
			}
			else
			{
				if (r == 0)
					hr += "<li>" + m;
				else
					hr += TGN.SM.GetHitShortReason(lastType)+ "</li><li>" + m;
				lastType = t;
			}
		}
		hr += TGN.SM.GetHitShortReason(lastType) + "</li></ul><br />Click for detailed reasons.";
	}
	return hr;
};
TGN.SM.HitHighlightInit = function(){
	var records = YAHOO.util.Dom.getElementsByClassName("record", "tr", $("results-main"));
	var spanId=0, starId=0;
	var fieldTips=new Array();
	var recordTips=new Array();
	for (var r in records){
		var spans = records[r].getElementsByTagName("span");
		for (var s=0, l = spans.length; s < l; s++){
			if (spans[s].className.indexOf("stars") > -1){
				var star = spans[s];
				star.id = "star"+starId++;
				star.onclick=TGN.SM.ShowRecordHits;
				var reason=TGN.SM.HitReasonTip(star);
				if (reason.length > 0){
					star.title=reason;
					recordTips.push(star.id);
				}
			}
			if (spans[s].className.indexOf("srchMatch") > -1/* || spans[s].className.indexOf("srchHit") > -1*/)
			{
				spans[s].id = 'srchMatch' + spanId++;
				var hit = TGN.SM.GetText(spans[s]);
				//score – integer between 0 and 1000
//				var score = 0;
//				if (spans[s].getAttribute('score') != null)
//					Math.round((spans[s].getAttribute('score')*100)/1000);
//				//type – string indicating an exact match to a search term or an expanded match as below:
				var type = spans[s].getAttribute('type');
				if (type != null)
					spans[s].title = "<strong>" + hit + "</strong>" + TGN.SM.GetHitShortReason(type); //+ "  " + score + "%";
				fieldTips.push(spans[s].id);
			}
		}
	}
	if (fieldTips.length !=0){
		var fieldTT=new YAHOO.widget.Tooltip('matchFieldTips',{appendtodocumentbody:true,context:fieldTips,width:'300px',autodismissdelay:10000,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.2}});
		fieldTT.element.className+=' alert';
		//fieldTT.setHeader('<h5>How Did This Match?</h5>');
	}
	if (recordTips.length !=0){
		var recordTT=new YAHOO.widget.Tooltip('whyMatchTip',{appendtodocumentbody:true,context:recordTips,width:'300px',autodismissdelay:15000,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.2}});
		recordTT.element.className+=' alert';
		recordTT.setHeader('<h5>Why Am I Seeing This Record?</h5>');
	}
};
TGN.SM.GetText = function(el)
{
	if (el.innerText != undefined)
		return el.innerText;
	if (el.textContent != undefined)
		return el.textContent;
	if (el.innerHtml != undefined)
		return el.innerHtml;
	return null;
};
TGN.SM.SetText = function(el, txt)
{
	if (el.innerText != undefined)
		el.innerText = txt;
	if (el.textContent != undefined)
		el.textContent = txt;
};
//YAHOO.util.Event.on(window, 'load', TGN.SM.HitHighlightInit);
//

/***************************************/
/* BEG Merge browseDate.js information */
/***************************************/

TGN.Search.BrowseDate.Calendar = function (Month,Year)
{
	var output = '';
	output += '<div id="browse_body"><table width="408" id="calendar"><tr align="center" valign="top">';
	output += '<td height="30" colspan="7"><nobr><select id="Month" name="Month" onchange="TGN.Search.BrowseDate.changeMonth();">';
	var monthIndex = 0;
	for (im = 0; im < availMonths[Year].length; im++) 
	{
		if (availMonths[Year][im] == Month)
		{
			output += '<option value="' + availMonths[Year][im] + '" SELECTED>' + monthNames[availMonths[Year][im]-1] + '<\/option>';
			monthIndex = im;
		}
		else
			output += '<option value="' + availMonths[Year][im] + '">' + monthNames[availMonths[Year][im]-1] + '<\/option>';  
	}
	output += '<\/select>&nbsp;&nbsp;<select ID="Year" NAME="Year" onChange="TGN.Search.BrowseDate.changeYear();">';
	for(iy = 0; iy < years.length; iy++)
	{
		if (years[iy] == Year)
			output += '<option value="' + years[iy] + '" SELECTED>' + years[iy] + '<\/option>';
		else
			output += '<option value="' + years[iy] + '">'          + years[iy] + '<\/option>';
	}
	output += '<\/select></nobr><\/td><\/tr>';
	firstDay = new Date(Year,Month-1,1);
	startDay = firstDay.getDay();
	if (((Year % 4 == 0) && (Year % 100 != 0)) || (Year % 400 == 0))
		browseDateDays[1] = 29;
	else
		browseDateDays[1] = 28;
	output += '<tr id="days">';
	for (i=0; i<7; i++)
		output += '<td>' + dow[i] +'<\/td>';
	output += '<\/tr><tr class="week">';
	var column = 0;
	for (i=0; i<startDay; i++, column++)
		output += '<td class="blank">&nbsp;<\/td>';
	for (i=1; i<=browseDateDays[Month-1]; i++, column++) 
	{
		if(availDays[Year][monthIndex] & (1 << (i-1)))
			output += '<td><a href="javascript:TGN.Search.BrowseDate.submitDay(\'' + dbid + '\',' + i + ',' + Month + ',' + Year + ')">' + i + '<\/a><\/td>';
		else
			output += '<td class="blank">' + i + '<\/td>';
		if (column == 6 && i != browseDateDays[Month-1]) 
		{
			output += '<\/tr><tr class="week">';
			column = -1;  
		} 
	}
	if (column > 0) 
	{
		for (i=1; column<7; i++, column++)
			output +=  '<td class="blank">&nbsp;<\/td>';
	}
	output += '<\/tr><\/table></div>';
	return output;
};

TGN.Search.BrowseDate.submitDay = function (id,day,month,year)
{
    TGN.Search.BrowseDate.submitFromCalendar(day, month, year);
    setDictionaryCookie("BROWSES", 'bm', month, null, null);
    setDictionaryCookie("BROWSES", 'by', year, null, null);
};

TGN.Search.BrowseDate.submitFromCalendar = function(day,month,year)
{
	document.location = "/Browse/view.aspx?dbid=" + dbid + "&path=" + year + "." + month + "." + day;
};

TGN.Search.BrowseDate.fnReplaceHtml = function (el, html) 
{
	var oldEl = YAHOO.util.Dom.get(el);
	
	if ('undefined' != typeof oldEl && null != oldEl) {
		var newEl = document.createElement(oldEl.nodeName);
		
		// Preserve the element's id and class (other properties are lost)
		newEl.id = oldEl.id;
		newEl.className = oldEl.className;

		// Replace the old with the new
		newEl.innerHTML = html;
		oldEl.parentNode.replaceChild(newEl, oldEl);

		/* Since we just removed the old element from the DOM, return a reference to the new element, which can be used to restore variable references. */
	}
	
	return newEl;
};

TGN.Search.BrowseDate.reload = function (month,year)
{
	var cs = YAHOO.util.Dom.get('CalendarSpot');
	var ca = TGN.Search.BrowseDate.Calendar(month,year);
	
    setDictionaryCookie("BROWSES", 'bm', month, null, null);
    setDictionaryCookie("BROWSES", 'by', year, null, null);
	
	TGN.Search.BrowseDate.fnReplaceHtml(cs, ca);
};

TGN.Search.BrowseDate.changeMonth = function ()
{
    var oMon = $("Month");
    var oYear = $("Year");
    var month = oMon.options[oMon.selectedIndex].value;
    var year = oYear.options[oYear.selectedIndex].value;
	TGN.Search.BrowseDate.reload(month,year);
	oMon.focus();
};

TGN.Search.BrowseDate.changeYear = function ()
{
    var oMon = $("Month");
    var oYear = $("Year");
    var month = oMon.options[oMon.selectedIndex].value;
    var year = oYear.options[oYear.selectedIndex].value;
	var bValidMonth = false;
	for(i = 0; i < availMonths[year].length; i++)
	{
		if(month == availMonths[year][i])
		{
			bValidMonth = true;
			break;
		}
	}
	if(!bValidMonth)
		month = availMonths[year][0];
	TGN.Search.BrowseDate.reload(month,year);
	oYear.focus();
};

TGN.Search.BrowseDate.buildCalendar = function ()
{
	var bd;
    var by = null;
    var bm = null;
    var path = getQueryStringParameter("path");
	if(null != path)
	{
		var parts = path.split('.');
		if(parts.length > 0 && parts[0].length == 4)
		{
			by = parts[0];
			if (parts.length > 1)
			    bm = parts[1];
			else
			    bm = availMonths[by][0];
		}
	}
	if (null == bm || null == by || null == availMonths[by]) {

	    by = getDictionaryCookie("BROWSES", "by");
	    bm = getDictionaryCookie("BROWSES", "bm");
	}

	if(null == bm || null == by || null == availMonths[by])
	{
		by = years[years.length-1];
		bm = availMonths[by][availMonths[by].length-1];
	}
	
	bd = TGN.Search.BrowseDate.Calendar(bm,by);
	TGN.Search.BrowseDate.fnReplaceHtml('CalendarSpot', bd);
};

var browseDateDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

/***************************************/
/* END Merge browseDate.js information */
/***************************************/

/* HoverTip.js */
//make sure namespaces are defined
if(typeof TGN=="undefined")
    var TGN={};

if(typeof TGN.Util=="undefined")
    TGN.Util={};


TGN.Util.HoverTip = function(){
    this.init();
};


TGN.Util.HoverTip.tipHideTimer=null;
TGN.Util.HoverTip.tipShowTimer=null;
TGN.Util.HoverTip.tipHideTimout=0;

//if it hasn't already been loaded load the the js file for getting and setting cookies
if(typeof setCookie=="undefined"){
    document.write("<script type='text/javascript' src='http://c.mfcreative.com/js/utility.js'> <\/script>");
}

TGN.Util.HoverTip.tip = null;


TGN.Util.HoverTip.prototype.init = function()
{
        this.panel =    new YAHOO.widget.Panel("div_hoverTip", {
					    fixedcenter: false,
						underlay: false,
						close: true,
						modal: false,
						visible: false,
						zIndex:1100,
						draggable: false
						//effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: .5}
					});

	    this.panel.setHeader(""); 
	    this.panel.setBody("");
	    this.panel.setFooter("");
	    this.panel.cfg.getProperty("strings").close = " ";
	    //Set the z-index at some big numbet to make sure it is always on top
	    this.panel.cfg.setProperty('zIndex', 1100);
	    this.panel.render(document.body);
	    document.getElementById("div_hoverTip").className="hovertip";
};
TGN.Util.HoverTip.CurrTip = null;
TGN.Util.HoverTip.prototype.show = function()
{
	//this was added as yui 2.7.0 panel steals focus.  We want to push focus back
	//to the origin of the message, but this can result in another onfocus event firing.
		if(TGN.Util.HoverTip.CurrTip != null && TGN.Util.HoverTip.CurrTip == this.elementId && this.panel.cfg.getProperty("visible"))
		{
			return;
		}
		TGN.Util.HoverTip.CurrTip = this.elementId;

        this.panel.setHeader("<h3>" + this.title + "</h3>"); 
        var tipHtml = "<div id=\"knub\"></div><div class=\"tl\"></div><div class=\"tr\"></div><div class=\"bl\"></div><div class=\"br\"></div><div id=\"tp_content\" class=\"content\">" + this.body + "</div>";
        this.panel.setBody(tipHtml);
        this.panel.cfg.setProperty('context',[this.elementId, this.tAlign, this.eAlign]);
        
        //perform any overrides here
        if(this.width > 0){
	        document.getElementById("div_hoverTip").style.width = this.width + "px";
	        document.getElementById("tp_content").style.width = this.width - 26 + "px";
	        document.getElementById("tp_content").style.marginLeft = "-" + (this.width - 14) + "px";
	        document.getElementById("tp_content").style.paddingLeft = "6px";
	        document.getElementById("tp_content").style.paddingRight = "6px";
	        document.getElementById("tp_bd").style.marginLeft = this.width - 14 + "px";
	    }
	    
	    var knubId = "knub";
	    //if the tip is to be aligned to the right side of the element then switch the knub
	    if(this.tAlign[1] == 'r'){
	        var knub = document.getElementById(knubId);
	        knub.style.background = "url(i/tip_knub_r.png) no-repeat 0 0;";
	        //knubId = "knub_r";
	        var pos = YAHOO.util.Dom.getXY(this.elementId);
	        document.getElementById("div_hoverTip_c").style.left = (pos[0] - this.width - 30) + "px"; 
	    }
	    //make sure style on div is set to display, it is set to none by default to fix a problem in IE
	    document.getElementById("div_hoverTip").style.display = "block";

        // place the box at 80% of center and the nub also at 80% of center
        document.getElementById(knubId).style.top = (0.8*((document.getElementById("div_hoverTip").scrollHeight/2)-(23))) + "px";
        document.getElementById("div_hoverTip").style.top = (0.8*(0-((document.getElementById("div_hoverTip").scrollHeight/2)-(document.getElementById(this.elementId).scrollHeight/2))))+"px";
	    
		this.panel.show();
		var elSource = document.getElementById(this.elementId);
	    if( TGN.Util.HoverTip.tipHideTimout >= 0 && elSource.tagName == "INPUT" ) {
			//yui 2.7.0 panel steals focus.  We want to give focus back where it
			//came from, like a text box after its shown itself and stolen the focus for itself.	
			//needs time to be sure the panel has been rendered and shown
			function getDisFunc(elId) { 
				return (function() {
					TGN.Util.HoverTip.close(); 
					//document.getElementById("ModuleTemplate1_gsln").value += "2"; 
					YAHOO.util.Event.removeListener(elId, "blur"); 
				});
			}

			function delayHover(zPanel, myEl) {
				return (function() {
						document.getElementById(myEl).focus();
	    				YAHOO.util.Event.addListener(myEl, "blur", getDisFunc(myEl));
				});
			}
			setTimeout(delayHover(this.panel, this.elementId),100);
		}
};
TGN.Util.HoverTip.close = function(){
        if(null != TGN.Util.HoverTip.tip && null != TGN.Util.HoverTip.tip.panel && TGN.Util.HoverTip.tip.panel.cfg.getProperty("visible"))
            TGN.Util.HoverTip.tip.panel.hide();
};

/*Parameters:
    id : The id of the element of which the tip will be aligned to 
    type : The type of tip to be rendered, can be empty if no special requirements for the tip are needed
    body : The body of the tip
    title : The title of the tip
    eAlign : Element alignment if reference to the tip, possible values, "tl", "tr", "bl", "br" default is "tr"
    tAlign : Tip alignment in reference to the element, possible values, "tl", "tr", "bl", "br" default is "tl"
    width : This will override the width of the tip defined in css, width must be an integer
*/

TGN.Util.HoverTip.showHoverTip=function(id, type, body, title, eAlign, tAlign, width, hideTimeout, showTimeout)
{
    TGN.Util.HoverTip.stopHideHoverTipTimer(); 
    if(showTimeout!=null && typeof showTimeout == "number" && showTimeout > 0)
    {
        clearInterval(TGN.Util.HoverTip.tipShowTimer);
        TGN.Util.HoverTip.tipShowTimer = setInterval(function(){TGN.Util.HoverTip.showHoverTip(id,type,body,title,eAlign,tAlign,width,hideTimeout,0);}, showTimeout);
        return;
    }
    
    if(hideTimeout==null || typeof hideTimeout != "number" || hideTimeout < 1)
        hideTimeout = 0;
        
    if(TGN.Util.HoverTip.tip == null){
        TGN.Util.HoverTip.tip = new TGN.Util.HoverTip();
        if( hideTimeout > 0 )
        {
            YAHOO.util.Event.addListener(document.getElementById("div_hoverTip"), "mouseout", TGN.Util.HoverTip.startHideHoverTipTimer);
		}
		if( showTimeout > 0 ) 
		{
            YAHOO.util.Event.addListener(document.getElementById("div_hoverTip"), "mouseover", TGN.Util.HoverTip.stopHideHoverTipTimer);
        }
    }

    if( hideTimeout > 0 )
    {
        TGN.Util.HoverTip.tipHideTimout = hideTimeout;
    }
    //Set defaults if params are null or empty
    if(eAlign==null || typeof eAlign == "undefined" || eAlign.length < 1)
        eAlign = "tr";
    if(tAlign==null || typeof tAlign == "undefined" || tAlign.length < 1)
        tAlign = "tl";
    if(title==null || typeof title == "undefined" || title.length < 1)
        title = "Get Better Matches";
    if(width==null || typeof width == "undefined" || width < 1)
        width = 200;
        
    TGN.Util.HoverTip.tip.elementId = id;
    TGN.Util.HoverTip.tip.body = body;
    TGN.Util.HoverTip.tip.title = title;
    TGN.Util.HoverTip.tip.eAlign = eAlign;
    TGN.Util.HoverTip.tip.tAlign = tAlign;
    TGN.Util.HoverTip.tip.width = width;

    var cookieVal;
    if(type == "name" || type == "date" || type == "place")
    {
        //For name, date, place tips we want to set a cookie to only show them once
         cookieVal = getDictionaryCookie('hvt',type); 
         if(cookieVal == 1) return;
         //Set cookie to not show next time
         var exp = new Date();  
         exp.setFullYear(exp.getFullYear() + 20 ,0,14);
         setDictionaryCookie('hvt', type, 1, '', exp);   
    }
    else
    {
        cookieVal = getDictionaryCookie('hvt',type); 
        if(cookieVal == 1) return;
    }
    
    TGN.Util.HoverTip.tip.show();
};

TGN.Util.HoverTip.turnHoverTipsOn=function(){
    //This reason why I set the cookie here instead of just deleting the cookie is if we ever want to track
    //if the customers are turning the tips on and off
    var exp = new Date();  
    exp.setFullYear(exp.getFullYear() + 20 ,0,14);
    setDictionaryCookie('hvt', 'name', 0, '', exp);
    setDictionaryCookie('hvt', 'date', 0, '', exp);
    setDictionaryCookie('hvt', 'place', 0, '', exp);
};

TGN.Util.HoverTip.startHideHoverTipTimer=function(hideTimeout)
{
    if(hideTimeout==null || typeof hideTimeout != "number" || hideTimeout.length < 1)
        hideTimeout = TGN.Util.HoverTip.tipHideTimout;

    clearInterval(TGN.Util.HoverTip.tipHideTimer);
    clearInterval(TGN.Util.HoverTip.tipShowTimer);
    if(TGN.Util.HoverTip.tip!=null && typeof TGN.Util.HoverTip.tip != "undefined" )
    {
        TGN.Util.HoverTip.tipHideTimer = setInterval(TGN.Util.HoverTip.tip.close, hideTimeout);
    }
};

TGN.Util.HoverTip.HideKWTips = function()
{
   setDictionaryCookie('hvt', 'kw', 1, '', '');
   location.reload(true);   

};

TGN.Util.HoverTip.stopHideHoverTipTimer=function(){
    clearInterval(TGN.Util.HoverTip.tipHideTimer);
    clearInterval(TGN.Util.HoverTip.tipShowTimer);
};
document.write("<div id=\"div_hoverTip\" class=\"hovertip\" style=\"display:none\"><div id=\"tp_bd\" class=\"bd\"></div></div>");

/* hover2.js */
var $NS=YAHOO.namespace("hover");var active;var itemz=new Array;itemz[0]=document.getElementById("hover0");itemz[1]=document.getElementById("hover1");itemz[2]=document.getElementById("hover2");itemz[3]=document.getElementById("hover3");itemz[4]=document.getElementById("hover4");itemz[5]=document.getElementById("hover5");itemz[6]=document.getElementById("hover6");itemz[7]=document.getElementById("hover7");itemz[8]=document.getElementById("hover8");marqueeActive=!(typeof copyspeed=="undefined"||typeof marqueespeed=="undefined"||typeof pausespeed=="undefined");function logit(a){}function deactiv(){$NS.hoverbox.cfg.setProperty("zIndex",-10);$NS.hoverbox.cfg.setProperty("visible",false);if(marqueeActive){copyspeed=marqueespeed}}function activ(d,c){if($NS.hoverbox.cfg.getProperty("visible")==true){return}active=c.id;idx=c.id.charAt(c.id.length-1);hovername=document.getElementById("hoverName");i=hovName.indexOf("{0}");hovername.innerHTML=hovName.substring(0,i)+data[idx][0]+"<h3>"+data[idx][1]+"</h3>"+hovName.substring(i+3);hoverimg=document.getElementById("hoverImg");hoverimg.src=data[idx][2];hoverlink=document.getElementById("hoverLink");hoverlink.href=document.getElementById("ah"+idx).href;var a=YAHOO.util.Dom.getX(c)+c.offsetWidth+8;if(site=="de"||site=="it"){a=a-350-24-c.offsetWidth}else{a=a-15}var b=YAHOO.util.Dom.getY(c)-40;$NS.hoverbox.cfg.setProperty("xy",[a,b]);$NS.hoverbox.cfg.setProperty("visible",true);$NS.hoverbox.cfg.setProperty("zIndex",10);if(marqueeActive){copyspeed=pausespeed}YAHOO.util.Event.addListener(document,"mousemove",hmouse,c)}function hmouse(b,a){if(a.id!=active){return}if($NS.hoverbox.cfg.getProperty("visible")==true){mx=YAHOO.util.Event.getPageX(b);my=YAHOO.util.Event.getPageY(b);hx=$NS.hoverbox.cfg.getProperty("x");hy=$NS.hoverbox.cfg.getProperty("y");hw=document.getElementById("hoverbox").clientWidth;hh=document.getElementById("hoverbox").clientHeight;imgx=YAHOO.util.Dom.getX(a);imgy=YAHOO.util.Dom.getY(a);imgw=document.getElementById(a.id).clientWidth;imgh=document.getElementById(a.id).clientHeight;if((mx>=hx&&mx<=hx+hw+23&&my>=hy&&my<=hy+hh)||(mx>=imgx&&mx<=imgx+imgw&&my>=imgy&&my<=imgy+imgh)){foo=1}else{$NS.hoverbox.cfg.setProperty("visible",false);$NS.hoverbox.cfg.setProperty("zIndex",-10);YAHOO.util.Event.removeListener(window,"mousemove",hmouse);if(marqueeActive){copyspeed=marqueespeed}}}}for(i=0;i<=8;i++){YAHOO.util.Event.addListener(itemz[i],"mouseover",activ,itemz[i])}YAHOO.util.Event.addListener(window,"click",deactiv);$NS.hoverbox=new YAHOO.widget.Overlay("hoverbox",{visible:false,width:"350px",iframe:false,monitorresize:false,zIndex:-10});$NS.hoverbox.setHeader(header);$NS.hoverbox.setBody(body);$NS.hoverbox.setFooter(footer);var rendered=$NS.hoverbox.render(document.body);document.getElementById("hoverbox").style.position="absolute";