
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.01
  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 && d.getElementById) x=d.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 hidestatus() 
{ 
	window.status="" 
	return true 
} 
	if (document.layers) 
	document.captureEvents(Event.mouseover | Event.mouseout) 
	document.onmouseover=hidestatus 
	document.onmouseout=hidestatus 

// °ø¹é °Ë»ç	
	function IsEmptyChk(strTmp)
	{
		var len,i;

		len = strTmp.length;
		
		for(i=0; i<len; i++)
		{
			if(strTmp.charAt(i)!=" ") return false;
		}

		return true;
	}

// Á¤¼ö °Ë»ç	
	function IsIntChk(strTmp)
	{
		var len, i, imsi;

		strTmp = "" + strTmp;

		if(IsEmptyChk(strTmp))
			return false;

		len = strTmp.length;
		
		for(i=0; i<len; i++)
		{
			imsi = strTmp.charAt(i);
			
			if(imsi<"0" || imsi>"9")
			{
				return false;
			}
		}

		return true;
	}

// Á¤¼ö(0) °Ë»ç	
	function IsIntChk_Zero(strTmp)
	{
		var imsi;

		strTmp = "" + strTmp;
		imsi = strTmp.charAt(0);
			
		if(imsi=="0")
		{
			return false;
		} else {
			return true;
		}
	}
	
//¼ýÀÚ¸¸ÀÔ·Â(onKeypress='return keyIntCheck(event)')
var n4 = (document.layers)?true:false;
var e4 = (document.all)?true:false;

function keyIntCheck(e) { 
	if(n4) var keyValue = e.which
	else if(e4) var keyValue = event.keyCode
	if (((keyValue >= 48) && (keyValue <= 57)) || keyValue==13) return true; 
	else return false
}
	
// ÀÌ¸ÞÀÏ°Ë»ç	
	function IsEmailChk(str) 
	{
		var filter=(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g);

    if (filter.test(str)) { 
    	return true; 
    } else { 
    	return false; 
    }

	}
	
// ÁÖ¹Î¹øÈ£ °Ë»ç	
	function IsJuminChk(P_Jumin) 
	{
		var IDtot, IDAdd, i; 

		IDtot = 0;
		IDAdd="234567892345";
		
		if(IsEmptyChk(P_Jumin)) return false;

		for(i=0;i<12;i++) 
		{
			IDtot=IDtot+parseInt(P_Jumin.substring(i,i+1))*parseInt(IDAdd.substring(i,i+1));
		}

		IDtot=11-(IDtot%11);
		if(IDtot==10) 
		{
			IDtot=0;
		}
		else if(IDtot==11)
			 {
				IDtot=1;
			 }

		if(parseInt(P_Jumin.substring(12,13))!=IDtot) return false;

		return true;
	}
	
// ³¯Â¥ °Ë»ç
function IsDateChk(strDate)
{
	var imsi, tempDate, temp, temp1;
	
	//°ø¹é°Ë»ç
	if(IsEmptyChk(strDate)) return false;
	
	// Á¤¼ö°Ë»ç
	if(!IsIntChk(strDate)) return false;
	
	if(strDate.length!=8) return false;
	
	imsi = "" + strDate.substring(0,4);
	imsi = imsi + "/" + strDate.substring(4,6);
	imsi = imsi + "/" + strDate.substring(6,8);
	
	tempDate = new Date(imsi);

	
	if(tempDate.getYear()==100)
		temp = "2000"
	else
	{
		if(tempDate.getYear()<2000)
			temp = "19" + tempDate.getYear();
		else
			temp = tempDate.getYear();
	}

	temp1 = tempDate.getMonth()+1;
	if(temp1<10)
		temp = temp + "/" + "0" + temp1;
	else
		temp = temp + "/" + temp1;
	
	if(tempDate.getDate()<10)
		temp = temp + "/" + "0" + tempDate.getDate();
	else
		temp = temp + "/" + tempDate.getDate();

	if(imsi!=temp) return false;
	
	return true;
}


