var aRegions=new Array(
"Autriche",
"Belgique",
"Canada",
"Danemark",
"France",
"Allemagne",
"Italie",
"Luxembourg",
"Pays-Bas",
"Espagne",
"Suisse",
"Royaume-Uni",
"États-Unis",
"Europe",
"Amérique du Nord ",
"Atlas mondial",
"Finlande (Helsinki)",
"Norvège",
"Portugal",
"Suède",
"Australie",
"Brésil",
"Australie",
"Brésil",
"Grèce (Athènes)");

var aDS=[1,1,2,1,1,1,1,1,1,1,1,1,2,1,2,4,1,1,1,1,8,16,8,16,1],
aAddr=[1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,0,0,1,1,1],
aCfgs=[2,2,1,2,2,2,1,2,2,1,2,3,0,0,0,0,2,2,2,2,0,0,4,5,2],
fields=["City","State","Zip"],
labs = new Array(
new Array("Ville ","État","Code postal "),
new Array("Ville ","Province","Code postal"),
new Array("Ville ","","Code postal"),
new Array("Ville ","","Code postal"),
new Array("Banlieue","État","Code postal"),
new Array("Ville ","État","Code postal"));

var gWith="";
function Ctl(n){return document.getElementById(gWith+n);}
function fcCtl(n){return document.getElementById("FndControl_"+n);}
function Display(n,f){Ctl(n).style.display=f?"block":"none"};

function SetControls(w,a){
gWith=w;
Ctl("PlaceRadio").checked=!a;
Ctl("AddressRadio").checked=a;
SetInputFields(a);
}

function SetInputFields(a){
var f=Ctl("ShowPaste").checked;
Ctl("AdTab").className="FindTab"+((a&&!f)?1:0);
Ctl("FfTab").className="FindTab"+((a&&f)?1:0);
Ctl("PlTab").className="FindTab"+(a?0:1);
Display("PlaceFields",!a);
Display("AddrFields",a);
Display("AFields2",a&&f);
Display("AFields1",a&&!f);
SetAddrFields(gWith);
}

var aSam=[
"Wollzeile 37<br>1010 Vienne",
"Grand-Place 1<br>1000 Bruxelles",
"1 Adelaide St. East<br>Toronto, Ontario<br>M5C 2V9",
"Vesterbrogade 59<br>1620 Copenhague",
"34 quai du Louvre<br>75001 Paris",
"Museumsinsel 1<br>D-80538 Munich",
"Via dei Piccolomini, 5<br>20148 Milan",
"Eug&egrave;ne Ruppert 20<br>2453 Luxembourg",
"Jodenbreestraat 4<br>1011 NK<br>Amsterdam",
"Calle de Serrano 13<br>28001 Madrid",
"Richtistrasse 3<br>8304 Wallisellen",
"10 Great Pulteney St<br>Londres<br>W1F 9NB",
"1 Microsoft Way<br>Redmond<br>WA 98052","","","",
"Keilaranta 7<br>02150 Espoo",
"Universitetsgata 13<br>0164 Oslo",
"Rua Serpa Pinto, 4<br>1200-444 Lisbonne",
"Finlandsgatan 30<br>164 93 Kista","","",
"132 Grattan Street<br>Carlton, Vic<br>3053",
"Av Rio Branco, 1<br>Rio de Janeiro - RJ<br>20090",
"Leoforos Kifisias 221<br>Athènes"];

function SetAddrFields(w){
gWith=w;
if(Ctl("Sample"))Ctl("Sample").innerHTML=aSam[Ctl("ARegionSelect").value];
var x,c=aCfgs[Ctl("ARegionSelect").value];
for(i=0;i<3;++i){
x="hidden";
if(labs[c][i]!=""){Ctl(fields[i]+"L").innerHTML=labs[c][i];x="visible"}
Ctl(fields[i]+"Label").style.visibility=x;
}}

function SaveToCookie(w){
gWith=w;
if(Ctl("ARegionSelect")){
var a=Ctl("AddressRadio").checked;
StoreInCookie(eRegion, Ctl(a?"ARegionSelect":"PRegionSelect").value);
StoreInCookie(eAltRegion,Ctl(a?"PRegionSelect":"ARegionSelect").value);
StoreInCookie(eFreeform,Ctl("ShowPaste").checked?1:0);}
}

function SetFocusToFind(w){
gWith=w;
if(Ctl("AmbiguousSelect"))Ctl("AmbiguousSelect").focus();
else if(Ctl("ARegionSelect")){
if(Ctl("AddressRadio").checked)Ctl(Ctl("ShowPaste").checked?"FreeText":"StreetText").focus();
else Ctl("PlaceText").focus();
}}

function CheckFindControl(w,f){
gWith=w;
if(Ctl("ARegionSelect"))SetInputFields(Ctl("AddressRadio").checked);
if(f)SetFocusToFind(w);
}

function onARegionChange(){fcCtl("BkARegion").value=fcCtl("ARegionSelect").value;SetAddrFields("FndControl_");}
function onPRegionChange(){fcCtl("BkPRegion").value=fcCtl("PRegionSelect").value;}

function onPTabClick(){if(!fcCtl("PlaceRadio").checked)onPlaceRadioClick();}
function onATabClick(){fcCtl("ShowPaste").checked=0;onAddressRadioClick();}
function onFTabClick(w){gWith=w;Ctl("ShowPaste").checked=1;onShowPaste(w);}

function onPlaceRadioClick(){SetControls("FndControl_",false);Ctl("PlaceText").focus();}
function onAddressRadioClick(){SetControls("FndControl_",true);Ctl("StreetText").focus();}
function onShowPaste(w){gWith=w;SetControls(w,true);Ctl("FreeText").focus();}

function GetMap(){
if(fcCtl("AmbiguousSelect")){var s=fcCtl("AmbiguousSelect").selectedIndex;if(-1<s){AmbiguousClick(s);return;}}
if(fcCtl("ARegionSelect"))fcCtl("BkARegion").value=fcCtl("ARegionSelect").value;
if(fcCtl("PRegionSelect"))fcCtl("BkPRegion").value=fcCtl("PRegionSelect").value;
SaveToCookie("FndControl_");
if(document.FindForm.fireEvent)document.FindForm.fireEvent("onsubmit");
document.FindForm.submit();
}

function onKeyDown(){if("13"==window.event.keyCode){GetMap();window.event.returnValue=false;}}
function MoreResults(){fcCtl("isRegionChange").value="2";document.FindForm.submit();}

