function iframeAutoFit() {
    try {
        if (window != parent) {
            var a = parent.document.getElementsByTagName("IFRAME");
            for (var i = 0; i < a.length; i++) {
                if (a[i].contentWindow == window) {
                    var h1 = 0, h2 = 0, d = document, dd = d.documentElement;
                    a[i].parentNode.style.height = a[i].offsetHeight + "px";
                    a[i].style.height = "10px";
                    if (dd && dd.scrollHeight) {
                        h1 = dd.scrollHeight;
                    }
                    if (d.body) {
                        //h2 = d.body.scrollHeight+110;
                        h2 = d.body.scrollHeight;
                    }
                    var h = Math.max(h1, h2);
                    if (document.all) {
                        //h += 4;
                        h += 0;
                    }
                    if (window.opera) {
                        //h += 1;
                        h += 0;
                    }
                    h += 20;
                    a[i].style.height = a[i].parentNode.style.height = h + "px";
                }
            }
        }
    } catch (ex) { }
}

//$(function () {    
//    //文本框内提示信息
//    if (!$.browser.msie || ($.browser.msie && $.browser.version != "6.0" && $.browser.version != "7.0")) {
//        $(window).resize(function () {
//            $("input[title]").each(function (i, n) {
//                var jqueryn = $(n);
//                if (jqueryn.attr("title") != null && $.trim(jqueryn.attr("title")) != "") {
//                    $("span:contains('" + $.trim(jqueryn.attr("title")) + "')").remove();
//                    if (jqueryn.val() != "") {
//                        var span = $("<span style=\"color:#C2C2C2;display:none;font-size:12px;padding:1px 1px 1px 1px;position:absolute;left:" + (jqueryn.offset().left + 8) + "px;top:" + (jqueryn.offset().top + (jqueryn.outerHeight() - 12) / 2) + "px;\">" + jqueryn.attr("title") + "</span>").click(function () {
//                            jqueryn.focus();
//                        }).appendTo("body");
//                    }
//                    else {
//                        var span = $("<span style=\"color:#C2C2C2;position:absolute;font-size:12px;padding:1px 1px 1px 1px;left:" + (jqueryn.offset().left + 8) + "px;top:" + (jqueryn.offset().top + (jqueryn.outerHeight() - 12) / 2) + "px;\">" + jqueryn.attr("title") + "</span>").click(function () {
//                            jqueryn.focus();
//                        }).appendTo("body");
//                    }
//                    jqueryn.keydown(function () {
//                        if ($.trim($(this).val()) == "")
//                            span.show();
//                        else
//                            span.hide();
//                    });
//                }
//            });
//        });
//    }
//    setTimeout(function () {
//        $("input[title]").each(function (i, n) {
//            var jqueryn = $(n);
//            if (jqueryn.attr("title") != null && $.trim(jqueryn.attr("title")) != "") {
//                if (jqueryn.val() != "") {
//                    var span = $("<span style=\"color:#C2C2C2;display:none;font-size:12px;padding:1px 1px 1px 1px;position:absolute;left:" + (jqueryn.offset().left + 8) + "px;top:" + (jqueryn.offset().top + (jqueryn.outerHeight() - 12) / 2) + "px;\">" + jqueryn.attr("title") + "</span>").click(function () {
//                        jqueryn.focus();
//                    }).appendTo("body");
//                }
//                else {
//                    var span = $("<span style=\"color:#C2C2C2;position:absolute;font-size:12px;padding:1px 1px 1px 1px;left:" + (jqueryn.offset().left + 8) + "px;top:" + (jqueryn.offset().top + (jqueryn.outerHeight() - 12) / 2) + "px;\">" + jqueryn.attr("title") + "</span>").click(function () {
//                        jqueryn.focus();
//                    }).appendTo("body");
//                }
//                jqueryn.keyup(function () {
//                    if ($.trim($(this).val()) == "")
//                        span.show();
//                    else
//                        span.hide();
//                });
//            }
//        });
//    }, 1000);
//});




/*********分页对象********/
//Pager.Display("页码","每页数据条数","总数据条数","url");

