<!--
/*
'' ============================================================================================
'' 项目名称：风越项目范例ASPX单层框架
'' 项目版本：V1.0
'' 项目描述：
'' 文件名称：js/js_page.js
'' 文件描述：[JavaScript] 页面排版函数库
'' 公司名称：中极网盛
'' 开发人员：刘怒
'' 创建日期：2008-8-7 21:34:32
'' 修订日期：2009-03-10 09:09:55
'' 版权信息：Copyright (C) 2008

'' 项目升级时需读取以下生成工具的版权信息
'' 生成工具：风越代码生成器 [FireCode Creator]
'' 当前版本：通用版 V1.8
'' 官方网站：http://www.sino8848.com
'' ============================================================================================
*/

// ---------------------------------------------------
// 设置表格内容行的鼠标“移上”事件颜色，用于针对表格行加入事件
// 行对象，CSS名：普通、移上、点击、点击移上
function SetTRcolorOver(objTR, cssName, cssOnName, cssClick, cssClickOn)
{
    if (objTR.className == cssClick)
        objTR.className = cssClickOn;
    else if (objTR.className == cssName)
        objTR.className = cssOnName;
}

// ---------------------------------------------------
// 设置表格内容行的鼠标“移开”事件颜色，用于针对表格行加入事件
// 行对象，CSS名：普通、移上、点击、点击移上
function SetTRcolorOut(objTR, cssName, cssOnName, cssClick, cssClickOn)
{
    if (objTR.className == cssClickOn)
        objTR.className = cssClick;
    else if (objTR.className == cssOnName)
        objTR.className = cssName;
}

// ---------------------------------------------------
// 设置表格内容行的鼠标“点击”事件颜色，用于针对表格行加入事件
// 是否起用，表对象，行对象，总控多选框名称，多选框名称，允许多行点选，CSS名：普通、移上、点击、点击移上
function SetTRcolorClick(bExec, objTab, objTR, strCBMainName, strAllCBName, bMultiLine, cssName, cssOnName, cssClick, cssClickOn)
{
    try
    {
        if (bExec)
        {
            //取消除本行外其它行的点击状态
            if (!bMultiLine)
            {
                //设置表格行显示状态为未选择
                for (var i = 0; i < objTab.rows.length; i++)
                {
                    if (objTab.rows[i].className == cssClick && objTR.rowIndex != i)
                    {
                        objTab.rows[i].className = RegExpMatch("(<tr.*?)(onmouseover.*?')([^\\s]*?)('[\\s\\S]*)", objTab.rows[i].outerHTML, "$3");
                    }
                }

                //设置表格行显示状态为未选择
                for (i = 0; i < objTab.getElementsByTagName("input").length; i++)
                {
                    if (RegExpCheck(".*?" + strAllCBName + "$", objTab.getElementsByTagName("input")[i].id))
                    {
                        objTab.getElementsByTagName("input")[i].checked = false;
                    }
                }
            }

            var bChecked = false;
            if (objTR.className != cssClick && objTR.className != cssClickOn)
            {
                //设置点击选择后的风格
                objTR.className = cssClick;
                bChecked = true;
            }
            else
            {
                //设置点击取消后的风格
                objTR.className = cssName;
            }
            //获取表格行中的checkbox对象，并设置是否勾选
            for (i = 0; i < objTR.getElementsByTagName("input").length; i++)
            {
                if (RegExpCheck(".*?" + strAllCBName + "$", objTR.getElementsByTagName("input")[i].id))
                    objTR.getElementsByTagName("input")[i].checked = bChecked;
            }

            if (document.getElementsByName(strCBMainName).length > 0) {SetMainCheckBoxSta(strCBMainName, strAllCBName);}
        }
    }
    catch(e)
    {
        alert(strAllCBName + "程序错误，请修改相应代码：" + e.description);
    }
}

// 在点击总控checkbox时，设置表格行的全部颜色
// 是否执行，表格对象，总控多选框对像，页眉行数，页脚行数，CSS名:单行、双行、点击
// 用法：在“总控多选框对像”的onclick上加入：SetTabTrColorAll(true, document.all.tabList, this, 3, 1, 'tableContent001', 'tableContentAlternating001', 'tableContentClick001')
function SetTabTrColorAll(bExec, objTab, objCBMain, iheaderNum, ifooterNum, cssA, cssB, cssClick)
{
    if (bExec)
    {
        var iTR = 1;
        var classNameNow = "";
        var isChecked = objCBMain.checked;
        for (var i = iheaderNum; i < objTab.rows.length - ifooterNum; i++)
        {
            var objTR = objTab.rows[i];
            if (iTR % 2 == 1)
            {
                classNameNow = cssA;
            }
            else
            {
                classNameNow = cssB;
            }

            if (isChecked)
                objTR.className = cssClick;
            else
                objTR.className = classNameNow;

            iTR++;
        }
    }
}

