var nextSelectId ;
var target;
var firstid;
function selectonchange(e){
	 getNextSelect(this.id);
	 if($("#"+nextSelectId)){
     $.post(target,"id="+$("#"+this.id).val(),callback);
	}
}
function getNextSelect(id){
	var nextid=id.substr(0,id.length-1)+(parseInt(id.substr(id.length-1,1))+1);
	nextSelectId=nextid;
}
function callback(data)
{
	var polices=eval("("+data+")");
	document.getElementById(nextSelectId).length=0;
	 for(var i=0;i<polices.police.length;i++){
		 document.getElementById(nextSelectId).options[document.getElementById(nextSelectId).length] = new Option(polices.police[i].name,polices.police[i].id); 	 
	 }
}
$(document).ready(function(){
	selectinit();
});


function selectinit(){
	target = "/AreaJump";
	if($("#firstid").html()!=null){
		firstid=$("#firstid").val();
		nextSelectId = "select1";
	}else{
		firstid = "0";
		nextSelectId = "select1";
	}
	$.post(target,"id="+firstid,callback);
	$("select").change(selectonchange);
}



