

setRowColor=function(color1,color2)
{
	
	
	var objs=document.getElementsByName("bbsRowDiv");
	for (var i=0;i<objs.length;i++){
		objs[i].onmouseover=function(){
		    //alert(color1);
			this.style.backgroundColor=color2;
		}
		
		objs[i].onmouseout=function(){
			this.style.backgroundColor=color1;
		}
		
	}
	
	objs=document.getElementsByName("bbsMenuDiv");
	for (var i=0;i<objs.length;i++){
		objs[i].onclick=function(){
			var id=this.bbsid;
			var obj=$("bbsid"+id);
			if (obj.style.display==""){
				obj.style.display="none";
				this.innerHTML="<img src='img/collapsed_yes.gif'>";
			}else{
				obj.style.display="";	
				this.innerHTML="<img src='img/collapsed_no.gif'>";
			}
		}
	}
	
	
	
}

 function addVot(){    //加网站论坛调查选项
       var tempObj=$c("div");
       var obj=$("votDiv");
       var newObj=obj.appendChild(tempObj);
       newObj.style.cssText="width:100%;";
       obj=newObj;
       obj.id="bbsVotOption"+bbsVoti;
       
       tempObj=$c("div");
       newObj=obj.appendChild(tempObj);
       newObj.style.cssText="float: left;width:35px;padding-top:3px;";
       newObj.innerText="选项";
       
       tempObj=$c("div");
       newObj=obj.appendChild(tempObj);
       newObj.style.cssText="float: left;width:165px";
       newObj.innerText="";
       
       tempObj=$c("input");
       tempObj.type="text";
       var textObj=newObj.appendChild(tempObj);
       textObj.style.cssText="width:120px;height:20px;"
       textObj.id="bbsVotText";
       textObj.name="bbsVotText";
       
       tempObj=$c("input");
       tempObj.type="button";
       tempObj.value="删除"
       var buttonObj=newObj.appendChild(tempObj);
       buttonObj.style.cssText="width:40px;height:20px;"
       buttonObj.i=bbsVoti;
       buttonObj.onclick=function(){
            var divObj=$("bbsVotOption"+this.i);
            divObj.removeNode(true);
       }
       
       
       bbsVoti++;
       
}

function readBbsVot()
{
	var outData=new Array();
	outData[0]="";
	outData[1]="";
	 var objs=document.getElementsByName("bbsVotText");
	 if (objs.length<1){
		return outData;  
	 }
	 var outStr="";
	 var intStr="";
	 var str="";
	 for (var i=0;i<objs.length;i++)
	 {
		 if (objs[i].value!=""){
			 str=objs[i].value;
			 str=str.replace(",","，");
			 outStr=outStr+str+",";
			 intStr=intStr+"0,";
		 }
	 }
	 if (outStr!=""){
		outStr=outStr.substring(0,outStr.length-1);
		intStr=intStr.substring(0,intStr.length-1);
	 }
	 
	 outData[0]=outStr;
	 outData[1]=intStr;
	 return outData;
}
   
function bbsPostSubmit(){ //提交网站论坛的发贴
   var objs=document.getElementsByName("pType");
  var votOutStr="";
  var votIntStr="";
  var postType="0";
   for (var i=0;i<objs.length;i++)
   {
         switch  (i)
		 {
			 case 1:
			 	if (objs[i].checked){
					var votData=readBbsVot();
					votOutStr=votData[0];
					votIntStr=votData[1];
					postType="1";
					if (votOutStr==""){
						alert("请正确设置调查");
						return;	
					}
				}
				 break;
			   case 2:
			       if (objs[i].checked){
			            postType="2";
			   		    if ($("bbsOutInt").value==""){
						    alert("请设置悬赏出分的值");
						    return;	
					    }
					}
			   break;
			   case 3:
			        if (objs[i].checked){
			            postType="3";
			   		    if ($("bbsInInt").value==""){
						    alert("请设置看你贴需要多少积分");
						    return;	
					    }
					 }
			   break;
		 }
   }
  
   
    var content=editTxt.GetContent();
    if (content.length<5){
        alert("请你填写贴子内容");
        return;
    }
   
   var v=new validate();
   v.form=$("form1");
   if (!v.start()){
	   return;
   }
   var prefixText=$("prefixSelect").value;
   var bbsTitle=$("pTitle").value;
   bbsTitle=bbsTitle.replace(" ","");
   if (bbsTitle.length<5){
         alert("贴子标题不能少于5个字");
         return;
   }
   var outInt=$("bbsOutInt").value;
   var inInt=$("bbsInInt").value;
   var votName=votOutStr;
   var votValue=votIntStr;
   var title="论坛投票:"+bbsTitle;
 
   var isV="0";
   if ($("R5").checked){
   		var vType="1";
   }else{
   		var vType="2";
   }
   
  // alert(prefixText);
   
	var menuid=readPar(location.href,"menuid");
   
    var objAjax=new JAjax();
   	var objResponse=new JHttpResponse();
	objResponse.write("postType",postType); //贴子类型   0 普通   1 调查   2 悬赏  3 卖分
	objResponse.write("bbsTitle",bbsTitle);  //帖子的标题
	objResponse.write("content",content);    //贴子内容
	objResponse.write("outInt",outInt);       //要送出的分
	objResponse.write("inInt",inInt);         //要收的分
	objResponse.write("votName",votName);      //调查的内容
	objResponse.write("votValue",votValue);    //调查的选项的值,
	objResponse.write("title",title);           //调查的标题 自动生成
	objResponse.write("vType",vType);           //调查的类型, 单选还是复选 单选为1 复选为2
	objResponse.write("prefix",prefixText);     //前缀
	objResponse.write("menuid",menuid);     //前缀
	
	
	var out=objAjax.getText("post","AddPost.aspx?type=addPost",objResponse,null);
	switch (out)
	{
	    case "1":
	        alert("发贴成功");
	        location.href="bbsList.aspx?menuid="+menuid+"&p=1";
	        break;
	    case "-1":
	        alert("发贴失败,你没有权限在此版发贴");
	        break;
	     default:
	        alert("错误:\n"+erStr(out));
	}
    
}  



function setBbsPageColor(color,bColor,bgColor)
{

    var objs=document.getElementsByName("bbsPageDiv");
    var colorBak,bColorBak,bgColorBak;
    
    
    for (var i=0;i<objs.length;i++){
        objs[i].onmouseover=function(){
            colorBak=this.style.color;
            bColorBak=this.style.border;
            bgColorBak=this.style.backgroundColor;
            
            this.style.color=color;
            this.style.backgroundColor=bgColor;
            this.style.border=" 1px solid "+bColor;
        }
        
        objs[i].onmouseout=function(){
             this.style.color=colorBak;
            this.style.backgroundColor=bgColorBak;
            this.style.border=bColorBak;
        }
    }
 
 
}

   