/*
//<body onload=''>°¡ ¸ÕÀú ½ÇÇàµÇ°í, ÀÌ¾î¼­ window::onload()°¡ ½ÇÇà µË´Ï´Ù.
//function window::onload(){ ½ÃÀÛ½Ã ½ÇÇàµÉ ³»¿ë }
function window::onload(){
	jsActiveXobj();			/// ÀÌ¿Ã¶ó½º ÆÐÄ¡ ´ëÃ³
}
*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Menu Link
// ÇÃ·¡½¬ ¸Þ´º¿¡¼­ÀÇ ¸µÅ© ÇÔ¼ö
function goMenu(pType) {
	//alert(pType);
	var strUrl = "";
	if (pType == "menu01_sub01") {
		strUrl ="/01_intro/intro01.asp";


	} else {
		alert("NOT DEFINE")
	}

	location.href = strUrl;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// DextUpload

/*
//// DextUpload : progress bar
function ShowProgress(depth)
{
	strAppVersion = navigator.appVersion;

	if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
		winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes";
		window.showModelessDialog("show_progress.asp?nav=ie", null, winstyle);
	}
	else {
		winpos = "left=" + ((window.screen.width-380)/2) + ",top=" + ((window.screen.height-110)/2);
		winstyle="width=380,height=110,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos;
		window.open("show_progress.asp?nav=ns",null,winstyle);
	}

	return true;
}
*/

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// OnLoad
// °Ô½ÃÆÇ °øÅë ÃÊ±âÈ­ ÇÔ¼ö : ÀÌ¹ÌÁö embed ¸®»çÀÌÂ¡
var bbsInitCount = 0;
function bbsInit(argDiv) {
	// »óÀ§ IFrame Å©±â Á¶Á¤
	if (self.parent) {
			if (parent.winMainCon) {
					if (bbsInitCount == 0) {
							//jsActiveXobj();
							parent.resizeIframe("winMainCon", true, 600, 500, false, 0, 0);
							//parent.resizeIframeHiehgt("winMainCon", true, 500, false, 0)
							bbsInitCount++;
					} else {
							parent.resizeIframeHiehgt("winMainCon", true, 500, false, 0)
							bbsInitCount++;
					}
					setTimeout("bbsInit('')", 1000);
			}
	}
}

var bbsConInitCount = 0;

function bbsConInit(argDiv) {

	try {
		var oBody;
		if (document.all)
			 var oBody   = self.document.body;
		else
			 var oBody = self.contentDocument.body;

		var frmWidth  = oBody.scrollWidth;
		

		// ÀÌ¹ÌÁö Å©±â Á¦ÇÑ
		resizeImage(frmWidth);
		resizeEmbed(frmWidth);

		if (self.parent) {
				if (parent.winBbsCont) {
						if (bbsConInitCount == 0) {
							//parent.resizeIframe("winBbsCont", true, 600, 200, false, 0, 0)
							parent.resizeIframeHiehgt("winBbsCont", true, 200, false, 0)
							parent.init();
							
							bbsConInitCount++;
						} else {
							parent.resizeIframeHiehgt("winBbsCont", true, 200, false, 0)
							parent.init();
							bbsConInitCount++;
						}
						setTimeout("bbsConInit('')", 1000);
				}
		}
	} catch (err) {
	}

}

function resizeImage(nSize){
	var obj;
	for(i=0; i < document.all.tags('img').length;i++){
      obj = document.all.tags('img')[i];
      if (obj.width) {
			if (obj.width > nSize) {
				obj.width = nSize;
			}
		}
	}
}

