/***************************************************************************
 * filename : FFWindow.js<br>
 * window°ü·Ã ÀÚ¹Ù½ºÅ©¸³Æ®<br>
 *
 * @version	: 1.0
 * @author	: Copyright (c) 2001 by free270. All Rights Reserved.
****************************************************************************/


var  WINDOW_ALIGN_CENTER			= 5;
var  WINDOW_ALIGN_RIGHT_TOP		= 9;
var  WINDOW_ALIGN_LEFT_TOP		= 7;
var  WINDOW_ALIGN_RIGHT_BOTTOM	= 3;
var  WINDOW_ALIGN_LEFT_BOTTOM	= 1;

/**
 * window.open() ÇÔ¼ö¿Í µ¿ÀÏÇÏ¸é ÃÖÃÊ Ã¢ÀÇ À§Ä¡¸¦ ÁöÁ¤ÇØ ÁÙ ¼ö ÀÖ´Ù.
 * @param align   : Á¤·Ä¹æ½Ä(À§¿¡ Á¤ÀÇ µÇ¾î ÀÖ´Â WINDOW_ALIGN_CENTER,WINDOW_ALIGN_RIGHT_TOP.... ¸¦ »ç¿ëÇÏ¸é µÈ´Ù.)
 * @param url     : º¸ÀÌ°íÀÚ ÇÏ´Â URL
 * @param winname : À©µµ¿ì ÀÌ¸§(form submit¿¡¼­ targetÀ» ÁÙ¶§µµ ÇÊ¿äÇÑ ÀÌ¸§ÀÌ°ÚÁÒ)
 * @param swidth  : Ã¢ÀÇ width (optionÀ¸·Î ÁÙ¼öµµ ÀÖ°ÚÁö¸¸ »ç¿ëÇÏ±â ÆíÇÒ¶ó±¸ ±×³É »°´Ù)
 * @param sheight : Ã¢ÀÇ height(optionÀ¸·Î ÁÙ¼öµµ ÀÖ°ÚÁö¸¸ »ç¿ëÇÏ±â ÆíÇÒ¶ó±¸ ±×³É »°´Ù)
 * @param option  : ex) "fullscreen=yes,toolbar=no"
 *                  fullscreen  = yes/no
 *                  channelmode = yes/no
 *                  toolbar		= yes/no
 *                  location	= yes/no
 *                  directories = yes/no
 *                  status	    = yes/no
 *                  menubar		= yes/no
 *                  scrollbars	= yes/no
 *                  resizable	= yes/no
 *                  top			= number (»ç¿ëÇÏÁö ¸¶¼¼¿ä)
 *                  left		= number (»ç¿ëÇÏÁö ¸¶¼¼¿ä)
 */
function FFWindowOpen(align,url,winname,swidth,sheight,option){
	if(align == WINDOW_ALIGN_CENTER)
		return openCenter(url,winname,swidth,sheight,option); 
	else if (align == WINDOW_ALIGN_RIGHT_TOP)
		return openRightTop(url,winname,swidth,sheight,option); 
	else if (align == WINDOW_ALIGN_LEFT_TOP)
		return openLeftTop(url,winname,swidth,sheight,option);
}


function FFWindowAlign(align,swidth,sheight){
	//...
}


function FFresizeTo(width,height){
	window.resizeTo(width, height); 
	width = width - (document.body.clientWidth -  width); 
	height = height - (document.body.clientHeight -  height); 
	window.resizeTo(width, height); 
}




///////////////////////////////////////////////////////////////////////
//¾Æ·¡ ÇÔ¼öµéÀº Á÷Á¢ È£ÃâÇÏÁö ¸»°í À§¿¡ ÀÖ´Â ÇÔ¼ö´Â »ç¿ëÇÏÀÚ

function alignCenter(swidth,sheight){
	if(swidth == null){
		swidth = self.width;
	}
	if(sheight==null){
		sheight = self.height;
	}
	self.focus();
	var sx=screen.availWidth/2-swidth/2;
	var sy=screen.availHeight/2-sheight/2;
	this.resizeTo(swidth,sheight);
	self.moveTo(sx,sy)
}
function alignLeftTop(swidth,sheight){
	if(swidth == null){
		swidth = self.width;
	}
	if(sheight==null){
		sheight = self.height;
	}
	self.focus();
	var sx=0;
	var sy=20;
	this.resizeTo(swidth,sheight);		
	self.moveTo(sx,sy)
}
function openCenter(url,winname,swidth,sheight,option){
	var sx=screen.availWidth/2-swidth/2;
	var sy=screen.availHeight/2-sheight/2;
	var obj
	if(option==null) option = "";
	obj = open(url,winname, "width="+swidth+" ,height="+sheight+",top="+sy+",left="+sx+","+option);	
	return obj
}
function openRightTop(url,winname,swidth,sheight,option){
	var sx=screen.availWidth-swidth - 15
	var sy=20;//screen.availHeight-sheight;
	var obj
	if(option==null) option = "";
	obj = open(url,winname, "width="+swidth+" ,height="+sheight+",top="+sy+",left="+sx+","+option);	
	return obj
}
function openLeftTop(url,winname,swidth,sheight,option){
	var sx=0;
	var sy=20;//screen.availHeight-sheight;
	var obj
	if(option==null) option = "";
	obj = open(url,winname, "width="+swidth+" ,height="+sheight+",top="+sy+",left="+sx+","+option);	
	return obj
}


//¸ð´Þ ´ÙÀÌ¾ó·Î±× ¿¹Á¦
/*
function InsertTable() {
  var pVar = ObjTableInfo;
  var args = new Array();
  var arr = null;
   
  // Display table information dialog
  args["NumRows"] = ObjTableInfo.NumRows;
  args["NumCols"] = ObjTableInfo.NumCols;
  args["TableAttrs"] = ObjTableInfo.TableAttrs;
  args["CellAttrs"] = ObjTableInfo.CellAttrs;
  args["Caption"] = ObjTableInfo.Caption;
  
  arr = null;
  
  arr = showModalDialog( "../WebEdit/instable.htm",
                             args,
                             "font-family:Verdana; font-size:12; dialogWidth:36em; dialogHeight:25em");
  if (arr != null) {
  
    // Initialize table object
    for ( elem in arr ) {
      if ("NumRows" == elem && arr["NumRows"] != null) {
        ObjTableInfo.NumRows = arr["NumRows"];
      } else if ("NumCols" == elem && arr["NumCols"] != null) {
        ObjTableInfo.NumCols = arr["NumCols"];
      } else if ("TableAttrs" == elem) {
        ObjTableInfo.TableAttrs = arr["TableAttrs"];
      } else if ("CellAttrs" == elem) {
        ObjTableInfo.CellAttrs = arr["CellAttrs"];
      } else if ("Caption" == elem) {
        ObjTableInfo.Caption = arr["Caption"];
      }
    }
    tbContentElement.ExecCommand(DECMD_INSERTTABLE,OLECMDEXECOPT_DODEFAULT, pVar);  
  }
}
*/
