
function open_popup(path, shape, win_name)
{
	shape += "toolbar=no,location=no,directories=no,status=no,";
	shape += "menubar=no,scrollbars=auto,resizable=no";
	var openWin = open(path, win_name, shape);
	openWin.focus();
}

function loginInfoPop(chkNo)
{
	var path = "http://www.healthkorea.net/hkcommon/login/loginalert.aspx?user_id=" + chkNo;
	
	if(opener == "undefined" || opener == null || opener == "")
	{
		open_popup(path, 'width=530,height=540', 'popinfo');	
	}
	else
	{
		top.location.href = path;
	}
}

function open_modal(path, shape, win_name)
{
	shape	+= "dialogTop:40px;dialogLeft:20px;help=0;status=0;scroll=0;";
	var retVal = window.showModalDialog(path, win_name, shape);
}

function open_popup2(path, win_name)
{
	shape  = "width=790,height=620,";
	shape += "toolbar=no,location=no,directories=no,status=no,";
	shape += "menubar=no,scrollbars=no,resizable=no";
	var myWin = open(path, win_name, shape);
	myWin.focus();
}

function open_popup3(path, shape2, win_name)
{
	var shape = "";
	shape += "toolbar=no,location=no,directories=no,status=no,";
	shape += "menubar=no,scrollbars=yes,resizable=no,";
	shape += shape2
	
	var openWin = open(path, win_name, shape);
	openWin.focus();
}

function open_popup4(path, shape, win_name)
{
	shape += "toolbar=no,location=no,directories=no,status=no,";
	shape += "menubar=no,scrollbars=auto,resizable=yes";
	var openWin = open(path, win_name, shape);
	openWin.focus();
}

function open_popup_noscroll(path,shape2,win_name)
{
	var shape = "";
	shape += "toolbar=no,location=no,directories=no,status=no,";
	shape += "menubar=no,scrollbars=no,resizable=no,";
	shape += shape2
	
	var openWin = open(path, win_name, shape);
	openWin.focus();
}


// ÆäÀÌÁö ·Îµå½Ã iframe height Á¶Á¤
function iframeHeightChange(ifmHeight, ifmObjId)
{
	var ifm1 = document.getElementById(ifmObjId);
	ifm1.style.height = ifmHeight;
}

function Dang_DescPopup()
{
	var path = "/Etc/reg/Sub_dang_desc_popup.aspx";
	var shape = "width=510,height=500";
	var popName = "dangDesc";
	open_popup(path, shape, popName);
}

function goPathLogin(aType, path)
{
	if(aType == "1")
	{
		if(confirm('°Ç°­»ùÈ¸¿ø¼­ºñ½ºÀÔ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?'))
		{
			if(path != "")
				top.location.href = "/hkcommon/login/login.aspx?path=" + path;
			else
				top.location.href = "/hkcommon/login/login.aspx";
		}
		else
		{
			top.location.href = "/";
		}
	}
	else
	{
		if(path != "")
			top.location.href = "/hkcommon/login/login.aspx?path=" + path;
		else
			top.location.href = "/hkcommon/login/login.aspx";
	}
}

function goMyHealthPathLogin(path, mysno)
{
	if(mysno == "")
	{
		alert('ºÎÁ¤È®ÇÑ URL ÀÔ´Ï´Ù.\n\nÈ®ÀÎÈÄ »ç¿ëÇÏ¼¼¿ä.');
		self.close();
		return;
	}
	else
	{
		alert('°Ç°­»ùÈ¸¿ø¼­ºñ½ºÀÔ´Ï´Ù.\n\n·Î±×ÀÎÈÄ »ç¿ë°¡´ÉÇÕ´Ï´Ù.');
		top.location.href = "/MyHealth/main/index.aspx?mysno=" + mysno + "&kspid=MY001101&path=" + path;
		return;
	}
	/*
	if(confirm('°Ç°­»ùÈ¸¿ø¼­ºñ½ºÀÔ´Ï´Ù.\n\n·Î±×ÀÎÈÄ »ç¿ë°¡´ÉÇÕ´Ï´Ù.'))
	{
		if(path != "")
		{
			top.location.href = path;
		}
		else
		{
			alert('ºÎÁ¤È®ÇÑ URL ÀÔ´Ï´Ù.\n\nÈ®ÀÎÈÄ »ç¿ëÇÏ¼¼¿ä.');
			self.close();
			return;
		}
	}
	else
	{
		top.location.href = "http://myhealth.healthkorea.net/MyHealth/main/index.aspx?mysno=25&kspid=MY001101";
	}
	*/
}


