var Record;window.onload=gInitIndex;
function gInitIndex(){
	gInit();var c,e,a="",i=0;c=g_d.getElementsByTagName('DIV');
	for(i=0;i<c.length;i++){if(c[i].className=="pu"){fAL(c[i],'mouseover',res_fDMOVR,1);fAL(c[i],'mouseout',res_fDMOUT,1);}}
	c=g_d.getElementsByTagName("A");
	for(i=0;i<c.length;i++){e=c[i];a=e.className;if( (a=="resultitem" || a=="rie") && e.id){fAL(e,'mouseover',res_fDMOVR,1);fAL(e,'mouseout',res_fDMOUT,1);fAL(e,'click',res_fDMOUT,1);fAL(e,'focus',res_fDMOVR,1);fAL(e,'blur',res_fDMOUT,1);}}}
function Go(l){
	var b=fID("index"),s=fID("sort1"),a=(fID("sortdir1asc").checked)?"asc":"desc"; 
	var s2=fID("sort2"),a2=(fID("sortdir2asc").checked)?"asc":"desc"; 
	if(fSIT(b)=="Country/Region" && (fSIT(s)=="County" || fSIT(s2)=="County")){
		alert("The Country index cannot be sorted by County.   \n\n"); 
		if(fSIT(s)=="County"){s.focus();}else{s2.focus();}return void(0);
	}else if(fSIT(b)=="Country/Region" && (fSIT(s)=="State" || fSIT(s2)=="State")){
		alert("The Country index cannot be sorted by State.  \n\nTip: If searching United States, select State index.   \n\n"); 
		if(fSIT(s)=="State"){s.focus();}else{s2.focus();}return void(0); 
	}else if(fSIT(b)!="Country/Region" && (fSIT(s)=="Country/Region" || fSIT(s2)=="Country/Region")){
		alert("The "+fSIT(b)+" index cannot be sorted by Country/Region.  \n\nTip: Select the Country/Region index with your sort options   \nand try again.   \n\n"); 
		if(fSIT(s)=="Country/Region"){s.focus();}else{s2.focus();}return void(0); 
	}else if(fSIT(s)==fSIT(s2)){alert("Duplicate sort selection.  \n\n");s.focus();return void(0);}
	fEA('frmltr').page.value=1;fEA('frmltr').letter.value=l;fSC("ind_"+fSIT(b),fSIT(s)+"|"+fSIT(s2)+"|"+a+"|"+a2+"|",0);fFRM('frmltr').submit();}
function Reset(){
	if(!confirm("Continue to reset your index search session?  \n\n")){return void(0);}
	var b=fID("index");for(var i=0;i<b.options.length;i++){fSC("ind_"+b.options[i].text,"",0);}
	window.location.replace("asstindex.php?cmd=reset"); 
}
function SetDefaultSort(f){
	var b=fSIT(fID("index")),s="",s2="",a="asc",a2="desc",r=fGC("ind_"+b);
	if(f){if(!confirm("Select the default sort selection for this index?   \n\n"))return void(0);}
	if(r.indexOf("|")!=-1 && !f){r=r.split("|");s=r[0];s2=r[1];a=r[2];a2=r[3];
	}else if(b=="Screen Name"){s="Screen Name";s2="Last Name";a2="asc";
	}else if(b=="Last Name"){s="Last Name";s2="First Name";a2="asc";
	}else if(b=="First Name"){s="First Name";s2="Last Name";a2="asc";
	}else if(b=="City"){s="City";s2="Postal Code";a2="asc";
	}else if(b=="County"){s="County";s2="City";a2="asc";
	}else if(b=="State"){s="State";s2="City";a2="asc"
	}else if(b=="Email"){s="Email";s2="Post Date";
	}else if(b=="Country/Region"){s="Country/Region";s2="City";a2="asc";}
	fID("sortdir1"+a).checked=1;fID("sortdir2"+a2).checked=1;OptSel("sort1",s);OptSel("sort2",s2);}
function OptSel(id,t){var cbo=fID(id);for(var i=0;i<cbo.options.length;i++){if(cbo.options[i].text==t){cbo.options[i].selected=true;break;}}return 1;}
function GotoPage(p){fEA('frmltr').page.value=p;fFRM('frmltr').submit();}
function ShowRecord(id,pdb,a){g_ol+=12;g_ol=(g_ol>48)?-48:g_ol;var cx=((g_scr.width-625)/2)+g_ol,cy=((g_scr.height-475)/2-25)+g_ol;g_win_viewer=window.open("view.php?db="+pdb+"&record="+id+"&anchor="+a+"&v="+fGC('PHPSESSID'),"","toolbar=0,height=475,width=625,left="+cx+",top="+cy+",screenX="+cx+",screenY="+cy+",scrollbars=1,resizable=1,status=1");g_win_viewer.focus();}
function res_SR(id,db,a){ShowRecord(id,db,a);if(g_res_tmr)window.clearTimeout(g_res_tmr);if(g_res_e.style.display=="block"){fCO(g_res_e.id,99,0,g_ft);g_res_e=0;}}
var g_res_tmr,g_res_e=""; 
function res_fGID(evt){
	evt=fGE(evt);
	var src=fGS(evt),e='',s=src,tries = 0;
	while(s && tries < 2){if(s.id){if(s.id.substr(s.id.length-2,2)=='_a'){e=s.id.replace(/_a$/,'');if(fID(e)){if(fID(e).className=='pu'){return e;}}}}s=s.parentNode;tries++;}s=src;tries=0;
	while(s && tries < 8){if(s.className=="pu" && s.tagName=="DIV" && s.id){return s.id;}s=s.parentNode;tries++;}return '';}
function res_fDMOVR(evt){
	var e=res_fGID(evt);if(!e){return 1;}evt=fGE(evt);
	if(!evt){return 1;}var src=fGS(evt),l,pw,b,ch=0,d=fID(e);if(!d){return 1};
	if(src.id==e || fIC(d,src)){if(g_res_tmr){clearTimeout(g_res_tmr);}d.style.display="block";return 1;}b=d.getElementsByTagName("DIV");
	for(var i=0;i<b.length;i++){if(b[i].className=="pup"){d.style.left="-1000px";d.style.display="block";ch=b[i].offsetHeight;if(ch<36){b[i].style.height="36px";}d.style.display="none";}}src=fEP(src);d.style.top=src.top-64+"px";l=src.left+src.width-6;b=fGO(fID("body"));
	pw=b.w+(b.l*2);if(l+360>pw){l=pw-360;}d.style.left=l+"px";if(g_res_e && (g_res_e != fIS(e))){g_res_e.display="none";d.style.display="block";}if(g_res_tmr)clearTimeout(g_res_tmr);g_res_e=d.style;g_res_tmr=setTimeout("if(g_res_e)g_res_e.display='block'",600);return 1;}
function res_fDMOUT(evt){
	var e=res_fGID(evt);if(!e){return 1;}evt=fGE(evt);
	var t=fGT(evt),d=fID(e);if(!d){return 1;}
	if(t){if(t.id==e+"_a" || t.id==e){return 1;}if(fIC(d,t)){return 1;}}if(g_res_tmr)clearTimeout(g_res_tmr);g_res_e=fID(e).style;g_res_tmr=setTimeout("g_res_e.display='none';g_res_e=0",500);return 1;}
