


function miasto_filtr(){


	miejsce_ob=document.getElementById('miejsce');
	if (!miejsce_ob)return false;
	miasto_ob=document.getElementById('miasto');
	if (!miasto_ob)return false;
	leng=miasto_ob.length;
	leng--;



	for (i=leng;i>0 ;i-- )
	{
		miasto_ob.remove(i);
	}

	if (miejsce_ob.value=='') {
	   
	   get_hotels();
	   return false;
    }




	for (var id in miasto) {


			if (miasto_rel[id][0]==miejsce_ob.value || miasto_rel[id][1]==miejsce_ob.value)
			{
			var oOption = document.createElement("OPTION");
			oOption.text = miasto[id];
			oOption.value = id;
			miasto_ob.options.add(oOption);
			}

	}

    get_hotels();
}











function get_hotels(){



	miejsce_ob=document.getElementById('miejsce');
	if (!miejsce_ob)return false;
	miasto_ob=document.getElementById('miasto');
	if (!miasto_ob)return false;



	var miejsce_id=parseInt(miejsce_ob.value);
	var miasto_id=parseInt(miasto_ob.value)


    if (!miejsce_id)miejsce_id=0;
    if (!miasto_id)miasto_id=0;


      $("#hotel").html('');

			$.ajax({ 
			type: "get", 
			url: "/js_hotele.php", 
			data: "miejsce="+miejsce_id+"&miasto="+miasto_id,
			success: function(response){ 

				$("#hotel").html(response);
			}
		});
	
}








function HoteleRequestOnSuccess(){
 
	 
	 
	

	 
	hotel_ob=document.getElementById('hotel');
	if (!hotel_ob)return false;
	var rows = this.responseText.split("\n");



	leng=hotel_ob.length;
	leng--;

	for (i=leng;i>0 ;i-- )
	{
		hotel_ob.remove(i);
	}


	 for(i=0; i < rows.length - 1; i++)
        { 
	 var d=rows[i].split("^");

			var oOption = document.createElement("OPTION");			
			oOption.value =d[0];
			oOption.text = d[1];
			hotel_ob.options.add(oOption);	
                
/*	*/				
		}



}



