var Ajax=new Object();
Ajax.onSuccess=function(){}
Ajax.onFailure=function(){}
Ajax.startPreload=function(){}
Ajax.stopPreload=function(){}

Ajax.Initialize=function(url,method) {
	try {// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		try {// Internet Explorer
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				Ajax.onFailure();
			}
		}
	}
  xmlHttp.onreadystatechange=function() {
	switch(xmlHttp.readyState) {
		case 1 :
			Ajax.startPreload();
			break;
		case 4 :
			Ajax.stopPreload();
			Ajax.onSuccess();
			break;
		}
	}
  method=(method)?method:"GET";
  xmlHttp.open(method,url,true);
  xmlHttp.send(null);
}

Ajax.response=function() { 
  return xmlHttp.responseText;
}

function CityChange(cityid, failure) {
  Ajax.startPreload=function() {
	//document.getElementById('cityholder').innerHTML='<center><img src="/loader.gif"></center>';
	}
  Ajax.stopPreload=function() {
	document.getElementById('cityholder').innerHTML='';
	}
  Ajax.onSuccess=function() {
	document.getElementById('cityholder').innerHTML = Ajax.response();
	}
  Ajax.onFailure=function() {
	document.getElementById('cityholder').innerHTML = 'Error!';
	eval(failure);
  }
  Ajax.Initialize('/get_ajax2.php?id='+cityid);
}

function CityChange2(cityid, failure) {
  Ajax.startPreload=function() {
	//document.getElementById('cityholder').innerHTML='<center><img src="/loader.gif"></center>';
	}
  Ajax.stopPreload=function() {
	document.getElementById('cityholder').innerHTML='';
	}
  Ajax.onSuccess=function() {
	document.getElementById('cityholder').innerHTML = Ajax.response();
	}
  Ajax.onFailure=function() {
	document.getElementById('cityholder').innerHTML = 'Error!';
	eval(failure);
  }
  Ajax.Initialize('/get_ajax3.php?id='+cityid);
}