//Open Child window and write back values //Thanks to Nongjian Zhou's for the excelent code found at http://www.codeproject.com function StartPopupCode50() { document.write(" "); }; function LookupOpenPopup50() { window.open('http://www.simplylookupadmin.co.uk/WebSearchWinButton.aspx'+'?id=33333333333333333333318B767283935972583548&co='+escape(document.forms[0].ch_u_zip_firstitem.value)+'&rt='+escape(self.location), 'WIN', 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1,width=520,height=540'); }; function GetStringFromQuery50(param) { var BeginPos; var EndPos; if (self.location.search.length>1) { BeginPos=self.location.search.indexOf(param + "=")+param.length+1; EndPos=self.location.search.indexOf("&",BeginPos); if (EndPos==(-1)) EndPos=self.location.search.length; return unescape(self.location.search.substring(BeginPos,EndPos)); } else if (self.location.hash.length>1) { BeginPos=self.location.hash.indexOf(param + "=") +param.length+1; EndPos=self.location.hash.indexOf("&",BeginPos); if(EndPos==(-1)) EndPos=self.location.hash.length; return unescape(self.location.hash.substring(BeginPos,EndPos )); } else return(''); }; if (typeof(window.opener) != 'undefined') { if (GetStringFromQuery50('ZID').toUpperCase() == 'ZPLOOKUP50') { LookupSetFieldVal50("ch_u_address_firstitem", GetStringFromQuery50('ZL1'));LookupSetFieldVal50("ch_u_address2_firstitem", GetStringFromQuery50('ZL2'));LookupSetFieldVal50("ch_u_address3_firstitem", GetStringFromQuery50('ZL3'));LookupSetFieldVal50("ch_u_city_firstitem", GetStringFromQuery50('ZL4'));LookupSetFieldVal50("ch_m_1013_firstitem", GetStringFromQuery50('ZL5'));LookupSetFieldVal50("ch_u_zip_firstitem", GetStringFromQuery50('ZL6'));LookupSetFieldVal50("ch_md_2001_firstitem", GetStringFromQuery50('ZL7')); window.close(); }; } function LookupSetFieldVal50(FieldName, data) { for (FrCounter=0; FrCounter <= window.opener.document.forms.length-1 ; FrCounter++) { for (FiCounter=0; FiCounter <= window.opener.document.forms[FrCounter].length-1 ; FiCounter++) { if (window.opener.document.forms[FrCounter].elements[FiCounter].name==FieldName) { window.opener.document.forms[FrCounter].elements[FiCounter].value = unescape(data); } }; }; }; StartPopupCode50();