1 <% include('/elements/xmlhttp.html',
2 'url' => $p.'misc/exchanges.cgi',
3 'subs' => [ $opt{'prefix'}. 'get_exchanges' ],
7 <SCRIPT TYPE="text/javascript">
9 function opt(what,value,text) {
10 var optionName = new Option(text, value, false, false);
11 var length = what.length;
12 what.options[length] = optionName;
15 function <% $opt{'prefix'} %>areacode_changed(what, callback) {
17 what.form.<% $opt{'prefix'} %>exchange.disabled = 'disabled';
18 what.form.<% $opt{'prefix'} %>exchange.style.display = 'none';
19 var exchangewait = document.getElementById('<% $opt{'prefix'} %>exchangewait');
20 exchangewait.style.display = '';
21 var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror');
22 exchangeerror.style.display = 'none';
24 what.form.<% $opt{'prefix'} %>phonenum.disabled = 'disabled';
26 areacode = what.options[what.selectedIndex].value;
28 function <% $opt{'prefix'} %>update_exchanges(exchanges) {
30 // blank the current exchange
31 for ( var i = what.form.<% $opt{'prefix'} %>exchange.length; i >= 0; i-- )
32 what.form.<% $opt{'prefix'} %>exchange.options[i] = null;
33 // blank the current phonenum too
34 for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- )
35 what.form.<% $opt{'prefix'} %>phonenum.options[i] = null;
36 opt(what.form.<% $opt{'prefix'} %>phonenum, '', 'Select phone number');
39 opt(what.form.<% $opt{'prefix'} %>exchange, '', '<% $opt{empty} %>');
42 // add the new exchanges
43 var exchangeArray = eval('(' + exchanges + ')' );
44 for ( var s = 0; s < exchangeArray.length; s++ ) {
45 var exchangeLabel = exchangeArray[s];
46 if ( exchangeLabel == "" )
47 exchangeLabel = '(n/a)';
48 opt(what.form.<% $opt{'prefix'} %>exchange, exchangeArray[s], exchangeLabel);
51 exchangewait.style.display = 'none';
52 if ( exchangeArray.length >= 1 ) {
53 what.form.<% $opt{'prefix'} %>exchange.disabled = '';
54 what.form.<% $opt{'prefix'} %>exchange.style.display = '';
56 var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror');
57 exchangeerror.style.display = '';
61 if ( callback != null )
65 // go get the new exchanges
66 <% $opt{'prefix'} %>get_exchanges( areacode, <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_exchanges );
72 <DIV ID="exchangewait" STYLE="display:none"><IMG SRC="<%$fsurl%>images/wait-orange.gif"> <B>Finding cities / exchanges</B></DIV>
74 <DIV ID="exchangeerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different area code</B></DIV>
76 <SELECT NAME="<% $opt{'prefix'} %>exchange" onChange="<% $opt{'prefix'} %>exchange_changed(this); <% $opt{'onchange'} %>" <% $opt{'disabled'} %>>
77 <OPTION VALUE="">Select city / exchange</OPTION>
84 $opt{disabled} = 'disabled' unless exists $opt{disabled};