function myHealthAddMyDoctor(LinkMyHealth, mySno, sHid, viewType)
{
	if(confirm("ÁÖÄ¡ÀÇ·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?"))
	{
		path = "/healthcare/mydoctor/adddoctor.aspx?mySno=[mySno]&docID=[docID]";
		path = path.replace("[mySno]", mySno);
		path = path.replace("[docID]", sHid);
		
		top.location.href = path;
		//open_popup2(path, 'myHealth')
	}
}

function healthCareAddMyDoctor(sHid)
{
	if(confirm("ÁÖÄ¡ÀÇ·Î µî·ÏÇÏ½Ã°Ú½À´Ï±î?"))
	{
		path = "/HealthCare/MyDoctor/AddDoctor.aspx?docID=[docID]";
		path = path.replace("[docID]", sHid);
		top.location.href = path;
	}
}

function kHomePage(path)
{
	var openWin = window.open(path, "kHomepage", "");
	openWin.focus();
}

function myHealth(LinkMyHealth, mySno, viewType)
{
	path = LinkMyHealth + "myhealth/main/index.aspx?mySno=[mySno]&kspid=[kspid]&g=[g]";
	path = path.replace("[mySno]", mySno);
	
	if(viewType == "deptlist")		// ÁÖ¹®Áø º¸Á¶¹®Áø ¸®½ºÆ®
	{
		path = path.replace("[kspid]", "MY001204");
	}
	else if(viewType == "food")	// ½ÄÀÌ°ü¸®
	{
		path = path.replace("[kspid]", "MY001415");
		path = path.replace("[g]", "4");
	}
	else if(viewType == "ex")		// ¿îµ¿°ü¸®
	{
		path = path.replace("[kspid]", "MY001416");
		path = path.replace("[g]", "4");
	}
	else if(viewType == "nosmoke")	// ±Ý¿¬
	{
		path = path.replace("[kspid]", "MY001302");
	}
	else if(viewType == "rh")	// Ç÷´ç
	{
		path = path.replace("[kspid]", "MY001410&cat=1");
	}
	else if(viewType == "diabetes")	// ´ç´¢
	{
		path = path.replace("[kspid]", "MY001410&cat=2");
	}
	else if(viewType == "clinic")	// ³»¿øÁ¤º¸
	{
		path = path.replace("[kspid]", "MY001411");
	}
	else if(viewType == "drug")	// ¾à·ÂÁ¤º¸
	{
		path = path.replace("[kspid]", "MY001414");
	}
	else if(viewType == "weight")	// Ã¼Áß
	{
		path = path.replace("[kspid]", "MY001404");
	}
	else if(viewType == "body")	// ½ÅÃ¼Á¤º¸
	{
		path = path.replace("[kspid]", "MY001404");
	}
	else if(viewType == "info")	// °³ÀÎÁ¤º¸
	{
		path = path.replace("[kspid]", "MY001402");
	}
	else if(viewType == "disease")	// Áúº´·Â
	{
		path = path.replace("[kspid]", "MY001409");
	}
	else if(viewType == "healthcheck")	// °Ç°­ÃøÁ¤
	{
		path = path.replace("[kspid]", "MY001410");
	}
	else if(viewType == "hrecord")	// °ËÁø±â·Ï
	{
		path = path.replace("[kspid]", "MY001412");
	}
	else if(viewType == "setinfo")	// ¸ÂÃãÁ¤º¸ ¼³Á¤
	{
		path = path.replace("[kspid]", "MY001601");
	}
	else if(viewType == "myscrap")	// ³ªÀÇ ½ºÅ©·¦
	{
		path = path.replace("[kspid]", "MY001604");
	}
	else if(viewType == "mydoctor")	// ÁÖÄ¡ÀÇ ÆäÀÌÁö
	{
		path = path.replace("[kspid]", "MY001501");
	}
	else if(viewType == "userhrecord")	// °Ç°­±â·Ï
	{
		path = path.replace("[kspid]", "MY001401");
	}
	else if(viewType == "myConsultList")	// °Ç°­»ó´ã±â·Ï
	{
		path = path.replace("[kspid]", "MY001420");
		path = path.replace("[g]", "3");
	}
	else
	{
		path = path.replace("[kspid]", "MY001101");
	}

	//alert(path);
	open_popup2(path, 'myHealth')
}




















// SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
// ==============================================================================================================
// =================================  window.createPopUp  =======================================================
// ==============================================================================================================
// ==============================================================================================================



var dangAlertHtml;

if (typeof(THEME_TYPE) == "undefined" ) 
    THEME_TYPE = "TM0";

TM0_BACKGROUND_COLOR= "#EAF5FF";
TM0_BORDER_COLOR    = "#0053B0";
TM1_BACKGROUND_COLOR= "#FBFDEE";
TM1_BORDER_COLOR    = "#6FA300";
TM2_BACKGROUND_COLOR= "#F0FEFF";
TM2_BORDER_COLOR    = "#00A2B0";
TM3_BACKGROUND_COLOR= "#F0FFF0";
TM3_BORDER_COLOR    = "#008B8B";
TM4_BACKGROUND_COLOR= "#FFEBF8";
TM4_BORDER_COLOR    = "#C20DA4";


function callFormatting(sFormatString)
{
    window.document.execCommand(sFormatString);
}
 

function makeUBContextMenu(dangMTypeVal)
{
	dangAlertHtml = "";
	dangAlertHtml += '<TABLE border=0 BGCOLOR="transparent" width=240 CELLPADDING="2" CELLSPACING="2" background="/img/common/bg/brown_bg.gif" STYLE="border:1px solid threedshadow;filter:progid:DXImageTransform.Microsoft.Shadow(Color=threedshadow, Strength=4, Direction=135);background-color:#fff;" oncontextmenu="return false;" ID="TableAlert1">'
	+ '<ST'+'YLE TYPE="text/css">\n'
	+ "TD.ub_menuitem"
	+ "{"
	+ " cursor: hand;"
	+ " color: #000000;"
	+ "	font-size: 9pt;"
	+ "	font-family: '±¼¸²', 'Trebuchet MS' , 'Arial';"
	+ " background-color: transparent;"
	//+ " border: solid 1px #ffffff;"
	+ " padding: 3px 2px 3px 2px"
	+ "}"
	+ "TD.ub_menuitem_over_" + THEME_TYPE
	+ "{"
	+ " cursor: hand;"
	+ "	color: #000000;"
	+ "	font-size: 9pt;"
	+ "	font-family: '±¼¸²', 'Trebuchet MS' , 'Arial';"
	+ " background-color: " + eval(THEME_TYPE + "_BACKGROUND_COLOR") + ";"
	+ " border: solid 1px " + eval(THEME_TYPE + "_BORDER_COLOR") + ";"
	+ " padding: 2px 1px 2px 1px"
	+ "}"
	+ "TD HR.divider"
	+ "{"
	+ " border-bottom: 1px solid #fff;"
	+ " border-top: 1px solid #E4EBF0;"
	+ " padding: 0;"
	+ " margin: 0px 0;"
	// + " clear: both;"
	+ " display: block"
	+ "}"
	+ "TD.viewText"
	+ "{"
	+ " cursor: arrow;"
	+ " color: #000000;"
	+ "	font-size: 9pt;"
	+ "	font-family: '±¼¸²', 'Trebuchet MS' , 'Arial';"
	+ " background-color: transparent;"
	//+ " border: solid 1px #ffffff;"
	+ " padding: 3px 2px 3px 2px"
	+ "}"
	+ '</ST'+'YLE>\n'
	+ '<SC'+'RIPT LANGUAGE="JavaScript">\n'
	+ '\n<'+'!--\n'
	+ 'window.onerror=null;\n'
	+ '/'+' -'+'->\n'
	+ '</'+'SCRIPT>\n'



	// ¸Þ´ºrendering
	if(dangMTypeVal == "dang")
	{
		dangAlertHtml += '<TR height=20>'
		+ '<TD class="viewText" style="padding-top:10; padding-left:10;">ÇØ´ç ¼­ºñ½º¸¦ ÀÌ¿ëÇÏ±â À§ÇØ¼­´Â'
		+ '</TD></TR>';

		dangAlertHtml += '<TR height=20>'
		+ '<TD class="viewText" style="padding-left:10;">¸¶ÀÌÇï½º´ç´¢ ±âº»Á¤º¸¸¦ ÀÔ·ÂÇÏ½ÅÈÄ'
		+ '</TD></TR>';

		dangAlertHtml += '<TR height=20>'
		+ '<TD class="viewText" style="padding-left:10;">»ç¿ë°¡´ÉÇÕ´Ï´Ù.'
		+ '</TD></TR>';

		dangAlertHtml += '<TR height=10>'
		+ '<TD class="viewText"></TD></TR>';

		dangAlertHtml += '<TR height=20>'
		+ '<TD class="viewText" align="center">'
		+ '<label onclick="parent.parentLocationHref(1);" style="cursor:hand"><font color="blue">[<u>±âº»Á¤º¸ ÀÔ·Â</u>]</font></label>'
		+ '&nbsp;&nbsp;&nbsp;'
		+ '<label onclick="parent.hidePopUp();" style="cursor:hand"><font color="blue">[<u>´Ý±â</u>]</font></label>'
		+ '</TD></TR>';

		dangAlertHtml += '<TR height=10>'
		+ '<TD class="viewText"></TD></TR>';
	}
	else if(dangMTypeVal == "mdoctor")
	{
		dangAlertHtml += '<TR height=20>'
		+ '<TD class="viewText" style="padding-top:10; padding-left:10;">¿¥´ÚÅÍ È¸¿ø Àü¿ë ¼­ºñ½º·Î,'
		+ '</TD></TR>';

		dangAlertHtml += '<TR height=20>'
		+ '<TD class="viewText" style="padding-left:10;">¿¥´ÚÅÍ °¡ÀÔ ÈÄ ÀÌ¿ëÀÌ °¡´ÉÇÕ´Ï´Ù.'
		+ '</TD></TR>';

		dangAlertHtml += '<TR height=10>'
		+ '<TD class="viewText"></TD></TR>';

		dangAlertHtml += '<TR height=20>'
		+ '<TD class="viewText" align="center">'
		+ '<label onclick="parent.parentLocationHref(2);" style="cursor:hand"><font color="blue">[<u>¿¥´ÚÅÍ °¡ÀÔ</u>]</font></label>'
		+ '&nbsp;&nbsp;&nbsp;'
		+ '<label onclick="parent.hidePopUp();" style="cursor:hand"><font color="blue">[<u>´Ý±â</u>]</font></label>'
		+ '</TD></TR>';

		dangAlertHtml += '<TR height=10>'
		+ '<TD class="viewText"></TD></TR>';
	}

	dangAlertHtml += '</TABLE>';
}



