var xmlHttp

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function fillSelect(eventTypeId) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url = "includes/getRegions2.asp?id=" + escape(eventTypeId);
//alert (url);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = go;
xmlHttp.send(null);
}

function go() {
if (xmlHttp.readyState == 4) {
	if (xmlHttp.status == 200) {
		var response = xmlHttp.responseText;
		var list=document.getElementById("locationId");
		var locations=response.split('|');
		for (i=1; i<locations.length; i++) {
			var values=locations[ i ].split(';');
			var x=document.createElement('option');
			x.setAttribute('value', values[0]);
			var y=document.createTextNode(values[1]);
			x.appendChild(y);
			list.appendChild(x);
			}
		}
	}
}


function initCs() {
//alert ("Function initCs loaded ");
var eventTypeId=document.getElementById('eventTypeId');
eventTypeId.onchange=function() {
 if(this.value!="") {
  var list=document.getElementById("locationId");
  while (list.childNodes[0]) {
list.removeChild(list.childNodes[0])
}
  fillSelect(this.value);
  }
 }
 fillSelect(eventTypeId.value);
}
