﻿//function popPrint(idx) {
//    //  alert(url);
//    window.open("/board/pop_contentsCopy.aspx?idx=" + idx + "&url=" + escape(url) + "&menucd=" + menucd, "copy", "width=500,height=480");
//}
//        
function fnAutoSize(s, obj) {
    var m = 20;

    if (s >= m) {
        obj.style.pixelHeight = s + 6;
    } else {
        obj.style.pixelHeight = m;

    }
}
function commentPwdCheckLayerPop(modeVal, comIdxVal, contIdx) {
    var scrollY = 0;
    var lefty = (screen.width) ? (screen.width - 434) / 2 : 0;

    if (navigator.appName.indexOf("Microsoft") == -1) {
        scrollY = window.pageYOffset + 200;
    } else {
        scrollY = document.getElementById("ILCHICONTENTVIEW").scrollTop;
    }
    
    Popup.openPopup("PWDCHECKPOP", "/Common/Popup_passInput.aspx?mode=" + modeVal + "&comIdx=" + comIdxVal + "&contIdx=" + contIdx, scrollY + 200, lefty - 200, 495, 277, 'no', 'gray', "D");
}


function commentModifyLayerPop(modeVal, comIdxVal, CertificationKey) {

    Popup.closeLayerD('PWDCHECKPOP');

    var scrollY = 0;
    var lefty = (screen.width) ? (screen.width - 434) / 2 : 0;

    if (navigator.appName.indexOf("Microsoft") == -1) {
        scrollY = window.pageYOffset + 200;
    } else {
        scrollY = document.getElementById("ILCHICONTENTVIEW").scrollTop;
    }

    Popup.openPopup("PWDCHECKPOP", "/Common/Popup_recommentWrite.aspx?contIdx=" + document.getElementById("hdnContIdx").value + "&mode=" + modeVal + "&comIdx=" + comIdxVal + "&certificationKey=" + CertificationKey, scrollY + 200, lefty - 200, 495, 308, 'no', 'gray', "D");

}

function goSearch() {

    __doPostBack('CommentM$btnSearch', '');
}

function loginPop() {
    var logpopup = window.open('/login/loginPopup.aspx', 'logpopup', 'top=70,left=70,width=350,height=260');
    logpopup.focus();
}

function ComTextChk(txtComment, comIdx) {
    var formObj = document.forms[0];
    var elementObj;

    elementObj = document.getElementById("CommentM_txtNickNm");
    if (elementObj.value.replace("이름", "").chkBlank() == true) {
        alert("이름을 입력하세요.");
        elementObj.focus();
        return false;
    }

    elementObj = document.getElementById("CommentM_txtPwd");
    if (elementObj.value.chkBlank() == true) {
        alert("비밀번호를 입력하세요.");
        elementObj.focus();
        return false;
    }

// 이메일 형식이 올바른지 확인하고 다시 입력하세요.

    elementObj = document.getElementById("CommentM_txtEmail");
    if (elementObj.value.replace("이메일", "").chkBlank() == true) {
        alert("이메일을 입력하세요.");
        elementObj.focus();
        return false;
    }

    if (email_chk(elementObj.value) == false) {
        alert("이메일 형식이 올바른지 확인하고 다시 입력하세요.");
        document.getElementById("CommentM_txtEmail").focus();
        return false;
    }

    elementObj = document.getElementById(txtComment);
    if (elementObj.value.chkBlank() == true) {
        alert("댓글을 입력해 주십시요.");
        elementObj.focus();
        return false;
    }

    elementObj = document.getElementById("CommentM_checkButtonClickFlag");
    if (elementObj.value == "true") {
        alert("이미 버튼을 클릭하셨습니다.");
        return false;
    } else {
        elementObj.value = "true";
    }

    return true;
}

function replayView(openIdx, closeIdx, colseIdx2, code) {
    document.getElementById(colseIdx2).style.display = "none";

    if (code == "R") {
        if (document.getElementById(openIdx).style.display == "none") {
            document.getElementById(openIdx).style.display = "";
        } else {
            document.getElementById(openIdx).style.display = "none";
        }
    } else {
        if (document.getElementById(openIdx).style.display == "none") {
            document.getElementById(openIdx).style.display = "";
            document.getElementById(closeIdx).style.display = "none";
        } else {
            document.getElementById(openIdx).style.display = "none";
            document.getElementById(closeIdx).style.display = "";
        }
    }

    document.getElementById("CommentM_checkButtonClickFlag").value = "false";
}
