$(document).ready(function(){
	var ids = "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50";
	$("#IDs").attr("value", ids);
	getHot(ids);
	getComments(1);
	window.setInterval(function() {
		getComments(1);
	}, 60000); //Ã¿60ÃëË¢ÐÂÒ»´Î
	
	$("#addHouse").click(function(){
		$("#dialog").show("fast");
		getHouse(1);
	});
	$("#close_dialog").click(function(){
		$("#dialog").hide("fast");
	});
});

function getHot(id) {
	$.ajax({
		type:"GET",
		url:"do.asp",
		data:"task=gethot&id="+id+"&num="+Math.round(Math.random()*10000),
		success:function(percents){
			$("#Percents").attr("value", percents);
			var arrId = $("#IDs").attr("value").split("|");
			var arrPercent = $("#Percents").attr("value").split("|");
			for (i=0; i<arrId.length; i++){
				$("#house_" + arrId[i]).animate({height:arrPercent[i]},1000);
			}
		}
	});
}

function heating(id) {
	$.ajax({
		type:"GET",
		url:"do.asp",
		data:"task=heating&id="+id+"&num="+Math.round(Math.random()*10000),
		success:function(percent){
			$("#house_" + id).animate({height:percent},1000);
		}
	});
}

function getHouse(page) {
	$.ajax({
		type:"GET",
		url:"do.asp",
		data:"task=getHouse&page="+page+"&num="+Math.round(Math.random()*10000),
		success:function(data){
			$(".dg_history").html(data);
		}
	});
}

function getComments(page) {
	$.ajax({
		type:"GET",
		url:"do.asp",
		data:"task=getComments&page="+page+"&num="+Math.round(Math.random()*10000),
		success:function(comments_data){
			$("#comm_list").html(comments_data);
		}
	});
}

