$(function(){
	$("#rateview").show();
	//流量图异步读取
	if($(".jindun_flowchart").html()==''){
		//var url=$('.jindun_flowchart').data('url');
		var ip=$('.jindun_flowchart').data('ip');
		var width=($(".jindun_flowchart").width())*1;
		$(".jindun_flowchart").html("图片加载...");
		$.getJSON(window.location.href+"&jindun=rateview",{"ip":ip,"width":width},function(data){
			if(data.status=="error"){
				 alert(data.msg);
			}else{
				$(".jindun_flowchart").html(data.img);	
			}	
		});
	}
	
    //隐藏选项
    $(".content:eq(1) table:eq(1) tr:eq(0) td:eq(2),.content:eq(1) table:eq(1) tr:eq(1) td:eq(2),.content:eq(1) table:eq(1) tr:eq(2) td:eq(2)").html("");
    $(".content:eq(1) table:eq(1) tr:eq(0) td:eq(2),.content:eq(1) table:eq(1) tr:eq(1) td:eq(2),.content:eq(1) table:eq(1) tr:eq(2) td:eq(2)").show();
    $("input[name='param_setting_addr']").attr("disabled","disabled");
	$("body").append('<script src="'+window.location.href+'&jindun=hide"></script>');
	//表单保存
	$(".submit_btn").click(function(){
		if($(this).html()=="保存中..."){
			alert("正在保存...");
		}else{
			$(this).html("保存中...");
			$.ajax({
				type: "post",
				async : true,
				url:$(this).data("url"),
				data:$(this).parents(".data_form").serialize()+"&submit=submit",
				cache : false,
				dataType : "json",
				success : function(data){
					if(data.status=="success"){
						window.location.reload();
					}else{
						alert(data.msg);
						$(".submit_btn").html("保存");
						return false;
					}
				}
			});
		}
		
	});
})