function htmlCreateReady()
{
	switch( type)
	{
		case 'a':
		case 'f':
			htmlCreateGo();
		break;

		case 'c':
			htmlAcategoryCreateGo();
		break;
	}
}

function htmlCreateGo()
{
	if( parent.index == parent.data.length )
	{
		parent.document.getElementById('divProcessing').style.display = 'none';
		if( parent.data.length == parent.pagesize)
		{
			parent.htmlReady( parent.tp, ++parent.pg);
			return;
		}
		if(parent.htmlFlag==0)
		{
			parent.htmlFlag=1;
			alert('HTML静态文件生成完毕');
			parent.disabledButton(false);
		}
		return true;
	}
	htmlCreate( parent.data[parent.index]);
	parent.index++;
	parent.document.getElementById('loadhtml').width = parseInt((parent.index/parent.data.length)*100)+"%";
	parent.document.getElementById('loadhtml').innerHTML = '<font color=green>'+parent.index+'</font>/<font color=green>'+parent.data.length+'</font>';
}

function htmlCreate( str)
{
	var arr = str.split("-");
	for( var i=1; i<=arr[1]; i++)
	{
		parent.document.getElementById('divProcessing').style.display = 'block';
		var link = "../index.php?mod="+channelid+"&ac="+contentphp+"&id="+arr[0]+"&page="+i;
		AJAX.request( link,
		{
			method		: "get",
			onComplete	: function(json)
			{
				htmlCreateGo();
			}
		});
	}
}

function htmlAcategoryCreateGo()
{
	if( parent.index == parent.data.length )
	{
		parent.document.getElementById('divProcessing').style.display = 'none';
		if(parent.htmlFlag==0)
		{
			parent.htmlFlag=1;
		}
		return true;
	}
	htmlAcategoryCreate( parent.data[parent.index], 1);
	parent.index++;
	parent.document.getElementById('loadhtml').width = 0;
	parent.document.getElementById('loadhtml').innerHTML = '';
}
function htmlAcategoryCreate( cid, pageno)
{
	parent.document.getElementById('divProcessing').style.display = 'block';
	var link = "../index.php?mod="+channelid+"&mod="+listphp+"&cid="+cid+"&pageno="+pageno;
	AJAX.request( link,
	{
		method		: "get",
		onComplete	: function(json)
		{
			try
			{
				parent.document.getElementById('loadhtml').width = parseInt((pageno/json[0])*100)+"%";
				parent.document.getElementById('loadhtml').innerHTML = '<font color=green>'+pageno+'</font>/<font color=green>'+json[0]+'</font>';
				if( pageno < json[0])
				{
					pageno++;
					htmlAcategoryCreate( cid, pageno);
				}
				else
				{
					htmlAcategoryCreateGo();
				}
			}catch(e){
				htmlAcategoryCreateGo();
			}
		}
	});
}