﻿// img
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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
} else if (event == "out") {
if (document.MM_nbOver != null && document.MM_nbOver != undefined) {
    for (i = 0; i < document.MM_nbOver.length; i++) {
        img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up;
    }
}
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

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_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]; }
}

// basic flash
function flashObj(URL,SizeX,SizeY,LnkId,Frm,Flag) // quick
{
    document.write('            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
    document.write('                    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
    document.write('                    width="'+SizeX+'" height="'+SizeY+'"  id="'+LnkId+'" align="middle">');
    document.write('            <param name="movie"     value="'+URL+'" />');
    document.write('            <param name="quality"   value="high" />');
    if ( Flag == null || Flag != 'N' )
    {
        document.write('        <param name="wmode"     value="transparent"/>');
    }
 document.write('   <param name="allowScriptAccess" value="always"/> ');
 document.write('   <param name="base" value="." />');
    document.write('            <embed base="." src="'+URL+'" quality="high" width="'+SizeX+'" height="'+SizeY+'"  align="middle" ');
  if ( Flag == null || Flag != 'N' )
    {
        document.write('         wmode="transparent" ');
    }
    document.write('             type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" swLiveConnect=true name="'+LnkId+'"  />');
    document.write('            </embed></object>');
 if ( Frm == 'Y' ) { // form 태그 들어가는 페이지에 적용
  eval("window." + LnkId + " = document.forms[0]."+ LnkId +"; ");
 }
}

/**************************************************************
*       Onion Hotel Flash Loading bar 호출용
**************************************************************/
function ObjSwf(src, width, height) {
    object = '';
    object += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="param" width="' + width + '" height="' + height + '">';
    object += '<param name="movie" value="' + src + '">';
    object += '<embed src="' + src + '" quality="high" wmode="transparent" bgcolor="#ffffff" menu="false" width="' + width + '" height="' + height + '" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
    object += '<\/object>';
    document.write(object);
}

/**************************************************************
*       Onion Hotel Flash Loading bar 호출용
**************************************************************/
function ObjSwf2(src, width, height) {
    object = '';
    object += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="param" width="' + width + '" height="' + height + '">';
    object += '<param name="movie" value="' + src + '">';
    object += '<embed src="' + src + '" quality="high" wmode="transparent" bgcolor="#ffffff" menu="false" width="' + width + '" height="' + height + '" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
    object += '<\/object>';
    return object;
}

/*****************************************************
*       img onerror이벤트 발생시 처리 imgObj 
*       onerror = "imgOnError(this,'대체이미지 경로')"
******************************************************/
function imgOnError(imgOBJ, replaceIMG) {
   noimg = "/images/common/noimage.jpg";
    if (replaceIMG != '' && imgOBJ.src != replaceIMG && imgOBJ.src.indexOf(replaceIMG) < 0) {
        imgOBJ.src = replaceIMG;
    } else {
        imgOBJ.src = noimg;
    }
}

/*****************************************************
*       팝업
******************************************************/
function MM_openBrWindow(theURL, winName, features) { //v2.0
    var Wins = window.open(theURL, winName, features);
    Wins.focus();
}

//환율보기-sidemenu에서 사용
function popCurrency(url) {

    window.open(url, "", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=610,height=660");
}

//팝업띄우기
function popLink(url, wid) {

    window.open(url, "", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=" + wid + ",height=660");
}

// 호텔 등급 이미지 생성
function makeStarImageTag(sStarRate) {
    if (sStarRate == "" || sStarRate == null) sStarRate = "0";

    iStarRate = eval(sStarRate);
    if (iStarRate == 0) iStarRate = 1;              //최소한 별1개는 표시되어야 함.
    if (iStarRate > 5) iStarRate = 5;

    s1 = "";

    for (i = 0; i < iStarRate; i++) {
        if (i + 1 <= iStarRate) {
            s1 += "<img src='/images/common/icon_star_yellow.gif' width='13' height='12' >";
        }
        else {
            s1 += "<img src='/images/common/icon_star_yellow.gif' width='13' height='12'>";
        }
    }
    document.write(s1);
}

// 호텔 등급 이미지 생성
function makeStarImageTag(sStarRate, sSellCurrencyCode) {
    if (sStarRate == "" || sStarRate == null) sStarRate = "0";

    iStarRate = eval(sStarRate);
    if (iStarRate == 0) iStarRate = 1;              //최소한 별1개는 표시되어야 함.
    if (iStarRate > 5) iStarRate = 5;

    var imgTag = (sSellCurrencyCode == "USD") ? "<img src='/images/common/icon_star_blue.gif' width='13' height='12' alt='별'>" : "<img src='/images/common/icon_star_yellow.gif' width='13' height='12' alt='별'>";
    s1 = "";

    for (i = 0; i < iStarRate; i++) {
        if (i + 1 <= iStarRate) {
            s1 += imgTag;
        }
        else {
            s1 += imgTag;
        }
    }
    document.write(s1);
}

function streetView(lat, lng) {
    url = "/html/map/StreetView.aspx?LATITUDE=" + lat + "&LONGITUDE=" + lng + "&HNAME=test";
    PopupWH(url, 620, 510);
}


//팝업띄우기
function popLink(url, wid) {

    window.open(url, "", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=" + wid + ",height=660");
}

function PopupWH(url, width, height) {
    window.open(url, "", "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=" + width + ",height=" + height);
}



function calcMath(strMode, nCalcVal, nDigit) {
    if (strMode == "ROUND") {        //반올림
        if (nDigit < 0) {
            nDigit = -(nDigit);
            nCalcVal = (nCalcVal / Math.pow(10, nDigit)).toFixed(0) * Math.pow(10, nDigit);

        } else {
            nCalcVal = nCalcVal.toFixed(nDigit)
        }
    } else if (strMode == "CEIL") {  //절상
        if (nDigit < 0) {
            nDigit = -(nDigit);
            nCalcVal = Math.ceil(nCalcVal / Math.pow(10, nDigit)) * Math.pow(10, nDigit);
        } else {
            nCalcVal = Math.ceil(nCalcVal * Math.pow(10, nDigit)) / Math.pow(10, nDigit);
        }
    } else if (strMode == "FLOOR") { //절하
        if (nDigit < 0) {
            nDigit = -(nDigit);
            nCalcVal = Math.floor(nCalcVal / Math.pow(10, nDigit)) * Math.pow(10, nDigit);
        } else {
            nCalcVal = Math.floor(nCalcVal * Math.pow(10, nDigit)) / Math.pow(10, nDigit);
        }
    } else {                        //그대로(무조건 소수점 첫째 자리에서 반올림)
        nCalcVal = nCalcVal.toFixed(0);
    }

    return nCalcVal;
}

// 입력값 콤마 삽입하기
function fncAddComma(nValue) {
    var strNo = new String(nValue);
    var pointMoney = '';
    var minus = '';
    if (strNo.indexOf('.') != -1) //소수점 공식
    {
        var nidx = fncPointReturn(strNo, strNo.length);
        pointMoney = strNo.substring(nidx);
        strNo = strNo.substring(0, nidx);
    }
    if (strNo.indexOf('-') != -1) {
        minus = '-';
        strNo = strNo.substring(1);
    }

    var nCount = strNo.length;
    var money = "";
    var y = -1;
    for (var i = nCount; i >= 0; i--) {
        var moyo = strNo.charAt(i);
        if (moyo != ",") {
            if (y % 3 == 0 && y != 0) /* 세자리 마다 컴마를 붙인다. */
            {
                money = moyo + "," + money
                y++;
            }
            else {
                money = moyo + money;
                y++;
            }
        }
    }
    return minus + money + pointMoney;
}


function Numberchk() {
    if ((event.keyCode < 48) || (event.keyCode > 57)) {
        alert("숫자만 입력가능합니다. !!");
        event.returnValue = false;
    }
}


function Start_Wait() {
    bodyBackgroundBlind('block');
    displayWaitFlash('block');

    //document.body.scrollTop = 0;
}


function bodyBackgroundBlind(sDisplayStyle) {
    var oframe = getObj("waitFrame");
    if (null != oframe) {
        //oframe.style.top = (document.body.scrollTop) + 'px';
        //document.getElementById("waitFrame").height = document.body.scrollHeight;
        // alert("waitFrame 높이 :" + oframe.style.height + "<br />");

        oframe.style.height = document.body.scrollHeight;
        oframe.style.display = sDisplayStyle;

        if (oframe.style.display == "none")
            oframe.style.zIndex = "0";
        else
            oframe.style.zIndex = "500";
    }
}

function displayWaitFlash(sDisplayStyle) {
    var odiv = getObj("waitDiv");
    // alert(document.body.clientWidth +" "+odiv.clientWidth )
    ;
    odiv.style.top = document.body.scrollTop + (eval(document.body.clientHeight) - iHotelDetailHeight) / 2 + 10;
    odiv.style.left = (document.body.clientWidth - 650) / 2;

    odiv.style.zIndex = "1000";

    if (null != odiv) odiv.style.display = sDisplayStyle;

}

//메인 공지사항 클릭(dkim)
function BoardSideMenuClick(iMenuNo, sDiv1, sDiv2, sBoardCID, sCurBoardCID, sImg1, sImg2, sImg1CID, sImg2CID) {
    if (iMenuNo == 1) {
        $('#' + sDiv1).show();
        $('#' + sDiv2).hide();
        $('#'+sImg1CID).attr('src', $('#'+sImg1).val() + '1.gif');
        $('#'+sImg2CID).attr('src',$('#',sImg2).val() + '2.gif');
    }
    else {
        $('#' + sDiv1).hide();
        $('#' + sDiv2).show();
        $('#'+sImg1CID).attr('src', $('#'+sImg1).val() + '2.gif');
        $('#'+sImg2CID).attr('src', $('#'+sImg2).val() + '1.gif');
    }
    $('#'+sCurBoardCID).val($('#'+sBoardCID).val());
}

function BoardSideClickMore(sCurBoardID) {
    //alert('More Clicked.:' + $(sCurBoardID).value);
    gotoBoardList($('#'+sCurBoardID).val());
}

//게시판으로 이동시 사용.
function gotoBoardList(boardID) {
    var sURL = "/custCenter/Board_List.aspx";
    var sURL2 = "/custCenter/eventList.aspx";

    var sParm = "boardID=" + boardID;
    if (boardID == null || boardID == "") {
        alert('게시판 ID가 없습니다.');
        return;
    } else if (boardID == "0") {
        gotoURL(sURL2);
    }
    else {
        gotoURL(sURL + "?" + sParm);
    }
}

//게시물보기로 바로 이동시 사용.
function gotoBoardView(boardID, contentsID) {
    var sURL = "/custCenter/Board_View.aspx";
    var sParm = "boardID=" + boardID + "&contentsID=" + contentsID;
    var sURL2 = "/custCenter/eventItem.aspx";
    var sParm2 = "";

    if (boardID == null || boardID == "" || contentsID == "") {
        alert('게시물 ID가 잘못되었습니다.');
        return;
    }

    // Event 처리
    if (boardID == "0") {
        var sEventID = contentsID.split(',');
        if (sEventID.length != 2) {
            alert("이벤트 ID가 잘못되었습니다.");
        } else {
            sParm2 = "eventID=" + sEventID[0] + "&codeID=" + sEventID[1];
            gotoURL(sURL2 + "?" + sParm2);
        }
    }
    else {
        gotoURL(sURL + "?" + sParm);
    }
}

//----------------------------------------------------------------------------------------------
// 지정한 URL 로 GOGO!!
// 공통으로 사용하는 것은 간단한 이름으로 이동함

function gotoURL(url) {
    var sURL = '/html';
    switch (url) {
        case 'main': sURL += '/main.aspx'; break;
        case 'introduce': sURL += '/company/introduce.aspx'; break;
        case 'agreement': sURL += '/company/agreement.aspx'; break;
        case 'privacy': sURL += '/company/privacy.aspx'; break;
        case 'sitemap': sURL += '/company/sitemap.aspx'; break;
        case 'location': sURL += '/company/location.aspx'; break;
        case 'partner': sURL += '/company/partner.aspx'; break;
        case 'mypage': sURL += '/mypage/bookinglist.aspx'; break;
        case 'bookinglist': sURL += '/mypage/bookinglist.aspx'; break;

        default: sURL = url; break;
    }

    document.location = sURL;
}


//문자의 갯수를 확인
function asclen(s) {
    var i, len = 0;
    for (i = 0; i < s.length; i++) (s.charCodeAt(i) > 255) ? len += 2 : len++;
    return len;
}


/**********************************************************
    상세 링크
**********************************************************/
function viewHotelDetail3(sDetail) {

    if (sDetail != '') {
        parent.document.location.href = "/product/hotelinfo.aspx?" + sDetail;
    }


}
/**********************************************************
상세 링크
**********************************************************/
function viewHotelDetail2(sDetail) {

    if (sDetail != '') {
        document.location.href = "../product/hotelinfo.aspx?HTLID=" + sDetail + '&enc=N';
    }
}
/**********************************************************
문자 길이
**********************************************************/
function length_check(Ltemp) {
    var temp_length = Ltemp.length;
    return temp_length;
}

/**********************************************************
// 주민번호 확인 TextBox Obj를 입력 받음
**********************************************************/
function resnoCheck(ResNo1, ResNo2) {

    var chk = 0;
    var yy = ResNo1.val().substring(0, 2);
    var mm = ResNo1.val().substring(2, 4);
    var dd = ResNo1.val().substring(4, 6);
    var sex = ResNo2.val().substring(0, 1);


    if (ResNo1.val().length != 6) {
        alert('주민등록번호 앞부분이 잘못되었습니다.');
        ResNo1.val('') ;
        ResNo1.focus();
        return false;
    }

    if ((sex != 1 && sex != 2 && sex != 3 && sex != 4) || (ResNo2.val().length != 7)) {
        alert('주민등록번호 뒷부분이 잘못되었습니다.');
        ResNo2.val('');
        ResNo2.focus();
        return false;
    }

    for (var i = 0; i <= 5; i++)
        chk = chk + ((i % 8 + 2) * parseInt(ResNo1.val().substring(i, i + 1)))

    for (var i = 6; i <= 11; i++)
        chk = chk + ((i % 8 + 2) * parseInt(ResNo2.val().substring(i - 6, i - 5)))

    chk = 11 - (chk % 11)

    chk = chk % 10

    if (chk != ResNo2.val().substring(6, 7)) {
        alert('유효하지 않은 주민등록번호입니다.');
        ResNo1.val('');
        ResNo2.val('');
        ResNo1.focus();
        return false;
    }
    return true;
}

var isNN = (navigator.appName.indexOf("Netscape") != -1);
var bVer;
function msieversion() {
    var ua = window.navigator.userAgent
    var msie = ua.indexOf("MSIE ")

    if (msie > 0) bVer = parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))); // If Internet Explorer, return version number
    else bVer = 0; // If another browser, return 0
}

msieversion();

function autoTab(input, len, e) {
    var keyCode = (isNN) ? e.which : e.keyCode;
    var filter = (isNN) ? [0, 8, 9] : [0, 8, 9, 16, 17, 18, 37, 38, 39, 40, 46];
    if (input.value.length >= len && !containsElement(filter, keyCode)) {
        input.value = input.value.slice(0, len);
        input.form[(getIndex(input) + 1) % input.form.length].focus();
    }

}

function containsElement(arr, ele) {
    var found = false, index = 0;
    while (!found && index < arr.length) {
        if (arr[index] == ele)
            found = true;
        else
            index++;
    }
    return found;
}

function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1) {
        if (input.form[i] == input)
            index = i;
        else
            i++;
    }
    return index;
}


