(function(a){a.fn.citySelect=function(d){if(this.length<1){return}d=a.extend({prov:null,city:null,dist:null,nodata:null,required:true,slect_all_lng:"<option value=''>请选择</option>"},d);var f=this;var c=f.find(".prov");var k=f.find(".city");var j=f.find(".dist");var b=(d.required)?"":d.slect_all_lng;var g;var i=function(){var l=c.get(0).selectedIndex;if(!d.required){l--}k.empty().attr("disabled",true);j.empty().attr("disabled",true);if(l<0||typeof(g[l].c)=="undefined"){if(d.nodata=="none"){k.css("display","none");j.css("display","none")}else{if(d.nodata=="hidden"){k.css("visibility","hidden");j.css("visibility","hidden")}}return}temp_html=b;a.each(g[l].c,function(m,n){temp_html+="<option value='"+n.n+"'>"+n.n+"</option>"});k.html(temp_html).attr("disabled",false).css({display:"",visibility:""});e()};var e=function(){var l=c.get(0).selectedIndex;var m=k.get(0).selectedIndex;if(!d.required){l--;m--}j.empty().attr("disabled",true);if(l<0||m<0||typeof(g[l].c[m].a)=="undefined"){if(d.nodata=="none"){j.css("display","none")}else{if(d.nodata=="hidden"){j.css("visibility","hidden")}}return}temp_html=b;a.each(g[l].c[m].a,function(n,o){temp_html+="<option value='"+o.s+"'>"+o.s+"</option>"});j.html(temp_html).attr("disabled",false).css({display:"",visibility:""})};var h=function(){temp_html=b;a.each(g,function(m,l){temp_html+="<option value='"+l.p+"'>"+l.p+"</option>"});c.html(temp_html);setTimeout(function(){if(d.prov){c.val(d.prov);i();setTimeout(function(){if(d.city){k.val(d.city);e();setTimeout(function(){if(d.dist){j.val(d.dist)}},1)}},1)}},1);c.bind("change",function(){i()});k.bind("change",function(){e()})};g=cityJSON;h()}})(jQuery);
