var color0, color1;
var page;





function go(url)
{
	window.location.href = url;
}

function goback()
{
	window.location.href = 'index.php?fn=back';
}

function col0(obj, over)
{
	
	if (over)
	{
		color0 = obj.style.backgroundColor;
		obj.style.backgroundColor = '#66CCFF';
	}
	else
		obj.style.backgroundColor = color0;
}

function col1(obj, over)
{
	if (over)
	{
		color1 = obj.style.backgroundColor;
		obj.style.backgroundColor = '#66CCFF';
	}
	else
		obj.style.backgroundColor = color1;
}


function nothing()
{
	iplate.location.replace('index.php?fn=blank');
}

function confirmDelete()
{
	if (confirm('確定要刪除嗎?'))
		return true;
}

function confirmDeletePicture(url)
{
	if (confirm('確定要刪除此圖片嗎?'))
		go(url);
}

function confirmDeleteFile(url)
{
	if (confirm('確定要刪除此檔案嗎?'))
		go(url);
}


function GetLength(id)
{
	// This functions shows that you can interact directly with the editor area
	// DOM. In this way you have the freedom to do anything you want with it.

	// Get the editor instance that we want to interact with.
	var oEditor = FCKeditorAPI.GetInstance(id) ;

	// Get the Editor Area DOM (Document object).
	var oDOM = oEditor.EditorDocument ;

	var iLength ;

	// The are two diffent ways to get the text (without HTML markups).
	// It is browser specific.

	if ( document.all )		// If Internet Explorer.
	{
		iLength = trim(oDOM.body.innerText).length ;
	}
	else					// If Gecko.
	{
		var r = oDOM.createRange() ;
		r.selectNodeContents( oDOM.body ) ;
		
		iLength = trim(r.toString()).length ;
	}

	return (iLength);

}

function ClearContent(id)
{
    var oEditor = FCKeditorAPI.GetInstance(id);
    oEditor.SetHTML("");
}

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


