<!--
/*
 * width		=> width
 * height	=> height
 * name	=> name
 * url			=> url
 * scroll	=> ("yes", "no")
 */
function winOpen(width, height, name, url, scroll, modal) {
	if (!url || typeof(url) == "undefined") url = "";
	if (!scroll || typeof(scroll) == "undefined") scroll = "no";
	if (!modal || typeof(modal) == "undefined") modal = "";
	
	var option;
	if(width == 0 || height == 0) {
		option = "";
	} else {
		var l = (screen.width / 2) - (width / 2);
		var t = (screen.height / 2) - (height / 2);
		option = "left=" + l + ", top=" + t + ", width=" + width + ", height=" + height + ", scrollbars=" + scroll + ", toolbar=no, location=no, status=no";
		
		if (modal == "modal") {
			option += ", resizable=no, modal=yes, dependent=yes";
		} else {
			option += ", resizable=yes";
		}
		
	}

	var btyWin = null;
//	btyWin = window.open(url, "", option);
//	btyWin.name = name;
	btyWin = window.open(url, name, option);
	btyWin.focus();

	return btyWin;
}


/*
 * mode		=> default(alert), iframe(iframe)
 * title		=> title
 * width		=> width
 * height	=> height
 * msg			=> message			<= mode(iframe) file path
 * btnWidth1	=> button1 size
 * btnTitle1		=> button1 name
 * btnWidth2	=> button2 size
 * btnTitle2		=> button2 name
 * icon			=> image
 * MODALESS => ModalDialog/ModalessDialog
						=> ModalDialog ¸®ÅÏ°ª Á¦´ë·Î °¡Á®¿È
						=> ModelessDialog ¸®ÅÏ°ªÀ» objectÇüÅÂ·Î ¹ÞÀ½
 * btnItem		=> button count

 * Object() or Array() send
 */
function modal(mode, modalTitle, modalWidth, modalHeight, modalMsg, btnWidth1, btnTitle1, btnWidth2, btnTitle2, modalIcon, MODALESS, btnItem) {
	var args = new Array();

	if(!mode || typeof(mode) == "undefined")									//mode()
		mode = "default";
	if(!modalTitle || typeof(modalTitle) == "undefined")					//Dialog title
		modalTitle = "error";
	if(!modalWidth || typeof(modalWidth) == "undefined")				//Dialog WIDTH
		modalWidth = 360;
	if(!modalHeight || typeof(modalHeight) == "undefined")				//Dialog HEIGHT
		modalHeight = 220;
	if(!modalMsg || typeof(modalMsg) == "undefined")					//message
		modalMsg = "error !";

	if(!btnItem || typeof(btnItem) == "undefined")
		btnItem = "1";

	if(!btnWidth1 || typeof(btnWidth1) == "undefined")					//button1 WIDTH
		btnWidth1 = "70";
	if(!btnTitle1 || typeof(btnTitle1) == "undefined") {					//button1 name
		if(btnItem == "2") {
			btnTitle1 = "Yes";
		} else {
			btnTitle1 = "OK";
		}
	}

	if(btnItem == "2") {
		if(!btnWidth2 || typeof(btnWidth2) == "undefined")	//button2 WIDTH
			btnWidth2 = "70";
		if(!btnTitle2 || typeof(btnTitle2) == "undefined")		//button2 name
			btnTitle2 = "No";

		args["btnWidth2"] = btnWidth2;
		args["btnTitle2"] = btnTitle2;
		args["btnLink2"] = "javascript:doNo()";
	}

	if(!modalIcon || typeof(modalIcon) == "undefined") {
	} else {
		args["modalIcon"] = modalIcon;
	}

	if(!MODALESS || typeof(MODALESS) == "undefined")
		MODALESS = "modal";

	args["modalTitle"] = modalTitle;
	args["modalMsg"] = modalMsg;

	args["btnWidth1"] = btnWidth1;
	args["btnTitle1"] = btnTitle1;
	args["btnLink1"] = "javascript:doYes()";

	args["mode"] = mode;
	
	args["parent"] = document;
	args["top"] = top;
	args[0] = null;	//FireFox3 ¿¡¼­´Â argument[0]¿¡ ¾î¶²°ªÀÌ ÀÖ¾î¾ß ¹Þ´ÂURL¿¡¼­ window.dialogArguments ·Î argument¸¦ ¹ÞÀ» ¼ö ÀÖÀ½


	var dialog = null;

	//domain is not factor
	//popup url
	var url = "/_lib/common/modal_popup.php?mode=" + mode + "&title=" + modalTitle;

	var option = "dialogWidth:" + modalWidth + "px; dialogHeight:" + modalHeight + "px; edge:sunken; center:yes; resizable:no; status:no; help:no; scroll:no;";

//	if(!MODALESS || typeof(MODALESS) == "undefined") {
	try {
		if(MODALESS == "modal") {
			dialog = window.showModalDialog(url, args, option);
		} else {
			dialog = window.showModelessDialog(url, args, option);
		}
	} catch (e) {
		dialog = winOpen(modalWidth, modalHeight, window, modalMsg, "no", "modal");
	}

	return dialog;
}


