// �˾�â
//�˾�â; ����.
// url : url
// popupname : �˾� )�����
// x : width
// y : height
// scroll : ȭ�� scroll����( 'yes','no' )
//by jupiter
function popUp(url, popupname,x,y,scroll)
{
    window.open(url,popupname,"toolbar=no,width="+x+",height="+y+ ",top="+ (screen.availheight- y )/2+",left="+(screen.availwidth- x)/2 +",directories=no,status=no,scrollbars=no,resize=no,menubar=no");
}


function setScrap(url) {
    popUp(url, "messageScrap", 400, 260);
}

// �̹��� ÷�� �¾� �˾�
function setImage(url)
{
	popUp(url, "messageImage", 400, 260);
}

// ������ ��ũ �¾� �˾�
function setMovie(url)
{
	popUp(url, "messageMovie", 470, 655);
}

// �÷��� ��ũ �¾� �˾�
function setFlash(url)
{
	popUp(url, "messageFlash", 400, 240);
}

function setImages(url)
{
    popUp(url, "image", 600, 560);
}

function appendImage(valve, align)
{
	insert2Editor(wrapImageTag(valve, align));
}

function appendMovie(valve, align)
{
	insert2Editor(wrapMovieTag(valve, align));
}

function appendFlash(valve, align)
{
	insert2Editor(wrapFlashTag(valve, align));
}

// �̹��� �±� ����
function wrapImageTag(valve, align)
{
	var template_open_tag = "<";
	var template_close_tag = ">";

	//var template_prefix = "img id=\""+ATTACHED_IMAGE_ID+"\" style=\"CURSOR: hand\" onclick=\"javascript:original_image_view(this);\"";
	var template_prefix = "img ";
	var template_postfix = "";

	var src= " src=\"" + valve + "\"";

	if ("LEFT" == align)
	{
		template_postfix = " align=\"left\"";
	}
	else if ("RIGHT" == align)
	{
		template_postfix = " align=\"right\"";
	}
	else if ("BOTTOM" == align)
	{
		template_open_tag = "<p>&nbsp;</p><center><p>" + template_open_tag;
		template_close_tag = template_close_tag + "</p></center>";
	}
	else // TOP
	{
		template_open_tag = "<center><p>" + template_open_tag;
		template_close_tag = template_close_tag + "</p></center><p>&nbsp;</p>";
	}

	return template_open_tag + template_prefix + src + template_postfix + template_close_tag;
}

// ������ �±� ����
function wrapMovieTag(valve, align)
{
	// ÷�ο����� width, height �� ���� �� �ִ� �����...

	var template_open_tag = "<";
	var template_close_tag = ">";

	var template_prefix = "embed ";
	var template_postfix = " autostart=\"false\"";

	var src= " src=\"" + valve + "\"";

	if ("LEFT" == align)
	{
		template_postfix = template_postfix + " align=\"left\"";
	}
	else if ("RIGHT" == align)
	{
		template_postfix = template_postfix + " align=\"right\"";
	}
	else if ("BOTTOM" == align)
	{
		template_open_tag = "<p>&nbsp;</p><center><p>" + template_open_tag;
		template_close_tag = template_close_tag + "</p></center>";
	}
	else // TOP
	{
		template_open_tag = "<center><p>" + template_open_tag;
		template_close_tag = template_close_tag + "</p></center><p>&nbsp;</p>";
	}

	return template_open_tag + template_prefix + src + template_postfix + template_close_tag;
}

// �÷��� �±� ����
function wrapFlashTag(valve, align)
{
	var template_open_tag = "<";
	var template_close_tag = ">";

	// <embed SRC="http://club.nate.com/cfiles/160/sketchmania/808.swf"   width=420 height=250>

	var template_prefix = "embed  play=\"true\" loop=\"true\" quality=\"high\"";
	var template_postfix = " pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash";

	var src= " src=\"" + valve + "\"";

	if ("LEFT" == align)
	{
		template_postfix = template_postfix + " align=\"left\"";
	}
	else if ("RIGHT" == align)
	{
		template_postfix = template_postfix + " align=\"right\"";
	}
	else if ("BOTTOM" == align)
	{
		template_open_tag = "<p>&nbsp;</p><center><p>" + template_open_tag;
		template_close_tag = template_close_tag + "</p></center>";
	}
	else // TOP
	{
		template_open_tag = "<center><p>" + template_open_tag;
		template_close_tag = template_close_tag + "</p></center><p>&nbsp;</p>";
	}

	return template_open_tag + template_prefix + src + template_postfix + template_close_tag;
}

// ������ ���� ó��
function insert2Editor(value)
{
	document.NetEditorGlobal.SetAction("InsertHTML", value, "", "");
}

                