function ConstA(RepConst){var edi = new CallBackObject();edi.OnComplete = Cbo_Con;edi.DoCallBack("Const.aspx?ID=" + ID +  "&" + RepConst);}
function Cbo_Con(responseText, responseXML){
    if(responseText == "-2"){ alert('提交成功！'); $("RepTit").value = ""; $("RepCon").value = "文明上网，理性发言！";$("RepC").innerHTML = "<a href='/R/?RepID=" + ID + "&RepType=" + Type + "&DocRid=" + Rid + "'>已有<b><span>" + (Number(RepC)+1) + "</span></b>条跟帖<span>（点击查看）</span></a>"; }
    else if(responseText == "-3") alert('填写内容含有非法字符！');
    else {
        var RepCs = responseText.split("$"); RepC = RepCs[0]; if(RepCs[1]) $("UpFile").innerHTML = RepCs[1]; var iTime = "发表时间：" + RepCs[2];
        if(RepC != "0") { $("RepC").innerHTML = "<a href='/R/?RepID=" + ID + "&RepType=" + Type + "&DocRid=" + Rid + "'>已有<b><span>" + RepC + "</span></b>条跟帖<span>（点击查看）</span></a>"; iTime += " 跟帖：<a href='/R/?RepID=" + ID + "&RepType=" + Type + "&DocRid=" + Rid + "'><span style='color: #FF0000'>" + RepC + "</span></a>"; }
        $("IfrTime").innerHTML = iTime;
    }
}
function CallBackObject(){this.XmlHttp = this.GetHttpObject();} 
CallBackObject.prototype.GetHttpObject = function(){ 
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
    try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}catch (E){xmlhttp = false;}}
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){try{xmlhttp = new XMLHttpRequest();}catch (e){xmlhttp = false;}}
    return xmlhttp;
} 
CallBackObject.prototype.DoCallBack = function(URL){ 
    if( this.XmlHttp ){
        if( this.XmlHttp.readyState == 4 || this.XmlHttp.readyState == 0 ){
            var oThis = this;
            this.XmlHttp.open('POST', '/Data/Ajax' + URL);
            this.XmlHttp.onreadystatechange = function(){ oThis.ReadyStateChange(); };
            this.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            this.XmlHttp.send(null);
        }
    }
}
CallBackObject.prototype.AbortCallBack = function(){if( this.XmlHttp ) this.XmlHttp.abort();} 
CallBackObject.prototype.OnLoading = function(){} 
CallBackObject.prototype.OnLoaded = function(){} 
CallBackObject.prototype.OnInteractive = function(){} 
CallBackObject.prototype.OnComplete = function(responseText, responseXml){} 
CallBackObject.prototype.OnAbort = function(){} 
CallBackObject.prototype.OnError = function(status, statusText){} 
CallBackObject.prototype.ReadyStateChange = function(){
    if( this.XmlHttp.readyState == 1 ) this.OnLoading();
    else if( this.XmlHttp.readyState == 2 ) this.OnLoaded();
    else if( this.XmlHttp.readyState == 3 ) this.OnInteractive();
    else if( this.XmlHttp.readyState == 4 ){
        if( this.XmlHttp.status == 0 ) this.OnAbort();
        else if( this.XmlHttp.status == 200 && this.XmlHttp.statusText == "OK" ) this.OnComplete(this.XmlHttp.responseText, this.XmlHttp.responseXML);
        else this.OnError(this.XmlHttp.status, this.XmlHttp.statusText, this.XmlHttp.responseText);
    }
}
function QueryString (val)
{ 
  var uri = window.location.search; 
  var re = new RegExp("" +val+ "=([^&?]*)", "ig"); 
  return ((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):null); 
} 
//var ID = Request['ID'], Rid = Request['Rid'], Type = Request['Type']
var ID = QueryString('ID') , Rid = QueryString('Rid'),Type =  QueryString('Type'), RepC, tf;
if(Rid==undefined || ID==undefined || Type==undefined) tf = false;
else{ tf = (ID.match(/\D/)==null); if(tf) tf = (Rid.length>13); }
if(tf){
    if(Type=="doc" || Type=="xls") { $("myframe").src = "/HTML/" + Rid + ".htm"; $('tMenu').innerHTML = '<a href="/Document/' + Rid + '.' + Type + '">[下载文章]</a> '; $('bMenu').innerHTML = '<a href="/Document/' + Rid + '.' + Type + '">[下载文章]</a>'; }
    else $("myframe").src = Rid;
    if(Type!="doc" && Type!="htm") { $("Pages").style.width = "94%"; $("Reps").style.width = "94%"; }
}else{alert("参数错误！"); top.location.href = "/";}
window.onload = function(){
    var dh = $("myframe");
    if(Type != "quo"){
        if (window.opera) dh.height = dh.document.body.scrollHeight+20;
        else if(dh.Document){if(dh.Document.body.scrollHeight) dh.height = dh.Document.body.scrollHeight+20;}   
        else dh.height = dh.contentDocument.height+20;
    }else dh.height = 500;
    ConstA('Field=Ifr&Rid=' + Rid);
}
function subRep(){
    var Const = $("RepCon").value.replace(/</g,"《"); Const=Const.replace(/>/g,"》"); Const=Const.replace(/\r\n/g,"<br/>");Const = Const.replace(/\0x13/g,"<br/>");
    if(Const=="文明上网，理性发言！" || Const.length<2){ alert("评论内容不得少于3字！"); $("RepCon").focus(); return false; }else ConstA("Field=Const&C=0&C2=0&Const=" + Const + "&Title=回复：" + ID);
}
function Copy(){
    if (window.clipboardData) {window.clipboardData.setData("Text","http://www.hljga.gov.cn/D/?ID=" + ID + "&Type=" + Type + "&Rid=" + Rid); alert("已将该网址复制到剪贴板！");}
    else alert("抱歉，您的浏览器不支持复制功能！");
}
function Fav(){ window.external.AddFavorite('http://www.hljga.gov.cn/D/?ID=' + ID + '&Type=' + Type + '&Rid=' + Rid, '龙警网.公文浏览.' + ID); }
function $(_sId){return document.getElementById(_sId);}
var docEle = function(){ return $(arguments[0]) || false; }
function openMask(){
    document.documentElement.style.overflowX = "hidden";document.body.style.overflowX = "hidden";document.documentElement.style.overflowY = "hidden";document.body.style.overflowY = "hidden";
    var newMask = document.createElement("div");newMask.id = "mask";newMask.style.left = 0;newMask.style.top = document.documentElement.scrollTop;newMask.style.width = screen.availWidth;newMask.style.height = screen.availHeight;document.body.appendChild(newMask);
}
function closeMask(){
    document.body.removeChild(docEle("newDiv")); document.body.removeChild(docEle("mask")); document.documentElement.style.overflowX = "hidden"; document.body.style.overflowX = "hidden"; document.documentElement.style.overflowY = "auto"; document.body.style.overflowY = "auto";
}
function Down(Durl,Dimg){
    if(Durl.indexOf(".flv")<0) window.open('/DownUser/' + Durl);
    else {
        if(Dimg=='') Dimg = "F/preview.jpg";
        openMask(); var arr = new Array(); arr.push('<div class="close"><img alt="关闭窗口" src="/images/close.gif" width="14" onclick="closeMask()" style="cursor: pointer;" /></div><div id="other"></div>'); var newdiv = document.createElement("div"); newdiv.id = "newDiv"; newdiv.style.width = "602px"; newdiv.style.left = document.body.offsetWidth/2-300  + "px"; newdiv.style.top = document.documentElement.scrollTop+130 + "px"; newdiv.innerHTML = arr.join(""); document.body.appendChild(newdiv);
	    var FO = {movie:"/F/flvplayer.swf",width:"600",height:"340",majorversion:"7",build:"0",bgcolor:"#FFFFFF",allowfullscreen:"true",flashvars:"file=/DownUser/" + Durl + "&image=/" + Dimg };
	    UFO.create(FO, "other");
    }
}
