var PageObject = new Object(); //列表的全局变量
    PageObject.page = 1;
    PageObject.id = "0";
    

    var getListObject = function(e) {
        this.data = "p=" + e;
        showProcessNotice();
        $.getJSON("getdata/?id=fsnl&" + this.data, function(obj) {
            listObject(obj);
        });
    }
    //显示信息列表
    function listObject(obj) {
        closeProcessNotice();
        if (obj.State.toString() == "1") {
            var listcontent = obj.Data.PageData.toString();
			if(listcontent=="")
				$("div.getMore").html("暂时没有动态了").attr("onclick","");
			else
			{
            	PageObject.page = obj.Data.Page.PageIndex;
            	$("div.listArea").append(listcontent);
			}
        }
        else {
            showError(obj.Data);
        }

    }
function getNextPage()
{
	getListObject(parseInt(PageObject.page)+1)
}
   

function getUserNotice()
{
	 $.getJSON("getdata/?id=mynl", function(obj) {
            if(obj.State==1)
			{
				if(obj.Data.RowCount>0)
				{
					$("#indexUserNotice").html(obj.Data.PageData.toString()).show();
					bindUserNotice();
				}
				else
					$("#indexUserNotice").hide();
			}
			else
				$("#indexUserNotice").hide();
	 });
}
function bindUserNotice()
{
	$("#indexUserNotice").find(".listItem").each(function(){
			var obj=this;
			$(this).click(function(){
					$.deleteObject({url:'postDelete/',ajaxid:'dmyn',id:obj.id,success:function(){
						$("#indexUserNotice").find("div[linkid="+$(obj).attr("linkid")+"]").remove();
						$(this).remove();
						
						}})
				});
		});
}
function addCouplet()
{
	if($("#content").val().length==0)
	{
		showError("对联内容不得为空！");
		$("#content").focus();
		return false;
	}
	if(!checkIsChinese($("#content").val()))
	{
		showError("对联内容只能为中文或空格，或以下标点：，。？：——");
		$("#content").focus();
		return false;
	}
	
	var data="";
		data="content="+encodeURIComponent(escape($("#content").val()));
		data=data+"&type="+encodeURIComponent(escape($("#type_edit").val()));
		data=data+"&remark="+encodeURIComponent(escape($("#remark").val()));
	$("#btn_addcouplet").val("正在提交，请稍后...").attr("disabled","disabled");	
	$.ajax({type:'POST',
		   url:'postdata/?id=ac',
		   data:data,
		   success:function(msg){onSuccess(msg);}
		   });	
}
function onSuccess(json)
{
	if(json.State==1)
	{
		showMsg("发表成功！");
		$("#content").val("");
		 $("#remark").val("");
		$("#btn_addcouplet").val("发表对联").attr("disabled","");
	}
	else
		showError(json.Data);
}

function showCouplet()
{
	if (cIndex >= $("ul#indexCoupletShowArea").find("li").length)
			cIndex=0;
	//alert(cIndex);
	$("ul#indexCoupletShowArea").find("li").each(function(i){
		if (i==cIndex)
			$(this).show('slow');
		else
			$(this).hide();
	});
	cIndex++;
}

function changeTab(e,i)
	{
		$("#coupletTypeTab").find(".tabTitleItem").removeClass().addClass("tabTitleItem");
		$(e).addClass("tabTitleItemNow");
		$("#type_edit").val(i);
	}