// ---------------------------------------------------
// 提示是否操作记录
// strInfo：操作的提示文字，如为empty则不提示
// strCBMainName：总控多选框名称, strAllCBName：多选框名称
function OperateRec(strInfo, strCBMainName, strAllCBName)
{
    var bExec = true;

    if (strCBMainName == undefined || strCBMainName.length == 0) strCBMainName = "CheckBox_RecMain";
    if (strAllCBName == undefined || strAllCBName.length == 0) strAllCBName = "CheckBox_RecID";
    if (IsEmptyStr(strInfo) == true)
        strInfo = "确定对选定的全部记录执行指定操作吗？";
    if (SetMainCheckBoxSta(strCBMainName, strAllCBName).substr(0, 1) != '0')
    {

        if (strInfo.toLowerCase() != "empty")
            bExec = ShowConfirm(strInfo);
        if (!bExec)
        {
            ShowMsg("您取消了此次操作。");
        }
    }
    else
    {
        ShowMsg("您未选择任何记录。");
        bExec = false;
    }
    return bExec;
}


// ---------------------------------------------------
// 设置全部checkbox状态
// objCBMain: 设置全选的CBX, strAllCBName: 全部CBX的相同NAME
// 刘怒 Johnny LiuNu
function SetAllCheckBoxSta(objCBMain, strAllCBName)
{
    var isChecked = objCBMain.checked;

    for (i = 0; i < document.getElementsByTagName("input").length; i++)
    {
        if (RegExpCheck(".*?" + strAllCBName + "$", document.getElementsByTagName("input")[i].id))
        {
            //失效的控件不允许设置
            if (document.getElementsByTagName("input")[i].disabled != true)
                document.getElementsByTagName("input")[i].checked = isChecked;
        }
    }    

    //如有多个总控CBX则使其同步
    for(i = 0; i < document.getElementsByName(objCBMain.name).length; i++)
    {
        document.getElementsByName(objCBMain.name)[i].checked = isChecked;
    }
    //返回全选状态: t/f
    return isChecked;
}

// 设置总checkbox状态，参数：strCBMainName 设置全选的CBX的名称, strAllCBName 全部CBX的相同NAME
// 刘怒 Johnny LiuNu
function SetMainCheckBoxSta(strCBMainName, strAllCBName)
{
    var isChecked = true;
    //选择的数目
    var iSel = 0;
    //未选择的数目
    var iNoSel = 0;

    for (i = 0; i < document.getElementsByTagName("input").length; i++)
    {
        if (RegExpCheck(".*?" + strAllCBName + "$", document.getElementsByTagName("input")[i].id))
        {
            if (!document.getElementsByTagName("input")[i].checked)
            {
                iNoSel++;
                isChecked = false;
            }
            else
            {
                iSel++;
            }
        }
    }

    //如有多个总控CBX则使其同步
    for(i = 0; i < document.getElementsByName(strCBMainName).length; i++)
    {
        document.getElementsByName(strCBMainName)[i].checked = isChecked;
    }
    //返回全选状态: 选中数目+未选中数目
    return iSel.toString() + " " + iNoSel.toString();
}
// ---------------------------------------------------

// ---------------------------------------------------
// 按ctrl+enter提交表单 onkeydown="ctlEnterSubmit()"
function ctlEnterSubmit(theForm)
{
    var bIsIE = (document.all) ? true : false
    if (bIsIE && window.event.ctrlKey && window.event.keyCode == 13)
    {
        SubmitForm(theForm);
    }
}
// ---------------------------------------------------

// 提示是否删除记录
function DelRec(theForm, strID)
{
    if (strID.length == 0)
    {
        //批量删除，不需要指定ID，直接由多选框判断
        if (SetMainCheckBoxSta('recordIDAll','recordID').substr(0, 1) != '0')
        {
            if (ShowConfirm('确定删除选定的全部记录吗？'))
            {
                document.all.actMod.value = 'DEL';
                SubmitForm(theForm);
            }
            else
            {
                ShowMsg("您取消了操作。");
            }
        }
        else
        {
            ShowMsg("您未选择任何记录。");
        }
    }
    else
    {
        //单项删除，需要指定ID
        if (ShowConfirm('确定删除指定的记录吗？'))
        {
            //若有多个recordID控件，则设置最后一个的值即可
            document.getElementsByName("recordID")[document.getElementsByName("recordID").length - 1].value = strID
            document.all.actMod.value = 'DEL';
            SubmitForm(theForm);
        }
        else
        {
            ShowMsg("您取消了删除操作。");
        }
    }
    return false;
}

