/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function gotoHome(){
    newIFrame.location = "/homepage.jsp";
}

function changeLocale(locale){
    newIFrame.location = "/fabricmore.do?method=changeLocale&locale="+locale;
}

function about(){
    newIFrame.location = "/jsp/about.jsp";
}

function tpcIntro(){
    newIFrame.location = "/jsp/tpcIntroduction.jsp";
}

function comparisonTable(){
    newIFrame.location = "/jsp/comparison_table.jsp";
}

function usageAndfeature(){
    newIFrame.location = "/jsp/usageAndfeature.jsp";
}

function productUsage(){
    newIFrame.location = "/jsp/productUsage.jsp";
}

function productMetrial(){
    newIFrame.location = "/jsp/productMetrial.jsp";
}

function productProcessing(){
    newIFrame.location = "/jsp/productProcessing.jsp";
}

function testReport(){
    newIFrame.location = "/jsp/testReport.jsp";
}

function openPDF(fileName){
    newIFrame.location = "/fabricmore.do?method=openPDF&fileName="+encodeURIComponent(fileName);
}

function boardMessage(){
    newIFrame.location = "/fabricmore.do?method=gotoBoradMessage&page=boardMsg";
}

function addBoardMessage(){
    var flag = "0";
    var subject = document.getElementById("subject").value;
    var msg = document.getElementById("msg").value;
    var creator = document.getElementById("creator").value;
    if (document.getElementById("creator").value == "") {
        flag = "-1";
        alert(document.getElementById("plsInputSubject").value);
    } else if (msg == "") {
        flag = "-1";
        alert(document.getElementById("plsInputMessage").value);
    } else if (creator == "") {
        flag = "-1";
        alert(document.getElementById("plsInputYourName").value);
    }
    var value = "&subject="+encodeURIComponent(subject)+"&msg="+encodeURIComponent(msg)+"&creator="+encodeURIComponent(creator);
    if (flag == "0") {
        newIFrame.location ="/fabricmore.do?method=addBoradMessage&page=boardMsg"+value;
    }
}

function replyBoardMessage(sysId){
    newIFrame.location = "/fabricmore.do?method=replyBoardMessage&page=boardMsg&sysId="+sysId;
}

function addReplyBorardMessage(sysId){
    var flag = "0";
    var replyMessage = document.getElementById("replyMessage").value;
    var replier = document.getElementById("replier").value;
    if (replyMessage == "") {
        flag = "-1";
        alert(document.getElementById("plsInputMessage").value);
    } else if (replier == "") {
        flag = "-1";
        alert(document.getElementById("plsInputYourName").value);
    }
    var value = "&replyMessage="+encodeURIComponent(replyMessage)+"&replier="+encodeURIComponent(replier);
    if (flag == "0") {
        if (confirmPassword()) {
            newIFrame.location = document.getElementById("boardMsgForm").action="/fabricmore.do?method=addReplyBorardMessage&page=boardMsg&sysId="+sysId+value;
        }
    }
    
}

function deleteBoardMsg(sysId) {
    if (confirmPassword()) {
        newIFrame.location = document.getElementById("boardMsgForm").action="/fabricmore.do?method=deleteBorardMessage&page=boardMsg&sysId="+sysId;
    }
}
function confirmPassword() {
    var pwd = prompt(document.getElementById("plsInputPwd").value, "");
    if (pwd != "238136cc") {
        alert(document.getElementById("passwordError").value);
        return false;
    }
    return true;
}

function checkMsgLength(obj, limitNum){
    if (obj.value.length > limitNum){
        obj.value = obj.value.substring(0, limitNum);
        if (limitNum == 256) {
            alert(document.getElementById("textLengthLessThan256").value);
        }
        return false;
    }
    return true;
}