// 입력값 콤마 삽입하기
function fncAddComma(nValue) {
    var strNo = new String(nValue);
    var pointMoney = '';
    var minus = '';
    if (strNo.indexOf('.') != -1) //소수점 공식
    {
        var nidx = fncPointReturn(strNo, strNo.length);
        pointMoney = strNo.substring(nidx);
        strNo = strNo.substring(0, nidx);
    }
    if (strNo.indexOf('-') != -1) {
        minus = '-';
        strNo = strNo.substring(1);
    }

    var nCount = strNo.length;
    var money = "";
    var y = -1;
    for (var i = nCount; i >= 0; i--) {
        var moyo = strNo.charAt(i);
        if (moyo != ",") {
            if (y % 3 == 0 && y != 0) /* 세자리 마다 컴마를 붙인다. */
            {
                money = moyo + "," + money
                y++;
            }
            else {
                money = moyo + money;
                y++;
            }
        }
    }
    return minus + money + pointMoney;
}

// 이벤트 좌표 구하기
function abspos(e) {
    this.x = e.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
    this.y = e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    return this;

}

function showLoading() {
    $('#divLoading').css({ visibility: "visible" });
    $('#divSubmit').css({ visibility: "hidden" });
}

function hiddenLoading() {
    $('#divLoading').css({ visibility: "hidden" });
    $('#divSubmit').css({ visibility: "visible" });

}

