﻿// JScript 파일
// 이미지 포커스 처리 시작
function bluring()
{
    if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}

document.onfocusin=bluring;
// 이미지 포커스 처리 종료


function zipOpen()
{
    window.open("/common/zipcode_search.aspx?form=ZipForm&zip1=zip1&zip2=zip2&address=address", "win", "width=540,height=310,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=100,left=200");    
}

//텍스트박스 엔터키 처리
function PreventSubmitOnEnter()
{
    if(event.keyCode==13)
    {
        return false;
    }
}

function store_info1(stcode)
{
    if( !window.open("/store_info.aspx?" + stcode, "win2", "width=850,height=750,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=100,left=200") )
	alert("상단의 노란색 줄 메시지를 클릭하셔서\r팝업 차단을 해제하여 주시기 바랍니다");
}

function store_info2(stcode)
{
    if( !window.open("/store_info2.aspx?" + stcode, "win2", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,top=100,left=200") )
	alert("상단의 노란색 줄 메시지를 클릭하셔서\r팝업 차단을 해제하여 주시기 바랍니다");
}

function LoginOpen()
{
    x = (screen.availWidth - 500) / 2; 
    y = (screen.availHeight - 620) / 2; 
    
    window.open('/popup/popup_login.aspx', "win", "width=500,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + x + ",top=" + y);
}

// 텍스트박스를 찾아서 엔터를 막아준다
function NotEnter()
{
    var inputs = document.getElementsByTagName("INPUT")         

    for(var i = 0; i < inputs.length ; i++)
    {               
        if( ( inputs[i].type == "text" || inputs[i].type =="password" ) && inputs[i].notEnter != "false" )
        {           
            inputs[i].attachEvent("onkeypress", PreventSubmitOnEnter);      
        }
    }
}

// 메세지박스 출력
function MsgBox(msg)
{
    alert(msg);
}

// 초성 분리
function GetFirstFont(str)
{
    font_cho = Array('ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ','ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ','ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' );
    font_jung = Array('ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ','ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ','ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ','ㅠ', 'ㅡ', 'ㅢ', 'ㅣ' );
    font_jong = Array('', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ','ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ','ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ' );

    CompleteCode = str.charCodeAt(0);
    UniValue = CompleteCode - 0xAC00;

    Jong = UniValue % 28;
    Jung = ( ( UniValue - Jong ) / 28 ) % 21;
    Cho = parseInt (( ( UniValue - Jong ) / 28 ) / 21);

    return font_cho[Cho];
}

// 아이프레임 자동 리사이즈
function IFrameReSize()
{
       try {
              var objFrame = document.getElementById("iframeMain");
              var objBody = iframeMain.document.body; 

              ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight); 

              if (ifrmHeight > 600) { 
                     objFrame.style.height = ifrmHeight; 
              } else {
                     objFrame.style.height = 600;
              } 
              objFrame.style.width = '99%'
       } catch(e) {
       };
} 

function getRetry()
{
       IFrameReSize(); 
       setTimeout('getRetry()',500);
}


