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++;
	var p = (parent.index/parent.data.length) * parent.document.getElementById('mytable').offsetWidth;
	parent.document.getElementById('loadhtml').width = parseInt(p);
	parent.document.getElementById('loadhtml').innerHTML = '<font color=green>'+parent.index+'</font>/<font color=green>'+parent.data.length+'</font>';
}

function htmlCreate( id)
{
	parent.document.getElementById('divProcessing').style.display = 'block';
	var link = "../index.php?mod="+channelid+"&ac="+contentphp+"&id="+id;
	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+"&ac="+listphp+"&cid="+cid+"&pageno="+pageno;
	AJAX.request( link,
	{
		method		: "get",
		onComplete	: function( json)
		{
			try
			{
				var total =  json[0] > 0 ? json[0] : 1;
				parent.document.getElementById('loadhtml').width = parseInt((pageno/total)*100)+"%";
				parent.document.getElementById('loadhtml').innerHTML = '<font color=green>'+pageno+'</font>/<font color=green>'+total+'</font>';
				if( pageno < total)
				{
					pageno++;
					htmlAcategoryCreate( cid, pageno);
				}
				else
				{
					htmlAcategoryCreateGo();
				}
			}catch(e){
				htmlAcategoryCreateGo();
			}
		}
	});
}