$(function() {
	var O_ProvinceDrop = $("#provinceDrop");	 
	var O_AreaDrop = $("#areaDrop");
	var O_CityDrop = $("#cityDrop");
		   
	//点击区域筛选下拉列
	O_ProvinceDrop.change(function() {
		var id = $(this).attr('value');

		$.post("?m=admin/city.getListByProvince", { pageSize:0, json:true , provinceId:id}, function(data) {
																		
				O_CityDrop.empty();
				O_CityDrop.append("<option value=\"\">==市区==</option>");
				$.each(data, function(id, item) {
					O_CityDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
				});
				
				O_AreaDrop.empty();
				O_AreaDrop.append("<option value=\"\">==行政区==</option>");
			
				
			}, "json");
		
	});
	
	
	//点击区域筛选下拉列
	O_CityDrop.change(function() {
		var id = $(this).attr('value');

		$.post("?m=admin/area.getListByCity", { pageSize:0, json:true , cityId:id}, function(data) {
																		
				O_AreaDrop.empty();
				O_AreaDrop.append("<option value=\"\">==行政区==</option>");
				$.each(data, function(id, item) {
					O_AreaDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
				});
				
			}, "json");
		
	});
	
	
	$('#O_SearchBtn').click(function(){
									 
		var id = '';	
		var country_id = '';
		var visatype_id = '';
		var search_value = $('#searchKey').attr('value');	  
		
		$(":input[name='country']:checked").each(function(){
			id = $(this).attr('value');	  
			country_id += id + '|';
		}); 
		country_id = country_id.substr(0,country_id.length - 1)
		
		$(":input[name='visa_type']:checked").each(function(){
			id = $(this).attr('value');	  
			visatype_id += id + '|';
		}); 
		visatype_id = visatype_id.substr(0,visatype_id.length - 1);
		var key = $('#searchKey').attr('value');
		
		var rand = Math.random();
		
		var province = O_ProvinceDrop.attr('value');
		var area = O_AreaDrop.attr('value');
		var city = O_CityDrop.attr('value');
		
		
		
		$('#autoF').attr('src' , '?m=admin/Pay.roomInfo&cid=' + country_id + '&vid=' + visatype_id + '&province='+ province + '&area='+ area + '&city='+ city + '&key=' + key + '&'+rand );
		
		$('#autoF').show();
		
	}); 
	
});