function getTownList(sel)
{
	var townCode = sel.options[sel.selectedIndex].value;
	document.getElementById('town').options.length = 0;	// Empty city select box
	if(townCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'getTowns2.php?townCode='+townCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities_(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function getTownList2(sel,ind)
{

	var townCode = sel.options[sel.selectedIndex].value;
	document.getElementById('town').options.length = 0;	// Empty city select box
	if(townCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'getTowns2.php?townCode='+townCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities_(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
		
		

	}
}

function createCities_(index)
{
	var obj = document.getElementById('town');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
	
	
	
		var sel2=document.getElementById('town');
		var i;
		
		for (i=0; i<sel2.options.length;i++){
			if (sel2.options[i].value==document.getElementById('selected2').value){
				sel2.options[i].selected = true;
			}
		}
}

	
/*function doshit(){
	
	if(document.getElementById('country') != undefined)
	{
		var s = document.getElementById('country');	
		
		if(document.getElementById('selected2') != undefined) {
		getTownList2(s,document.getElementById('selected2').value);
		}
	}
}*/