/**********************************************
* 오버레이 로딩바 

***********************************************/
function WaitStart() {
    var iHtml = '<div class="fs14 b mb4 c_ff"><img src="/images/etc/wait.gif" class="mb4 mr4" />실시간으로 호텔을 조회 중입니다. 잠시만 기다려주세요.</div>';
    $.blockUI({
        message: function () { return iHtml + buildLoadingBar(); },
        //centerY: true,
        //centerX: true,
        css: {
            top: ($(window).height() - 480) / 2 + 'px',
            left: ($(window).width() - 690) / 2 + 'px'

            , width: '680px'
            , height: '480px'
            , backgroundColor: '#000'
            , border: '4px solid #000'
            , borderRadius: '10px'
            , padding: '15px 6px 6px 6px'
            , '-webkit-border-radius': '10px'
            , '-moz-border-radius': '10px'
            , color: '#fff'
            , opacity: .7
        }
    });
}

/**********************************************
* 랜덤 값 구하기 iLimit는 최대값 - 1
***********************************************/
function getRand(iLimit) {
    var r = Math.round(Math.random() * iLimit - 0.5);
    if (r < 0) { r = 0; }
    return r;
}

function buildLoadingBar() {
    var fnFlash = ["Amsterdam.swf" 
                    ,"Athens-1.swf"  
                    ,"Athens-2.swf"  
//                    ,"Bangkok.swf"   
//                    ,"Barcelona.swf" 
//                    ,"Beijing.swf"   
//                    ,"Berlin.swf"    
//                    ,"Boston-1.swf"  
//                    ,"Boston.swf"    
//                    ,"Chicago.swf"   
//                    ,"Florence.swf"  
//                    ,"HongKong.swf"  
//                    ,"Istanbul.swf"  
//                    ,"KualaLumpur.swf"
//                    ,"Lasvegas-1.swf"
//                    ,"Lasvegas.swf"  
//                    ,"London1.swf"   
//                    ,"London2.swf"   
//                    ,"Madrid-1.swf"  
//                    ,"Madrid-2.swf"  
//                    ,"Melbourne.swf" 
//                    ,"Munich.swf"    
//                    ,"Newyork-2.swf" 
//                    ,"Newyork.swf"   
//                    ,"Paris.swf"     
//                    ,"Prague.swf"    
//                    ,"RiodeJaneiro.swf"
//                    ,"SanFrancisco.swf"
//                    ,"Seattle.swf"   
//                    ,"Singapore.swf" 
//                    ,"Stockholm.swf" 
//                    ,"Sydney.swf"    
//                    ,"Toronto.swf"   
//                    ,"Vancouver.swf" 
//                    ,"Venice.swf"    
//                    ,"Vienna.swf"    
//                    ,"Washington.swf"
           ];
    return ObjSwf2('/images/fla/Loading/' + fnFlash[getRand(fnFlash.length)], 660, 450)

}

