﻿function ChangeNav(nav, list, id) {
    for (i = 0; i < nav.length; i++) {
        if (i == id && nav[i].style) {
            nav[i].className = "currentNav";
            list[i].style.display = "";
        } else {
            nav[i].className = "extNav";
            list[i].style.display = "none";
        }
    }
}

function ReSize(size) {
    var obj = document.getElementById("Content");
    obj.style.fontSize = size + "px";
}

//转到页码
function goPage(pageUrl) {
    var pageNo = document.getElementById("No");
    if (pageNo.value == "") {
        window.alert("请输入有效页码！");
        pageNo.focus();
    } else {
        if (pageUrl == null || pageUrl == "")
            pageUrl = window.location.pathname;
        window.location.href(pageUrl + pageNo.value);
    }
}

function checkspace(checkstr) {
    var str = '';
    for (i = 0; i < checkstr.length; i++) {
        str = str + ' ';
    }
    return (str == checkstr);
}

function checkComment() {
    if (checkspace(document.SendComment.PLRY.value)) {
        alert("用户名不能为空，请填写!");
        document.SendComment.PLRY.focus();
        return false;
    }
    var editor = FCKeditorAPI.GetInstance("PLNR");
    var plnr = editor.GetXHTML();
    if (checkspace(plnr)) {
        alert("评论内容不能为空，请填写!");
        return false;
    }
    if (plnr.length > 4000) {
        alert("评论内容不能超过4000个字符，请重新填写！");
        return false;
    }
    return true;
}

function checkBook() {
    if (checkspace(document.BookFrm.LYBT.value)) {
        alert("留言标题不能为空，请填写!");
        document.BookFrm.LYBT.focus();
        return false;
    }
    var editor = FCKeditorAPI.GetInstance("LYNR");
    var lynr = editor.GetXHTML();
    if (checkspace(lynr)) {
        alert("留言内容不能为空，请填写!");
        return false;
    }
    if (lynr.length > 4000) {
        alert("留言内容不能超过4000个字符，请重新填写！");
        return false;
    }
    if (checkspace(document.BookFrm.LYRY.value)) {
        alert("联系人不能为空，请填写!");
        document.BookFrm.LYRY.focus();
        return false;
    }
    if (checkspace(document.BookFrm.LXDH.value)) {
        alert("联系电话不能为空，请填写!");
        document.BookFrm.LXDH.focus();
        return false;
    }
    if (checkspace(document.BookFrm.DZYJ.value)) {
        alert("电子邮件不能为空，请填写!");
        document.BookFrm.DZYJ.focus();
        return false;
    }
    return true;
}

//收藏操作
function collection(title, url) {
    window.location.href = "/User/Collection/QuickCreate/?id=" + title + "," + url;
}
