﻿// JScript 文件

function OpenMsg(str){
window.scrollTo(0,0);
   var msgw,msgh,bordercolor;
   msgw=280;//提示窗口的宽度
   msgh=135;//提示窗口的高度
   titleheight=25 //提示窗口标题高度
   bordercolor="#ff6600";//提示窗口的边框颜色
   titlecolor="#99CCFF";//提示窗口的标题颜色
  
   var sWidth,sHeight;
   sWidth=document.body.offsetWidth;
   sHeight=window.screen.availHeight;
   
   var MsgPositionX,MsgPositionY;
   MsgPositionX=sWidth/2-msgw/2;
   MsgPositionY=sHeight/2-msgh/2-120;
   var msgObj=document.createElement("div");
   msgObj.setAttribute("id","msgDiv");
   msgObj.style.border="1px solid " + bordercolor;
   msgObj.style.background="#ffffff";
   msgObj.style.position = "absolute";
   msgObj.style.left = MsgPositionX;
   msgObj.style.top = MsgPositionY;
   msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
   msgObj.style.width = msgw + "px";
   msgObj.style.height =msgh + "px";
   msgObj.style.textAlign = "center";
   msgObj.style.lineHeight ="22px";
   msgObj.style.zIndex = "10001";
     myTable = document.createElement("TABLE")
         myTable.id ="TableOne"
         myTable.border = 0
         myTable.setAttribute("align","center");
         myTable.setAttribute("cellpadding","10px");
         myTable.setAttribute("cellspacing","10px");
         myTable.style.width="280px";
         myTable.style.height="130px";
         myTable.style.background="url(../images/praise.gif)";
         myTable.style.backgroundRepeat="no-repeat";
         myTableBody = document.createElement("TBODY");
                   row = document.createElement("TR")
                   cell = document.createElement("TD")
	                           cell.innerHTML="<font style='font-size:12px'>"+str+"</font>";
	                           cell.style.margin="20px";
	                           cell.style.padding="10px 10px 20px 70px";
	                           cell.style.width="200px";
	                           cell.style.color="#000000";
	                           cell.style.fontsize="12px";
	                           cell.style.lineheight="20px";
                               cell.width="100%";
	                           cell.align="left";
                                       row.appendChild(cell);
                                      myTableBody.appendChild(row);
                                       myTable.appendChild(myTableBody);
     document.body.appendChild(msgObj);
	 document.getElementById("msgDiv").appendChild(myTable);
	 setTimeout(function(){document.body.removeChild(msgObj);},3000); 
	 return false;
}
function ToTop1(recommendcount){
var OpenStr;
if(recommendcount==0){
Openstr="如果您觉得这篇文章不错，努力成为编辑来为他加垫吧！";
}
else{
Openstr="您顶的文章，有" + recommendcount + "个编辑加垫过，你有做编辑的潜力哦！";
}
OpenMsg(Openstr);
}

function ToTop3(){
var OpenStr;
Openstr="您顶的文章是篇金垫文章，你眼光确实不错！";
OpenMsg(Openstr);
}
function ToTop4(){
var OpenStr;
Openstr="您喜欢这篇文章？去给他加垫吧！";
OpenMsg(Openstr);
}
function ToTop5(recommendcount){
var OpenStr;
Openstr="您顶的文章，有" + recommendcount + "个编辑加垫过，您继续努力就可以给他加垫了哦！";
OpenMsg(Openstr);
}
function ToTop6(){
var OpenStr;
Openstr="继续加油哦！";
OpenMsg(Openstr);
}

function OprUserToTop(recommendcount,UserID,Classid,ArticleID){
try {
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
    try{
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e2){
       xmlHttp=false;
    }
}
//判断XMLHTTP是否创建成功
if(!xmlHttp && typeof XMLHTTPRequest !='undefined'){
       xmlHttp=new XMLHTTPRequest();
}
   url="../ArticleComm/ToTopArticle.aspx?classid="+Classid+"&username="+UserID+"&id="+ArticleID+"&seed="+rand(9999999);
   xmlHttp.open("GET",url,true);
   xmlHttp.onreadystatechange=callBack_GetEditorResult2;
   xmlHttp.send(null);
}
function callBack_GetEditorResult2(){
   if (xmlHttp.readyState == 4){
   var isValid=xmlHttp.responseText;
   var str=isValid.toLowerCase();
   p1=str.indexOf("<body>");
   p2=str.indexOf("</body>");
   str2=str.substring(p1+6,p2);
   p3=str2.indexOf("<span id='result'>");
   p4=str2.indexOf("</span>");
   isValid=str2.substring(p3+25,p4);
   if(isValid=="0")
   {
     ToTop1(0);
   }
   else
   {
   OpenStr="继续加油哦！";
   OpenMsg(OpenStr);
   }
  
}
}