function setCookie(name,value,interval,ival) {
	var domain = "mkhealth.co.kr";
	var cookieString = name +"="+ escape(value) +"; path=/";
	cookieString += ((domain == '') ? "" : "; domain="+ domain);
	if (interval != '') {
		var nowDate = new Date();
		if (interval == 'f') {
			var arrDate = ival.split("-"); //2008-01-03 Çü½Ä
			nowDate = new Date(arrDate[0],arrDate[1]-1,arrDate[2],nowDate.getHours(),nowDate.getMinutes(),nowDate.getSeconds());
		} else if (interval != '') {
			ival = parseInt(ival);
			if (interval == 'y') {
				nowDate.setYear(nowDate.getYear() + ival);
			} else if (interval == 'm') {
				nowDate.setMonth(nowDate.getMonth() + ival);
			} else if (interval == 'd') {
				nowDate.setDate(nowDate.getDate() + ival);
			} else if (interval == 'hh') {
				nowDate.setHours(nowDate.getHours() + ival);
			} else if (interval == 'mm') {
				nowDate.setMinutes(nowDate.getMinutes() + ival);
			} else if (interval == 'ss') {
				nowDate.setSeconds(nowDate.getSeconds() + ival);
			}
		}
		cookieString += "; expires="+ nowDate.toGMTString();
	}
	document.cookie = cookieString;
}
function getCookie(name) {
		var domain = "mkhealth.co.kr";
		var nameOfCookie = name + "=";
		var x = 0;
		while ( x <= document.cookie.length ) {
				var y = (x+nameOfCookie.length);
				if ( document.cookie.substring( x, y ) == nameOfCookie ) {
						if ( (endOfCookie=document.cookie.indexOf( ";",y )) == -1 )
								endOfCookie = document.cookie.length;
						return unescape( document.cookie.substring(y, endOfCookie ) );
				}
				x = document.cookie.indexOf( " ", x ) + 1;
				if ( x == 0 )
						break;
		}
		return "";
}
function getCookieKey(key,name) {
	var KeyNameCookie = getCookie(key);
	var arrkeyCookieName = KeyNameCookie.split("&");
	for (var i = 0; i < arrkeyCookieName.length-1; i++) {
		if (arrkeyCookieName[i].search(name) != -1) {
			arrkeyCookieName[i] = arrkeyCookieName[i].slice(name.length+1, arrkeyCookieName[i].length);
			return unescape(arrkeyCookieName[i]);
			break;
		}
	}
	return "";
}
function deleteCookie(name) {
		var exp = new Date();
		exp.setTime (exp.getTime() - 1);
		var cval = getCookie (name);
		document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function confirmDelete(nextURL) {
	if (confirm ("»èÁ¦µÈ µ¥ÀÌÅ¸´Â º¹±¸ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.      \n\nÁ¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?      ")) {
		location.href = nextURL;
	}
}
function confirmSignIn(nextURL) {
	if (confirm ("¿äÃ»ÇÏ½Å ¼­ºñ½º´Â È¸¿øÁ¤º¸¸¦ ¿ä±¸ÇÕ´Ï´Ù. ·Î±×ÀÎÀ» ÇÏ½Ã°Ú½À´Ï±î?      ")) {
		location.href = nextURL;
	}
}
function confirmMsg(nextURL, msg) {
	if (confirm (msg)) {
		location.href = nextURL;
	}
}
function openBrWindow(theURL,theTarget,width,height,scrollbars,resizable,status,align,valign) {
	var left,top;
	if (scrollbars == 'yes') {
		width += 17
	}
	height += 25;
	if (align == 'center') {
		left = ((window.screen.width * 5 / 10) - (width / 2));
	} else if (align == 'right') {
		left = window.screen.width - width;
	} else {
		left = 1;
	}
	if (valign == 'middle') {
		top = ((window.screen.height * 5 / 10) - (height / 2));
	} else if (valign == 'bottom') {
		top = window.screen.height - height;
	} else {
		top = 1;
	}
	window.open(theURL,theTarget,"toolbar=no,location=no,directories=no,status="+ status +",menubar=no,scrollbars="+ scrollbars +",resizable="+ resizable +",left="+ left +", top="+ top +", width="+ width +",height="+ height +"");
}
function openWindow(strURL,strTargetFrame,intWidth,intHeight,strSort,intLeft,intTop) {
	switch (strSort) {
		case "ratio":
			var intNowLeft	= ((window.screen.width * intLeft / 10) - (intWidth / 2));
			var intNowTop	= ((window.screen.height * intTop / 10) - (intHeight / 2));
		break;
		case "fix":
			var intNowLeft	= intLeft;
			var intNowTop	= intTop;
		break;
		default:
			var nowLocLeft	= 1;
			var nowLocTop	= 1;
	}
	window.open(strURL,strTargetFrame,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left="+ intNowLeft +", top="+ intNowTop +", width="+ intWidth +",height="+ intHeight +"");
}
function ImageViewer(strImagePath) {
	window.open('/modules/image.viewer.asp?ImageURL='+strImagePath+'','ImageGallery',"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=0,width=0,height=0");
}
function innerOpen(url,width,height,isScroll){
	window.showModelessDialog(url,window,'dialogWidth:'+width+'px;dialogHeight:'+height+'px;status:no;edge:raised;scroll:'+isScroll);
}
function showDisplay(ObjID) {
	document.getElementById(ObjID).style.display = "block";
}
function hideDisplay(ObjID) {
	document.getElementById(ObjID).style.display = "none";
}
function ToggleDisplay(ObjID) {
	var displayStyle = document.all[ObjID].style.display;
	if (displayStyle == "block") {
		document.all[ObjID].style.display="none";
	} else {
		document.all[ObjID].style.display="block";
	}
}
function ToggleVisibility(ObjID) {
	var visibilityStyle = document.all[ObjID].style.visibility;
	if (visibilityStyle == "visible") {
		document.all[ObjID].style.visibility ="hidden";
	} else {
		document.all[ObjID].style.visibility  ="visible";
	}
}
function showVisibility(ObjID) {
	document.all[ObjID].style.visibility  ="visible";
}
function hideVisibility(ObjID) {
	document.all[ObjID].style.visibility  ="hidden";
}
function ToggleClass(ObjID,c1ClassName,c2ClassName) {
	var styleClassName = document.all[ObjID].className;
	if (styleClassName == c1ClassName) {
		document.all[ObjID].className = c2ClassName;
	} else {
		document.all[ObjID].className = c1ClassName;
	}
}
function TextElementSet(formname,fieldgroup,values,parents,closed) {
	var arrfieldname = fieldgroup.split("|");
	var arrvalue = values.split("|");
	for (var i=0; i < arrfieldname.length; i++) {
		if (parents) {
			opener.document.all[formname].all[arrfieldname[i]].value = arrvalue[i];
		} else {
			document.all[formname].all[arrfieldname[i]].value = arrvalue[i];
		}
	}
	if (closed) {
		self.window.close();
	}
}
function openerDiv(objectname, wclose, value, parents) {
	var arrobjectname = objectname.split("|");
	var arrvalue = value.split("|");
	for (var i=0; i < arrobjectname.length; i++) {
		if (parents == "yes") {
			opener.document.all[arrobjectname[i]].innerHTML = arrvalue[i];
		} else {
			document.all[arrobjectname[i]].innerHTML = arrvalue[i];
		}
	}
	if (wclose == 'y') {
		self.window.close();
	}
}
function CheckBoxSelect(frmname,fieldname,checkvalue) {
	var form = document.all[frmname];
	var fieldname = form.all[fieldname];
	if (fieldname == undefined) {
		alert('°³Ã¼°¡ ¾ø½À´Ï´Ù.   ');
		return;
	}
	var checksingle = GetElementSingle(fieldname);
	if (checksingle) {
		fieldname.checked = checkvalue;
	} else {
		for (var i=0;i<fieldname.length ;i++) {
			fieldname[i].checked = checkvalue;
		}
	}
}
function GetElementSingle(objname) {
	if (objname != undefined) {
		if (objname.length == undefined) {
			return true;
		} else {
			return false;
		}
	}
}
function getObjCnt(obj) {
	if (obj == undefined) {
		return 0;
	} else {
		if (obj.length == undefined) {
			return 1;
		} else {
			return obj.length;
		}
	}
}
function FormReset(formName) {
	document.all[formName].reset();
}
function CopyText(cValue) {
	var doc = document.body.createTextRange();
	doc.findText(cValue);
	doc.execCommand('copy');
}
function LengthLimit(strings,limitlength) {
	var stringslength = strings.length;
	if (stringslength < limitlength) {
		return false;
	} else {
		return true;
	}
}
function FormatNumber(strDigit) {
	var strDigit = new String(strDigit);
	var arrDigits = new Array();
	var chkDigit = /^\d+$/;

	if (strDigit.charAt(0) == 0) {
		strDigit = strDigit.substr(1,strDigit.length);
	}

	var j = 0;
	for (var i=0;i<strDigit.length ;i++ ) {
		if (chkDigit.test(strDigit.charAt(i))) {
			arrDigits[j] = strDigit.charAt(i);
			j++;
		}
	}
	var strCovDigit = new String();
	var intDigitsLength = arrDigits.length;
	for (j=0;j<arrDigits.length ;j++ ) {
		if (((intDigitsLength-j-3)%3 == 0) && (j>0)) {
			strCovDigit += ',';
		}
		strCovDigit += arrDigits[j];
	}
	if (strCovDigit == 0) {
		strCovDigit = 0;
	}
	return strCovDigit;
}
function LongString(objName,cVal) {
	var FormLimit = 102399;
	var TempVar = new String;
	TempVar = cVal;
	if (TempVar.length > FormLimit) {
		form.InfoContents.value = TempVar.substr(0, FormLimit);
		TempVar = TempVar.substr(FormLimit);
		while (TempVar.length > 0) {
			var objTEXTAREA = document.createElement("TEXTAREA");
			objTEXTAREA.name = objName;
			objTEXTAREA.value = TempVar.substr(0, FormLimit);
			form.appendChild(objTEXTAREA);
			TempVar = TempVar.substr(FormLimit);
		}
	}
}
function ImagesResize(oImage,oWidth,intBaseWidth) {
	if (oWidth > intBaseWidth) {
		oImage.width = intBaseWidth;
	}
}
function GoVote(form) {
	var chkItems = false;
	for (var i=0;i<form.vSEQ.length;i++) {
		if (form.vSEQ[i].checked) {
			chkItems = true;
		}
	}
	if (chkItems) {
		return true;
	} else {
		alert('Ç×¸ñÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä.	   ');
		return false;
	}
}
function fe(s,d,w,h,t,q){
	document.write ("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0' width='"+w+"' height='"+h+"' id='"+d+"'><param name='allowScriptAccess' value='always' /><param name='allowFullScreen' value='false' /><param name=wmode value='"+t+"' /><param name=movie value='"+s+"?"+q+"' /><param name=quality value=high /><embed src='"+s+"' quality=high wmode='"+t+"' width='"+w+"' height='"+h+"' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>");
}
function fe2(v,s,d,w,h,t,q){
	document.write ("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+v+"' width='"+w+"' height='"+h+"' id='"+d+"'><param name='allowScriptAccess' value='always' /><param name='allowFullScreen' value='false' /><param name=wmode value='"+t+"' /><param name=movie value='"+s+"?"+q+"' /><param name=quality value=high /><embed src='"+s+"' quality=high wmode='"+t+"' width='"+w+"' height='"+h+"' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>");
}
function me(d,f,s,c,p,b,l,w,h) {
	document.write ("<object id='"+d+"' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' width='"+w+"' height='"+h+"'><param name='wmode' value='transparent' ><param name='windowlessVideo' vlaue='1' ><param name='FileName' value='"+f+"'><param name='AutoStart' value='"+s+"'><param name='ShowControls' value='"+c+"'><param name='ShowDisplay' value='"+p+"'><param name='ShowGotoBar' value='"+b+"'><param name='loop' value='"+l+"'><embed src='"+f+"' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' width='"+w+"' height='"+h+"' wmode='transparent'></embed></object>");
}
function me2(d,f,w,h) {
	alert('a');
	document.write ("<object id='"+d+"' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' width='"+w+"' height='"+h+"'><param name='wmode' value='transparent'><param name='FileName' value='"+f+"'><embed src='"+f+"' pluginspage='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' width='"+w+"' height='"+h+"' wmode='transparent'></embed></object>");
}
function confDelete(nextURL) {
	if (confirm ("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?			  ")) {
		location.href = nextURL;
	}
}
function ViewPersonInfo(CtmID) {
	var intWidth = 500;
	var intHeight = 400;
	var intLeft = 5;
	var intTop = 5;

	var intNowLeft	= ((window.screen.width * intLeft / 10) - (intWidth / 2));
	var intNowTop	= ((window.screen.height * intTop / 10) - (intHeight / 2));

	window.open("/medicalinfo/person.info.asp?CtmID="+CtmID,"CtmInfo","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left="+ intNowLeft +", top="+ intNowTop +", width="+ intWidth +",height="+ intHeight +"");
}
function fnIsDelete(obj) {
	if (confirm ("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		location.href = obj.href +'&strNextURL='+ encodeURIComponent(document.location);
	}
}

