function getActiveWebsiteMap(_strColumnPath){
  if(_strColumnPath.indexOf("_100_")!=-1){
	return 2;
  }
  if(_strColumnPath.indexOf("_15_")!=-1){
	return 3;
  }
  if(_strColumnPath.indexOf("_6_")!=-1){
	return 4;
  }
  if(_strColumnPath.indexOf("_140_")!=-1){
	return 5;
  }
  if(_strColumnPath.indexOf("_21_")!=-1){
	return 6;
  }
  if(_strColumnPath.indexOf("_1008_")!=-1){
	return 7;
  }
  return 8;
}

function selectWebsiteMap(_intTabID){
  for(var i=1;i<=8;i++){
    if(i!=_intTabID){
      document.getElementById("tabT"+i).className="tab-title-blur";
      document.getElementById("tabC"+i).className="tab-content-blur";
    }
    else{
      if(document.getElementById("tabT"+i).className=="tab-title-focus"){
        document.getElementById("tabT"+i).className="tab-title-blur";
        document.getElementById("tabC"+i).className="tab-content-blur";
      }
      else{
        document.getElementById("tabT"+i).className="tab-title-focus";
        document.getElementById("tabC"+i).className="tab-content-focus";
      }
    }
  }
  try{
    document.getElementById("formTopSearch").target="_blank";
  }
  catch(e){
  }
}


function setTab(strTabDisplay,strTabAll,boolHidden){

}

function cancelQuestion(_intReplyCount,_strCancelOperator){
  if(_intReplyCount>0){
   if(window.confirm("已经有网友回复了这个问题，取消悬赏可能引起争议，确定取消悬赏吗？")){
     window.open(_strCancelOperator,"_self");
   }
  }
  else{
    if(window.confirm("确定取消悬赏?")){
      window.open(_strCancelOperator,"_self");
    }
  }
}

function createCircle(){
  window.open("/forum/forum/application/form.asp");
}

function createReply(_intForumID,_intTopicID){
  window.open("/forum/reply/form.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID+"&reply_id=-1");
}

function editReply(_intForumID,_intTopicID,_intReplyID){
  window.open("/forum/reply/editor/form.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID+"&reply_id="+_intReplyID);
}

function quoteReply(_intForumID,_intTopicID,_intQuoteID){
  window.open("/forum/reply/form.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID+"&quote_id="+_intQuoteID+"&reply_id=-1");
}

function selectBestReply(_intForumID,_intTopicID,_intReplyID){
  window.open("/forum/reply/best/form.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID+"&reply_id="+_intReplyID);
}


function editTopicByAuthor(_intForumID,_intTopicID){
  window.open("/forum/topic/form.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID);

}

function editTopicByEditor(_intForumID,_intTopicID){
  window.open("/forum/topic/editor/form.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID);
}

function blockAuthor(_intForumID,_intTopicID){
  window.location.href = "/forum/topic/editor/block_author.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID;
}

function transferTopic(_intForumID,_intTopicID){
  var intNewForumID = parseInt(document.getElementById("topic_new_forum_id").value,10);
  if(isNaN(intNewForumID) || intNewForumID<=0){
    window.alert("请选择要转移到哪个版面");
  }
  else{
    window.location.href = "/forum/topic/editor/transfer_topic.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID+"&topic_new_forum_id="+intNewForumID;
  }
}

function convertTopic(_intForumID,_intTopicID){
  var intNewTopicID = parseInt(document.getElementById("topic_new_id").value,10);
  if(isNaN(intNewTopicID) || intNewTopicID<=0){
    window.alert("请输入主题的ID值");
    try{
      document.getElementById("topic_new_id").focus()
    }
    catch(e){
    }
  }
  else{
    window.location.href = "/forum/topic/editor/convert_topic.asp?forum_id="+_intForumID+"&topic_id="+_intTopicID+"&topic_new_id="+intNewTopicID;
  }
}


function GetYearAndMonthArray(_objDateBegin,_objDateEnd){
  var intYearBegin    = _objDateBegin.getFullYear();
  var intMonthBegin   = _objDateBegin.getMonth()+1;
  var intYearEnd      = _objDateEnd.getFullYear();
  var intMonthEnd     = _objDateEnd.getMonth()+1;
  var arrYearAndMonth = new Array()
  var strYear = "";strMonth = "";
  for(var intYear=intYearBegin;intYear<=intYearEnd;intYear++){
    for(var intMonth=1;intMonth<=12;intMonth++){
      if(intYear==intYearBegin && intMonth<intMonthBegin){
        continue;
      }
      if(intYear==intYearEnd && intMonth>intMonthEnd){
        break;
      }
      strYear = new String(intYear).toString();
      strMonth = new String(intMonth).toString();
      if(strMonth.length==1){
        strMonth = "0"+strMonth;
      }
      arrYearAndMonth[arrYearAndMonth.length] = new Array(strYear,strMonth);
    }
  }
  return arrYearAndMonth;
}



function goDatePosition(_intPosition){
  if(_intPosition<0){
    return false;
  }
  if(_intPosition<7){
    _intPosition = 7;
  }
  else{
    if(Math.abs(_intPosition-intCurrentDatePosition)!=8){
      if(_intPosition>=7){
        _intPosition = _intPosition + 4;
      }
    }
  }

  if(_intPosition>(arrDateIndex.length-1)){
    _intPosition = (arrDateIndex.length-1);
  }
  intCurrentDatePosition = _intPosition;

  for(var d=0;d<arrDateIndex.length;d++){

    var objStyle = document.getElementById("topicIndexOf"+arrDateIndex[d][0]+arrDateIndex[d][1]).style;
	var objStyle2 = document.getElementById("topicIndex2Of"+arrDateIndex[d][0]+arrDateIndex[d][1]).style;

    if(d<=(intCurrentDatePosition-8)){
      objStyle.display="none";
      objStyle2.display="none";
    }
    else{
      if(d>intCurrentDatePosition){
        objStyle.display="none";
        objStyle2.display="none";
      }
      else{
        objStyle.display="";
        objStyle2.display="";
      }
    }
  }
}

function initDateIndex(){
  arrDateIndex = GetYearAndMonthArray(objDateCreated,new Date())
  var strDate = new String(window.location).toString();
  if(strDate.match(/\/(\d{4})\/(\d{2})\//ig)!=null){
    strCurrentYear = RegExp.$1;
    strCurrentMonth = RegExp.$2;
  }
  else{
    strCurrentYear = (new Date().getFullYear())+"";
    strCurrentMonth = (new Date().getMonth()+1)+"";
    if(strCurrentMonth.length==1){
      strCurrentMonth = "0"+strCurrentMonth;
    }
  }
  for(var d=0;d<arrDateIndex.length;d++){
    if(arrDateIndex[d][0]==strCurrentYear && arrDateIndex[d][1]==strCurrentMonth){
      intCurrentDatePosition = d;
    }
  }
  try{
    goDatePosition(intCurrentDatePosition);
  }catch(e){
  }
}

function joinForum(_intForumID){
  window.alert("Join Forum(id="+_intForumID+")")
}
function inviteFriend(_intForumID){
  window.open("/forum/member/invite/form.asp?forum_id="+_intForumID);
}


function showDivWindow(_strDivID){
  var div = document.getElementById(_strDivID);
  if(div.style.display=="none"){
    div.style.display = "";
    div.style.left = (document.body.clientWidth - div.offsetWidth)/2 + "px";
    div.style.top = (document.body.clientHeight - div.offsetHeight)/2 + "px";
  }
  else{
    div.style.display = 'none';
  }
}


