

var _DEF_UnitType_point = 1;
var _DEF_UnitType_mm = 2;
var _DEF_UnitType_cm = 3;
var _DEF_UnitType_inch = 4;

// ÇöÀçÀÇ Mode
var Def_ProcCommand_Delete        = 1;


// ÇöÀçÀÇ Mode
var Def_ToolMode_PenDraw          = 1;
var Def_ToolMode_Pen              = 2;
var Def_ToolMode_PenMoveObject    = 3;
var Def_ToolMode_PenReSizeObject  = 4;
var Def_ToolMode_AngleShear       = 5;
var Def_ToolMode_Zoom             = 6;
var Def_ToolMode_Fill             = 7;
var Def_ToolMode_ColorDropper     = 8;
var Def_ToolMode_Gradient         = 9;
var Def_ToolMode_Select           = 10;


// Select Iamge Move
var Def_OBJECT_MOVETOFRONT    = 1;
var Def_OBJECT_MOVETOBACK     = 2;
var Def_OBJECT_MOVEFORWARD    = 3;
var Def_OBJECT_MOVEBACK       = 4;


function isHangul(s) 
{
     var len;
     len = s.length;
     for (var i = 0; i < len; i++)  {
         if (s.charCodeAt(i)  != 32 && (s.charCodeAt(i)  < 44032 || s.charCodeAt(i)  > 55203))
             return 0;
     }
     return 1;
} 

// +--------------------------------------------------------------------------

function AppSelectLayer(selectstring)

{

	DrApp.SelectLayer(selectstring);

}



// +--------------------------------------------------------------------------

function DrAppendImage(iname, Zoom)

{

	DrApp.AppendImage(iname, Zoom);

//	DrApp.LayerListView();

}

// +--------------------------------------------------------------------------

function DrAppendText(

      			CursourX, CursourY,

      			FontSizeX, FontSizeY,

      			FillColor_R, FillColor_G, FillColor_B, FillColor,

      			LineColor_R, LineColor_G, LineColor_B, Set_LineColor,

      			LineWidth,

      			NextLineGap,

      			FontName,

      			TextString) {



	DrApp.AppendText(

			CursourX, CursourY,

      			FontSizeX, FontSizeY,

      			FillColor_R, FillColor_G, FillColor_B, FillColor,

      			LineColor_R, LineColor_G, LineColor_B, Set_LineColor,

      			LineWidth,

      			NextLineGap,

      			FontName,

      			TextString

      			);



//	DrApp.LayerListView();

}

// +--------------------------------------------------------------------------

function DrAppendText_N(

      			CursourX, CursourY,

      			FontSizeX, FontSizeY,

      			FillColor,

      			LineColor,

      			LineWidth,

      			NextLineGap,

      			FontName,

      			TextString) {



	DrApp.AppendText(

			CursourX, CursourY,

      			FontSizeX, FontSizeY,

      			FillColor,

      			LineColor,

      			LineWidth,

      			NextLineGap,

      			FontName,

      			TextString

      			);



//	DrApp.LayerListView();

}

// +--------------------------------------------------------------------------

function DrAppendText_F(

      			CursourX, CursourY,

      			FontSizeX, FontSizeY,

      			FillColor,

      			LineColor,

      			LineWidth,

      			NextLineGap,

      			FontName,

      			TextString) {



	DrApp.AppendText_F(

			CursourX, CursourY,

      			FontSizeX, FontSizeY,

      			FillColor,

      			LineColor,

      			LineWidth,

      			NextLineGap,

      			FontName,

      			TextString

      			);



//	DrApp.LayerListView();

}

// +--------------------------------------------------------------------------

function DrAppend_FColor(r, g, b) {

  	DrApp.SetForgroundColor(r,g,b);

}



// +--------------------------------------------------------------------------

function DrAppend_FColor_I(rgb) {

  	DrApp.SetForgroundColor_I(rgb);

}

// +--------------------------------------------------------------------------

function DrAppend_BColor(r, g, b) {

  DrApp.SetBackgroundColor(r,g,b);

}

// +--------------------------------------------------------------------------

function DrAppend_BColor_I(rgb) {

  DrApp.SetBackgroundColor_I(rgb);

}

