$(document).ready(function(){ 
    
	$("#community-details").click(function(){
		$("#floorpalns,#homelistings").hide();
		$("#community").show();
	});	
	
	$("#available-homes").click(function(){
		$("#community,#floorpalns").hide();
		$("#homelistings").show();
	});					 

	$("#floorplans-details").click(function(){
		$("#community,#homelistings").hide();
		$("#floorpalns").show();
	});					 

	//$(window).load(floorplan_list());	
	
	//$(window).load(home_list());	
	
	home_list();
	
	floorplan_list();
	
});

var sel_id = 1;

var hsel_id = 1;



function floorplan_list(id){
		$('#loader').show(); // Hide the Loading...
		$('#floorpalnlist').hide(); // Show the drop down
		
		id = (id != undefined && id != '')? id : sel_id;
		sel_id = id;
		
		//alert(communityid);
		
	
		$.post("get-floorplans.php",{id:id,communityid:communityid,table:"floorplans"} ,function(data)
        {
				//alert(data);
				$("#floorpalnlist").html(data);
				$('#loader').hide(); // Hide the Loading...
				$('#floorpalnlist').show(); // Show the drop down
				
	    });
		
}



function home_list(hid){
		//alert(communityid);

		$('#loader1').show(); // Hide the Loading...
		$('#homelist').hide(); // Show the drop down
		
		hid = (hid != undefined && hid != '')? hid : hsel_id;
		hsel_id = hid;
		$.post("get-homes.php",{hid:hid,communityid:communityid,table:"homes"} ,function(data)
        {
				//alert(data);
				$("#homelist").html(data);
				$('#loader1').hide(); // Hide the Loading...
				$('#homelist').show(); // Show the drop down
	
	    });
}
