﻿// JScript 파일
function Select(sel, text)//이메일 선택..
{
    if(sel == "00")
    {
        text.focus();
        text.value = "";
    }
    else
    {
        text.value = sel;
    }
}

function txt_click(Subject)//답글시 re글씨 지움.
{
    if(Subject.value == "[Re]:")
    {
        Subject.value = "";
    }
}

function chkForm2(ed1, name, title, passwd)//글쓸때 체크..
{ 
    var content1 = ed1.getHtml(); //대체한 textarea에 작성한HTML값 전달
    
    content1 = content1.replace(/&nbsp;/gi, '').replace(/<br>/gi, '').replace(/ /, '').replace(/<P>/gi, '').replace('</P>', '');
    
    
    if(name.value=='')
    {
        name.focus();
        alert('이름을 적어주세요');
        return false;
    }
    if(passwd.value=='')
    {
        passwd.focus();
        alert('비밀번호를 적어주세요');
        return false;
    }
    if(title.value=='')
    {
        title.focus();
        alert('제목을 적어주세요');
        return false;
    }
    if (content1 == '')
    {
        alert('내용을 적어주세요');
        ed1.focus();
        return false;
    }

}
var save = 0;
function chkForm_Download(ed1, name, title, passwd, upload, dd) // 다운로드 Write시..체크..
{
    var content1 = ed1.getHtml();
    content1 = content1.replace(/&nbsp;/gi, '').replace(/<br>/gi, '').replace(/ /, '').replace(/<P>/gi, '').replace('</P>', '');
    
    if(name.value=='')
    {
        name.focus();
        alert('이름을 적어주세요');
        return false;
    }
    if(passwd.value=='')
    {
        passwd.focus();
        alert('비밀번호를 적어주세요');
        return false;
    }
    if(title.value=='')
    {
        title.focus();
        alert('제목을 적어주세요');
        return false;
    }
    if (content1 == '')
    {
        alert('내용을 적어주세요');
        ed1.focus();
        return false;
    }
    if (upload.value == '')
    {
        alert('업로드 할 파일을 선택해주세요');
        ed1.focus();
        return false;
    }
    if(save == 0)
    {
        save++;
        name.readOnly = true;
        passwd.readOnly = true;
        title.readOnly = true;
        ed1.readOnly = true;
        
        dd.style.display = "";
    }
    else
    {
        alert('업로드 중 입니다. 잠시만 기다려 주세요.');
        return false;
    }
}
    
function Del(PID, STEP, TOP_NO, PAGE)//글 삭제시..
{
    var left = (screen.availWidth - 240)/2;
    var top = (screen.availHeight - 140)/2;
    window.open("Passwd.aspx?pid="+PID+"&step="+ STEP +"&EXE=DEL&PAGE=" + PAGE + "&top_no="+TOP_NO+"","","top="+top+",left="+left+",width=240,height=140");
}
function Amendments(PID, STEP, TOP_NO, PAGE)//글 수정시..
{
    var left = (screen.availWidth - 240)/2;
    var top = (screen.availHeight - 140)/2;
    window.open("Passwd.aspx?pid="+PID+"&step="+ STEP +"&EXE=AM&PAGE=" + PAGE + "&top_no="+TOP_NO+"","","top="+top+",left="+left+",width=240,height=140");
//  window.showModalDialog("Passwd.aspx?pid="+PID+"&step="+ STEP +"&EXE=AM&PAGE=QNA&top_no="+TOP_NO+"","","top="+top+",left="+left+",width=240,height=140");
}

function bluring()//메인페이지 스크립트들..
{
    if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}

document.onfocusin=bluring;

function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
    window.open(theURL,winName,features);
}
function MM_openBrWindow2(theURL,winName,features) 
{ //v2.0
    var left = (screen.availWidth - 510)/2;
    var top = (screen.availHeight - 250)/2;
    window.open(theURL,winName,features + 'top='+top + ', left=' + left);
}



function chkForm() ///마스터 페이지에 있던것..
{
    var content1 = ed1.getHtml(); //대체한 textarea에 작성한HTML값 전달
    var content2 = ed2.getHtml(); //대체한 textarea에 작성한HTML값 전달
    if (content1 == "") {
        alert("내용을 적어주세요!");
        ed1.focus();
        return false;
    }

    if (content2 == "") {
        alert("내용을 적어주세요!");
        ed2.focus();
        return false;
    }

    //alert(content); //값확인(디버깅)
    return true;
}

function isKeyEnter()//Enter누를 시 검색버튼..
{
    var keyCode = window.event.keyCode;
    if(keyCode == 13)
    {
        __doPostBack("ctl00$ContentPlaceHolder1$Button1","");
    }
}