// +--------------------------------------------------------------------------

function OpenPdl(iname, Zoom) {

  	DrApp.ArtOpen_PDL(iname, Zoom);

//	DrApp.LayerListView();

}


// +--------------------------------------------------------------------------

function OpenPff(iname, Zoom) {

  	DrApp.PictureFrameOpen_PFF(iname, Zoom);

//	DrApp.LayerListView();

}


// +--------------------------------------------------------------------------

function SetToolMode(mode) {

  DrApp.SetMode(mode);

}



// +--------------------------------------------------------------------------

function ProcCommand(cmd) {

  	DrApp.ProcCommand(cmd);

//	DrApp.LayerListView();

}



// +--------------------------------------------------------------------------

function ProcPosition(type) {

	DrApp.SetPositionObject(type);

//	DrApp.LayerListView();

}



// +--------------------------------------------------------------------------

function UpDownLoad() {

	DrApp.FileUpDown();

//	DrApp.LayerListView();

}



// +--------------------------------------------------------------------------

// ÄíÅ°ÀÇ °ªÀ» °¡Á®¿À´Â ÇÔ¼öÀÔ´Ï´Ù.

// GetCookie(ÄíÅ°ÀÌ¸§);

function GetCookie (name) {

        var arg = name + "=";

        var alen = arg.length;

        var clen = document.cookie.length;

        var i = 0;

        while (i < clen) {

        var j = i + alen;

        if (document.cookie.substring(i, j) == arg)

                return getCookieVal (j);

                i = document.cookie.indexOf(" ", i) + 1;

                if (i == 0) break;

        }

        return null;

}



// +--------------------------------------------------------------------------

// ÄíÅ°¸¦ ±Á´Â ÇÔ¼öÀÔ´Ï´Ù.

// php ÀÇ setcookie() ÇÔ¼ö¿Í µ¿ÀÏÇÏ°Ô »ç¿ëÇÏ¸é µË´Ï´Ù.

// SetCookie (ÄíÅ°ÀÌ¸§,°ª,º¸°ü½Ã°£,µð·ºÅä¸®,µµ¸ÞÀÎ,....);

function SetCookie (name, value) {

        var argv = SetCookie.arguments;

        var argc = SetCookie.arguments.length;

        var expires = (argc > 2) ? argv[2] : null;

        var path = (argc > 3) ? argv[3] : null;

        var domain = (argc > 4) ? argv[4] : null;

        var secure = (argc > 5) ? argv[5] : false;

        document.cookie = name + "=" + escape (value) +

        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +

        ((path == null) ? "" : ("; path=" + path)) +

        ((domain == null) ? "" : ("; domain=" + domain)) +

        ((secure == true) ? "; secure" : "");

}





// +--------------------------------------------------------------------------

// ÄíÅ°¸¦ Áö¿ì´Â ÇÔ¼ö ÀÔ´Ï´Ù.

// DeleteCookie (ÄíÅ°ÀÌ¸§);

function DeleteCookie (name) {

        var exp = new Date();

        exp.setTime (exp.getTime() - 1);

        // This cookie is history

        var cval = GetCookie (name);

        document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}



// +--------------------------------------------------------------------------

//GetCookie() ¿¡¼­ »ç¿ëÇÏ´Â ÇÔ¼ö µû·Î ¾µÀÏÀº ¾ø½À´Ï´Ù.:)

function getCookieVal (offset) {

        var endstr = document.cookie.indexOf (";", offset);

        if (endstr == -1)

                endstr = document.cookie.length;

                return unescape(document.cookie.substring(offset, endstr));

}

function IsLogin()
{
	var v = GetCookie('drapp2');
//	window.alert( v );
	
	if( v == "" || v == null || v < 1) {
		return 0;
   	}
	return 1;
}

function MMtoPT( r )	{
  	return  r * 72 / 25.4 ;
}

function PTtoMM( r )	{
    return r / 72 * 25.4;
}

function INtoPT( r )	{
    return  r * 72;
}

function PTtoIN( r )	{
    return  r / 72;
}

function PTtoQ( r )	{
    return  PTtoMM( r ) * 4;
}

function QtoPT( r )		{
    return MMtoPT( r ) * 0.25;
}