//È®ÀÎ
function msgOK(modalTitle, modalMsg, btnTitle1, modalWidth, modalHeight, btnWidth1) {
	if(!modalWidth || typeof(modalWidth) == "undefined") modalWidth = "";
	if(!modalHeight || typeof(modalHeight) == "undefined") modalHeight = "";
	if(!btnWidth1 || typeof(btnWidth1) == "undefined") btnWidth1 = "";
	
	return modal("", modalTitle, modalWidth, modalHeight, modalMsg, btnWidth1, btnTitle1, "", "", "", "", "");
}


//È®ÀÎ Ãë¼Ò
function msgYesNo(modalTitle, modalMsg, btnTitle1, btnTitle2, modalWidth, modalHeight, btnWidth1, btnWidth2) {
	if(!modalWidth || typeof(modalWidth) == "undefined") modalWidth = "";
	if(!modalHeight || typeof(modalHeight) == "undefined") modalHeight = "";
	if(!btnWidth1 || typeof(btnWidth1) == "undefined") btnWidth1 = "";
	if(!btnWidth2 || typeof(btnWidth2) == "undefined") btnWidth2 = "";
	
	return modal("", modalTitle, modalWidth, modalHeight, modalMsg, btnWidth1, btnTitle1, btnWidth2, btnTitle2, "", "", "2");
}


//window close
function winClose() {
	window.close();
}


//iframe
//function setIframe(_name, _width, _height, _scroll, _url) {
function doCreateIframe(_name, _width, _height, _scroll, _url, _style, _className) {
	var _strHtml;
	
	if(!_width || typeof(_width) == "undefined") _width = 0;
	if(!_height || typeof(_height) == "undefined") _height = 0;
	if(!_scroll || typeof(_scroll) == "undefined") _scroll = "no";
	if(!_url || typeof(_url) == "undefined") _url = "about:blank";
	if(!_style || typeof(_style) == "undefined") _style = "";
	if(!_className || typeof(_className) == "undefined") _className = "";
	
	_strHtml = "<iframe " 
						+" id=\"" + _name + "\" "
						+" name=\"" + _name + "\" "
						+" width=\"" + _width + "\" "
						+" height=\"" + _height + "\" "
						+" scrolling=\"" + _scroll + "\" "
						+" src=\"" + _url + "\" "
						+" frameborder=\"0\" framespacing=\"0\" marginwidth=\"0\" marginheight=\"0\" "
						+" style=\"" + _style + "\" "
						+" class=\"" + _className + "\" "
						+"></iframe>";
	
	document.write(_strHtml);
}


//object
function doCreateObject(_name, _width, _height, _scroll, _url) {
	var _strHtml;
	
	if(!_width || typeof(_width) == "undefined") _width = 0;
	if(!_height || typeof(_height) == "undefined") _height = 0;
	if(!_scroll || typeof(_scroll) == "undefined") _scroll = "no";
	if(!_url || typeof(_url) == "undefined") _url = "about:blank";
	
	_strHtml = "<object id=\"" + _name + "\" name=\"" + _name + "\" width=\"" + _width + "\" height=\"" + _height + "\" type=\"text/x-scriptlet\">"
						+"<param name=\"url\" value=\"" + _url + "\">"
						+"<param name=\"selectableContent\" value=\"0\">"
						+"<param name=\"scrollbar\" value=\"" + _scroll + "\">"
						+"</object>";
	
	document.write(_strHtml);
}
//-->