var viewMode  = 1; // WYSIWYG
var font_name = '' ;
var cPicker = null;

// Ã³À½ ·Îµù½Ã HTML Á¤¸®
function Init()
{
	iView.document.designMode = 'On';
	iView.document.write("<style>P {margin-top:2px;margin-bottom:2px;} body {font-size:9pt;font-family:±¼¸²Ã¼;line-height:18px;}</style>");
	iView.document.write(document.all.doctxttext.innerHTML);
}

// Ã³À½ ·Îµù½Ã HTML Á¤¸® - ¾È¸Ô´Â ÆäÀÌÁö¿¡¼­ °Ç´Ù..
function Init_engels1004()
{
	iView.document.designMode = 'On';
	iView.document.write("<style>P {margin-top:2px;margin-bottom:2px;} body {font-size:9pt;font-family:±¼¸²Ã¼;line-height:18px;}</style>");
	iView.document.write(document.all.doctxttext.innerHTML);
}

function selOn(ctrl)
{
	ctrl.style.borderColor     = '#000000';
	ctrl.style.backgroundColor = '#B5BED6';
	ctrl.style.cursor          = 'hand';
}

function selOff(ctrl)
{
	ctrl.style.borderColor     = '#D6D3CE';  
	ctrl.style.backgroundColor = '#D6D3CE';
}

function selDown(ctrl)
{
	ctrl.style.backgroundColor = '#8492B5';
}

function selUp(ctrl)
{
	ctrl.style.backgroundColor = '#B5BED6';
}

function doBold()
{
	iView.document.execCommand('bold', false, null);
	iView.focus();
}

function doItalic()
{
	iView.document.execCommand('italic', false, null);
	iView.focus() ;
}

function doUnderline()
{
	iView.document.execCommand('underline', false, null);
	iView.focus() ;
}

function doLeft()
{
	iView.document.execCommand('justifyleft', false, null);
	iView.focus() ;
}

function doCenter()
{
	iView.document.execCommand('justifycenter', false, null);
	iView.focus() ;
}

function doRight()
{
	iView.document.execCommand('justifyright', false, null);
	iView.focus() ;
}

function doOrdList()
{
	iView.document.execCommand('insertorderedlist', false, null);
	iView.focus() ;
}

function doBulList()
{
	iView.document.execCommand('insertunorderedlist', false, null);
	iView.focus() ;
}

function doCol(type)
{
	cPicker  = window.open("/include/cjshop_colpicker1.php", "ColorPicker", "fullscreen=no,titlebar=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=320,height=290")
}

// Ä®¶ó¼ÂÆÃ ºÎºÐ
function setColor(col)
{
	if (col=='transparent')
	{
		iView.document.execCommand('forecolor', false, '#c0c0c0');
	}
	
	else
	{
		iView.document.execCommand('forecolor', false, col);
	}
}

function doLink()
{
	iView.document.execCommand('createlink');
	iView.focus() ;
}

function doImage()
{
	var imgSrc = prompt('Enter image location', '');

	if (imgSrc != null) iView.document.execCommand('insertimage', false, imgSrc);
	iView.focus() ;
}

function doRule()
{
	iView.document.execCommand('inserthorizontalrule', false, null);
	iView.focus() ;
}

function doFont(fName)
{
	if (fName != '') iView.document.execCommand('fontname', false, fName);
	font_name = fName ;
	iView.focus() ;
}

function doSize(fSize)
{
	if (fSize != '') iView.document.execCommand('fontsize', false, fSize);
	iView.focus() ;
}

function doHead(hType)
{
	if(hType != '')
	{
		iView.document.execCommand('FormatBlock', false, hType);  
		doFont(font_name);
	}

	iView.focus() ;
}

function doToggleView_Code()
{
	iHTML = iView.document.body.innerHTML;
	iView.document.body.innerText = iHTML;

	tblCtrls.style.display = 'none';
	sel_ctrl.style.display = 'none' ;

	iView.focus();
	viewMode = 2;
	iView.focus() ;
}


function doToggleView_Html()
{
	iText = iView.document.body.innerText;
	iView.document.body.innerHTML = iText;

	tblCtrls.style.display = 'inline';
	sel_ctrl.style.display = 'inline' ;
		
	iView.focus();
	viewMode = 1;
	iView.focus() ;
}