var oPopupContextMenu = window.createPopup();

// A Tag ÀÇ °æ¿ì   <a href= ·Î ¿¬°áÇÏ¸é Id °ªÀ» ²À ½áÁà¾ßÇÏ¸ç, <a onclick ´Â OBJ ·Î µÊ
// oStr : object, ¶Ç´Â object ID
// oType : °ø¹é ¶Ç´Â id
// msgType : dang - ´ç´¢ ¸Þ¼¼Áö,  mdoctor - ¿¥´ÚÅÍ ¸Þ¼¼Áö
function doPopupContextMenu(oStr, oType, msgType) 
{
	var obj = null, p = null;
	var x, y;
	
	if(oType == "id")	// ID Name À¸·Î ÇØ°áÇÑ °æ¿ì
	{
		//obj = document.getElementsByName(oStr);
		obj = document.getElementById(oStr);
		p = fnGetPositionWinCreatePopUp(obj);
		
		x = p.x;
		y = p.y+10;
	}
	else
	{
		x = window.event.x * 1;
		y = window.event.y * 1;
	}
	
	var oPopupContextMenuBody = oPopupContextMenu.document.body;
	makeUBContextMenu(msgType);          // dangAlertHtml ±×·ÁÁü
	oPopupContextMenuBody.innerHTML = dangAlertHtml;

	//oPopupContextMenu.show(0, 0, 0, 0);
	var realHeight = oPopupContextMenuBody.scrollHeight * 1;   // Á¤È®ÇÑ ³ôÀÌ °è»ê
	var realWidth = oPopupContextMenuBody.scrollWidth * 1;     // Á¤È®ÇÑ Æø °è»ê
	//alert("11111111\n\n\n" + "realHeight =[" + realHeight + "] \n\n" + "realWidth =[" + realWidth + "]");
	oPopupContextMenu.show(x, y, realWidth, realHeight, document.body);
	//oPopupContextMenu.hide();

	if(realHeight <= 0 || realHeight <= 0)
	{
		realHeight = oPopupContextMenuBody.scrollHeight * 1;   // Á¤È®ÇÑ ³ôÀÌ °è»ê
		realWidth = oPopupContextMenuBody.scrollWidth * 1;     // Á¤È®ÇÑ Æø °è»ê		
	}	
	oPopupContextMenu.show(x, y, realWidth, realHeight, document.body);
}

