// 2009-03-26
var showText = "正在加载...";
function showLoad(){
    $(window).scroll(function () {
        $('#loading').animate({
            top:document.documentElement.scrollTop+10,
            right:17
        },1);
    });
    $('<div id="loading"></div>').appendTo('body');
}
function showLoading(msg){
    $('#loading').animate({
        top:document.documentElement.scrollTop+10,
        right:17
    },1);
    $('#loading').text(msg);
    $('#loading').show();
}
function hideLoading(){
    $('#loading').hide();
}
function getPageContent(address){
    $.ajax({
        url: address,
        dataType:"javascript",
        // ifModified:true,   使用这个属性firefox会有问题，无法成功响应
        beforeSubmit:  showLoading(showText),   // 提交之前执行的方法
        success: function(msg){
            $("#" + ShowDiv).html(msg);
            hideLoading();
        }
    });
}
function getOrderPageContent(address){
    $.ajax({
        url: address,
        dataType:"javascript",
        async:"false",
        beforeSubmit:  showLoading(showText),
        success: function(msg){
            $("#ajaxorderlist").html(msg);
            hideLoading();
        }
    });
}
function postcounter(){
    $.ajax({
        url: root_path+"/counter.php",
        data: "ref="+encodeURIComponent(document.referrer)+"&url="+encodeURIComponent(window.location)+"&w="+window.screen.width+"&h="+window.screen.height,
        type:'post',
        dataType:"html"
    });
}
function getmsg2(path,pcode){
    $.ajax({
        url: path+'info.php',
        type: 'get',
        dataType: 'html',
        data: 'act=get_msg&rootpath='+path+'&pcode='+pcode+'&ajax=1&tm='+ Math.ceil(Math.random()*10000),
        success: function(html){
            $('#AjGuestBook').html(html);
        }
    });
}
function getstar(score){
    var strstar="";
    if(score > 4)
        strstar = "<img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/>";
    else if(score > 3)
        strstar = "<img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/>";
    else if(score > 2)
        strstar = "<img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/>";
    else if(score > 1)
        strstar = "<img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/>";
    else if(score > 0)
        strstar = "<img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar2.gif width='12' height='11'/>";
    else
        strstar = "<img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/><img src=http://images.doc88.com/skin/basic/images/prostar1.gif width='12' height='11'/>";
    return strstar;
}
var loadingCss = {
    padding:0,
    margin:0,
    width:'240px',
    height:'80px',
    left:'40%',
    top:'40%',
    textAlign:'center',
    color:'#ffffff',
    border:'0px solid #ffb64b',
    backgroundColor:'#555555',
    cursor:'default'
};
var loadingReadyCss = {
    padding:0,
    margin:0,
    width:'60px',
    height:'60px',
    left:'38%',
    top:'360px',
    textAlign:'center',
    color:'#ffffff',
    border:'0px solid #404040',
    backgroundColor:'#f2f2f2',//'#808080',//#d4d0c8',"#555555"
    cursor:'default'
};
var blockCss = {
    padding:0,
    margin:0,
    width:'600px',
    height:'300px',
    top:'20%',
    textAlign:'center',
    color:'#b43200',
    border:'0px solid #ffb64b',
    backgroundColor:'#FFFFFF',
    cursor:'default'
};
function search_submit(){
    var frm_search = document.forms['frm_search'];
    keyword = document.getElementById("keyword").value
    var regEx = /[\^\{\}\?\*\\]/g;
    keywordnew = keyword.replace(regEx, "");
    regEx = /[\[\]\(\)\/]/g;
    keywordnew = keywordnew.replace(regEx, " ");
    if(keyword != keywordnew){
        regEx = /\s+/g;
        if(keywordnew.replace(regEx, "")==""){
            keyword = "";
        }else{
            keyword = keywordnew;
        }
        document.getElementById("keyword").value = keyword;
    }
    frm_search.action = root_path+'tag/'+encodeURIComponent(keyword);
    if(keyword == ""){
        document.getElementById("keyword").focus();
        return false;
    }
    frm_search.submit();
    return false;
}
$(document).ready(function() {
    if ( $.browser.safari){
        $("#mydoc88").css("margin-top","28px");
    }
    $.get(root_path+'index.php',{
        act:'getviewmenu',
        parent_url:location.href
    },function(data){
        if(data == "reload_autologin"){
            location = location;
            return;
        }else{
            $("#mydoc88").html(data);
        }
    });
    if(timeLimit=="" || timeLimit=="0"){
        curDecrypt = "";
    }else{
        curDecrypt = "&p2=decrypt";
    }
    var fo = new SWFObject(siteurl_images+"/skin/basic/flash/viewer.swf", "docflash", "720", "540", "9.0.16.0", "#FFFFFF");
    fo.addVariable("p1",product_code);
    if(curDecrypt != ""){
        fo.addVariable("p2","decrypt");
    }
    /*fo.addParam("align","middle");
    fo.addParam("quality","high");
    fo.addParam("wmode","opaque");
    fo.addParam("allowScriptAccess","always");
    fo.addParam("allowFullScreen","false");
    fo.useExpressInstall(siteurl_images+'/skin/basic/flash/expressinstall.swf');*/

    fo.addParam("play","true");
    fo.addParam("loop","true");
    fo.addParam("scale","showall");
    fo.addParam("wmode","opaque");
    fo.addParam("devicefont","false");
    fo.addParam("menu","true");
    fo.addParam("allowfullscreen","true");
    fo.addParam("allowscriptaccess","always");
    fo.addParam("salign","");
    fo.addParam("align","middle");

    fo.write("divFlash");                               
                
    var blockinfo_reload="<div id='blkinfopoints' >\
            <b>您可以通过以下方法, 获得积分：</b><br>\
            &nbsp;1，完善个人信息，通过邮件认证，获得积分，点击'我的文档-><a style='color:#1E35A5;' target='_blank' href='"+site_url+"/help/index.html#help1_20'>发送认证邮件</a>'；<br>\
            &nbsp;2，上传文档，获取积分，详情参见<a style='color:#1E35A5;' target='_blank' href='"+site_url+"/help/index.html#scoremang'>'会员积分管理办法'</a>；<br>\
            &nbsp;3，通过网上银行或支付宝在线充值，兑换积分，点击'我的文档->充值'，<a style='color:#1E35A5;' target='_blank' href='"+site_url+"/help/index.html#help2_26'>详情>></a>。\
        </div>\
        <div id='blklogininfo' class='blkinfoframe' >\
            <div class='blkclosebtn'><img id='blkloginclose1' src='"+siteurl_images+"/skin/basic/images/blockclose.gif'></div>\
            <div class='blkinfotitle' ><b style='font-size:16px'>"+product_shortname+"</b></div>\
            <div id='blklogininfodoc' class='blkinfodoc' ></div>\
            <div id='blklogininfopoints' class='blkinfopoints' ></div>\
            <div class='blkinforemind' >您还没有登录,只有登录用户才能下载本网站的文档,请点击登录或注册</div>\
            <div class='blkinfobtn' >\
                <input type='button' class='blkbtn' id='blkbtnlogin' value='登录' />\
                <input type='button' class='blkbtn' id='blkbtnreg' value='注册' />\
                <input type='button' class='blkbtn' id='blkbtncancel1' value='返回' />\
            </div>\
        </div>\
        <div id='blkorderinfo' class='blkinfoframe' >\
            <div class='blkclosebtn'><img id='blkloginclose2' src='"+siteurl_images+"/skin/basic/images/blockclose.gif'></div>\
            <div class='blkinfotitle' ><b style='font-size:16px'>"+product_shortname+"</b></div>\
            <div id='blkorderinfodoc' class='blkinfodoc' ></div>\
            <div id='blkorderinfopoints' class='blkinfopoints' ></div>\
            <div class='blkinforemind' >您的积分已不多(当前积分为<span id='blkorderbalance'>0</span>)，可以正常<span id='blkorderbuydlstr'>下载</span>，请点击继续按钮。</div>\
            <div class='blkinfobtn' >\
                <input type='button' class='blkbtn' id='blkbtnorder' value='继续' />\
                <input type='button' class='blkbtn' id='blkbtncancel2' value='返回' />\
            </div>\
        </div>\
        <div id='blkdepositinfo' class='blkinfoframe' >\
            <div class='blkclosebtn'><img id='blkloginclose3' src='"+siteurl_images+"/skin/basic/images/blockclose.gif'></div>\
            <div class='blkinfotitle' ><b style='font-size:16px'>"+product_shortname+"</b></div>\
            <div id='blkdepositinfodoc' class='blkinfodoc' ></div>\
            <div id='blkdepositinfopoints' class='blkinfopoints' ></div>\
            <div class='blkinforemind' >您的积分已不足(当前积分为<span id='blkdepositbalance'>0</span>)，请及时充值。</div>\
            <div class='blkinfobtn' >\
                <input type = 'button' class='blkbtn' id = 'blkbtnupload' value = '上传文档' />\
                <input type = 'button' class='blkbtn' id = 'blkbtndeposit' value = '充值' />\
                <input type = 'button' class='blkbtn' id = 'blkbtncancel3' value = '返回' />\
            </div>\
        </div>";
    document.getElementById("blkinfo").innerHTML = blockinfo_reload;
    document.getElementById("blkinfo").style.display = 'none';

    var buyordloperator = "再次点击'下载'按钮，请勿使用下载工具";
    if(priceFree!=1){
        buyordloperator = "清晰阅读全文或下载文档"
    }
    var howinfo_reload="<div class='lis_ju01' id='howclearid' >\
            <img src='"+siteurl_images+"/skin/basic/images/20050423123030135s.gif' width='14' height='11' />\
            <a href='"+site_url+"/help/index.html#faq' target='_blank' title='此文档需要积分交换后，才可以清晰显示，请点击`下载`按钮'>为什么看不清楚？</a>\
        </div>\
        <div class='lis_ju01' id='howviewall' >\
            <img src='"+siteurl_images+"/skin/basic/images/20050423123030135s.gif' width='14' height='11' />\
            <a href='"+site_url+"/help/index.html#faq' target='_blank' title='此文档需要积分交换后，才可以浏览全部内容，请点击`下载`按钮'>为什么只能看到部分内容？</a>\
        </div>\
        <div class='lis_ju01' id='howbuy' style='display:none'>\
            <img src='"+siteurl_images+"/skin/basic/images/20050423123030135s.gif' width='14' height='11' />\
            <a href='javascript:;' onclick='onclick_howbuy();return false;' target='_blank' title='注册>登录>兑换积分>下载'>如何下载?</a>\
        </div>\
        <div class='lis_ju01' id='howdownload' style='display:none'>\
            <img src='"+siteurl_images+"/skin/basic/images/20050423123030135s.gif' width='14' height='11' />\
            <a href='"+site_url+"/help/index.html#help2_21' target='_blank' title='点击`下载`按钮，如果不能弹出文件保存对话框，请使用ie浏览器或检查相应的设置'>为什么下载不成功？</a>\
        </div>";
    document.getElementById("howinfo").innerHTML = howinfo_reload;

    var blockinfobuy_reload="<div id='blkinfopoints_buy' style='display:none' >\
        <b>下载步骤：</b><br>\
        &nbsp;1，注册成为网站会员并登录；<br>\
        &nbsp;2，查看帐户积分(点击'我的文档')，如果积分不足，请参考<a style='color:#1E35A5;' target='_blank' href='"+site_url+"/help/index.html#help2_25'>'如何获得积分'</a>；<br>\
        &nbsp;3，点击本页面的'下载'按钮；<br>\
        &nbsp;4，在'下载文档'页面，点击'确认'；<br>\
        &nbsp;5，操作成功后，"+buyordloperator+"。<br>\
    </div>\
    <div id='blklogininfo_buy' class='blkinfoframe' >\
        <div class='blkclosebtn'><img id='blkloginclose_buy' src='"+siteurl_images+"/skin/basic/images/blockclose.gif'></div>\
        <div class='blkinfotitle'><b style='font-size:16px'>"+product_shortname+"</b></div>\
        <div id='blklogininfodoc_buy' class='blkinfodoc' ></div>\
        <div id='blklogininfopoints_buy' class='blkinfopoints' ></div>\
        <div class='blkinfobtn' >\
            <input type='button' class='blkbtn' id='blkbtncancel_buy' value='返回' />\
        </div>\
    </div>";
    document.getElementById("blkinfobuy").innerHTML = blockinfobuy_reload;
    document.getElementById("blkinfobuy").style.display = 'none';

    if(timeLimit!="" || product_pagecount<=1){
        $("#howclearid")[0].style.display = 'none';
        $("#howviewall")[0].style.display = 'none';
    }else{
        if(statePagekey == 1){
            $("#howclearid")[0].style.display = 'none';
        }else{
            $("#howviewall")[0].style.display = 'none';
        }
    }
    if(isNaN(downloadPrice)){
        $("#downloadpriceid").html("下载积分："+downloadPrice);
    }else{
        $("#downloadpriceid").html("下载积分："+(downloadPrice*1000/10));
    }

    $stateTimeLimit = 0;// 文档阅读期限, 0-没有权限, "notimelimit"-永久租阅, "times"-限次租阅, 其他-租阅到期时间
    if(curDownloadTimes<=0){
        if(priceFree ==1 ){
            if(freeDLoadable == 2){
                $("#howbuy")[0].style.display = 'block';
            }
        }else{
            if(timeLimit==""){
                $("#howbuy")[0].style.display = 'block';
            }
        }
    }

    if(doccheckstate==1 && logined==1 && ownPublish!=1 && curDownloadTimes>=1 ){
        if(priceFree==0 || freeDLoadable==2){
            $("#howdownload")[0].style.display = 'block';
        }
    }

    if(doccheckstate==1){
        if(priceFree==0 || freeDLoadable==2){
            //ShowOrderDiv = "ajaxorderlist";
            getOrderPageContent(root_path+"info.php?act=ajax_list_order&rootpath="+root_path+"&pcode="+product_code+"&tm="+ Math.ceil(Math.random()*10000));
        }
        getmsg2(root_path, product_code);
    }
    setTimeout("postcounter()", 500);
    if(ajaxrelated==1){
        setTimeout("getrelateddoc()", 200);
    }
    $('#zoomin').click(function(event){
        if($(".frm-right").css("display") == "block"){
            $(".frm-right").hide("slow");
            $(".frm-left").css("width","960px");
            $("#divFlash").css("width","960px");
            $("#docflash").css("width","960px");
            $('#zoomin').html("<img src='"+siteurl_images+"/skin/basic/images/suoxiao02.jpg' border='0' />");
            $('#center-frame01title').css("width", "960px");
        }else{
            $("#docflash").css("width","720px");
            $("#divFlash").css("width","720px");
            $(".frm-left").css("width","720px");
            $(".frm-right").show("normal");
            $('#zoomin').html("<img src='"+siteurl_images+"/skin/basic/images/zhankai02.jpg' border='0' />");
            $('#center-frame01title').css("width", "720px");
        }
    });
    $('#blkbtnlogin').click(function() {
        $.unblockUI();
        location.href = root_path+'member.php?act=login&forward='+encodeURIComponent(window.location.href);
    });
    $('#blkbtnreg').click(function() {
        $.unblockUI();
        location.href = root_path+'member.php?act=regist&forward='+encodeURIComponent(window.location.href);
    });
    $('#blkbtnorder').click(function() {
        $.unblockUI();
        $("#form_productbuy").submit();
    });
    $('#blkbtnupload').click(function() {
        $.unblockUI();
        window.open(root_path+'user/upload.php?act=sell');
    });
    $('#blkbtndeposit').click(function() {
        $.unblockUI();
        window.open(root_path+'user/usr_account.php?act=deposit');
    });
    $('#blkloginclose1').click($.unblockUI);
    $('#blkloginclose2').click($.unblockUI);
    $('#blkloginclose3').click($.unblockUI);
    $('#blkbtncancel1').click($.unblockUI);
    $('#blkbtncancel2').click($.unblockUI);
    $('#blkbtncancel3').click($.unblockUI);
    $('#blkloginclose_buy').click($.unblockUI);
    $('#blkbtncancel_buy').click($.unblockUI);
});
function getrelateddoc(){

    docid = $('#txtPcode').val();
    doctitle = $('#txtPname').val();
    docmember = $('#txtPsellername').val();
    dotindex = doctitle.lastIndexOf(".");
    if(dotindex>0){
        doctitle = doctitle.substring(1, dotindex);
    }
    $.ajax({
        url: root_path+'doc.php',
        type: 'get',
        dataType: 'html',
        data: 'act=ajaxrelated&rootpath='+root_path+'&pid='+docid+'&searchWord='+encodeURIComponent(doctitle),
        success: function(data){
            $("#relateddoc").html(data);
        }
    });
}
function onclick_howbuy(){
    $('#blklogininfodoc_buy').html(docpricetype);
    $('#blklogininfopoints_buy').html($('#blkinfopoints_buy').html());
    if(document.body.clientWidth-600>0){
        jQuery.blockUI.defaults.css.left = (document.body.clientWidth-600)/2;
    }
    $.blockUI({
        message:  $('#blkinfobuy'),
        css: blockCss,
        focusInput: false,
        overlayCSS: {
            cursor:'default'
        }
    });
    $('.blockOverlay').click($.unblockUI);
}
function checkbuyproduct(){
    if(doccheckstate != 1){
        alert("此文档未通过审核, 不能下载!");
        return false;
    }
    $.blockUI({
        message: "<img style='margin-left:40px;margin-top:24px;float:left;' src='"+siteurl_images+"/skin/basic/images/block_waitview.gif'/><span style='margin-top:24px;font-size:25px;float:left;'>&nbsp;Loading...</span>",
        css: loadingCss
    });
    $.ajax({
        url: root_path+"member.php",
        type: 'get',
        dataType: 'json',
        data: 'act=ajax_getuserinfo',
        async: false,
        success: function(data){
            if ('1' != data.result){//未登录
                if(priceFree==1 && freeDLoadable==0){
                    $.unblockUI();
                    alert("此文档, 上传者未提供下载允许");
                    return false;
                }
                $('#blklogininfodoc').html(docpricetype);
                $('#blklogininfopoints').html($('#blkinfopoints').html());
                if(document.body.clientWidth-600>0){
                    jQuery.blockUI.defaults.css.left = (document.body.clientWidth-600)/2;
                }
                $.blockUI({
                    message:  $('#blklogininfo'),
                    css: blockCss,
                    focusInput: false,
                    overlayCSS: {
                        cursor:'default'
                    }
                });
                $('.blockOverlay').click($.unblockUI);
                return false;
            }else{
                if(data.member_id!=0){
                    balance = data.money;
                    deposit = 0;
                    if(balance-docprice<0){
                        deposit = 1;
                    }else if(balance-5<0){
                        deposit = 2;
                    }

                }
                if(ownPublish == 1){
                    if(priceFree == 1){
                        if(freeDLoadable==0){
                            $.unblockUI();
                            alert("此文档, 未提供下载");
                            return false;
                        }
                    }else{
                        $.unblockUI();
                        alert("无需积分交换");
                        return false;
                    }
                }else{
                    if(priceFree == 1){
                        if(freeDLoadable==0){
                            $.unblockUI();
                            alert("此文档, 不支持下载");
                            return false;
                        }
                    }else{
                        if(timeLimit=="notimelimit" && downloadable!=1){
                            $.unblockUI();
                            alert("此文档, 不支持下载");
                            return false;
                        }
                    }
                }
                $("#txtPdocurl").val(location.href);
                if(stateOrderChecking == 1){
                    $.unblockUI();
                    alert("您对此文档的积分交换, 正处于待审核状态, 请等待系统处理后, 再操作.");
                    return false;
                }
                if(deposit == 1){
                    $('#blkdepositinfodoc').html(docpricetype);
                    $('#blkdepositbalance').html(balance*1000/10);
                    $('#blkdepositinfopoints').html($('#blkinfopoints').html());
                    if(document.body.clientWidth-600>0){
                        jQuery.blockUI.defaults.css.left = (document.body.clientWidth-600)/2;
                    }
                    jQuery.blockUI({
                        message:  $('#blkdepositinfo'),
                        css: blockCss,
                        focusInput:false,
                        overlayCSS: {
                            cursor:'default'
                        }
                    });
                    $('.blockOverlay').click($.unblockUI);
                }else if(deposit == 2){
                    $('#blkorderinfodoc').html(docpricetype);
                    $('#blkorderbuydlstr').html(buydlstr);
                    $('#blkorderbalance').html(balance*1000/10);
                    $('#blkorderinfopoints').html($('#blkinfopoints').html());
                    if(document.body.clientWidth-600>0){
                        jQuery.blockUI.defaults.css.left = (document.body.clientWidth-600)/2;
                    }
                    jQuery.blockUI({
                        message:  $('#blkorderinfo'),
                        css: blockCss,
                        focusInput:false,
                        overlayCSS: {
                            cursor:'default'
                        }
                    });
                    $('.blockOverlay').click($.unblockUI);
                }else{
                    $("#form_productbuy").submit();
                }
                return false;
            }
        }
    });
    return false;
}
function checkdownloadproduct(){
    if(doccheckstate != 1){
        alert("此文档未通过审核, 不能下载!");
        return false;
    }    
    $.ajax({
        url: root_path+"member.php",
        type: 'get',
        dataType: 'html',
        data: 'act=ajax_checkdownload',
        async: false,
        success: function(data){
            if(data=="" || data=="nologin") {//未登录
                $('#blklogininfodoc').html(docpricetype);
                $('#blklogininfopoints').html($('#blkinfopoints').html());
                if(document.body.clientWidth-600>0){
                    jQuery.blockUI.defaults.css.left = (document.body.clientWidth-600)/2;
                }
                jQuery.blockUI({
                    message:  $('#blklogininfo'),
                    css: blockCss,
                    focusInput:false,
                    overlayCSS: {
                        cursor:'default'
                    }
                });
                $('.blockOverlay').click($.unblockUI);
                return false;
            }else{
                if(ownPublish == 1){
                    location.href = root_path+'/doc.php?act=download&pcode='+product_code+'&dlrand='+data;
                    return false;

                }else if(priceFree==1 && freeDLoadable==0){
                    alert("此文档, 不提供下载");
                    return false;
                }
                if(priceFree==1 && freeDLoadable==1){
                    location.href = root_path+'/doc.php?act=download&pcode='+product_code+'&dlrand='+data;
                    return false;
                }
                if(curDownloadTimes-1<0){
                    alert("您对此文档的下载已经失效。");
                    location = location;
                    return false;
                }
                var dlinfo = "您将下载此文档(请勿使用下载工具), 是否继续?\n您也可以到“我的文档->已下载文档”页面点击下载，\n如果没有提示保存文件, 请使用ie浏览器或联系网站QQ客服。";
                if(window.confirm(dlinfo)==false){
                    return false;
                }
                location.href = root_path+'/doc.php?act=download&pcode='+product_code+'&dlrand='+data+'&dlcode='+dlcode;
                curDownloadTimes--;
                return false;
            }
        }
    });
    return false;
}
function checkcollectproduct(){
    if(doccheckstate != 1){
        alert("此文档未通过审核, 不能被收藏!");
        return false;
    }
    if(logined != 1){
        return true;
    }
    if(ownPublish == 1){
        alert("不能收藏自己的文档");
        return false;
    }
    input = prompt("请输入收藏信息", "我的收藏");
    if(input==null || input==""){
        return false;
    }
    $.get(root_path+"user/usr_favorite.php",{
        act: "save",
        memberid:member_id,
        collection:product_id,
        type:"product",
        txtIntro:input
    },function(data){
        if ('-1'==data) {
            alert("您必须先登录");
        }else if ('0'==data) {
            alert("不能收藏自己的文档");
        }else if ('2'==data) {
            $('#collectbtn').attr("value", "已收藏");
            document.getElementById("collectbtn").onclick = function(){
                return false;
            };
            alert("已经收藏过了");
        }else if ('1'==data){
            $('#collectbtn').attr("value", "已收藏");
            document.getElementById("collectbtn").onclick = function(){
                return false;
            };
            alert("收藏成功");
        }else {
            alert(data);
        }
    });
    return false;
}
function deleteMsg(mid, pcode){
    if(confirm("您确认删除留言吗?")==false)
        return;
    var address = root_path + "docmessage.php?act=del&messageid="+mid;
    $.ajax({
        url: address,
        dataType:  'json',
        success: function(msg){
            alert(msg.message);
            getmsg2(root_path, pcode)
        }
    });
}
function replyMsg(mid, pcode){
    ShowDiv = "AjGuestBook";
    getPageContent(root_path+"docmessage.php?act=re&rootpath="+root_path+"&messageid="+mid);
}