// 在列表、搜索文件中直接设置字段的值
// 表单对象，设置的字段，提示信息，默认值，单项操作时的记录ID
function SetValueInList(theForm, strFieldShowName, strPrompt, strDefaultValue, strID)
{
    if (strID.length == 0)
    {
        //批量设置，不需要指定ID，直接由多选框判断
        if (SetMainCheckBoxSta('recordIDAll','recordID').substr(0, 1) != '0')
        {
            var strValue = ShowPrompt(strPrompt, strDefaultValue);
            if (strValue != null)
            {
                if (strValue.replace(" ", "").length > 0)
                {
                    document.all.actMod.value = "SET_BATCH_VALUE";
                    document.all.setValue_FieldShowName.value = strFieldShowName;
                    document.all.setValue_FieldValue.value = strValue;
                    SubmitForm(theForm);
                }
                else
                {
                    ShowMsg("设置值的内容不得为空。");
                }
            }
            else
            {
                ShowMsg("您取消了操作。");
            }
        }
        else
        {
            ShowMsg("您未选择任何记录。");
        }
    }
    else
    {
        //单项设置，需要指定ID
        var strValue = ShowPrompt(strPrompt, strDefaultValue);
        if (strValue != null)
        {
            if (strValue.replace(" ", "").length > 0)
            {
                //因单项设置时也会生成多项设置的链接，将出现多个recordID控件，设置最后一个的值即可
                document.getElementsByName("recordID")[document.getElementsByName("recordID").length - 1].value = strID
                document.all.actMod.value = "SET_BATCH_VALUE";
                document.all.setValue_FieldShowName.value = strFieldShowName;
                document.all.setValue_FieldValue.value = strValue;
                SubmitForm(theForm);
            }
            else
            {
                ShowMsg("设置值的内容不得为空。");
            }
        }
        else
        {
            ShowMsg("您取消了操作。");
        }
    }
    return false;
}

// 排序
function SetOrderBy(theForm, strOrderby, strDesc)
{
    document.all.sqlOrderBy.value = strOrderby;
    document.all.sqlDescAsc.value = strDesc;
    SubmitForm(theForm);
    return false;
}
// ---------------------------------------------------

