var data=new Object();
var isTp=0;
var pageIndex=1;
var pageTotal=0;
var MMCount=0;
var pageSize=12;
var toCopy;
var lwPage="page_2.html?MMId="
var morePage="page_2.html?MMId="
var loadPicPage="FunctionPage/MonthShowPage.aspx?pid="
$(function(){
	$("#div_MMrq").empty();
	DoLoadJSON()
})


function DoLoadJSON()
{
	var path="FunctionPage/LoadPicid.aspx"
	$.getJSON(path,function(msg){
		var data=msg.InfoTable;
		var divs= new Array(data.length);
		$.each(data,function(i,n)
		{                                                                                   
			if (i%3==0)
			{
				div=$('<div class="div-wrap2" id=DivD'+i+'></div>');
				div.appendTo("#div_MMrq")
			}                                                                                    
			divs[i]=NDiv(n,"#"+div.attr("id"),i);
		});
		$.each(divs,function(i,n){n.fadeIn("slow")})
	})
}


function NDiv(dat,div,i)
{
	try
	{
		if (this.toCopy==null)
		{
			this.toCopy=$("#ToHide");
		}
		var cdiv =this.toCopy.clone();
		var xdoc=cdiv.find("#zp").get(0);
		LoadImage(xdoc,loadPicPage,format(dat.picid,"0"));
	    var month=dat.Datatime
		
		cdiv.find("#zp").css("cursor","pointer").click(function(){window.open("page.aspx?tmonth="+ month+"&picid="+dat.picid)});

		cdiv.appendTo(div);
		return cdiv;
		
	}
	catch(e)
	{
		return false;
	}
}

function format(str,def)
{
	return $.trim(str)==""?def:$.trim(str);
}