var Pager = new Object();
//
Pager.GoToPage = function (url, page) {
    var reg = /^\d{1,}$/;
    if (!reg.test(page)) {
        document.getElementById('pageinput').focus();
        alert('页码请输入数字！');
        return;
    }

    if (url.indexOf("?") == -1) {
        window.location = url + "?page=" + page;
    } else {
        window.location = url + "&page=" + page;
    }
}
//分页
Pager.Display = function (currentpage, pagesize, totalnum, url) {
    currentpage = parseInt(currentpage);
    pagesize = parseInt(pagesize);
    totalnum = parseInt(totalnum);

    var maxpage = 1;
    if (totalnum == 0) {
        maxpage = 1;
    } else {
        maxpage = parseInt((totalnum - 1) / pagesize + 1);
    }

    if (currentpage > maxpage) {
        currentpage = maxpage;
    }

    var nextpage = 0;
    var prepage = 0;
    if (currentpage < maxpage) {
        nextpage = currentpage + 1;
    }
    else {
        nextpage = currentpage;
    }
    if (currentpage > 1) {
        prepage = currentpage - 1;
    }
    else {
        prepage = 1;
    }

    var html = "";
    html += "<table style='font-weight:bold;font-size:12px;'>";
    html += "<tr>";
    html += "<td>共<font color='red'>" + maxpage + "</font>页</td>";
    html += "<td>共<font color='red'>" + totalnum + "</font>条记录</td>";
    html += "<td><font color='red'>" + currentpage + "</font>/" + maxpage + "</td>";
    html += "<td>[<a href=\"javascript:Pager.GoToPage('" + url + "',1);\">首页</a>]</td>";
    html += "<td>[<a href=\"javascript:Pager.GoToPage('" + url + "'," + prepage + ")\" >上一页</a>]</td>";
    html += "<td>[<a href=\"javascript:Pager.GoToPage('" + url + "'," + nextpage + ")\" >下一页</a>]</td>";
    html += "<td>[<a href=\"javascript:Pager.GoToPage('" + url + "'," + maxpage + ")\" >尾页</a>]</td>";
    html += "<td>转到第<input id='pageinput' name='pageinput' type='text' style='width:20px;' size='5' onkeyup=\"value=value.replace(/[^\\d]/g,'')\" onbeforepaste=\"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\\d]/g,''))\" onkeypress='pageinputenterpress(event)' />页</td>";
    //一个表单下，如果只有一个文本框时，按下回车将会触发表单的提交事件。
    //既然是只有一个文本框才会出问题，那么可以加一个隐藏的文本框
    html += "<input id='hiddenText' type='text' style='display:none' />";
    html += "<td><a id='gotobtn' name='gotobtn' href=\"javascript:Pager.GoToPage('" + url + "',document.getElementById('pageinput').value);\">跳转</a></td>";
    html += "</tr>";
    html += "</table>";
    //alert(html);
    document.write(html);
}
function pageinputenterpress(e) {
    var key = window.event ? e.keyCode : e.which;
    //alert(key);
    if (key == 13) {
        document.getElementById("gotobtn").click();
        return false;
    }
}

/*********分页对象(Post)********/
//Pager.Display("页码","每页数据条数","总数据条数","form名称");

var PagerPost = new Object();
//
PagerPost.GoToPage = function (form, page) {
    var reg = /^\d{1,}$/;
    if (!reg.test(page)) {
        document.getElementById('pageinput').focus();
        alert('页码请输入数字！');
        return;
    }
    document.getElementById("page").value = page;
    document.getElementById(form).submit();
}
//分页
PagerPost.Display = function (currentpage, pagesize, totalnum, form) {
    currentpage = parseInt(currentpage);
    pagesize = parseInt(pagesize);
    totalnum = parseInt(totalnum);

    var maxpage = 1;
    if (totalnum == 0) {
        maxpage = 1;
    } else {
        maxpage = parseInt((totalnum - 1) / pagesize + 1);
    }

    if (currentpage > maxpage) {
        currentpage = maxpage;
    }

    var nextpage = 0;
    var prepage = 0;
    if (currentpage < maxpage) {
        nextpage = currentpage + 1;
    }
    else {
        nextpage = currentpage;
    }
    if (currentpage > 1) {
        prepage = currentpage - 1;
    }
    else {
        prepage = 1;
    }

    var html = "";
    html += "<table style='font-weight:bold;font-size:12px;'>";
    html += "<tr>";
    html += "<td>共<font color='red'>" + maxpage + "</font>页</td>";
    html += "<td>共<font color='red'>" + totalnum + "</font>条记录</td>";
    html += "<td><font color='red'>" + currentpage + "</font>/" + maxpage + "</td>";
    html += "<td>[<a href=\"javascript:PagerPost.GoToPage('" + form + "',1);\">首页</a>]</td>";
    html += "<td>[<a href=\"javascript:PagerPost.GoToPage('" + form + "'," + prepage + ")\" >上一页</a>]</td>";
    html += "<td>[<a href=\"javascript:PagerPost.GoToPage('" + form + "'," + nextpage + ")\" >下一页</a>]</td>";
    html += "<td>[<a href=\"javascript:PagerPost.GoToPage('" + form + "'," + maxpage + ")\" >尾页</a>]</td>";
    html += "<td>转到第<input id='pageinput' name='pageinput' type='text' style='width:20px;' size='5' onkeyup=\"value=value.replace(/[^\\d]/g,'')\" onbeforepaste=\"clipboardData.setData('text',clipboardData.getData('text').replace(/[^\\d]/g,''))\" onkeypress='pageinputenterpress(event)' />页</td>";
    //一个表单下，如果只有一个文本框时，按下回车将会触发表单的提交事件。
    //既然是只有一个文本框才会出问题，那么可以加一个隐藏的文本框
    html += "<input id='hiddenText' type='text' style='display:none' />";
    html += "<input type='hidden' name='page' id='page' value='" + currentpage + "'/>";
    html += "<td><a id='gotobtn' name='gotobtn' href=\"javascript:PagerPost.GoToPage('" + form + "',document.getElementById('pageinput').value);\">跳转</a></td>";
    html += "</tr>";
    html += "</table>";
    //alert(html);
    document.write(html);
}


//获取不重复参数
function getRandom() {
    var time = new Date();
    var returnvalue = time.getYear() + "" + time.getMonth() + "" + time.getDate() + "" + time.getHours() + "" + time.getMinutes() + "" + time.getSeconds() + "" + time.getMilliseconds();
    return returnvalue;
}
