


function test(){
	//call from page including js file to check reference is correct
	alert("working")
}


function findCountry(strFind){
	for(i=0;i<strzCountry.length;i++){
		if(strzCountry[i][1]==strFind){					
			return i;
		}
	}
	return -1;
}
function drawContinentOnChange(f, objSelect) {
		
		//alert(selContinent + " selCountry:=" + selCountry  + " " + selCity);
		var j, sCountry;
		
		if(objSelect==null||objSelect==''){			
			objSelect = document.frmEdit.continent;
		}
		if(f==null||f==''){
			f = document.frmEdit;
		}
			
		var iCont = objSelect.options[objSelect.selectedIndex].value;
		var nCount = f.country.options.length;

		for (j=nCount;j>0;j--) {
			f.country.options[j] = null;
		}
			
			//special sequence for US / Canada 19/05/2005 RJR
		if(iCont==1){ //currently id for US / Canada so change if DB changes
			var nCanada = findCountry('Canada');
				
			if(nCanada!=-1){
				f.country.options[f.country.options.length] = new Option(strzCountry[nCanada][1], strzCountry[nCanada][2]);
				f.country.options[f.country.options.length] = new Option('', '');
			}
			for (j=0;j<strzCountry.length;j++) {				
				if(strzCountry[j][0] == iCont) {
					sCountry = strzCountry[j][1];
				if(sCountry!="Canada"){
					f.country.options[f.country.options.length] = new Option(strzCountry[j][1], strzCountry[j][2]);				
				}	
			}
		}

	}else{
		for (j=0;j<strzCountry.length;j++) {				
			if(strzCountry[j][0] == iCont) {
				f.country.options[f.country.options.length] = new Option(strzCountry[j][1], strzCountry[j][2]);						
			}
		}
	}

	try{
		searchCountryOnChange(f.country)	
	}catch(e){
		//alert("error " + e)
	}finally{		
		f.country.selectedIndex = 0;
		drawCountryOnChange(f, f.city)
	}
}

function drawCountryOnChange(f, objSelect) {
	var j;

	var nCount = f.city.options.length; //document.forms['frmEdit'].elements['city'].options.length;

	if(nCount>0) {
		for (j=nCount;j>0;j--) {
			f.city.options[j] = null //document.forms['frmEdit'].elements['city'].options[j] = null;
		}
		for (j=0;j<strzCity.length;j++) {
			if(strzCity[j][0] == objSelect.options[objSelect.selectedIndex].value) {
				f.city.options[f.city.options.length] = new Option(strzCity[j][1], strzCity[j][2]);
			}
		}
	}
	f.city.selectedIndex = 0;
}