Код скрипта
<HTML>
<HEAD>
<TITLE>Air Distances</TITLE>
<BODY BGCOLOR="#FFFFFF">
</HEAD>
<!-- js v2.9 96.08.12 jhk -->
<!-- Cut-N-Paste JavaScript from ISN Toolbox
Copyright 1996, Infohiway, Inc. Restricted use is hereby
granted (commercial and personal OK) so long as this code
is not *directly* sold and the copyright notice is buried
somewhere deep in your HTML document. A link to our site
http://www.infohiway.com is always appreciated of course,
but is absolutely and positively not necessary. ;-) -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from JavaScript-Impaired Browsers
var l=0;
var r=0;
var tc="";
var al=" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
var ns="0123456789";
function iA(){
this.length=iA.arguments.length;
for (var i=0;i<this.length;i++){
this[i]=iA.arguments[i];
}
}
/* 3011 byte database of air distances uses position in the
string "al" to substitute for the numerics, saving a bit
over 4k download to visitors. */
var a=new iA(35);
a[0]="Berlin, Germany* ciagchdcheihh dadeee gcaa hdef egeghfaci"
+"ibf da cifdcd ebehe eddegagecehadhfaa gcgh e debbfageedkbgdca";
a[1]="Bombay, India* ibga deacde dhabfgh bbiifhgddfhg caefa igb"
+"cacggiei dacigddcfbifbffgcgeaihbfchdj dggdcacbdcdaigfhbhf";
a[2]="Buenos Aires, Argentina* jbddbgiaceifkdfgefgegggffibfabk "
+"dgbcdfchchec hhegfacchfhhkiggcfefhga abbfic gffialb ihfkd fbffdb";
a[3]="Calcutta, India* f ccgdeebaecg dcfefccdiehaebaieeeie cdeg"
+"ibebgddfjaadhib bceagdhedaichde jiigbbbaaagicaig dchf";
a[4]="Capetown, South Africa* fiee hgcgkecebbjccf aiiggecfdahea"
+"fbigh jaafdig aehdh edeighfgaacggebee jb h ff bi gg bbce";
a[5]="Darwin, Australia* ibgbfdecfgcigaahf ghdaihaifi hg eiiffb"
+"dh bjcehehcgcgafigbhfciifhaihifgfbcadb hccgccafda";
a[6]="Gibraltar* fhch hahgebga ieidgdhjh efcbdacfced agidic iff"
+" abahcchb edgha cfdaedfffegbcfiil fda ";
a[7]="Hong Kong, China* eeddihefceihgbd fidfahghdddh edeeecdj h"
+"eifabcdihgfef ck eggkfafdg ggafeah eheeda";
a[8]="Honolulu, Hawaii, USA* ha bhbgbcbefec eeacghg cdifc fghe"
+"begdce ghgde f hhaih bfgibfhdicfgachedgajhg";
a[9]="Istanbul, Turkey* ee aeefhdeffi iga a ie aea aebfgead dch"
+" fidfdbeffd hehagf fdifecgeefjffcca";
a[10]="Juneau, Alaska, USA* ddbahdehgh dcbbdecbhea id eddfdfcde"
+"bfbbbffcbggf ebegbg i dhggbdd agdhhh ";
a[11]="London, England, UK* eddffgje eedaeecdfdch gaebh bae eba"
+"eca aagegg higbfdghegafgdeidkfhdf ";
a[12]="Los Angeles, California, USA* gbggicaedf gbdebhheccc ef"
+" fbegecbehdcafc fcceec iffdhhggedgfgaj b";
a[13]="Manilla, Luzon, Phillipines* cidhhceachdidhbf bjbhffgagg"
+"efbhabffekbefdfjicffdaaeadhahfeafegf";
a[14]="Melbourne, Australia* hdbhifjcfgefiici bjd efghffje jedh"
+"aiiicg haie acgfe iaf fh ";
a[15]="Mexico City, Mexico* ffib idcaegaae egaggcgfgbdedfbdggfc"
+"ed ebcdh djcag dfi idh";
a[16]="Moscow, Russia* dffd da bfgaaedcf agadbdb fgb adghgieb d"
+"bdebddfejbhdbg";
a[17]="New York City, New York, USA* cggcfgbbccfbfhbeei ddbehdh"
+"bdbge ibdagcfifcfgdhiegg ";
a[18]="Nome, Alaska, USA* chdeeddegcdcegecdiccgheie hhcfaihcghf"
+"aebihgchhba";
a[19]="Oslo, Norway* efi hcdcfbbacbfa hfdhabdgiadeie bfbeebbjig"
+"dh ";
a[20]="Panama City, Panama* echhiagaebffdgacbiei bidcfeicbkfihd"
+"bgdchbe";
a[21]="Paris, France* ea aihcbdacheg fhgbediiegeffgf ckgidd ";
a[22]="Peking, China* dehfdbdi jgge ekgged ffbggacafg eh ";
a[23]="Port Said, Suez Canal, Egypt* ebecbcfbdacbh ifgfeace ieh"
+"djbebgc";
a[24]="Quebec, Quebec, Canada* baieaccidee bcefihia fdbibcgdd";
a[25]="Reykjavik, Faxa Bay, Iceland* fabb dgbccfaeefgafedgjgbegf";
a[26]="Rio de Janeiro, Brazil* efiahffhikcdiggkedgceeei";
a[27]="Rome, Italy* gdbeffefhfbcfabkebcga";
a[28]="Santiago, Chile* fbckfejbcjfdegigah";
a[29]="Seattle, Washington, USA* eg h fdghgbdicf";
a[30]="Shanghai, China* bcha if eeig";
a[31]="Singapore, Singapore* cc ebiddh";
a[32]="Tokyo, Japan* egfg d";
a[33]="Wellington, New Zealand* hab";
a[34]="Zanzibar City, Tanzania* ";
var b=new iA(4);
b[0]=1;
b[1]=10;
b[2]=100;
b[3]=1000;
b[4]=10000;
function getMiles(form){
lf=(document.isn.isn1.options[document.isn.isn1.selectedIndex].value);
rf=(document.isn.isn2.options[document.isn.isn2.selectedIndex].value);
l=al.indexOf(lf);
r=al.indexOf(rf);
if (r<l){
l=r;
r=al.indexOf(lf);
}
ls=a[l];
pos=ls.indexOf("*")
ls1="From "+ls.substring(0,pos)+" to "
+a[r].substring(0,a[r].indexOf("*"))+" is about ";
ls=ls.substring(pos+1,ls.length);
tc=ls.substring(((r*3)-(l*3)),ls.length);
if (document.isn.rb[1].checked){
dispKm();
}
else{
dispMi();
}
}
function dispMi(){
ch=tc.charAt(0);
ls1+=al.indexOf(ch);
ch=tc.charAt(1);
ls1+=al.indexOf(ch);
ch=tc.charAt(2);
if (ch!=" "){
ls1+=(al.indexOf(ch)*10)+" miles";
} //1.613
else ls1+="00"+" miles";
document.isn.disp.value=ls1;
}
function dispKm(){
ch=tc.charAt(0);
km="";
km+=al.indexOf(ch);
ch=tc.charAt(1);
km+=al.indexOf(ch);
ch=tc.charAt(2);
if (ch!=" "){
km+=(al.indexOf(ch)*10);
}
else{
km+="00";
}
num=0;
kml=km.length;
for (var i=kml-1;i>-1;i--){
cr=km.substring(i,i+1);
pos=ns.indexOf(cr);
num+=pos*b[kml-i-1];
}
km="";
km+=num*1.613;
pos=km.indexOf(".");
if (pos>-1){
km=km.substring(0,pos);
}
ls1+=km+" kilometers";
document.isn.disp.value=ls1;
}
// End Hiding -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white">
<CENTER>
<!-- Your Web Page Content Here -->
<FORM NAME="isn">
<TABLE BORDER=0 WIDTH=486>
<TR><TD COLSPAN=3 ALIGN=CENTER>
<HR NOSHADE><FONT COLOR="blue">
<B>Air Distances between Selected World Cities</B></FONT></TD></TR>
<TR><TD ALIGN=CENTER><FONT COLOR="blue">
<B>Starting City</B></FONT><BR><SELECT NAME="isn1" SIZE=12>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from JavaScript-Impaired Browsers
ls="";
for (var i=0;i<35;i++){
ls+='<OPTION VALUE="'+al.substring(i,i+1)+'" onClick=""';
if (i==0){ls+=' SELECTED';}
ls+='>'+a[i].substring(0,a[i].indexOf("*"));
}
document.write(ls);
// End hiding -->
</SCRIPT>
</SELECT></TD>
<TD ALIGN=CENTER VALIGN=TOP><FONT COLOR="blue" SIZE=1>
<B>Instructions:</B></FONT>
<BR>Select starting city at left, destination at right.
Or, if you are feeling particularly contrary today,
vice versa. Then click below.<P>
<INPUT TYPE="button" NAME="but" VALUE=" Get Distance " onClick="getMiles(this.form)">
<BR><INPUT TYPE="radio" NAME="rb" VALUE="a" CHECKED onClick="">Miles
<INPUT TYPE="radio" NAME="rb" VALUE="b" onClick="">Kilometers
<TD ALIGN=CENTER><FONT COLOR="blue">
<B>Destination City</B></FONT>
<BR><SELECT NAME="isn2" SIZE=12>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide from JavaScript-Impaired Browsers
ls="";
for (var i=0;i<35;i++){
ls+='<OPTION VALUE="'+al.substring(i,i+1)+'" onClick=""';
if (i==1){ls+=' SELECTED';}
ls+='>'+a[i].substring(0,a[i].indexOf("*"));
}
document.write(ls);
// End hiding -->
</SCRIPT>
</SELECT></TD></TR>
<TR><TD COLSPAN=3 ALIGN=CENTER>
<TABLE BORDER=2>
<TR><TD>
<INPUT TYPE="text" NAME="disp" VALUE="" SIZE=80>
</TD></TR>
</TABLE></TD></TR>
<TR><TD COLSPAN=3><HR NOSHADE></TD></TR>
</TABLE>
</FORM>
</CENTER>