function popup(parent, src, width, height)
{
	parent.setAttribute('href','javascript:void(0);');
	parent.setAttribute('target','');
	var win = window.open('/assets/file/index.php?GetFile='+src,null,"height="+height+",width="+width+",status=no,left=112, top=84,toolbar=no,menubar=no,location=no");
}

var timerID;
var bRichText = false;

function show(menu, top)
{
alert(top);
	clearTimeout(timerID);
	timerID = setTimeout("hide('" + menu + "')", 1000);
	document.getElementById(menu).style.top = top;
	//document.getElementById(menu).style.left = '160';
	document.getElementById(menu).style.display = 'inline';

}


function hide(menu)
{
	document.getElementById(menu).style.display = 'none';
}


function editor_init()
{
	document.frames.editor.document.designMode = "On";
}

function editor_cmd(cmd)
{
	if(cmd == "init")
	{
		if(!bRichText) 
		{
			editor_init();
			frames.editor.document.body.innerHTML = document.getElementById("default[long_text]").value;
			var hidden = document.getElementById('default[long_text]');
			hidden.style.display = "none";

			var frame = document.getElementById('editor');
			frame.style.display = "block";
			bRichText = true;

			var button = document.getElementById('init');
			button.value = "View Source...";
		}
		else
		{
			document.getElementById("default[long_text]").value = frames.editor.document.body.innerHTML;
			var hidden = document.getElementById('default[long_text]');
			hidden.style.display = "block";

			var frame = document.getElementById('editor');
			frame.style.display = "none";
			bRichText = false;

			var button = document.getElementById('init');
			button.value = "Rich Text...";
		}
	}
	else
	{
		if(cmd == "heading")
		{
			var select = document.getElementById('heading');
//			switch(heading)
//			{
//				case "Paragraph";
//			}
//			frames.editor.document.execCommand(cmd);
		}
		else
		{
			frames.editor.document.execCommand(cmd);
		}
	}
}



function editor_save()
{
	if(!bRichText) 
	{

	}
	else
	{
		var hidden = document.getElementById('default[long_text]');
		hidden.value = (frames.editor.document.body.innerHTML);
	}

}