﻿
//后台管理左栏导航伸缩效果

var showId = "";
var type, idiv, id;


function divshow(div) {
    id = div.id + "1";
    if (showId != "" && showId != id) {
        idiv = document.getElementById(showId);
        idiv.style.display = "none";
        idiv = document.getElementById(showId.substring(0, showId.length - 1));
        idiv.style.background = "url(../images/title_bg_hide.gif)";
    }
    idiv = document.getElementById(id);
    type = idiv.style.display;
    type == "none" ? type = "" : type = "none";
    idiv.style.display = type;
    showId = id;
}

function imgshow(div) {
    type = idiv.style.display;

    type == "none" ? url = "url(../images/title_bg_hide.gif)" : url = "url(../images/title_bg_show.gif)";

    div.style.background = url;
}

function show(div) {
    divshow(div);
    imgshow(div);
}

//支持firefox的链接效果
function go(a) {
    top.frames[2].location = a;
}



//禁止删除有子栏目的栏目


function ConfirmDel1() {
    alert("You can not delete a parent category!");
    return false;
}

function ConfirmDel2() {
    if (confirm("\t             Warning!\n Contents of the category will be deleted with it! \n \tYou determine to Delete it?"))
        return true;
    else
        return false;

}

//禁止删除有子章节的章节


function ConfirmDel3() {
    alert("You can not delete a parent Chapter!");
    return false;
}

function ConfirmDel4() {
    if (confirm("\t             Warning!\n Contents of the chapter will be deleted with it! \n \tYou determine to Delete it?"))
        return true;
    else
        return false;
}

function CheckAll(form) {
    for (var i = 0; i < form.elements.length; i++) {
        var e = form.elements[i];
        if (e.Name != "chkAll" && e.disabled == false)
            e.checked = form.chkAll.checked;
    }
}

function CheckChoose(form) {
    var count = 0;
    for (var i = 0; i < form.elements.length; i++) {
        var c = form1.elements[i];
        if (c.type == "checkbox" && c.checked == true && c.id != "chkAll") {
            count++
        }
    }
    return count;
}

function CheckCount(form) {
    if (CheckChoose(form) == 0) {
        alert('Please choose one to eidt!');
        return false;
    }
    else if (CheckChoose(form) > 1) {
        alert('Choose only one to edit!');
        return false;
    }
}

function CancelKeywork() {
    var c = document.getElementById("txtKeyword");

    c.value = "";
}


function Delete(form) {
    if (CheckChoose(form) == 0) {
        alert('Please choose at least one!');
        return false;
    }

    return confirm('You are to remove all selected items?')
}

function IsCheckOne(form) {
    if (CheckChoose(form) == 0) {
        alert('Please choose at least one!');
        return false;
    }
    return true;
}


function goSelectDate(dataID) {
    var strNode = window.showModalDialog("../../inc/jvDateCal.htm", "newwind", "dialogWidth:250px;dialogHeight:250px;dialogTop=200px;,dialogLeft=300px;edge:sunken;help:no;resizable:no;scroll:no;status:no")
    if (strNode != -1) {
        if (typeof (strNode) != "undefined") {
            var strNodeary = strNode.split(";")
            var strNodeID = strNodeary[0]
            var strNodeName = strNodeary[1]
            document.all(dataID).value = strNodeID;
        }
    }
}



function NotEmpty(obj, title) {
    var Content;
    Content = document.getElementById(obj);
    if (Content.value == "") {
        alert(title + " is required!");
        return false;
    }
    return true;
}


function CheckForm() {
    if (document.Login.txtUserName.value == "") {
        alert("Please input user name！");
        document.Login.txtUserName.focus();
        return false;
    }
    if (document.Login.txtPassword.value == "") {
        alert("Please input password！");
        document.Login.txtCheckCode.focus();
        return false;
    }
    if (document.Login.txtCheckCode.value == "") {
        alert("Please input Aut Code！");
        document.Login.txtCheckCode.focus();
        return (false);
    }
}

//显示编辑章节内容的模式窗口

function ShowdialogContent(ClassID, ModuleID, ID) {
    window.showModalDialog("Content.aspx?ModuleID=" + ModuleID + "&ClassID=" + ClassID + "&ID=" + ID, null, "dialogWidth:800px;dialogHeight:600px;resizeable:no;status:no;center:yes;help:no");
}

function Showdialog(url) {
    window.showModalDialog(url, null, "dialogWidth:600px;dialogHeight:400px;resizeable:no;status:no;center:yes;help:no");

}

function Showdialog(url, wth, ht) {
    window.showModalDialog(url, null, "dialogWidth:280px;dialogHeight:160px;resizeable:no;status:no;center:yes;help:no");
}
function SaveAs() {
    document.execCommand('Saveas', true, 'Saveas')
    return false
} 
    
    


     
     
     

    