function hidePopUp()
{
	if (typeof(oPopupContextMenu) == "object")
	{
		oPopupContextMenu.hide();
	}
}

// Html À»  JavaScript ·Î ¸¸µé±â ¶§¹®¿¡ ÆÄ¶ó¹ÌÅÍ °ªÀ» ¼ýÀÚ·Î ÁöÁ¤ÇÒ°Í
// 1:¸¶ÀÌÇï½º ´ç´¢°¡ÀÔ(º¸±â), 2:¿¥´ÚÅÍ °¡ÀÔ(º¸±â), 3:È¸¿ø°¡ÀÔ
function parentLocationHref(hrefType)
{
	var path = parent.location.href;
	path = path.replace("?", "||").replace("&", "|");
	
	if(hrefType == 1)
	{
		parent.location.href = "/member/regmember.aspx?kspid=DU015108&uinfo=u&path=" + path;
	}
	else if(hrefType == 2)
	{
		parent.location.href = "/member/regmember.aspx?kspid=DU015109&uinfo=u&path=" + path;	
	}
	else if(hrefType == 3)
	{
		parent.location.href = "/member/regmember.aspx?kspid=DU015105&path=" + path;	
	}
	else
	{
		parent.top.location.href = "/";
	}
}


function fnGetPositionWinCreatePopUp(gObj)
{
	var oTmp = gObj;
	var ptWin = new PointWinCreatePopUp(0,0);
	
	do 
	{
		ptWin.x += oTmp.offsetLeft;
		ptWin.y += oTmp.offsetTop;
		
		oTmp = oTmp.offsetParent;
		
	} while(oTmp.tagName != "BODY");
	
	return ptWin;
}

function PointWinCreatePopUp(iiiX, iiiY)
{
	this.x = iiiX;
	this.y = iiiY;
}

/* --> ContextMenu °¡ ³ª¿È.. ¿©±â ÁÖ¼® Á¦°ÅÇÏ¸é
document.oncontextmenu = function() 
{
	if(typeof(ContextMenuStatus) == "undefined")
	{
		doPopupContextMenu();
		return false; 
	}
	else if(ContextMenuStatus == 0)
	{
		doPopupContextMenu();
		return false; 
	}
}
*/
// ==============================================================================================================
// ==============================================================================================================
// =================================  window.createPopUp  =======================================================
// ==============================================================================================================
// EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE