+% if ( $opt{'tollfree'} ) {
+ function <% $opt{'prefix'} %>update_phonenums(phonenums) {
+ // lame hack so I can copy the code from above
+ what = document.getElementById('<% $opt{prefix} %>phonenum');
+
+ // blank the current phonenum
+ $('#<% $opt{prefix} %>phonenum').empty();
+
+% if ($opt{empty}) {
+ jopt($('#<% $opt{'prefix'} %>phonenum'), '', '<% $opt{empty} %>');
+% }
+
+ // add the new phonenums
+ var phonenumArray = eval('(' + phonenums + ')' );
+ for ( var s = 0; s < phonenumArray.length; s++ ) {
+ var phonenumLabel = phonenumArray[s];
+ if ( phonenumLabel == "" )
+ phonenumLabel = '(n/a)';
+ jopt($('#<% $opt{'prefix'} %>phonenum'), phonenumArray[s], phonenumLabel);
+ }
+
+ $('#<% $opt{'prefix'} %>phonenum').prop('disabled', false);
+
+ if ( phonenumArray.length >= 1 ) {
+ $('#<% $opt{'prefix'} %>phonenum').prop('disabled', false);
+ $('#<% $opt{'prefix'} %>phonenum').css('display', '');
+ }
+
+ }
+ <% $opt{'prefix'} %>get_phonenums( 'tollfree', <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_phonenums );
+% }
+