﻿function getTextAreaInnerHtmlS2() {
    if (document.getElementById("ListBoxS2").selectedIndex < 0) {
        alert("您尚未選取分類!");
        return false;
    }
    if (document.getElementById("txtTitleS2").value == "") {
        alert("請輸入標題!");
        return false;
    }

    var oEditor = CKEDITOR.instances.editor1.getData();
    if (oEditor == "")
    {
        alert("請輸入文章內容!");
        return false;
    }
};


function Check3() {
    if (document.getElementById("txtPetName").value == "") {
        alert("您尚未輸入您的暱稱!");
        return false;
    }
    if (document.getElementById("txtMailAddress").value == "") {
        alert("您尚未輸入推薦的郵件地址!");
        return false;
    }
};


function generateFloatLayer(p) {
    var src = 'SubForm/ExtendsAction.aspx?Ext='+p;
    var html = "<div style='height:20px'></div><iframe marginwidth=0  marginheight=0 frameborder=0 name=EDetail scrolling=auto width=400 height=400px src=" + src + "></iframe>";
    
    floatArea = document.getElementById("DIVE");
    floatArea.style.display = "none";
    divClose = '<div id="close" style="position:absolute; right:15px; top:10px; left:auto; bottom:auto;"><a href="javascript:closeFloat();">關閉視窗</a></div><br>';
    //alert(p);
    floatArea.innerHTML = divClose + html;
    floatArea.style.border = "#B5CBD0 0px solid";
    var screenWidth = document.body.clientWidth + document.body.scrollLeft;
    var screenHeight = document.body.clientHeight;
    var divWidth = floatArea.offsetWidth;
    var divHeight = floatArea.offsetHeight;
    var left = parseInt((screenWidth - divWidth) / 2);
    var top = parseInt((screenHeight - divHeight) / 2);
    floatArea.style.left = left/2+60;
    floatArea.style.top = 100;
    floatArea.style.display = "block";
    floatArea.style.filter = "alpha(opacity = 98)";
    return false;
};
function OrderFloatLayer() {
    var src = 'SubForm/PublishOrder.aspx';
    var html = "<div style='height:20px'></div><iframe marginwidth=0  marginheight=0 frameborder=0 name=EDetail scrolling=auto width=400 src=" + src + "></iframe>";

    floatArea2 = document.getElementById("DIVE2");
    floatArea2.style.display = "none";
    divClose = '<div id="close" style="position:absolute; right:15px; top:10px; left:auto; bottom:auto;"><a href="javascript:closeFloatE2();">關閉視窗</a></div><br>';
    //alert(p);
    floatArea2.innerHTML = divClose + html;
    floatArea2.style.border = "#B5CBD0 0px solid";
    var screenWidth = document.body.clientWidth + document.body.scrollLeft;
    var screenHeight = document.body.clientHeight;
    var divWidth = floatArea2.offsetWidth;
    var divHeight = floatArea2.offsetHeight;
    var left = parseInt((screenWidth - divWidth) / 2);
    var top = parseInt((screenHeight - divHeight) / 2);
    floatArea2.style.left = left / 2 + 60;
    floatArea2.style.top = 100;
    floatArea2.style.display = "block";
    floatArea2.style.filter = "alpha(opacity = 98)";
    return false;
};

function ResponseVisionandError() {
    var src = 'SubForm/ResponseVisionandError.aspx';
    var html = "<div style='height:20px'></div><iframe marginwidth=0  marginheight=0 frameborder=0 name=EDetail scrolling=auto height=250px width=400 src=" + src + "></iframe>";

    floatArea3 = document.getElementById("DIVE3");
    floatArea3.style.display = "none";
    divClose = '<div id="close" style="position:absolute; right:15px; top:10px; left:auto; bottom:auto;"><a href="javascript:closeFloatE3();">關閉視窗</a></div><br>';
    //alert(p);
    floatArea3.innerHTML = divClose + html;
    floatArea3.style.border = "#B5CBD0 0px solid";
    var screenWidth = document.body.clientWidth + document.body.scrollLeft;
    var screenHeight = document.body.clientHeight;
    var divWidth = floatArea3.offsetWidth;
    var divHeight = floatArea3.offsetHeight;
    var left = parseInt((screenWidth - divWidth) / 2);
    var top = parseInt((screenHeight - divHeight) / 2);
//    var top = (window.screen.availHeight - 30 - 250) / 2;
//    var left = (window.screen.availWidth - 10 - 400) / 2; 
    floatArea3.style.left = left / 2 + 60;
    floatArea3.style.top = 100;

    floatArea3.style.display = "block";
    floatArea3.style.filter = "alpha(opacity = 98)";
    return false;
};

function closeFloat() {
    floatArea = document.getElementById("DIVE");
    floatArea.innerHTML = "";
    floatArea.style.display = "none";
};

function closeFloatE2() {
    floatArea2 = document.getElementById("DIVE2");
    floatArea2.innerHTML = "";
    floatArea2.style.display = "none";
};

function closeFloatE3() {
    floatArea3 = document.getElementById("DIVE3");
    floatArea3.innerHTML = "";
    floatArea3.style.display = "none";
};

function GetContentURL() {
    var clipBoardContent = "已成功複製文章引用網址!";
    var clipBoard_Error = "抱歉！您現在所使用的瀏覽器不支援此項功能!";
    if (window.clipboardData) {
        if (document.getElementById('TextBox1').value != "") {
            window.clipboardData.setData("Text", document.getElementById('TextBox1').value);
            alert(clipBoardContent);
        }
    }
    else {
        alert(clipBoard_Error);
    }
    return false;
}


function GoS2Check() {

    if (document.getElementById("txtPetName").value == "") {
        alert("請輸入暱稱!");
        return false;
    }
    if (document.getElementById("txtEMail").value == "") {
        alert("請輸入電子郵件信箱!");
        return false;
    }
    if (document.getElementById("txtResponseContents").value == "") {
        alert("您尚未輸入評論的內容!");
        return false;
    }
};