// ---------------------------------------------------
// 提交表单并触发onsubmit事件
function SubmitForm(theCheckForm)
{
    try
    {
        if(theCheckForm.onsubmit() != false)
            theCheckForm.submit();
    }
    catch(e)
    {
        theCheckForm.submit();
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 强制关闭窗口
function CloseWindow()
{
    window.opener = null;
    window.close();
}
// ---------------------------------------------------

// ---------------------------------------------------
// 导出文件
function ExportFile(theCheckForm)
{
    if (document.all.ctrl_ExportFileType.options[document.all.ctrl_ExportFileType.selectedIndex].value != "")
        SubmitForm(theCheckForm);
    else
        ShowMsg("请选择导出文件的类型");

    document.all.ctrl_ExportFileType.selectedIndex = 0;
}
// ---------------------------------------------------

// ---------------------------------------------------
// 批量上载文件的管理代码

// Edit.asp文件中，提示删除批量上载的文件
function DelFileCheck(theForm, strCtrlName, strDelFileName)
{
    if (ShowConfirm('确定删除该文件吗？\n\n' + strDelFileName))
    {
        document.all.actMod.value = 'DEL_File';
        document.all.delFileName.value = strDelFileName;
        document.all.ctrlName.value = strCtrlName;
        SubmitForm(theForm);
    }
    else
    {
        ShowMsg("您取消了删除操作。");
    }
    return false;
}

// 设置多文件上载的输入框
// txtCount：输入文件个数的文本框
// ctrlName：要生成控件名的前缀，基于输入控件名生成
// objSpan：显示输出HTML的层
function SetMultiUpdateNum(txtCount, ctrlName, objSpan)
{
    var strOutPut = "";
    if (!/^[\d]+$/g.test(txtCount.value) || parseInt(txtCount.value) < 1 || parseInt(txtCount.value) > 99)
    {
        txtCount.value = txtCount.value.replace(/[^\d]/g, "");
        if (!/^[\d]+$/g.test(txtCount.value) || txtCount.value == "0")
            txtCount.value = "1";
        ShowMsg("请输入1至99的数字！");
    }
    else
    {
        var iCount = txtCount.value;
        var iLen = txtCount.value.length;
        for(i = 0; i < iCount; i++)
        {
            var strNum = FillZeroBeforeNum((i + 1).toString(), iCount);
            var strI = i.toString();

            // 保证第一个生成的控件名即原始控件名，以便检测代码生效（否则无此控件，backgroundColor的属性将报错）
            if (strI == "0") { strI = ""; }

            // 生成的输入框都以 原始控件名+编号 命名
            strOutPut += "<tr><td nowrap>" + ShowTranslateWords('文件') + strNum + ".&nbsp;</td><td width='99%'><input type=\"file\" name=\"" + ctrlName + strI + "\" id=\"" + ctrlName + strI + "\" style=\"width:100%\" class=\"textBox\"></td></tr>";
        }
        strOutPut = "<table BORDER='0' CELLPADDING='0' CELLSPACING='0' width='100%'>" + strOutPut + "</table>";
        objSpan.innerHTML = strOutPut;
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 设置指定对象中(Fyp_ArticleContent)的字体(宋体)
function Text_FontFace(objSpan, strFace)
{
    if (strFace != "")
    {
        for (i = 0; i < document.getElementsByName(objSpan).length; i++)
        {
            document.getElementsByName(objSpan)[i].style.fontFamily = strFace;
            SetCookieSub("FypWeb", "fontFace", strFace, "1000");
        }
    }
}

// 设置指定对象中(Fyp_ArticleContent)字体的大小(12)
function Text_Zoom(objSpan, strSize)
{
    if (strSize != "")
    {
        for (i = 0; i < document.getElementsByName(objSpan).length; i++)
        {
            document.getElementsByName(objSpan)[i].style.fontSize = strSize + "pt";
            SetCookieSub("FypWeb", "fontSize", strSize, "1000");
        }
    }
}

// 设置指定对象中(Fyp_ArticleContent)字体的颜色(#FF0000)
function Text_SetColor(objSpan, strColor)
{
    if (strColor != "")
    {
        for (i = 0; i < document.getElementsByName(objSpan).length; i++)
        {
            document.getElementsByName(objSpan)[i].style.color = strColor;
            SetCookieSub("FypWeb", "fontColor", strColor, "1000");
        }
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 判断是否翻译，输出对应的文本
function ShowTranslateWords(strMsg)
{
    try
    {
        strMsg = TranslateWords(strMsg);
    }
    catch(e)
    { }

    return strMsg;
}
// ---------------------------------------------------

// ---------------------------------------------------
// 弹出确认提示框
function ShowConfirm(strMsg)
{
    strMsg = ShowTranslateWords(strMsg);
    return confirm(strMsg);
}
// ---------------------------------------------------

// ---------------------------------------------------
// 弹出输入提示框
function ShowPrompt(strMsg, strDefault)
{
    strMsg = ShowTranslateWords(strMsg);
    strDefault = ShowTranslateWords(strDefault);

    return window.prompt(strMsg, strDefault);
}
// ---------------------------------------------------

// ---------------------------------------------------
// 弹出提示
function ShowMsg(strMsg)
{
    strMsg = ShowTranslateWords(strMsg);

    //strMsg = strMsg.replace("\"", "\\\"").replace("'", "\\'");
    alert(strMsg);
}
// ---------------------------------------------------

// ---------------------------------------------------
// 跳转路径
// 参数：路径地址或历史记录(0,-1), 跳转方式(reload，href，replace), 无历史记录时的默认页面
function GoUrl(strUrl, theMethod, defaultPage)
{
    if (/^-?[\d]+$/gim.test(strUrl))
    {
        // 传入路径为数字则跳转历史记录
        if (window.history.length > 0)
        {
            // 有历史记录时跳转
            window.history.go(strUrl);
        }
        else if (defaultPage != undefined)
        {
            // 无历史记录时转到默认页
            window.location.replace(defaultPage);
        }
        else
        {
            // 无历史记录及默认页时转到根目录
            window.location.replace(CurrentUrlPathFolder());
        }
    }
    else
    {
        // 传入路径为
        if(theMethod == "reload")
        {
            window.location.reload();
        }
        else if (theMethod == "href")
        {
            window.location.href = strUrl;
        }
        else
        {
            window.location.replace(strUrl);
        }
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 弹出窗口
function PopWin(strUrl, strParam)
{
    window.open(strUrl, "", strParam);
}
// ---------------------------------------------------

// ---------------------------------------------------
// 鼠标移上变换图片
// 参数：图片对象，新图片路径
// 使用：<img src='img.gif' onmouseover=HoverPic(this, 'img2.gif') onmouseout=HoverPic(this, 'img1.gif')>
function HoverPic(objPic, strPic)
{
    objPic.src = strPic;
}
// ---------------------------------------------------

// ---------------------------------------------------
// 限制图片比例：宽、高不大于指定值
// img: 图片对象, iW: 宽, iH: 高
function ImgFit(img, iW, iH)
{
    iRate = img.width /img.height;

    if (img.width > iW)
    {
        img.style.width = iW;
        img.style.height = iW / iRate;
    }
    if (img.height > iH)
    {
        img.style.height = iH;
        img.style.width = iH * iRate;
    }
    if (img.style.width > iW || img.style.height > iH)
    {
        ImgFit(img, iW, iH);
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 滚轮缩放图片大小
// img: 图片对象
function ImgZoom(img)
{
    var zoom = parseInt(img.style.zoom, 10) || 100;
    zoom += event.wheelDelta/12;
    if (zoom > 10 && zoom < 500) img.style.zoom = zoom + '%';
    return false;
}
// ---------------------------------------------------


// ---------------------------------------------------
// 获取指定名称的控件的值或显示信息
// objTxtBox：输入框对象，iDoType：执行方式：1、聚焦检测，2、失焦检测，3、输入
function Mask_TimeHM(objTxtBox, iDoType)
{
    var strOut = objTxtBox.value;
    var dateNow = new Date();
    var strNow = Right("0" + dateNow.getHours().toString(), 2) + ":" + Right("0" + dateNow.getMinutes().toString(), 2);
    var dateEmpty = "00:00";

    //执行检测
    if (iDoType != 3)
    {
        if (iDoType == 1)
        {
            //聚焦检测 无内容时输入掩码值
            if (strOut.replace(/[^\d]+/gim, "") == "")
                strOut = dateEmpty;
            objTxtBox.value = strOut;
            objTxtBox.select();
        }
        if (iDoType == 2)
        {
            //有内容，但不符合格式置为现在时间
            if (/^[\d]{1,2}\:[\d]{1,2}$/gim.test(strOut) == false && strOut.length > 0)
                strOut = strNow;

            //失焦时值为掩码值，清除
            if (strOut == dateEmpty)
                strOut = "";
            objTxtBox.value = strOut;
        }
    }
    //执行输入
    if(iDoType == 3)
    {
        //只可输入数字
        strOut = strOut.replace(/[^\d\:]/gim, "");
        if (strOut.length == 2)
            strOut += ":";
        if (strOut.length > 5)
            {strOut = Left(strOut, 5);}//alert();

        if (event.keyCode >= 48 && event.keyCode <= 57 || event.keyCode >= 96 && event.keyCode <= 105)
        objTxtBox.value = strOut;
        //objTxtBox.select();
    }
    //alert(strOut);
}
// ---------------------------------------------------

// ---------------------------------------------------
// 获取指定名称的控件的值或显示信息
// ctrlName：控件名称, strTextOrValue：获取值或显示信息，text/value
function GetCtrlTextOrValue(ctrlName, strTextOrValue)
{
    var strText = "";
    try
    {
        var cType, i;
        var allElements = document.getElementsByName(ctrlName);
        for(i = 0; i < allElements.length; i++)
        {
            var ctrl = allElements[i];
            if (ctrl.type == undefined)
                cType = ctrl.tagName;
            else
                cType = ctrl.type;

            var strEnd = "";
            if (strText.length > 0)
            {
                strEnd = " ";
            }
            // 判断指定控件类型，多选控件则累加
            switch(cType.toLowerCase())
            {
                case "password" :
                    strText += CharRepeat('*', ctrl.value.length);
                    break;
                case "text" :
                case "file" :
                case "hidden" :
                case "textarea" :
                case "button" :
                case "submit" :
                case "reset" :
                    strText += strEnd + ctrl.value;
                    break;
                case "span" :
                case "div" :
                    strText += strEnd + ctrl.innerHTML;
                    break;
                case "checkbox" :
                case "radio" :
                    if (ctrl.checked)
                        strText += strEnd + ctrl.value;
                    break;
                case "select-one" :
                    if (ctrl.selectedIndex >= 0)
                    {
                        if (strTextOrValue == "text")
                            strText += strEnd + ctrl.options[ctrl.selectedIndex].text;
                        else
                            strText += strEnd + ctrl.options[ctrl.selectedIndex].value;
                    }
                    break;
                case "select-multiple" :
                    var s;
                    for (s = 0; s < ctrl.options.length; s++)
                    {
                        if (ctrl.options[s].selected)
                        {
                            if (strTextOrValue == "text")
                                strText += " " + ctrl.options[s].text;
                            else
                                strText += " " + ctrl.options[s].value;
                        }
                    }
                    break;
            }
        }

        return strText;
    }
    catch(e)
    {
        alert(e.description);
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 获取指定名称的控件的值或显示信息,并生成对应文件输出格式的代码,一般用于"上载文件"的显示
// ctrlName：控件名称
function ShowMedia(ctrlName, strShowType)
{
    var strText = "";
    var strShowMedia = "";
    try
    {
        var cType;
        var allElements = document.getElementsByName(ctrlName);
        for(i = 0; i < allElements.length; i++)
        {
            strText = "";
            var ctrl = allElements[i];
            if (ctrl.type == undefined)
                cType = ctrl.tagName;
            else
                cType = ctrl.type;

            // 判断指定控件类型，多选控件则累加
            switch(cType.toLowerCase())
            {
                case "password" :
                    strText = CharRepeat('*', ctrl.value.length);
                    break;
                case "text" :
                case "file" :
                case "hidden" :
                case "textarea" :
                case "button" :
                case "submit" :
                case "reset" :
                    strText = ctrl.value;
                    break;
                case "span" :
                case "div" :
                    strText = ctrl.innerHTML;
                    break;
                case "checkbox" :
                case "radio" :
                    if (ctrl.checked)
                        strText = ctrl.value;
                    break;
                case "select-one" :
                    strText = ctrl.options[ctrl.selectedIndex].text;
                    break;
                case "select-multiple" :
                    var s;
                    for (s = 0; s < ctrl.options.length; s++)
                    {
                        if (ctrl.options[s].selected)
                            strText += " " + ctrl.options[s].text;
                    }
                    break;
            }

            // 判断输出文件类型
            switch(strShowType)
            {
                case "link" :
                    strShowMedia += "<a href=\"" + strText + "\" target=\"_blank\">查看 [" + strText + "]</a>";
                    break;
                case "img" :
                    strShowMedia += "<a href=\"" + strText + "\" target=\"_blank\"><img src=\"" + strText + "\" onload=\"ImgFit(this, screen.width - 200, 10000)\" onmouseover=\"ImgFit(this, screen.width - 200, 10000)\" onmousewheel=\"return ImgZoom(this);\" oncontextmenu=\"this.style.zoom='100%';return(false);\" border=\"0\" onerror=\"this.style.display='none'\"></a>";
                    break;
                case "sound" :
                    strShowMedia += "<BGSOUND SRC=\"" + strText + "\" LOOP=INFINITE><EMBED SRC=\"" + strText + "\" AUTOSTART=TRUE HIDDEN=TRUE VOLUME=100 LOOP=TRUE>";
                    break;
                case "flash" :
                    strShowMedia += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"100%\" height=\"100%\">";
                    strShowMedia += "<param name=\"movie\" value=\"" + strText + "\" />";
                    strShowMedia += "<param name=\"quality\" value=\"high\" />";
                    strShowMedia += "<embed src=\"" + strText + "\" quality=\"high\" pluginspage=\"http:\/\/www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"32\" height=\"32\"></embed>";
                    strShowMedia += "</object>";
                    break;
                case "vedio" :
                    strShowMedia += "<object classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" id=\"FireAsp_MediaPlayer<%=iShowMedia%>\" name=\"FireAsp_MediaPlayer<%=iShowMedia%>\" width=\"450\" height=\"390\" STANDBY=\"正在加载 Loading Windows Media Player components...\" TYPE=\"application/x-oleobject\">";
                    strShowMedia += "<param name=\"Filename\" value=\"" + strText + "\" valuetype=\"ref\">";
                    strShowMedia += "<!--播放文件路径-->";
                    strShowMedia += "<param name=\"AudioStream\" value=\"-1\">";
                    strShowMedia += "<param name=\"AutoSize\" value=\"-1\">";
                    strShowMedia += "<!--是否自动调整播放大小-->";
                    strShowMedia += "<param name=\"AutoStart\" value=\"0\">";
                    strShowMedia += "<!--是否自动播放-->";
                    strShowMedia += "<param name=\"AnimationAtStart\" value=\"-1\">";
                    strShowMedia += "<param name=\"AllowScan\" value=\"-1\">";
                    strShowMedia += "<param name=\"AllowChangeDisplaySize\" value=\"-1\">";
                    strShowMedia += "<param name=\"AutoRewind\" value=\"0\">";
                    strShowMedia += "<param name=\"Balance\" value=\"0\">";
                    strShowMedia += "<!--左右声道平衡,最左-9640,最右9640-->";
                    strShowMedia += "<param name=\"BaseURL\">";
                    strShowMedia += "<param name=\"BufferingTime\" value=\"15\">";
                    strShowMedia += "<!--缓冲时间-->";
                    strShowMedia += "<param name=\"CaptioningID\">";
                    strShowMedia += "<param name=\"ClickToPlay\" value=\"-1\">";
                    strShowMedia += "<param name=\"CursorType\" value=\"0\">";
                    strShowMedia += "<param name=\"CurrentPosition\" value=\"0\">";
                    strShowMedia += "<!--当前播放进度 -1 表示不变,0表示开头 单位是秒,比如10表示从第10秒处开始播放,值必须是-1.0或大于等于0-->";
                    strShowMedia += "<param name=\"CurrentMarker\" value=\"0\">";
                    strShowMedia += "<param name=\"DefaultFrame\">";
                    strShowMedia += "<param name=\"DisplayBackColor\" value=\"0\">";
                    strShowMedia += "<param name=\"DisplayForeColor\" value=\"16777215\">";
                    strShowMedia += "<param name=\"DisplayMode\" value=\"0\">";
                    strShowMedia += "<param name=\"DisplaySize\" value=\"0\">";
                    strShowMedia += "<!--视频1-50%, 0-100%, 2-200%,3-全屏 其它的值作0处理,小数则采用四舍五入然后按前的处理-->";
                    strShowMedia += "<param name=\"Enabled\" value=\"-1\">";
                    strShowMedia += "<param name=\"EnableContextMenu\" value=\"-1\">";
                    strShowMedia += "<!-是否用右键弹出菜单控制-->";
                    strShowMedia += "<param name=\"EnablePositionControls\" value=\"-1\">";
                    strShowMedia += "<param name=\"EnableFullScreenControls\" value=\"-1\">";
                    strShowMedia += "<param name=\"EnableTracker\" value=\"-1\">";
                    strShowMedia += "<!--是否允许拉动播放进度条到任意地方播放-->";
                    strShowMedia += "<param name=\"InvokeURLs\" value=\"-1\">";
                    strShowMedia += "<param name=\"Language\" value=\"-1\">";
                    strShowMedia += "<param name=\"Mute\" value=\"0\">";
                    strShowMedia += "<!--是否静音-->";
                    strShowMedia += "<param name=\"PlayCount\" value=\"10\">";
                    strShowMedia += "<!--重复播放次数,0为始终重复-->";
                    strShowMedia += "<param name=\"PreviewMode\" value=\"-1\">";
                    strShowMedia += "<param name=\"Rate\" value=\"1\">";
                    strShowMedia += "<!--播放速度1.0-2.0倍的速度播放-->";
                    strShowMedia += "<param name=\"SAMILang\">";
                    strShowMedia += "<param name=\"SAMIStyle\">";
                    strShowMedia += "<param name=\"SAMIFileName\">";
                    strShowMedia += "<!--选择同时播放(伴音)的歌曲-->";
                    strShowMedia += "<param name=\"SelectionStart\" value=\"-1\">";
                    strShowMedia += "<param name=\"SelectionEnd\" value=\"-1\">";
                    strShowMedia += "<param name=\"SendOpenStateChangeEvents\" value=\"-1\">";
                    strShowMedia += "<param name=\"SendWarningEvents\" value=\"-1\">";
                    strShowMedia += "<param name=\"SendErrorEvents\" value=\"-1\">";
                    strShowMedia += "<param name=\"SendKeyboardEvents\" value=\"0\">";
                    strShowMedia += "<param name=\"SendMouseClickEvents\" value=\"0\">";
                    strShowMedia += "<param name=\"SendMouseMoveEvents\" value=\"0\">";
                    strShowMedia += "<param name=\"SendPlayStateChangeEvents\" value=\"-1\">";
                    strShowMedia += "<param name=\"ShowCaptioning\" value=\"0\">";
                    strShowMedia += "<!--是否显示字幕,为一块黑色,下面会有一大块黑色,一般不显示-->";
                    strShowMedia += "<param name=\"ShowControls\" value=\"-1\">";
                    strShowMedia += "<!--是否显示控制,比如播放,停止,暂停-->";
                    strShowMedia += "<param name=\"ShowAudioControls\" value=\"-1\">";
                    strShowMedia += "<!--是否显示音量控制-->";
                    strShowMedia += "<param name=\"ShowDisplay\" value=\"0\">";
                    strShowMedia += "<!--显示节目信息,比如版权等-->";
                    strShowMedia += "<param name=\"ShowGotoBar\" value=\"0\">";
                    strShowMedia += "<!--一条框,在下面,有往下箭头-->";
                    strShowMedia += "<param name=\"ShowPositionControls\" value=\"-1\">";
                    strShowMedia += "<!--是否显示往前往后及列表,如果显示一般也都是灰色不可控制-->";
                    strShowMedia += "<param name=\"ShowStatusBar\" value=\"-1\">";
                    strShowMedia += "<!--当前播放信息,显示是否正在播放,及总播放时间和当前播放到的时间-->";
                    strShowMedia += "<param name=\"ShowTracker\" value=\"-1\">";
                    strShowMedia += "<!--是否显示当前播放跟踪条,即当前的播放进度条-->";
                    strShowMedia += "<param name=\"TransparentAtStart\" value=\"-1\">";
                    strShowMedia += "<param name=\"VideoBorderWidth\" value=\"0\">";
                    strShowMedia += "<!--显示部的宽部,如果小于视频宽,则最小为视频宽,或者加大到指定值,并自动加大高度.此改变只改变四周的黑框大小,不改变视频大小-->";
                    strShowMedia += "<param name=\"VideoBorderColor\" value=\"0\">";
                    strShowMedia += "<!--显示黑色框的颜色, 为RGB值,比如ffff00为黄色-->";
                    strShowMedia += "<param name=\"VideoBorder3D\" value=\"0\">";
                    strShowMedia += "<param name=\"Volume\" value=\"0\">";
                    strShowMedia += "<!--音量大小,负值表示是当前音量的减值,值自动会取绝对值,最大为0,最小为-9640,最大0-->";
                    strShowMedia += "<param name=\"WindowlessVideo\" value=\"0\">";
                    strShowMedia += "<!--如果是0可以允许全屏,否则只能在窗口中查看-->";
                    strShowMedia += "</object>";
                    break;
            }
        }

        return strShowMedia;
    }
    catch(e)
    {
        alert(e.description);
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 拆分成多个同名控件 引自软件范例
// 参数：表单对象,被拆分的控件对象
// 输入控件的文本字符数超过最大允许字符数时(表单内每个域限制不能超过100KB)，需拆分成多个同名控件
// 在ASP文件里需循环从拆分的控件对象中取值，以组合成原始内容
function BreakItUp(objForm, objCtrl)
{
    //Set the limit for field size.
    //若内容含中文字符，可以设置为:(1024*100)/2-1 纯英文设置为：102399 (1024*100)-1
    var FormLimit = (1024*100)/2-1;
    //Get the value of the large input object.
    var TempVar = new String;
    TempVar = objCtrl.value;
    //If the length of the object is greater than the limit, break it
    //into multiple objects.
    if (TempVar.length > FormLimit)
    {
        objCtrl.value = TempVar.substr(0, FormLimit) ;
        TempVar = TempVar.substr(FormLimit) ;
        while (TempVar.length > 0)
        {
            var objTEXTAREA = document.createElement("TEXTAREA");
            objTEXTAREA.name = objCtrl.name;
            objTEXTAREA.value = TempVar.substr(0, FormLimit);
            objTEXTAREA.style.display = "none";
            objForm.appendChild(objTEXTAREA);

            TempVar = TempVar.substr(FormLimit);
        }
    }
}
// ---------------------------------------------------

// ---------------------------------------------------
// 打印：设置页眉、页脚 Begin
var hkey_root, hkey_path, hkey_key
hkey_root="HKEY_CURRENT_USER";
hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";

// 打印
function PrintPage()
{
    PageSetup_Null();
    window.print();
    PageSetup_Default();
}

// 设置页眉页脚为空
function PageSetup_Null()
{
    try
    {
        var RegWsh = new ActiveXObject("WScript.Shell");
        hkey_key = "header";
        RegWsh.RegWrite(hkey_root+hkey_path+hkey_key, "");
        hkey_key = "footer";
        RegWsh.RegWrite(hkey_root+hkey_path+hkey_key, "");
    }
    catch(e){}
}

// 设置页眉页脚为默认值
function PageSetup_Default()
{
    try{
        var RegWsh = new ActiveXObject("WScript.Shell");
        hkey_key="header";
        RegWsh.RegWrite(hkey_root+hkey_path+hkey_key, "&w&b页码，&p/&P");
        hkey_key="footer";
        RegWsh.RegWrite(hkey_root+hkey_path+hkey_key, "&u&b&d");
    }
    catch(e){}
}
// 打印：设置页眉、页脚 End
// ---------------------------------------------------
-->