var http = createRequestObject();

function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}

function loading(){
var id = document.getElementById('city').value;
http.open('GET','get.php?id='+id, true);
http.onreadystatechange = getState;
http.send(null);
}

function getState(){
var newOption;
var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null;
var State = document.getElementById('province');
while (State.options.length) {
State.remove(0);
}
id = document.getElementById('city').value;
if(id == 'sel'){
document.getElementById('province').disabled = true;
newOption = document.createElement("option");
newOption.value = 'sel';
newOption.text = 'City:';
State.add(newOption, where);
}else{
if(http.readyState == 4){
if (http.status == 200) {
var response = http.responseText;
if(response == ''){
document.getElementById('province').disabled = true;
newOption = document.createElement("option");
newOption.value = 'sel';
newOption.text = 'Nessuna voce';
State.add(newOption, where);
}else{
coppia = response.split(',');
max = coppia.length;
newOption = document.createElement("option");
newOption.value = 'sel';
newOption.text = 'Province:';
State.add(newOption, where);
for(x=0;x<max;x++){
val = coppia[x].split('-');
newOption = document.createElement("option");
newOption.value = val[0];
newOption.text = val[1];
State.add(newOption, where);
}
document.getElementById('province').disabled = false;
}
}
}
}
}




function zoomToggle(iWideSmall,iHighSmall,iWideLarge,iHighLarge,whichImage){
var nW,nH,oH,oW;
oW=whichImage.style.width;oH=whichImage.style.height;
if((oW==iWideLarge)||(oH==iHighLarge)){
nW=iWideSmall;nH=iHighSmall;}else{
nW=iWideLarge;nH=iHighLarge;}
whichImage.style.width=nW;whichImage.style.height=nH;
}




