	function openWindow(url,name,width,height,etc) 
	{
		var option = etc+"width="+width+",height="+height;
		var x="",y="";
		
		x=(screen.width-width)/2
		y=(screen.height-height)/2
		
		option+=",left="+x+",top="+y;
		var win = window.open(url,name,option);
		focus();
		win.focus();
	}

	function popupWin(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}
	

	function	Svalue(obj,msg)
	{
		if ( obj.selectedIndex != 0 )	return false;
		alert (msg);
		obj.focus();
		return true;
	}
	
	function	Tvalue(obj,len,msg)
	{
		if ( obj.value.length >= len )	return false;
		alert (msg + len + '±ÛÀÚ ÀÌ»ó ±âÀÔÇØ ÁÖ¼¼¿ä.' );
		obj.focus();
		return true;
	}
	
	function	Ivalue(obj,len,msg)
	{		
		if ( obj.value.length >= len )	return false;
		alert (msg + ' ¼±ÅÃÇØÁÖ¼¼¿ä.' );
		obj.focus();
		return true;
	}
	
	function	Ivalue1(obj,len,msg)
	{
		if ( obj.value.length >= len )	return false;
		alert (msg);
		obj.focus();
		return true;
	}
	
	function Rvalue(obj, msg)
	{
		var GiValue;
		GiValue = "";
		for (i=0; i<obj.length; i++) {
			if (obj[i].checked == true) {
				GiValue = obj[i].value;
			}
		}
	
		if(GiValue=="")
		{
			alert(msg + ' ¼±ÅÃÇØÁÖ¼¼¿ä.');
			//obj.focus();
			return true;
		}
	}
	
	function	Fvalue(obj,msg)
	{
		if ( obj.value.length > 0 )	return false;
		alert (msg);
		obj.focus();
		return true;
	}
	
	function	NumCheck(obj,len,msg)
	{
		if ( obj.value.length <  len) {
			alert (msg + len + '±ÛÀÚ ÀÌ»ó ±âÀÔÇØ ÁÖ¼¼¿ä.' );
			obj.focus();
			return true;
		}
	
		if ( isNaN ( obj.value) ) {
			alert (msg + ' ¼ýÀÚ·Î ±âÀÔÇØ ÁÖ¼¼¿ä.' );
			obj.focus();
			return true;
		}
		return false;
	}


	function	ValidDigit(obj,min,max,cmt)
	{
		if (obj.value < min || obj.value > max) {
			alert(cmt+' '+max+'¿¡¼­ '+min+'±îÁöÀÇ ¼ýÀÚ ÀÌ¾î¾ß ÇÕ´Ï´Ù'+obj.value);
			obj.focus();
			return true;
		}
		return false;
	}                       


	function Tcheck(target, cmt, astr, lmin, lmax)
	{
		var i
		var t = target.value;

		if (t.length < lmin || t.length > lmax) {
			if (lmin == lmax) alert(cmt + '´Â ' + lmin + ' Byte ÀÌ¾î¾ß ÇÕ´Ï´Ù');
			else alert(cmt + '´Â ' + lmin + ' ~ ' + lmax + ' Byte ÀÌ³»·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù');
			target.focus();
			return true;
		}
		
		if (astr.length > 1) {
			for (i=0; i<t.length; i++)
				if(astr.indexOf(t.substring(i,i+1))<0) {
				alert(cmt + '¿¡ Çã¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÔ·ÂµÇ¾ú½À´Ï´Ù');
				target.focus();
				return true;
				}
		}
		return false;
	}                      

	function Tcheck1(target, msg, astr, lmin)
	{
		var i
		var t = target.value;
		
		if (t.length < lmin ) {
			alert(msg);
			target.focus();
			return true;
		}
		
		if (astr.length > 1) {
			for (i=0; i<t.length; i++)
				if(astr.indexOf(t.substring(i,i+1))<0) {
				alert('Çã¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÔ·ÂµÇ¾ú½À´Ï´Ù');
				target.focus();
				return true;
				}
		}
		return false;
	}                      


	function isImage(url) {
		var ix = url.toLowerCase();
		if ((ix.indexOf('.jpg') != -1) || (ix.indexOf('.jpe') != -1) || (ix.indexOf('.jpeg') != -1) || (ix.indexOf('.gif') != -1)) return true;
		else return false; // can't determine further from filename!
	}


	function isEmail(str) {
	  // regular expression Áö¿ø ¿©ºÎ Á¡°Ë
	  var supported = 0;
	  if (window.RegExp) {
	    var tempStr = 'a';
	    var tempReg = new RegExp(tempStr);
	    if (tempReg.test(tempStr)) supported = 1;
	  }
	  if (!supported) 
	    return (str.indexOf('.') > 2) && (str.indexOf('@') > 0);
	  var r1 = new RegExp('(@.*@)|(\\.\\.)|(@\\.)|(^\\.)');
	  var r2 = new RegExp
	  ('^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$');
	  return (!r1.test(str) && r2.test(str));
	}

	function SnCheck(s1, s2) {
		var s = s1+s2;
		if (s.charAt(6) == 1 || s.charAt(6) == 2 ) {
			if ( s.charAt(12) == (( 11 - ((s.charAt(0)*2+s.charAt(1)*3+s.charAt(2)*4+s.charAt(3)*5+s.charAt(4)*6+s.charAt(5)*7+s.charAt(6)*8+s.charAt(7)*9+s.charAt(8)*2+s.charAt(9)*3+s.charAt(10)*4+s.charAt(11)*5)%11)))%10) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}

	function emailcheck(str) {// ÀÌ ÆÐÅÏ°ú ÀÏÄ¡ÇÏÁö ¾ÊÀ¸¸é false¸¦ ¹ÝÈ¯ÇÑ´Ù.
		re=/(\w+)@(\w+)\.(\w+)/
		return re.test(str)
	}

	function emailChk(str) {//email¿¡ ÇÑ±ÛÀÌ ³ª Æ¯¼ö¹®ÀÚ°¡ µé¾î°¬´ÂÁö °Ë»ç
		count=0
		for (i=0;i<str.length;i++) {
			if(str.charAt(i)>'z') count++;
		}
		if(count!=0) {
			return false;
		} else {
			return true;
		}
	}


	function calculate_msglen(message)
	{
		var nbytes = 0;

		for (i=0; i<message.length; i++)
		{
			var ch = message.charAt(i);
			if(escape(ch).length > 4) 
			{
				nbytes += 2;
			}
			else if (ch == '\n') 
			{
				if (message.charAt(i-1) != '\r') 
				{
					nbytes += 1;
				}
			} 
			else if (ch == '<' || ch == '>') 
			{
				nbytes += 4;
			} 
			else
			{
				nbytes += 1;
			}
		}

		return nbytes;
	}

	function ReplaceCheck(strText)
	{
	  var r, re;
	  re = /\s/g;
	  r = strText.replace(re, "");
	  return(r);
	}

// Flash Activating Script
// 2006-04-11
// inome _at_ nhncorp.com
// Don't Edit Below! Never!

// s: source url
// d: flash id
// w: source width
// h: source height
// t: wmode ("" for none, transparent, opaque ...)
function mf(s,d,w,h,t){
        return "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width="+w+" height="+h+" id="+d+"><param name=wmode value="+t+" /><param name=movie value="+s+" /><param name=quality value=high /><embed src="+s+" quality=high wmode="+t+" type=\"application/x-shockwave-flash\" pluginspage=\"https://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+w+" height="+h+"></embed></object>";
}

// write document contents
function documentwrite(src){
        document.write(src);
}

// assign code innerHTML
function setcode(target, code){
        target.innerHTML = code;
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function GoHome() {
	   location.href="http://www.drmo.co.kr/";
}
function GoMenu(a, b) {
	 if (a == 1) { //Dr.Ù¾
		 if (b == 0) {
			   location.href="http://www.drmo.co.kr/drmo/drmoPlus_01.asp";
		 } else if (b == 1) {
			   location.href="http://www.drmo.co.kr/drmo/drmoPlus_01.asp";
		 } else if (b == 2) {
			   location.href="http://www.drmo.co.kr/drmo/drmo02_02.asp";
		 } else if (b == 3){
			   location.href="http://www.drmo.co.kr/drmo/drmo03.asp";
		 } else if (b == 4){
			   location.href="http://www.drmo.co.kr/drmo/drmo04.asp";
		 } else if (b == 5){
			   location.href="http://www.drmo.co.kr/customer/qna.asp";
		 }
	 }else if (a == 2){ //Å»¸ð¹é°ú
		if (b == 0) {
			   location.href="http://www.drmo.co.kr/learning/main.asp";
		 } else if (b == 1) {
			   location.href="http://www.drmo.co.kr/learning/learning_01.asp";
		 } 
	 }else if (a == 3){ //Dr.Ù¾ Shop
		if (b == 0) {
			   location.href="http://www.drmo.co.kr/shop/list.asp";
		 } else if (b == 1) { //¸®½ºÆ®
			   location.href="http://www.drmo.co.kr/shop/list.asp";
		 } else if (b == 2) {//Àå¹Ù±¸´Ï
			   location.href="http://www.drmo.co.kr/shop/orderStep1.asp?methodChk=inOk";
		 } else if (b == 3){//¹è¼ÛÈ®ÀÎ
			   location.href="http://www.drmo.co.kr/shop/deliveryList.asp?SeDay=30";
		 } else if (b == 4){//±¸¸Å³»¿ª
			   location.href="http://www.drmo.co.kr/shop/orderList.asp?SeDay=30";
		 } else if (b == 5){//Æ÷ÀÎÆ®¾È³»
			   location.href="http://www.drmo.co.kr/shop/pointinfo.asp";
				//alert('»õ·Î¿î Æ÷ÀÎÆ® Á¤Ã¥À» ÁØºñÁßÀÔ´Ï´Ù.');
		 } else if (b == 6){//±¸¸Å³»¿ª
			   location.href="http://www.drmo.co.kr/shop/guide_01.asp";
		 } else if (b == 7){//ÁÖ¹®Ãë¼Ò
			   location.href="http://www.drmo.co.kr/shop/cancelList.asp?SeDay=30";
		 } 
	}else if (a == 4){ //°í°´¼¾ÅÍ
		if (b == 0) {
			   location.href="http://www.drmo.co.kr/customer/main.asp";
		 } else if (b == 1) {//faq
			   location.href="http://www.drmo.co.kr/customer/faq.asp";
		 } else if (b == 2) {//qna
			   location.href="http://www.drmo.co.kr/customer/qna.asp";
		 } else if (b == 3){//¿î¿µÀÚ¸ÞÀÏ(ÆË¾÷)
			   location.href="javascript:popupWin('/customer/mailWrite.asp','mail','scrollbars=auto,width=522,height=462');";
		 } else if (b == 4) {//°øÁö»çÇ×
			   location.href="http://www.drmo.co.kr/customer/notice.asp";
		 }
	}else if (a == 5){ //ÀÌ´Þ¿¡ ÀÎ±â»óÇ°
		location.href="http://www.drmo.co.krview.asp?gi_code="+b;
	}
}

function menu_legal() { //ÀÌ¿ë¾à°ü
	   location.href="http://www.drmo.co.kr/member/regist_start.asp";
}

function menu_private() { //°³ÀÎÁ¤º¸º¸È£Á¤Ã¥
	   window.open('/member/protect.html','protect','top=10,left=10,width=569,height=700,toolbar=no,menubar=no,location=no,scrollbars=yes,status=no,resizable=no,fullscreen=no,channelmode=no');
}

function menu_faq() { //faq
	   location.href="http://www.drmo.co.kr/customer/faq.asp";
}

function menu_qa() { //qna
	   location.href="http://www.drmo.co.kr/customer/qna.asp";
}


////////// 6¿ù 3ÀÏ Ãß°¡(±è¿ì¿ë)////////////////////////
function keyNext(obj1, obj2, ilen) {
  var str = obj1.value.length;
  if(str == ilen) {
    obj2.focus();    
  }
}

function checkLength(c) {
  rtn = 0;
  for(i = 0; i < c.length; i++) {
    t = escape(c.charAt(i)) ;
    if(t.length == 1) {
      rtn ++;    
    } else if(t.indexOf("%u") != -1) {
      rtn += 2;
    } else if(t.indexOf("%") != -1) {
      rtn += t.length / 3;
    }
  }
  return rtn;
}

function checkPrivateRegnum(strValue1, strValue2) {
  if(checkLength(strValue1) != 6) return false;
  if(checkLength(strValue2) != 7) return false;
  strValue = strValue1 + strValue2;
  for(i = 0; i < strValue.length; i++) {
    astr = strValue.substring(i, i + 1);
    if(!((astr >= "0") && (astr <= "9"))) {
      return false; 
      break;
    }
  }
  val = 0;
  for(i = 0; i <= 11; i++)
    val = val + ((i % 8 + 2) * parseInt(strValue.substring(i, i + 1)));
  val = 11 - (val % 11)
  val = val % 10
  if(val != strValue2.substring(6, 7)) {
    return false;
  }
  return true; 
}

function checkEmail(strValue) {
	if (strValue.length > 4) {
		var i;
		var strEmail = strValue;
		var strCheck1 = false;
		var strCheck2 = false;

		for(i=0; i<strEmail.length; i++) {
			if ((strEmail.substring(i,i+1) == "~") || (strEmail.substring(i,i+1) == ".") || 
				(strEmail.substring(i,i+1) == "_") || (strEmail.substring(i,i+1) == "-") ||
				((strEmail.substring(i,i+1) >= "0") && (strEmail.substring(i,i+1) <= "9")) ||
				((strEmail.substring(i,i+1) >= "@") && (strEmail.substring(i,i+1) <= "Z")) ||
				((strEmail.substring(i,i+1) >= "a") && (strEmail.substring(i,i+1) <= "z"))) {
					if (strEmail.substring(i,i+1) == ".")
						strCheck1 = true;
					if (strEmail.substring(i,i+1) == "@")
						strCheck2 = true;
			}
				else {
					return false; 
				}  
			}

		if ((strCheck1 == false) || (strCheck2 == false)) {
			return false;  
		} else {
		  return true;
		}

	} else {
		return false;
	}
}