function resizeEmbed(nSize) {
		// embed objectÅ©±âÁ¦ÇÑ
		var obj, objwidth
	   for(i=0;i<document.all.tags('object').length;i++){
		      obj = document.all.tags('object')[i];
		      if (obj.width) {
		      	if (obj.width > nSize) {
		      		obj.width = nSize
		      	}
		      } else if (obj.style.width) {
		      	objwidth = obj.style.width
		      	if (strSearch(objwidth, "px")) {
			      	if (objwidth > nSize + "px") {
			      		obj.style.width = nSize + "px"
			      	}
			      } else if (strSearch(objwidth, "%")) {
			      		//obj.style.width = nSize + "px"
			   	} else {
			      		obj.style.width = nSize
			   	}
		      }
	   }
	   for(i=0;i<document.all.tags('embed').length;i++){
		      obj = document.all.tags('embed')[i];
		      if (obj.width) {
		      	if (obj.width > nSize) {
		      		obj.width = nSize
		      	}
		      } else if (obj.style.width) {
		      	objwidth = obj.style.width
		      	if (strSearch(objwidth, "px")) {
			      	if (objwidth > nSize + "px") {
			      		obj.style.width = nSize + "px"
			      	}
			      } else if (strSearch(objwidth, "%")) {
			      		//obj.style.width = nSize + "px"
			   	} else {
			      		obj.style.width = nSize
			   	}
		      }
	   }
}	   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ÀÌ¹ÌÁö µ¿¿µ»ó ºä¾î Ã¢
function popupImgView(argUrl, dm_pk) {
	if (argUrl > '') {
		if (strSearch(argUrl, ".wmv") != -1) {
			window.open("/common/asp/pg_popup_movieView.asp?mediaUrl="+ argUrl+"&dm_pk="+dm_pk, "winMovView","width=300,height=300,left=300,top=300,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,copyhistory=no")
		} else {
			window.open("/common/asp/pg_popup_imageView.asp?mediaUrl="+ argUrl+"&dm_pk="+dm_pk, "winMovView","width=300,height=300,left=300,top=300,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,copyhistory=no")
		}
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ±âÅ¸
// ÆË¾÷Ã¢ ¿­±â
function openPopup(sp_pk,x) {
	if((x==null)||(x==" ")){
		x = 300
	}
	
	
		
	window.open("/common/asp/pg_popup.asp?sp_pk=" + sp_pk, "popupWin"+sp_pk, "width=300,height=300,left="+x+",top=100,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,copyhistory=no")
}


// ¿ìÆí ¹øÈ£ ¼±ÅÃ Ã¢ ¿­±â
function openZip(pFormName, pZipPkEleName, pZipCodeName, pZipAddrEleName) {
	var winUrl = "/common/asp/pg_popup_zip.asp?wm=init&formName="+pFormName+"&zipPkName="+pZipPkEleName+"&zipCodeName="+pZipCodeName+"&zipAddrName="+pZipAddrEleName;
	var thisWidth = 405;
	var thisHeight = 430;
	var thisLeft = (window.screen.width-thisWidth)/2
	var thisTop = (window.screen.height-thisHeight)/2

	window.open(winUrl, "popupZipWin", "width="+thisWidth+",height="+thisHeight+",left="+thisLeft+",top="+thisTop+",status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no")
}

// È¸¿ø °¡ÀÔ Á¤º¸ Ã¢ ¿­±â
function openPopupInfoMemRegist() {
	window.open("/?pro_id=EU/MEMBER/REGIST", "popupInfoMemRegWin", "width=350,height=145,left=300,top=300,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no")
}

// ¾ÆÀÌµð ºñ¹Ð¹øÈ£ Ã£±â Ã¢ ¿­±â
function openPopupInfoFindIDPwd() {
	parent.location.href = "/?pro_id=EU/MEMBER/FIND_ID_PWD";
}

// È¸¿ø Á¤º¸ ¼öÁ¤ Ã¢ ¿­±â
function openMemInfo() {
	//openModal("/?pro_id=EU/MEMBER/UPDATE", "popupMemInfoWin", 500, 260)

	window.open("/?pro_id=EU/MEMBER/UPDATE", "popupMemInfoWin", "width=500,height=240,left=300,top=300,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no")
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// °Ô½ÃÆÇ ¸µÅ©
// drawBbs("multi", 3, 0)
// drawBbs("multi", 3, 1)

// iframe Å©±â »ý·«
function drawBbs(pBbsUrl, pResetContAreaCode, pBbsDiv) {
	drawBbsBasic(pBbsUrl, pResetContAreaCode, pBbsDiv, "100%", "500px")
}

// ±âº»Çü
function drawBbsBasic(pBbsUrl, pResetContAreaCode, pBbsDiv, pWidth, pHeight) {

	var bbsUrl = getBBSUrl(pBbsUrl, pResetContAreaCode, pBbsDiv);

	document.write("<iframe name='winMainCon' id='winMainCon' frameborder='0' scrolling='no' style='width:"+pWidth+";height:"+pHeight+";'src='"+bbsUrl+"'></iframe>");
	return;
}

// °Ô½ÃÆÇ URL È¹µæ
function getBBSUrl(pBbsUrl, pResetContAreaCode, pBbsDiv) {
	var bbsPk = 0;
	if (QueryString.length) {
		if (QueryString["bbs_pk"]) {
			bbsPk = QueryString["bbs_pk"];
		}
	}

	var bbsUrl = "/App"+ pBbsUrl;

	if (bbsPk != "" && bbsPk != "0") {
		//1025	Photo Photo, 20 Á¦Ç° ¼Ò°³
		if (pBbsDiv == "20" || pBbsDiv == "1025") {
			bbsUrl += "content.asp?rcac="+pResetContAreaCode+"&div="+pBbsDiv+"&dm_pk="+bbsPk;
		//ÀÌ ´ÞÀÇ ¾à±¹
		} else if (pBbsDiv == "21") {
			bbsUrl += "content.asp?rcac="+pResetContAreaCode+"&div="+pBbsDiv+"&md_pk="+bbsPk;
		} else {
			bbsUrl += "content.asp?rcac="+pResetContAreaCode+"&div="+pBbsDiv+"&bm_pk="+bbsPk;
		}
	} else {
		bbsUrl += "list.asp?wm=init&rcac="+pResetContAreaCode+"&div="+pBbsDiv;
	}
	return bbsUrl;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ¼³¹®Á¶»ç ¸µÅ©
var nPollWinWidth = 460;
var nPollWinHeight = 600;

function openPoll(argType) {

	var nWidth = nPollWinWidth;
	var nHeight = nPollWinHeight;

	var maxHeight = (document.body.clientHeight - 20)


	if (nWidth < nPollWinWidth) { nWidth = nPollWinWidth; }
	if (nHeight < nPollWinHeight) { nHeight = nPollWinHeight; }
	if (nHeight > maxHeight) { nHeight = maxHeight; }

	var nLeft = bodyCenterLeft(nWidth);
	var nTop = bodyCenterTop(nWidth);

	var winPoll = getObject("winPoll");

	// draggable IFrame
	bringSelectedIframeToTop(true);

	winPoll.style.width = nWidth;
	winPoll.style.height = nHeight;
	winPoll.style.left = nLeft;
	winPoll.style.top = nTop;

	if (argType == "result") {
		winPoll.src = "/App/poll/list.asp?wm=init&mode=result"
	} else {
		winPoll.src = "/App/poll/list.asp?wm=init&mode=come"
	}
}

function closePoll() {
	var winPoll = getObject("winPoll");

	winPoll.style.left = -1000;
	winPoll.style.top = -1000;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ÁØÈ¸¿øÀÏ¶§ Ã³¸®
function alertMsgForWaitMemNeedMemAuth() {
	alert("Á¤È¸¿ø Àü¿ë ÆäÀÌÁöÀÔ´Ï´Ù.\n\n ÇöÀç ½ÂÀÎÃ³¸® ÁßÀÔ´Ï´Ù.");
}


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ±âÅ¸
// bit ¾àÇ° °Ë»ö
function Bit_Search() {
    var form = getObject("searchBitF");
    
    if (checkF(form)) {
	    var tofind = form.tbxBitSearch.value

		// form.action = 'http://ndrug.druginfo.co.kr/cp/cp_interface.aspx?domain=ndrug&cpId=guest&cpUserClass=2&tofind=' + tofind;

		 form.action = 'http://www.druginfo.co.kr/search2/search.aspx?q=' + tofind;

		 return true;
    } else {
		 return false;
    }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ±âÅ¸
// ¾àÇÐÁ¤º¸¿ø ¾àÇ° °Ë»ö
function druginfo_Search() {
    var form = getObject("kpic_search");
    
    if (checkF(form)) {
	
	form.action = '/?pro_id=EU/CONSULT/DRUG_INFO?search_type=' + form.search_type.value + '&search_keyword=' + form.search_keyword.value;
	return true;

    } else {
	return false;
    }
}