function getCookie(name) {
    var Found = false
    var start, end
    var i = 0

    while (i <= document.cookie.length) {
        start = i
        end = start + name.length

        if (document.cookie.substring(start, end) == name) {
            Found = true
            break
        }
        i++
    }

    if (Found == true) {
        start = end + 1
        end = document.cookie.indexOf(";", start)
        if (end < start)
            end = document.cookie.length
        return document.cookie.substring(start, end)
    }
    return ""
}

function setCookie(name, value, expiredays) {
    var todayDate = new Date();
    todayDate.setDate(todayDate.getDate() + expiredays);
    document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function fnViewReceipt(sBHBID) {
    MM_openBrWindow('/mypage/popup_receipt.aspx?BHBID=' + sBHBID, '현금입금증출력', 'width=380,height=600')
}
function fnViewInvoiceAG(sBHIID, sBHBID) {
    MM_openBrWindow('/booking/invoice.aspx?BHIID=' + sBHIID + '&BHBID=' + sBHBID + '&AG=1010', '인보이스출력', 'width=650,height=1000')
}
function fnViewInvoice(sBHIID, sBHBID) {
    MM_openBrWindow('/booking/invoice.aspx?BHIID=' + sBHIID + '&BHBID=' + sBHBID, '인보이스출력', 'width=650,height=1000')
}
function fnViewVoucher(sBHIID, sBHBID, sPayStat) {
    if (sPayStat == "Z")
        MM_openBrWindow('/booking/voucher.aspx?BHIID=' + sBHIID + '&BHBID=' + sBHBID, '바우처출력', 'width=650,height=1000');
    else
        alert("결제 후에 출력할 수 있습니다.");
}
function fnReceiptDisplay(sBHBID) {
    //OpenInfoWH(400,700,'http://onionhotel.com/html/mypage/receiptdisplay.aspx?BHBID=
    MM_openBrWindow('/mypage/receiptdisplay.aspx?BHBID=' + sBHBID, '이니시스영수증출력', 'width=400,height=700')
}

function BuildOMap(mapSizeX,mapSizeY,mapImgPath,poiX,poiY,poiZ) {
    var strMap;
    strMap = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="' + mapSizeX + '" HEIGHT="' + mapSizeY + '" ID="theMovie">';
    strMap+='<PARAM NAME="FlashVars" VALUE="zoomifyImagePath=' + mapImgPath + '&zoomifyX=' + poiX + '&zoomifyY=' + poiY + '&zoomifyZoom=' + poiZ + '&zoomifyToolbar=1&zoomifyNavWindow=1&zmapSizeX=' + mapSizeX + '&zmapSizeY=' + mapSizeY + '">';
    strMap += '<PARAM NAME="wmode" VALUE="transparent">';
    strMap += '<PARAM NAME="src" VALUE="/map/hotelmap/map-090610.swf">';
    strMap += '<EMBED wmode="transparent" FlashVars="zoomifyImagePath=' + mapImgPath + '&zoomifyX=' + poiX + '&zoomifyY=' + poiY + '&zoomifyZoom=' + poiZ + '&zoomifyToolbar=1&zoomifyNavWindow=1&zmapSizeX=' + mapSizeX + '&zmapSizeY=' + mapSizeY + '" SRC="map.swf" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"  WIDTH="' + mapSizeX + '" HEIGHT="' + mapSizeY + '" NAME="theMovie">';
    strMap += '</EMBED>';
    strMap += '</OBJECT>';

    return strMap;
}

function CopyHotelInfoUrl(id) {
    var obj = document.getElementById(id);
    if (obj.value == "") {
        alert("클립보드에 저장할 문자를 입력 하세요.");
        obj.focus();
        return;
    }
    obj.select()
    var oRange = obj.createTextRange();
    oRange.execCommand("Copy");
    alert("[" + obj.value + "]가 클립보드에 저장되었습니다. Ctrl+v를 눌러보세요.");
}
