function hide_subject()
{
	var num_cats = document.getElementById("num_cats");
	for(var i=1;i<=num_cats.value;i++)
	{
		var num_subjects = document.getElementById("num_subjects"+i);
		if(num_subjects.value == 0)
		{
			var oTitle = document.getElementById("title"+i);
			oTitle.style.display = "none";
		}
	}
}

function span(oDiv, oA)
{
	oDiv.style.display = "inline";
	oA.onclick = function(){cclose(oDiv, oA);}
}

function cclose(oDiv, oA)
{
	oDiv.style.display = "none";
	oA.onclick = function(){span(oDiv, oA);}
}

function publish(id)
{
	if(confirm("是否確定發佈？"))
	{
		window.location = "publish_code.php?id="+id;
	}
}

function disable(id)
{
	if(confirm("是否確定撤回？"))
	{
		window.location = "disable_code.php?id="+id;
	}
}

function spanContent(id, source)
{
	if(source == "content")
	{
		var oAbstract = document.getElementById("abstract"+id);
		var oContent = document.getElementById("content"+id);
		oAbstract.style.display = "none";
		var oSwitch = document.getElementById("switch"+id);
		oSwitch.innerHTML = "摘要";
	}
	else
	{
		var oContent = document.getElementById("contents"+id);
		var oSwitch = document.getElementById("switch"+id);
	}
	oContent.style.display = "inline";
	oSwitch.href = "javascript:closeContent("+id+",'"+source+"');";
}

function closeContent(id, source)
{
	if(source == "content")
	{
		var oAbstract = document.getElementById("abstract"+id);
		var oContent = document.getElementById("content"+id);
		oAbstract.style.display = "inline";
		var oSwitch = document.getElementById("switch"+id);
		oSwitch.innerHTML = "全文";
	}
	else
	{
		var oContent = document.getElementById("contents"+id);
		var oSwitch = document.getElementById("switch"+id);
	}
	oContent.style.display = "none";
	oSwitch.href = "javascript:spanContent("+id+",'"+source+"');";
}

function openWindow(theURL,winName,features)
{
	window.open(theURL,winName,features);
}