function xssFilter(InStr) {

	
	if ( InStr.replace(/\</g, "")) return false;
	if ( InStr.replace(/\>/g, "")) return false;
	if ( InStr.replace(/\"/g, "")) return false;
	if ( InStr.replace(/\'/g, "")) return false;
	if ( InStr.replace(/\%/g, "")) return false;
	if ( InStr.replace(/\;/g, "")) return false;
	if ( InStr.replace(/\(/g, "")) return false;
	if ( InStr.replace(/\)/g, "")) return false;
	if ( InStr.replace(/\&/g, "")) return false;
	if ( InStr.replace(/\+/g, "")) return false;

}


function check_write(){

		obj =  document.theForm;

		if(obj.strTitle.value == ""){
			alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
			obj.strTitle.focus();
			return false;
		}
		if(obj.strName.value == ""){
			alert("ÀÛ¼ºÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			obj.strName.focus();
			return false;
		}
		
		if(obj.strPass.value == ""){
			alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
			obj.strPass.focus();
			return false;
		}

		if(obj.content.value == ""){
			alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
			obj.content.focus();
			return false;
		}
		
	/*sendHTML(obj.ms_desc, false);

	if(obj.ms_desc.value.length < 1) {
		alert("¸ÞÀÏ ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false ;
	} 
	*/


}

// °Ô½ÃÆÇ
//---------------------------------------- check_modify
function check_modify(){

	obj =  document.theForm;

	if(obj.strTitle.value == ""){
		alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
		obj.strTitle.focus();
		return false;
	}
		
	sendHTML(obj.ms_desc, false);

	if(obj.ms_desc.value.length < 1) {
		alert("¸ÞÀÏ ³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		return false ;
	} 	
		
	if(obj.strPass.value == ""){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		obj.strPass.focus();
		return false;
	}

}
//---------------------------------------- check_search
function check_search(obj){
	if(obj.sKeyword.value == ""){
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		obj.sKeyword.focus();
		return false;
	}
}

//°Ô½ÃÆÇ ³»¿ë ÇÁ¸°Æ®ÇÏ±â
function printArea() 
{ 
	var initBody;
	var printBody;
	
	initBody = document.body.innerHTML; 
	printBody = document.getElementById('idPrint');
	document.body.innerHTML = printBody.innerHTML

	window.print(); 
	document.body.innerHTML = initBody; 
}

//È®´ëÀÌ¹ÌÁö º¸±â
function viewPicture(imgPath, imgW, imgH) {
	
	var opt = 'leftmargin=0, toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,resicopyhistory=0,width='+imgW+',height='+imgH; 	

	openWin = window.open ('', 'viewP', opt);
	openWin.document.write ("<html>");
	openWin.document.write ("<head>");
	openWin.document.write ("<title>È®´ë ÀÌ¹ÌÁö º¸±â</title>");
	openWin.document.write ("<body leftmargin=0 topmargin=0>");
	openWin.document.write ("<table width="+imgW+" height='"+imgH+"' border='0' cellpadding='0' cellspacing='0'>");
	openWin.document.write ("  <tr>");
	openWin.document.write ("    <td><img src='"+imgPath+"' width='"+imgW+"' height='"+imgH+"' onClick='self.close()'></td>");
	openWin.document.write ("  </tr>");
	openWin.document.write ("</table>");
	openWin.document.write ("</body>");
	openWin.document.write ("</html>");
}

///////// ¸ÞÀÎ »ó´Ü ¸Þ´º ¸¶ÀÌ½º¿À¹ö½Ã ¸Þ´º º¸ÀÌ±â ////////////
function submenu_on(i)
{
		var obj, j

		for (j=1; j < 9; j++) {
			obj = eval("submenu_"+j);
			if ( j == i ) {
				obj.style.display='';
			} else {
				obj.style.display='none';
			}
		}


}


//////////////// ¾ÆÀÌµð Áßº¹Ã¼Å© ////////////////////
function id_check(objForm)
{
	var imsi;
	
	imsi = objForm.f_id.value;
	if(imsi=="") 
	{
		alert("¾ÆÀÌµð¸¦ 4ÀÚ¸® ÀÌ»ó ÀÔ·ÂÇÏ½Ê½Ã¿À!");
		objForm.f_id.focus();
		return;
					
	 } else {
		imsi = objForm.f_id.value;
		var eng=/(^[a-zA-Z0-9_-]{4,20})$/
		if(eng.test(imsi)==false){
			alert("ID Çü½ÄÀÌ Æ²¸³´Ï´Ù.\n´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä.")
			objForm.f_id.focus();
			return;
		}
		window.open('/order/id_check.asp?f_id='+imsi ,'checkID','scrollbars=no,width=412,height=220');
	}
}

//////////////// SMS ºü¸¥ »ó´ã Ã¼Å© //////////////////
function cal_msglen(value) {
    var len = value.length;
    for (i = 0; i < value.length; i++)
        if (value.charCodeAt(i) > 127)
            len++;
    document.f_counsel.msg_len.value=len; 
}

function counsel_ok() {
	
	frm = document.f_counsel;
	
		
	if (frm.f_content.value == "" || frm.f_content.value == "Áú¹®»çÇ×À» Àû¾îÁÖ¼¼¿ä.") {
		alert("³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.f_content.value = "";
		frm.f_content.focus();
		return;
	}
	
	if (frm.msg_len.value > 80) {
		alert("80ÀÚ ÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.msg_len.focus();
		return;
	}
	
	if (frm.f_hp1.value == "") {
		alert("ÇÚµåÆù¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.f_hp1.focus();
		return;
	}
	
	if ( (frm.f_hp1.value.length) != 3 ) {
		alert("ÇÚµåÆù¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.f_hp1.focus();
		return;
	}

	if (frm.f_hp2.value == "") {
		alert("ÇÚµåÆù¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.f_hp2.focus();
		return;
	}
	
	if ( (frm.f_hp2.value.length < 3) || (frm.f_hp2.value.length > 4) ) {
		alert("ÇÚµåÆù¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.f_hp2.focus();
		return;
	}
	
	if (frm.f_hp3.value == "") {
		alert("ÇÚµåÆù¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.f_hp3.focus();
		return;
	}
	
	if ( (frm.f_hp3.value.length < 3) || (frm.f_hp3.value.length > 4) ) {
		alert("ÇÚµåÆù¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		frm.f_hp3.focus();
		return;
	}
	
	frm.submit();

}

function keyword_reset() {
	document.f_counsel.f_content.value = "";
	document.f_counsel.msg_len.value = 0;
}

function SetID(strID, strFlag)
{
	imsi = document.sfm.f_id;
	imsi.value = strID;
	//ÁÖÀÇ : readonly ·Î ¾²¸é ¾ÈµÊ readOnly ·Î ½á¾ßÇÔ
	imsi.readOnly = true;
	document.sfm.f_id_flag.value = strFlag;
	document.sfm.f_pwd1.focus();
}

//////////////// ¿ìÆí¹øÈ£ °Ë»ö ////////////////////
function address_check()
{
  window.open('/order/address_check.asp','openPost','scrollbars=no,width=410,height=342');
}

//////////////// Æ÷Ä¿½º ³Ñ±â±â ////////////////////
function fnSizeCheck(obj,nextobj)
{
	if (obj.value.length == obj.maxLength ) {
		nextobj.focus();
	}

}

////////////// ÅØ½ºÆ®¹Ú½º °ª ¿©·¯°³ ¹Þ±â ////////////////
function Iprice(val)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
	if(val != "")                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
	{                         
	
		n   = val.indexOf("-"); 
		m   = val.indexOf("@");  
		len = val.length;  
		
		Ipr    = val.substring(0, n);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
		Iidx   = val.substring(n + 1, m); 
		Ipoint = val.substring(m + 1, len);
		
		document.pForm.optionIdx.value=Iidx;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
		document.pForm.price.value=Ipr; 
		document.pForm.p_point.value=Ipoint;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
	}	                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
}

///////// ÀÚµ¿ ½ºÅ©·Ñ ///////////

var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements()
{
  var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

  if ( bNetscape4plus ) { // ³×Ã÷ÄÉÀÌÇÁ ¿ë ¼³Á¤
    yMenuFrom   = document["layer_right"].top;
    yMenuTo     = top.pageYOffset + 0;   // À§ÂÊ À§Ä¡
  }
  else if ( bExplorer4plus ) {  // ÀÍ½ºÇÃ·Î·¯ ¿ë ¼³Á¤
    yMenuFrom   = parseInt (layer_right.style.top, 10);
    yMenuTo     = document.body.scrollTop + 50; // À§ÂÊ À§Ä¡
  }

  timeoutNextCheck = 500;

  if ( Math.abs (yButtonFrom - (yMenuTo + 57)) < 6 && yButtonTo < yButtonFrom ) {
    setTimeout ("CheckUIElements()", timeoutNextCheck);
    return;
  }


  if ( yButtonFrom != yButtonTo ) {
    yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
    if ( yButtonTo < yButtonFrom )
     	yOffset = -yOffset;

    if ( bNetscape4plus )
    	document["divLinkButton"].top += yOffset;
    else if ( bExplorer4plus )
    	divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

    timeoutNextCheck = 10;
  }
  if ( yMenuFrom != yMenuTo ) {
    yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 10 );
    if ( yMenuTo < yMenuFrom )
    	yOffset = -yOffset;

    if ( bNetscape4plus )
    	document["layer_right"].top += yOffset;
    else if ( bExplorer4plus )
    	layer_right.style.top = parseInt (layer_right.style.top, 10) + yOffset;

    timeoutNextCheck = 10;
  }

  setTimeout ("CheckUIElements()", timeoutNextCheck);
}
function OnLoad()
{
        var y;

        // ÇÁ·¹ÀÓ ¿¡¼­ ¹þ¾î³ª°Ô ÇÏ´Â ÇÔ¼öÀÔ´Ï´Ù. ÇÁ·¹ÀÓ¿¡ ³ÖÀ¸·Á¸é »èÁ¦ÇÏ¼¼¿ä
        if ( top.frames.length )
         //       top.location.href = self.location.href;

        // Æä¿¡Áö ·Îµù½Ã Æ÷Áö¼Ç
        if ( bNetscape4plus ) {
                document["layer_right"].top = top.pageYOffset + 100;
                document["layer_right"].visibility = "visible";
        }
        else if ( bExplorer4plus ) {
                scrollmenu.style.top = document.body.scrollTop + 100;
                scrollmenu.style.visibility = "visible";
        }

        CheckUIElements();
        return true;
}
//-->

