function changeDisplay(){var A=$("display");if($F(A)!=display){display=$F(A);$("search_results","selected_addresses").invoke("childElements").flatten().each(function(C){var B=C.value;if(!B){return}C.value=encodeURIComponent(C.text);C.update(decodeURIComponent(B))})}}function passAddresses(){var A="";$("selected_addresses").childElements().each(function(B){if(!B.value){return}A+=B.value+"|"+B.text+"|"});$("sa").setValue(A)}function sameOption(F,E,A){var D=F+": "+E.text,C=A.text,B=F+": "+E.value,G=A.value;return Try.these(function(){return((D==C)||(decodeURIComponent(D)==decodeURIComponent(C)))&&((B==G)||(decodeURIComponent(B)==decodeURIComponent(G)))},function(){return(D==C&&B==G)})}function addAddress(C){var B=$("search_results");if(!$F(B).size()){alert(IMP.text.contacts_select);return false}else{var D=$("selected_addresses"),A=$A(D).length;B.childElements().each(function(E){if(E.value&&E.selected){if(!$A(D).any(function(F){return sameOption(C,E,F)})){D[A++]=new Option(C+": "+E.text,C+": "+E.value)}}})}return true}function updateMessage(){if(parent.opener.closed){alert(IMP.text.contacts_closed);this.close();return}if(!parent.opener.document[formname]){alert(IMP.text.contacts_called);this.close();return}$("selected_addresses").childElements().each(function(D){var B,E,A,F=null,G,C;if(display=="name"){B=decodeURIComponent(D.value);A=D.text}else{B=D.text;A=decodeURIComponent(D.value)}G=B.indexOf(":");E=B.substring(0,G);if(E=="to"){F=parent.opener.document[formname].to}else{if(!to_only&&E=="cc"){F=parent.opener.document[formname].cc}else{if(!to_only&&E=="bcc"){F=parent.opener.document[formname].bcc}else{return}}}A=A.substring(G+2,A.length).replace(/\\/g,"\\\\").replace(/"/g,'\\"');if(B.substring(G+2,B.length).indexOf(",")>0){B=A+": "+B.substring(G+2,B.length)+";"}else{B='"'+A+'" <'+B.substring(G+2,B.length)+">"}if(F.value.length){C=F.value.replace(/, +/g,",").split(",").findAll(function(H){return H});C.push(B);F.value=C.join(", ")}else{F.value=B}if(B.lastIndexOf(";")!=B.length-1){F.value+=", "}});this.close()}function removeAddress(){$("selected_addresses").childElements().each(function(A){if(A.selected){A.remove()}})};