var RootDir='';
function checklogin()
{
    if(document.getElementById("TxtLogEmail").value==""||document.getElementById("TxtLogPassword").value=="")
    {
        alert('请填写帐号及密码！');return false;
    }
    else
    {
        return true;
    }
}
function ShowDlg(width,height,title,content,onok)
{
    var ExsitDivObj=document.getElementById("div_AlertBox");
    if(ExsitDivObj!=null)ExsitDivObj.parentNode.removeChild(ExsitDivObj);
    var pos = getPosition(document.body);
	objDiv = document.createElement("div");
	objDiv.id="div_AlertBox";
	objDiv.className="f_box";
	objDiv.style.width = width +"px";
    objDiv.style.position = "absolute";
    objDiv.style.left = (((window.screen.width/2)-(width/2))-15) + "px";
	objDiv.style.top = ((((window.screen.height/2)-(height))+document.documentElement.scrollTop)+20) + "px";
	var s ="<div class=\"f_box1\"><div class=\"boxtitle chengse\"><div class=\"nl bold\">"+ title +"</div><div class=\"nr\"><a href=\"javascript:void(0);\" onclick=\"closediv($('div_AlertBox'));\">关闭</a></div></div>";
    s +="<div class=\"spline\">";
    s +="</div><div class=\"padding10\"><div class=\"content\">"+ content +"</div>"; 
    s +="<div class=\"spline\"></div>"; 
    s +="<div class=\"line1 s95\"></div></div>"; 
 	s +="<div class=\"bback cright\"><input onclick=\""+ onok +"\" class=\"f-button\" type=\"button\" value=\" 确定 \"/>  &nbsp;   <input type=\"button\" class=\"f-reset\" onclick=\"HideAlertBox()\" value=\" 取消 \"/></div></div>";
	objDiv.innerHTML = s;
    document.body.appendChild(objDiv);
}

//通用弹出DIV窗口
function ShowMsgBox(divID,swidth,sheight,surl,sparam)
{
    var ExsitDivObj=document.getElementById(divID);
    if(ExsitDivObj!=null)ExsitDivObj.parentNode.removeChild(ExsitDivObj);
    var objDiv = document.createElement("div");
    objDiv.className="f_box";//For IE
    objDiv.style.position = "absolute";
    objDiv.id=divID; 
    objDiv.innerHTML = "loading...";
	var width=swidth;
	var height=sheight;
	objDiv.style.width = width +"px";
    objDiv.style.position = "absolute";
	objDiv.style.left = (((window.screen.width/2)-(width/2))-15) + "px";
	objDiv.style.top = ((((window.screen.height/2)-(height))+document.documentElement.scrollTop)+20) + "px";
    objDiv.style.display = "";
    document.body.appendChild(objDiv);  
	 var  options={  
					   method:'get',  
					   parameters:sparam,
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    objDiv.innerHTML = "Error!";
                             }
							else
							{
								    objDiv.innerHTML = returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/'+surl+'.aspx?no-cache='+Math.random(),options);    
	
}



function SendPoke(uid,uname,upic,liid)
{
    var swidth="520";
    var sheight="300"; 
    var ExsitDivObj=document.getElementById("poke_floatDiv");
    if(ExsitDivObj!=null)ExsitDivObj.parentNode.removeChild(ExsitDivObj);
    var objDiv = document.createElement("div");
    objDiv.className="f_box";//For IE
    objDiv.style.position = "absolute";
    objDiv.id="poke_floatDiv"; 
    objDiv.innerHTML = "loading...";
	var width=swidth;
	var height=sheight;
	objDiv.style.width = width +"px";
    objDiv.style.position = "absolute";
 
	objDiv.style.left = (((window.screen.width/2)-(width/2))-15) + "px";
	objDiv.style.top = ((((window.screen.height/2)-(height))+document.documentElement.scrollTop)+20) + "px";
    objDiv.style.display = "";
    document.body.appendChild(objDiv);  
	 var  options={  
					   method:'get',  
					   parameters:"uid="+uid+"&uname="+escape(uname)+"&upic="+escape(upic)+"&liid="+liid,
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    objDiv.innerHTML = "Error!";
                             }
							else
							{
								    objDiv.innerHTML = returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/poke/send.aspx?no-cache='+Math.random(),options);    
}


  function getValue(Name)
    {
        var rd= document.getElementsByName(Name);
        var len=rd.length
        for (var i=0; i<len; i++)
        {
            if (rd[i].checked)
            {
                return rd[i].value;
                break;
            }
        }
   }
   
   function deletePoke(liid,did)
   {
    	var  options={  
				   method:'get',  
				   parameters:"&action=update&liid="+liid,
				   onComplete:function(transport)
					{  
						var returnvalue=transport.responseText;
						if (returnvalue.indexOf("??")>-1)
						{
                                alert("忽略失败");return false;
                         }
						else
						{
						    if(returnvalue=="succ")
						    {   
					            document.getElementById("Poke_li_"+did+"").style.display="none";
							 }
							 else
							 {
                                alert("忽略失败");return false;
							 }
						}
					}  
			   }; 
	    new  Ajax.Request(RootDir+'/inc/ajax/poke/send.aspx?no-cache='+Math.random(),options);    
   }
   
   function sendfloatpoke1(liid)
   {
        document.getElementById("p_sendbutton").disabled=true;
        document.getElementById("p_gift_slod").style.display="";
        if(document.getElementById("p_Hid_UserID")!=null)
        {
            var hidid=document.getElementById("p_Hid_UserID").value;
        }
        var ptype=getValue("pok_action");   
        var pokefrom =document.getElementById("p_pokefrom").value;
        var poketo =document.getElementById("p_poketo").value;
        var isPub="1";
        if(document.getElementById("pok_isPub").checked)
        {
            isPub="0";
        }
    	var  options={  
				   method:'get',  
				   parameters:"&a=save&rID="+hidid+"&ptype="+ptype+"&pokefrom="+escape(pokefrom)+"&poketo="+escape(poketo)+"&liid="+liid+"&isPub="+isPub,
				   onComplete:function(transport)
					{  
						var returnvalue=transport.responseText;
						if (returnvalue.indexOf("??")>-1)
						{
                                document.getElementById("p_gift_slod").innerHTML = "Error!";
                                document.getElementById("p_sendbutton").disabled=false;
                         }
						else
						{
						    if(returnvalue=="succ")
						    {   
						        if(liid!="")
						        { 
						            document.getElementById("Poke_li_"+liid+"").style.display="none";
						        }
							    closediv($('poke_floatDiv'));
							 }
							 else
							 {
							    document.getElementById("p_gift_slod").innerHTML=returnvalue;
                                document.getElementById("p_sendbutton").disabled=false;
							 }
						}
					}  
			   }; 
	    new  Ajax.Request(RootDir+'/home/poke/index.aspx?no-cache='+Math.random(),options);    
   } 

function sendfloatpoke()
{
    
}

//加为好友
function addleftFriend()
{
    var st=document.getElementById("addstaus");
    var uid =document.getElementById("uNumber").value;
    st.className='showSumbitflow'; 
    st.style.cssText="margin-top:5px;"
    st.innerHTML="等待...";
    if(uid.indexOf("ID、邮箱、空间网址")>-1||uid.length<1)
    {
    st.innerHTML="请填写您要加的好友";
    return; 
    }  
	 var  options={  
					   method:'get',  
					   parameters:"uid="+escape(uid),
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    st.innerHTML = "Error!";
                             }
							else
							{
								    st.innerHTML = returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/friend/addfriend.aspx?no-cache='+Math.random(),options);    
}




function managebillclass()
{
    ShowMsgBox('public_widonwbill','400','230','bill/class','');
}
function managebillfamily()
{
    ShowMsgBox('public_widonwbillfamily','400','230','bill/family','');
}

function addbillclass()
{
    var cname=document.getElementById("float_className");
       if(cname.value=="")
       {
        alert("填写分类名称");return;
       } 
	 var  options={  
					   method:'get',  
					   parameters:"a=add&cna="+escape(cname.value),
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    alert("错误");return;
                             }
							else
							{
							    if(returnvalue=="succ")
							    {
							        window.c_frame_bill.location.href=RootDir+"/inc/ajax/bill/classlist.aspx";
							        //loadclassStat();
							    }
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/bill/class.aspx?no-cache='+Math.random(),options);    
}

function editbillclass()
{
    var cname=document.getElementById("float_bill_classID_new");
    var classID=document.getElementById("float_bill_classID");
       if(cname.value=="")
       {
            alert("填写分类名称");return;
       } 
	 var  options={  
					   method:'get',  
					   parameters:"a=edit&classid="+classID.value+"&cna="+escape(cname.value),
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    alert("错误");return;
                             }
							else
							{
							    if(returnvalue=="succ")
							    {
							        alert("修改成功！");
							        window.c_frame_bill.location.href=RootDir+"/inc/ajax/bill/classlist.aspx";
							        loadclassStat();
							    }
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/bill/class.aspx?no-cache='+Math.random(),options);    
}

function addbillfamily()
{
    var cname=document.getElementById("float_familyName");
       if(cname.value=="")
       {
        alert("填写分类名称");return;
       } 
	 var  options={  
					   method:'get',  
					   parameters:"a=add&cna="+escape(cname.value),
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    alert("错误");return;
                             }
							else
							{
							    if(returnvalue=="succ")
							    {
							        window.c_iframe_bill_family.location.href=RootDir+"/inc/ajax/bill/familylist.aspx";
							    }
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/bill/family.aspx?no-cache='+Math.random(),options);    
}

function editbillfamily()
{
    var cname=document.getElementById("float_bill_familyID_new");
    var classID=document.getElementById("float_bill_familyID");
       if(cname.value=="")
       {
            alert("填写分类名称");return;
       } 
	 var  options={  
					   method:'get',  
					   parameters:"a=edit&fid="+classID.value+"&cna="+escape(cname.value),
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    alert("错误");return;
                             }
							else
							{
							    if(returnvalue=="succ")
							    {
							        alert("修改成功！");
							        window.c_iframe_bill_family.location.href=RootDir+"/inc/ajax/bill/familylist.aspx";
							        loadclassStat();
							    }
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/bill/family.aspx?no-cache='+Math.random(),options);    
}

//发送电子邮件
function mailto(uid,c)
{
    var param='c='+escape(c)+'&uid='+uid;
    ShowMsgBox('public_mail','508','300','mail/mailto',param);
}
//保存电子邮件
function SaveMail()
{
    var recID = document.getElementById("uID");
    var title = document.getElementById("m_title"); 
    var content = document.getElementById("m_content"); 
	 var  options={  
					   method:'get',  
					   parameters:"a=save&recID="+recID.value+"&title="+escape(title.value)+"&content="+escape(content.value)+"",
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
                                    alert("错误");return false;
                             }
							else
							{
							    if(returnvalue=="succ")
							    {
							        closediv($('public_mail'));
							    }
							    else
							    {
							        alert(returnvalue);return false;
							    }
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/mail/mailto.aspx?no-cache='+Math.random(),options);    
}
//高级搜索
function showSearch()
{
    ShowMsgBox('public_search','508','300','other/search_frame','');
}

//创建分享
function postShare(uid,url,desc,title)
{
    var param="u="+uid+"&url="+escape(url)+"&desc="+escape(desc)+"&title="+escape(title)+"";
    ShowMsgBox('public_share','508','300','share/shareweb',param);
}

//创建心情日记
function postMood(uid)
{
    var param=escape("u="+uid+"");
    ShowMsgBox('public_mood','508','300','mood/moodnew',param);
}

function saveshare()
{
   var sharetitles=document.getElementById("sharetitles").value;
   var shareurl=document.getElementById("shareurls").value;
   var content=document.getElementById("shareTXTContent").value;
   if(sharetitles.length<2)
   {
        alert("正确填写标题。");return false;
   }
   if(shareurl.length<10)
   {
        alert("正确填写地址。");return false;
   }
   
   if(content.length<2||content.length>200)
   {
        alert("描述至少2个字符，小于200个字符。");return false;
   } 
   else
   {
	     var  options={  
					       method:'get',  
					       parameters:"r=save&sharetitle="+escape(sharetitles)+"&urls="+escape(shareurl)+"&content="+escape(content),
					       onComplete:function(transport)
						    {  
							    var returnvalue=transport.responseText;
							    if (returnvalue=="success")
							    {
							        alert("分享发布成功。\n您的好友已经可以看见您的想分享了。");
								    closediv($('public_share'));
                                 }
							    else
							    {
								    alert("分享发生错误！");
							    }
						    }  
				       }; 
	     new  Ajax.Request(RootDir+'/inc/ajax/share/shareweb.aspx?no-cache='+Math.random(),options);    
    }}

//保存心情日记
function saveMini()
{
   var content=document.getElementById("MoodTXTContent").value;
   if(content.length<2||content.length>250)
   {
        alert("内容至少2个字符，小于250个字符。");return false;
   } 
   else
   {
	     var  options={  
					       method:'get',  
					       parameters:"r=save&content="+escape(content),
					       onComplete:function(transport)
						    {  
							    var returnvalue=transport.responseText;
							    if (returnvalue=="success")
							    {
							        alert("心情日记发布成功。\n您的好友已经可以看见您的想法和心情了。");
								    closediv($('public_mood'));
                                 }
							    else
							    {
								    alert("发表心情日志发生错误！");
							    }
						    }  
				       }; 
	     new  Ajax.Request(RootDir+'/inc/ajax/mood/moodnew.aspx?no-cache='+Math.random(),options);    
    }
}

function insertFace(id,target)
{
    var text = '[em:'+id+':]';
    var obj = $(target);
    selection = document.selection;
    checkFocus(target);
    if(!isUndefined(obj.selectionStart)) 
    {
        var opn = obj.selectionStart + 0;
        obj.value = obj.value.substr(0, obj.selectionStart) + text + obj.value.substr(obj.selectionEnd);
    } 
    else if(selection && selection.createRange)
    {
   
        var sel = selection.createRange();
        sel.text = text;
        sel.moveStart('character', -text.length);		      
    }
    else
    {
        obj.value += text;
    }	
    closediv($('facebg_idwindow'));
} 
   
 function checkFocus(target)
 {
	var obj = $(target);
	if(!obj.hasfocus) {
		obj.focus();
	}
}
function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
}

//去除字符串的前后空白
String.prototype.trim = function(){
      return this.replace(/(^\s*)|(\s*$)/g,"");
}
//判断字符串是否全为数字
String.prototype.IsNum = function(){
    var reg = /^\d+$/g;
    return reg.test(this);
}
//判断字符串是否为有效email地址
String.prototype.IsEmail = function(){
    var reg = /^([a-zA-Z0-9_-]|\.)+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
    return reg.test(this);

}
//判断是否数组
function isArray(obj)
{   
  if(obj.constructor == window.Array)   
    return true;
  else   
    return false;
}

function selectAll(f,mode)
{
	if(mode==true)
	{
	    for(i=0;i<f.length;i++)
	    {
		    if(f.elements[i].type=="checkbox")
		    {
			    f.elements[i].checked=true;
		    }
	    }
	}
	else
	{
	    for(i=0;i<f.length;i++)
	    {
		    if(f.elements[i].type=="checkbox")
		    {
			    f.elements[i].checked=false;
		    }
	    }
	}
}


//request pos
position = function(x,y)
{
    this.x = x;
    this.y = y;
}
getPosition = function(oElement)
{
    var objParent = oElement
    var oPosition = new position(0,0);
    try 
    {
        while (objParent.tagName != "BODY")
        {
            oPosition.x += objParent.offsetLeft;
            oPosition.y += objParent.offsetTop;
            objParent = objParent.offsetParent;
        }
    }
    catch(e){}
    return oPosition;
} 
//包含新的js
function includeJS(js)
{
	var j=document.createElement("script");
	j.src=js;
	var head=document.getElementsByTagName("head")[0];
	head.appendChild(j);
}

function ShowMsg()
{
    var event=getEvent();
    var obj=event.srcElement||event.target;
	var tempmsg = "";
	var deltype=obj.getAttribute("deltype");
	switch (deltype)
	{
		case "InLett":
		    tempmsg = "<ul><li>你确认删除此私信吗?</li><li>注意：这样会把所有回复都删除。</li></ul>";
		    Confirm(obj,tempmsg,"删除",function(){StartDel(deltype,obj.getAttribute("delid"))});
			break;
		case "OutLett":
		    tempmsg = "<ul><li>你确认删除此私信吗?</li><li>注意：这样会把所有回复都删除。</li></ul>";
		    Confirm(obj,tempmsg,"删除",function(){StartDel(deltype,obj.getAttribute("delid"))});
			break;
		case "UnTopTopic":
		    tempmsg = "<ul><li>确定取消该主题置顶吗？</li></ul>";
		    Confirm(obj,tempmsg,"取消置顶",function(){GroupStartOp(deltype,obj.getAttribute("tempid"),obj.getAttribute("userid"))});
			break;
		case "TopTopic":
		    tempmsg = "<ul><li>确定将该主题置顶吗？</li></ul>";
		    Confirm(obj,tempmsg,"置顶",function(){GroupStartOp(deltype,obj.getAttribute("tempid"),obj.getAttribute("userid"))});
			break;
		case "DelTopTopic":
		    tempmsg = "<ul><li>确定删除该主题吗？</li></ul>";
		    Confirm(obj,tempmsg,"删除",function(){GroupStartOp(deltype,obj.getAttribute("tempid"),obj.getAttribute("userid"))});
			break;
		case "DelReplys":
		    tempmsg = "<ul><li>确定删除该回复吗？</li></ul>";
		    Confirm(obj,tempmsg,"删除",function(){GroupStartOp(deltype,obj.getAttribute("tempid"),obj.getAttribute("userid"))});
			break;
		case "AcceptGroup":
		    groupRequest(obj);
			break;		
		case "IgnoreGroup":
		    groupRequest(obj);
			break;		
	}
}

function groupRequest(obj)
{
    var liobj = document.getElementById(obj.liid);
    var cntobj= document.getElementById("Lit_Cnt");
    var cntobj1= document.getElementById("Lit_Cnt1");
    var cnt = cntobj.innerHTML;
	var  options={  
					   method:'get',  
					   parameters:"Type=" + obj.deltype + "&groupid=" + obj.groupid,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    alert('操作失败,请重新再试');
							else
							{
                                liobj.innerHTML=returnvalue;
                                var tempcnt = parseInt(cnt)-1;
                                cntobj.innerHTML = tempcnt;
                                cntobj1.innerHTML = tempcnt;
                            }
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/DelGroupMemAjax.aspx?no-cache='+Math.random(),options);
}

function CarStartOp(type,clubid,userid)
{
    var obj = document.getElementById("li"+userid);
    var obj1 = document.getElementById("li_"+userid);
	var  options={  
					   method:'get',  
					   parameters:"Type=" + type + "&clubid=" + clubid +"&userid="+userid,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    alert('操作失败,请重新再试');
							}
							else
							{
                                switch (type)
	                            {
		                            case "DelCarMem":
		                                document.getElementById('showfolk_t').removeChild(obj);
                                        break;
		                            case "DelCarAdmin":
		                                obj1.innerHTML=returnvalue;
                                        break;
		                            case "SetCarAdmin":
		                                obj1.innerHTML=returnvalue;
                                        break;
		                            case "AdoptMem":
		                                document.getElementById('showfolk_t').removeChild(obj);
                                        break;
	                            }
	                            closeConfirm();
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/CarOpAjax.aspx?no-cache='+Math.random(),options);
}



function GroupStartOp(type,groupid,userid)
{
	var  options={  
					   method:'get',  
					   parameters:"Type=" + type + "&groupid=" + groupid +"&userid="+userid,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    alert('删除失败,请重新再试');
							}
							else
							{
                                switch (type)
	                            {
		                            case "SetGroupAdmin":
                                        getGroupMemberList(document.getElementById('showfolk_t'),document.form1.viewtype.value,document.form1.Hid_GroupID.value);
                                        break;
		                            case "DelGroupAdmin":
                                        getGroupMemberList(document.getElementById('showfolk_t'),document.form1.viewtype.value,document.form1.Hid_GroupID.value);
                                        break;
		                            case "DelGroupMem":
                                        getGroupMemberList(document.getElementById('showfolk_t'),document.form1.viewtype.value,document.form1.Hid_GroupID.value);
                                        break;
                                    case "QuitGroup":
		                                self.location="/home/Group/Group.aspx?GroupID="+groupid;
                                        break;    
		                            case "TopTopic":
		                                 document.getElementById("H_TopicName").innerHTML=returnvalue;
		                                 document.getElementById("Div_OpTopic").innerHTML="<li><a href=\"javascript:void(0)\" onclick=\"javascript:Confirm(this,'<ul><li>确定取消该主题置顶吗？</li></ul>','取消置顶',function(){GroupStartOp('UnTopTopic',"+groupid+","+userid+")})\">取消置顶</a></li>";
                                        break;
		                            case "UnTopTopic":
		                                document.getElementById("H_TopicName").innerHTML=returnvalue;
		                           		document.getElementById("Div_OpTopic").innerHTML="<li><a href=\"javascript:void(0)\" onclick=\"javascript:Confirm(this,'<ul><li>确定将该主题置顶吗？</li></ul>','置顶',function(){GroupStartOp('TopTopic',"+groupid+","+userid+")})\">置顶主题</a><a href=\"javascript:void(0)\" onclick=\"javascript:Confirm(this,'<ul><li>确定删除该主题吗？</li></ul>','删除',function(){GroupStartOp('DelTopTopic',"+groupid+","+userid+")})\">删除主题</a></li>";
                                        break;
		                            case "DelTopTopic":
		                                self.location=returnvalue;
                                        break;
                                    case "DelReplys":
                                        var cobj = document.getElementById("Div_"+groupid);
                                        var pobj = cobj.parentElement;
                                        pobj.removeChild(cobj);
		                                pobj.className="dummy";
		                                pobj.innerHTML=returnvalue;
		                                break;
	                            }
	                            closeConfirm();
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/DelGroupMemAjax.aspx?no-cache='+Math.random(),options);
}

//开始删除
function StartDel(type,id)
{
    var cntobj= document.getElementById("span_Count");
    var cnt = cntobj.innerHTML;
	var  options={  
					   method:'get',  
					   parameters:"Type=" + type + "&ID=" + id,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    alert('删除失败，请重新再试');
							}
							else
							{
						        //RemoveObj(type,id);
						        document.getElementById('Tr_' + id).style.display="none";
						        closeConfirm();
						        var tempcnt = parseInt(cnt)-1;
                                cntobj.innerHTML = tempcnt;
						    }
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/mail/delajax.aspx?no-cache='+Math.random(),options);
}

function GetMailCount()
{
    var obj = document.getElementById('MailCount');
	var  options={  
					   method:'get',  
					   parameters:"a=gc",  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="";
							else
							    obj.innerHTML=returnvalue;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/ajax/mail/mailcount.aspx?no-cache='+Math.random(),options);
	
}

function SysMessage()
{
    var obj = document.getElementById('getsysMessage');
	var  options={  
					   method:'get',  
					   parameters:"1=1",  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="";
							else
							    obj.innerHTML=returnvalue;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/ajax/index/news.aspx?no-cache='+Math.random(),options);
}

function AddMovieUrl(mid)
{
    var param="Id="+mid;
    ShowMsgBox('mURL_idwindow','580','310','movie/movieURL',param);
}

function saveMovieURL(mid)
{
    var mtitle=document.getElementById("MovieNameTXT").value;
    var murl=document.getElementById("MovieURLTXT").value;
    if(mtitle.length<1)
   {
         alert("请填写名称。");return false;
   } 
    if(murl.length<15||murl.indexOf("http://")==-1)
   {
        alert("请正确填写地址。格式为：http://:...");;return false;
   } 
    document.getElementById("showURLAddState").style.display="block"; 
	var  options={  
					   method:'get',  
					   parameters:"&Action=save&MovieID="+mid+"&mName="+escape(mtitle)+"&mURL="+murl+"",  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							alert(returnvalue);
						   closediv(document.getElementById("mURL_idwindow"));
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/movie/MovieURL.aspx?no-cache='+Math.random(),options);
}

function showPoint()
{
    var param=escape("1=1");
    ShowMsgBox('point_idwindow','550','310','other/showPoint',param);
}


function showPointHistory(page,sTime,eTime)
{
    var objDiv=document.getElementById("div_pointhisty");
    objDiv.style.display="block"; 
	var  options={  
					   method:'get',  
					   parameters:"type=s&sTime="+sTime+"&eTime="+eTime+"&page="+page,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    objDiv.innerHTML="加载失败";
							}
							else
							{
                                objDiv.innerHTML = returnvalue;
                            }
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/other/showPoint.aspx?no-cache='+Math.random(),options);
}



//显示好友描述信息对话框
function ShowFriendDetailDlg(title,content,onok)
{
    var width = 500;
    var height = 400;
    var pos = getPosition(document.body);
	objDiv = document.createElement("div");
	objDiv.id="div_AlertBox";
	objDiv.className="alertbox";
	
	objDiv.style.width = width +"px";
	objDiv.style.height = height +"px";
    objDiv.style.position = "absolute";
	objDiv.style.left = ((window.screen.width/2)-(width/2)) + "px";
	objDiv.style.top = ((window.screen.height/2)-height) + "px";
	var s = "<div class=\"alertboxcontent\">";
    s +="   <div class=\"alertboxmain\">"+ content +"</div>";
 	s +="   <div class=\"alertboxbutn\"><input onclick=\""+ onok +"\" class=\"f-button\" type=\"button\" value=\"确定\"/><input type=\"button\" class=\"f-reset\" onclick=\"HideAlertBox()\" value=\"取消\"/></div>";
	s +="</div> ";
	objDiv.innerHTML = s;
    document.body.appendChild(objDiv);
}
function AlertBox(type,id,width,height)
{
    var pos = getPosition(document.body);
	objDiv = document.createElement("div");
	objDiv.id="div_AlertBox";
	objDiv.className="alertbox";
	objDiv.style.width = width + "px";
	objDiv.style.height = height + "px";
    objDiv.style.position = "absolute";
	objDiv.style.left = ((window.screen.width/2)-(width/2)) + "px";
	objDiv.style.top = ((window.screen.height/2)-height) + "px";
	getAlertBoxContent(type,id,objDiv);
    document.body.appendChild(objDiv);
}

function getAlertBoxContent(type,id,objDiv)
{
	var  options={  
					   method:'get',  
					   parameters:"type="+type+"&id="+id,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    obj.innerHTML="加载失败";
							}
							else
							{
							    var arr_returnvalue = returnvalue.split('||');
                            	var content = "<div class=\"alertboxcontent\">";
		                        content +="   <div class=\"alertboxtitle\">" + arr_returnvalue[0] + "</div>";
		                        content +="   <div class=\"alertboxmain\">" + arr_returnvalue[1] + "</div>";
 		                        content +="   <div class=\"alertboxbutn\">" + arr_returnvalue[2] + "</div>";
		                        content +="</div> ";
                                objDiv.innerHTML = content;
                            }
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/other/getAlertBoxContent.aspx?no-cache='+Math.random(),options);
}
function HideAlertBox()
{
    var obj = document.getElementById('div_AlertBox');
    document.body.removeChild(obj);
}
function GroupAddMber(value,name)
{
    var sobj = document.getElementById('inviter_pendding');
    var usobj = document.getElementById('FriendList');
	objli = document.createElement("li");
	objli.id= "li"+value;
	objli.innerHTML="<div style=\"float:left; width:320px;\"> <a href=\""+RootDir+"/user/?r="+value+"\"> "+name+" </a></div> <div style=\"float:left;\"><a href=\"javascript:void(0);\" onclick=\"javascript:GroupReMber('"+value+"','"+name+"')\">删除</a></div>";
    sobj.appendChild(objli);
    usobj.removeChild(document.getElementById('l'+value));
    document.form1.Hid_FriendID.value+=value+"|";
}
function GroupReMber(value,name)
{
    var sobj = document.getElementById('inviter_pendding');
    var usobj = document.getElementById('FriendList');
	objlable = document.createElement("div");
	objlable.id = "l"+value;
	objlable.innerHTML="<input type=\"checkbox\" value=\"" + value + "\" onclick=\"GroupAddMber('" +value + "','" +  name + "');\" />" + name + "";
	usobj.appendChild(objlable);
	sobj.removeChild(document.getElementById('li'+value));
    document.form1.Hid_FriendID.value = document.form1.Hid_FriendID.value.replace(value+"|","");
}
function getGroupMemberList(obj,grade,groupid)
{
    obj.innerHTML = "正在加载中...";
	var  options={  
					   method:'get',  
					   parameters:"GroupID="+groupid+"&Grade="+grade,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="取得成员列表失败";
							else
							    obj.innerHTML=returnvalue;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/GroupMemberGradeList.aspx?no-cache='+Math.random(),options);
}
function getFriendMemberFroGroup(obj,key,groupid)
{
    obj.innerHTML="";
	var  options={  
					   method:'get',  
					   parameters:"GroupID="+groupid+"&key="+escape(key),  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="取得成员列表失败";
							else
							{
							    var s_list = "";
							    var arr_return = returnvalue.split('|');
						        for(var i=0;i<arr_return.length;i++)
						        {
						            var arr_nameid = arr_return[i].split(',');
                                    objlable = document.getElementById("li"+arr_nameid[0]);
                                    if(objlable==null)
                                    {
                                        if(arr_nameid[0]!="")
                                        {
                                            var usobj = document.getElementById('FriendList');
                                            objlable = document.createElement("div");
                                            objlable.id = "l"+arr_nameid[0];
                                            objlable.innerHTML="<input type=\"checkbox\" value=\"" + arr_nameid[0] + "\" onclick=\"GroupAddMber('" +arr_nameid[0] + "','" +  arr_nameid[1] + "');\" />" + arr_nameid[1] + "";
                                            usobj.appendChild(objlable);
                                        }
                                    }
						        }
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/GetFriendsForGroup.aspx?no-cache='+Math.random(),options);
}

function getGroupMemPage(page,grade,id)
{
    var obj = document.getElementById('showfolk_t');
    obj.innerHTML = "正在加载中...";
	var  options={  
					   method:'get',  
					   parameters:"GroupID="+id+"&Grade="+grade+"&page="+page,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							    obj.innerHTML="取得成员列表失败";
							else
							    obj.innerHTML=returnvalue;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/GroupMemberGradeList.aspx?no-cache='+Math.random(),options);
}

function EditDis()
{
    var event=getEvent();
    var obj=event.srcElement||event.target;
    var id = obj.tempid;
    var tempvalue = document.getElementById("HidID"+id).value;
    if(tempvalue=="1")
        return;
    else
        document.getElementById("HidID"+id).value = "1";
    var obj = document.getElementById('Div_Content'+id);
    setCookie("TempValue"+id,obj.innerHTML);
    obj.innerHTML = "";
	var  options={  
					   method:'get',  
					   parameters:"Action=getContent&DisID="+ id,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
				                obj.innerHTML="取得内容失败";
							else
                                obj.innerHTML=returnvalue;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/DisCussInfoEdit.aspx',options);
}
function HideDis(id)
{
    document.getElementById("Div_Content" +id).innerHTML=getCookie("TempValue" + id );
    delCookie("TempValue" + id)
    document.getElementById("HidID"+id).value = "";
}

function SaveEditDis(id)
{
    var obj = document.getElementById('Div_Content'+id);
    var value = escape(document.getElementById('Content'+id).value);
    document.getElementById("spanerr").innerHTML="";
    if(value=="")
    {
        document.getElementById("spanerr").innerHTML="<font color=red>内容不能为空</font>";
        return;  
    }
    document.getElementById("HidID"+id).value = "";
    delCookie("TempValue"+id);
    var  options={
        method:'get',
        parameters:"Action=SaveContent&Content="+value+"&DisID="+ id,
        onComplete:
            function(transport)
	        {
				var returnvalue=transport.responseText;
				if (returnvalue.indexOf("??")>-1)
				    obj.innerHTML="保存失败";
				else
				{
                    obj.innerHTML=returnvalue;
				}
	        } 
	}
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/DisCussInfoEdit.aspx',options);
}
function ReplyDis(id,username,SeriesNum)
{
    var obj = document.getElementById('Div_Reply');
    obj.style.display="";
    document.form1.IsReply.value=SeriesNum;
	var  options={  
					   method:'get',  
					   parameters:"Action=getReplyContent&DisID="+ id,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
				                obj.innerHTML="取得内容失败";
							else
                                obj.innerHTML="<b>回复 "+SeriesNum+" 楼 "+username+"</b><p>"+returnvalue+"</p>";;
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/group/DisCussInfoEdit.aspx',options);    
}
function HideReplyDiv()
{
    try{
        var obj = document.getElementById('Div_Reply');
        obj.style.display="none";
    }
    catch(e){};
}

function setCookie(name,value)
{
  var Days = 1; //此 cookie 将被保存 1 天
  var exp  = new Date();    //new Date("December 31, 9998");
  exp.setTime(exp.getTime() + Days*24*60*60*1000);
  document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString();
}

function getCookie(name)
{
  var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
  if(arr != null) return unescape(arr[2]); return null;
}

function delCookie(name)
{
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cval=getCookie(name);
  if(cval!=null) document.cookie=name +"="+cval+";expires="+exp.toGMTString();
}

function SaveComm(content,movieid)
{
    var obj = document.getElementById('Common');
    var spanobj = document.getElementById("span_err");
    spanobj.innerHTML="";
    if(content==null || content=="")
    {
        spanobj.innerHTML="<font color=red>内容不能为空</font>";
        return;
    }
    var  options={
        method:'get',
        parameters:"Action=Save&Content="+escape(content)+"&movieid="+ movieid,
        onComplete:
            function(transport)
	        {
				var returnvalue=transport.responseText;
				if (returnvalue.indexOf("??")>-1)
				    obj.innerHTML="保存失败";
				else
				{
                    obj.innerHTML=returnvalue;
				}
	        } 
	}
	new  Ajax.Request(RootDir+'/Inc/Ajax/movie/MovieAjax.aspx',options);
}
function EditComm(movieid)
{
    var obj = document.getElementById('Common');
    var  options={
        method:'get',
        parameters:"Action=Edit&movieid="+ movieid,
        onComplete:
            function(transport)
	        {
				var returnvalue=transport.responseText;
				if (returnvalue.indexOf("??")>-1)
				    obj.innerHTML="加载失败";
				else
				{
                    obj.innerHTML=returnvalue;
				}
	        } 
	}
	new  Ajax.Request(RootDir+'/Inc/Ajax/movie/MovieAjax.aspx',options);
}

//取得对象obj的坐标，返回对象.X .Y
//arjun
function getXY(obj)
{
	var o=obj;
	var x=o.offsetLeft;
	var y=o.offsetTop;
	while(o=o.offsetParent)
	{
		x+=o.offsetLeft;
		y+=o.offsetTop;
	}
	return {X:x,Y:y}
}

//obj,事件对象
//ms, 弹出框信息
//ms1,弹出框确认按钮信息
//f1, 弹出框确认回调函数
//arjun
function Confirm(obj,ms,ms1,f1)
{
	var o=document.getElementById("confirmMSG");
	if(!o)
	{
		o=document.createElement("DIV");
		o.setAttribute("id","confirmMSG");
		document.body.appendChild(o);
	}
	o.className="confirmMSGCSS";
	o.style.position="absolute";
	o.style.zIndex="10";
	var confirmstr="<button id=\"confirmMSG_confirm\" class=\"f-button\">"+ms1+"</button>&nbsp;";
	if(ms1=="")
	    confirmstr="";
	var canclestr="取消";
	try
	{
	    if(arguments[4]!=undefined)
	    {
	        canclestr=arguments[4];
	    }
	}
	catch(e){}
	o.innerHTML="<div>"+ms+"</div><div style='width:250px;text-align:right'>"+confirmstr+"<button id=\"confirmMSG_cancle\" class=\"f-reset\">"+canclestr+"</button></div>";
    
    var offwidth=55;
	var cx=getXY(obj).X-o.offsetWidth+offwidth+obj.offsetWidth*6.18/10;
	var cy=getXY(obj).Y-o.offsetHeight-5;
	o.style.left=cx+"px";
	o.style.top=cy+"px";
	o.style.display="block";
	var ifr=document.getElementById("confirmMSGIFRAME");
	if(!ifr)
	{
		ifr=document.createElement("iframe");
		ifr.setAttribute("id","confirmMSGIFRAME");
		document.body.appendChild(ifr);
	}
	ifr.style.position="absolute";
	ifr.style.zIndex="9";
	ifr.style.width=o.offsetWidth+"px";
	ifr.style.height=o.offsetHeight+"px";
	ifr.style.top=cy+"px";
	ifr.style.left=cx+"px";
	ifr.setAttribute("frameborder","0");
	
	var xiaojian=document.getElementById("confirmMSGxiaojian");
	if(!xiaojian)
	{
		xiaojian=document.createElement("img");
		xiaojian.setAttribute("id","confirmMSGxiaojian");
		document.body.appendChild(xiaojian);
	}
	xiaojian.src=RootDir+"/template/images/cor.gif";
	xiaojian.style.position="absolute";
	xiaojian.style.zIndex="11";
	xiaojian.style.top=cy+o.offsetHeight-3+"px";
	xiaojian.style.left=cx+0.7*o.offsetWidth+xiaojian.offsetWidth+"px";
	try
	{
	document.getElementById("confirmMSG_confirm").onclick=f1;
	}catch(e){}
	document.getElementById("confirmMSG_cancle").onclick=function()
	{
	    
	    o.parentNode.removeChild(o);
	    ifr.parentNode.removeChild(ifr);
	    xiaojian.parentNode.removeChild(xiaojian);
	}
}

//关闭confirm窗口
function closeConfirm()
{
    var xiaojian=document.getElementById("confirmMSGxiaojian");
    var o=document.getElementById("confirmMSG");
    var ifr=document.getElementById("confirmMSGIFRAME");
    
    if(xiaojian)
    {
        xiaojian.parentNode.removeChild(xiaojian);
    }
    if(o)
    {
        o.parentNode.removeChild(o);  
    }
    if(ifr)
    {
        ifr.parentNode.removeChild(ifr);
    }
}

//设置confirm窗口信息
function setConfirmMSG(msg)
{
    var o=document.getElementById("confirmMSG");
    if(o)
    {
        o.style.width=o.offsetWidth-22+"px";
        o.style.height=o.offsetHeight-22+"px";
        o.innerHTML=msg;
    }
}

var Image_xiaojian=new Image();
Image_xiaojian.src=RootDir+"/images/xiajiao.gif";

//取得竖向滚动高度
function windowScrollTop()
{
	var scrollPos; 
	if (typeof window.pageYOffset != 'undefined') { 
	   scrollPos = window.pageYOffset; 
	} 
	else if (typeof document.compatMode != 'undefined' && 
		 document.compatMode != 'BackCompat') { 
	   scrollPos = document.documentElement.scrollTop; 
	} 
	else if (typeof document.body != 'undefined') { 
	   scrollPos = document.body.scrollTop; 
	}
	return scrollPos; 
}

getPosition = function(oElement)
{
    var objParent = oElement
    var oPosition = new position(0,0);
    while (objParent.tagName != "BODY")
    {
        oPosition.x += objParent.offsetLeft;
        oPosition.y += objParent.offsetTop;
        objParent = objParent.offsetParent;
    }
    return oPosition;
} 

function showface(id,message,num)
{
    var ExsitDivObj=document.getElementById("facebg_idwindow");
    if(ExsitDivObj!=null)ExsitDivObj.parentNode.removeChild(ExsitDivObj);
    var objDiv = document.createElement("div");
    objDiv.className="f_box";//For IE
    objDiv.style.position = "absolute";
    objDiv.id="facebg_idwindow"; 
    objDiv.innerHTML = "loading...";
	var width="542";
	var height="118";
	if(num==1)
	{
	    height="260";
	}
	else if(num==2)
	{
	    height="150";
	}
	objDiv.style.width = width +"px";
    objDiv.style.position = "absolute";
	objDiv.style.left = (((window.screen.width/2)-(width/2))-32) + "px";
	objDiv.style.top = ((((window.screen.height/2)-(height))+document.documentElement.scrollTop)+20) + "px";
    objDiv.style.display = "";
    document.body.appendChild(objDiv); 
   objDiv.innerHTML="loading..."; 
   var fstr="";  
   for(i=1; i<90; i++) 
   {
		fstr += '<img src="'+RootDir+'/template/images/face/'+i+'.gif" title="[em:'+i+':]" onclick="insertFace('+i+', \''+ message +'\')" style="cursor:pointer; position:relative;" />';
   } 
	objDiv.innerHTML = "<div class=\"f_box1\"><div  class=\"boxtitle chengse\"><div class=\"nl bold\"></div><div class=\"reshow nr\"><a href=\"javascript:void(0);\" onclick=\"closediv($('facebg_idwindow'));\">关闭</a></div></div>"+fstr+"</div>";
}

function getFace(i,message)
{
    fstr = '<img src="'+RootDir+'/template/images/face/'+i+'.gif" title="[em:'+i+':]" onclick="insertFace('+i+', \''+ message +'\')" style="cursor:pointer; position:relative;" />';
   return  fstr;
}


function ShowShareDiv(sType,shareid,stitle,surl,scontent,linkuserid)
{
    var param="Id="+shareid+"&type="+sType+"&title="+escape(stitle)+"&url="+escape(surl)+"&linkUserID="+linkuserid+"&content="+escape(scontent)+"";
    ShowMsgBox('share_idwindow','510','320','share/ShareCommonality_frame',param);
}

function closediv(objDiv)
{
   objDiv.parentNode.removeChild(objDiv);
}
function cleardiv(objDiv)
{
   objDiv.style.display="none";
}


function showDivMovie(movieid,p,murl)
{
    var param="ID="+movieid+"&QURL="+escape(murl)+"&p="+p+"";
    ShowMsgBox('movie_idwindow','660','370','movie/playmovie',param);
}

function UserOperate(username,uid)
{
    var param="Id="+uid+"&username="+escape(username)+"";
    ShowMsgBox('poke_idwindow','508','300','friend/pokeCommonality',param);
}
function editFriend(fid,uid)
{
    var param="fId="+fid+"&uid="+uid+"";
    ShowMsgBox('friend_idwindow','308','300','friend/setclass',param);
}

function SetFriendRulst(fid)
{
     var  cvalue=document.getElementById("getSetProClassID").value;
	 var  options={  
					   method:'get',  
					   parameters:"action=update&fId="+fid+"&cid="+cvalue,
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue!=1)
							{
							    alert("设置失败");
							}
							closediv(document.getElementById("friend_idwindow"));
						}  
				   }; 
	new  Ajax.Request(RootDir+'/inc/ajax/friend/setclass.aspx?no-cache='+Math.random(),options);
}

function showgiftcontent(gid)
{
    for(var j=100;j>=0;j--)
    {
        var  objDiv=document.getElementById("gift_idwindow_"+j);
        if(objDiv!=null)
        {
           objDiv.parentNode.removeChild(objDiv);
        }
    }
    var param="r="+gid+"&t=1";
    ShowMsgBox('gift_idwindow_'+gid+'','408','200','gift/getinfo',param);
}

function rePoke(fid,uid,id)
{
	 var  options={  
					   method:'get',  
					   parameters:"action=repoke&fId="+fid+"&uid="+uid,
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
                                    objDiv.innerHTML = "error!";
							else
							{
								closediv(document.getElementById("poke_idwindow"));
								document.getElementById("umessage_"+id).style.display="none";
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/home/pokeCommonality.aspx?no-cache='+Math.random(),options);
}

function CloseOperate(fid,uid,divid)
{
	 var  options={  
					   method:'get',  
					   parameters:"&action=clear&fId="+fid+"&uid="+uid,
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
                                    alert("错误")
							else
							{
								document.getElementById(divid).style.display="none";
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/home/pokeCommonality.aspx?no-cache='+Math.random(),options);
}

function showType(t)
{
    if(t=="1")
    {
        document.getElementById("shTYPE1").className="";
        document.getElementById("shTYPE2").className="current";
    	document.getElementById("FriendDiv").style.display="none";
    }
    else
    {
        document.getElementById("shTYPE1").className="current";
        document.getElementById("shTYPE2").className="";
    	document.getElementById("FriendDiv").style.display="";
    }
} 

function ContentSaveShare()
{
    var sFriendIDGroup = document.getElementById('sFriendIDGroup');
    var ShareType = document.getElementById('ShareType');
    var ShareUrl = document.getElementById('ShareUrl'); 
    var stitle = document.getElementById('stitle'); 
    var scontent = document.getElementById('scontent'); 
    var shareID = document.getElementById('shareID'); 
    var result="";
    if(stitle.value=="")
    {
        result+="填写主题\n";
    }   
    if(scontent.value=="")
    {
        result+="填写内容\n";
    }   
   if(result!="")
   {
    alert(result);
   return false; 
   } 
    var Action ="action=add&shareID="+shareID.value+"&sFriendIDGroup="+ sFriendIDGroup.value+"&ShareType="+ShareType.value+"&ShareUrl="+escape(ShareUrl.value)+"&stitle="+escape(stitle.value)+"&scontent="+escape(scontent.value)+"";
    var  options={
        method:'get',
        parameters:Action,onComplete:function(transport)
	        {
				var returnvalue=transport.responseText;
				if (returnvalue=="SaveSharesuccess")
				{
				     window.top.location.href=RootDir+"/home/share";
                }
				else
				{
                    alert("分享出错!");return false;
				}
	        } 
	}
	new  Ajax.Request(RootDir+'/inc/ajax/share/shareoperator.aspx',options);
}

//显示框
function showFloatBox(msg)
{
    var event=getEvent();
    var obj=event.srcElement||event.target;
    var o=document.getElementById("FloatBox");
    if(!o)
    {
        o=document.createElement("div");
        o.setAttribute("id","FloatBox");
        o.className="FloatBox";
        o.innerHTML=msg;
        document.body.appendChild(o);
    }

    var XY=getXY(obj);
    var x=XY.X;
    var y=XY.Y-obj.offsetHeight;
    o.style.left=x+"px";
    o.style.top=y+"px";
    return o;
}

//关闭框
function closeFloatBox()
{
    var o=document.getElementById("FloatBox");
    if(o)
    {
        document.body.removeChild(o);
     }
}
//设置框消息
function setFloatBox(msg)
{
   var o=document.getElementById("FloatBox");
    if(o)
    {
        o.innerHTML=msg;
     }
     return o;
}

//function show_visitor(vid,bvid)
//{
//    document.getElementById("home-"+vid+"-tab").className="h_visit1";
//    document.getElementById("home-"+bvid+"-tab").className="h_visit2";
//    document.getElementById("home"+vid).style.display="block";
//    document.getElementById("home"+bvid).style.display="none";
//}

function showminicomment(cid,id,divid,gtype,a)
{
    var did=document.getElementById(divid);
    var minidiv=document.getElementById("divmini_"+cid);
    if(did.style.display=="none"||a=="1")
    {   
        minidiv.innerHTML="收起评论";
        did.style.display="block";
        did.innerHTML="loading...";
        var Action ="type="+gtype+"&cid="+cid+"&id="+id;
        var  options={
            method:'get',
            parameters:Action,onComplete:function(transport)
	            {
				    var returnvalue=transport.responseText;
				     did.innerHTML=returnvalue;
	            } 
	        }
	    new  Ajax.Request(RootDir+'/Inc/Ajax/index/CommentIndex.aspx?no-cache='+Math.random(),options);    
	}
	else
	{
	    did.style.display="none";
        minidiv.innerHTML="评论"
	}
}

function saveDataComment(UserID,type,id,gvalue,commentid,a,divid)
{
        var v=document.getElementById(gvalue);
        if(v.value=="")
        {
            alert('请填写评论内容');
            return false;
        }
        var Action ="action=add&UserID="+UserID+"&type="+type+"&id="+id+"&commentid="+commentid+"&content="+escape(v.value)+"";
        var  options={
            method:'get',
            parameters:Action,onComplete:function(transport)
	            {
	                 var returnvalue=transport.responseText;
	                 if(returnvalue=="Success")
	                 {
                        showminicomment(divid.replace("mini_",""),id,divid,type,a);	    
                     }   
                     else
                     {
                        alert('评论失败');
                        showminicomment(divid.replace("mini_",""),id,divid,type,a);	    
                     }
                 } 
	        }
	    new  Ajax.Request(RootDir+'/Inc/Ajax/index/CommentIndex.aspx?no-cache='+Math.random(),options);    
}

function deleteComment(UserID,type,id,divid,infoID,cid)
{
      if(window.confirm("确定要删除评论吗?"))
       {
        var did=document.getElementById(divid);
        var Action ="action=del&UserID="+UserID+"&cid="+cid+"&type="+type+"&id="+id;
        var  options={
            method:'get',
                parameters:Action,onComplete:function(transport)
	            {
                        showminicomment(cid,infoID,divid,type,'1');	       
                 } 
	        }
	    new  Ajax.Request(RootDir+'/Inc/Ajax/index/CommentIndex.aspx?no-cache='+Math.random(),options);    
       } 
}

//迷你博客评论
function showCommentJS(mid,divid,a)
{
        var did=document.getElementById(divid);
        if(a=="1"||did.style.display=="none")
        {
            did.style.display="block";
            did.innerHTML="loading....";
            var Action ="action=show&mid="+mid;
            var  options={
                method:'get',
                    parameters:Action,onComplete:function(transport)
	                {
                        var returnvalue=transport.responseText;
                        did.innerHTML=returnvalue; 
                        document.getElementById('conent_'+mid+'').focus(); 
                     } 
	            }
	        new  Ajax.Request(RootDir+'/Inc/Ajax/mood/MoodComment.aspx?no-cache='+Math.random(),options);    
	    }
	    else
	    {
            did.style.display="none";
	    }
}

function saveMiniContent(mid,a)
{
        var did=document.getElementById("mini_ID_"+mid);
        var cstr=document.getElementById("conent_"+mid);
        if(cstr.value=="")
        {
            alert('评论内容不能为空！');
            return false;
        }
        if(a=="1"||did.style.display=="none")
        {
            did.style.display="block";
            var Action ="action=Save&mid="+mid+"&content="+escape(cstr.value);
            var  options={
                method:'get',
                    parameters:Action,onComplete:function(transport)
	                {
                        showCommentJS(mid,"mini_ID_"+mid,a);
                     } 
	            }
	        new  Ajax.Request(RootDir+'/Inc/Ajax/mood/MoodComment.aspx?no-cache='+Math.random(),options);    
	    }
	    else
	    {
            did.style.display="none";
	    }
}

function delMiniComment(uid,bid,mid,a)
{
     var did=document.getElementById("mini_ID_"+mid);
            if(a=="1"||did.style.display=="none")
            {
                did.style.display="block";
                var Action ="action=Del&mid="+mid+"&uid="+uid+"&bid="+bid;
                var  options={
                    method:'get',
                        parameters:Action,onComplete:function(transport)
                        {
                            showCommentJS(mid,"mini_ID_"+mid,a);
                            closeConfirm(); 
                         } 
                    }
                new  Ajax.Request(RootDir+'/Inc/Ajax/mood/MoodComment.aspx?no-cache='+Math.random(),options);    
            }
            else
            {
                did.style.display="none";
            }
}


function get_City(obj,id)
{
    if(id == "")
    {
        clearalloption(obj);
        obj.options[0] = new Option("","0");
        obj.options[0].select=true;
        return;
    }
    var Action = "Action=Start&ParentID="+id;
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    return;
							}
							else
							{
							    Addoption(obj,returnvalue);
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/other/GetCity.aspx?no-cache='+Math.random(),options);
}
function clearalloption(obj)
{
    var testnum=obj.length;
    for(var j=testnum-1;j>=0;j--)
    {
        obj.options[j]=null;
    }
}
function Addoption(obj,value)
{
    clearalloption(obj);
    if(value!="")
    {
        arr_value = value.split('||');
        s_name = arr_value[0];
        s_id = arr_value[1];
        arr_name = s_name.split(',');
        arr_id = s_id.split(',');
        for(var i=0;i<arr_name.length;i++)
        {
            var text = arr_name[i];
            var varItem = new Option(text,arr_id[i]);
            obj.options.add(varItem);
        }
    }
    else
    {
        obj.options[0] = new Option("","0");
        obj.options[0].select=true;
    }
}

function getCarIntro(id,obj)
{
    var Action = "id="+id;
    
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    return;
							}
							else
							{
							   Confirm(obj,returnvalue,'',function(){closeConfirm()},"关闭")
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/getCarIntro.aspx?no-cache='+Math.random(),options);
}

function getEvent(){     //同时兼容ie和ff的写法
         if(document.all)    return window.event;        
         func=getEvent.caller;            
         while(func!=null){    
             var arg0=func.arguments[0];
             if(arg0){
                 if((arg0.constructor==Event || arg0.constructor ==MouseEvent)
                     || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation)){    
                     return arg0;
                 }
             }
             func=func.caller;
         }
         return null;
 }

function closemsgbox(mid)
{
    document.getElementById(mid).style.display="none";
    document.getElementById("m_"+mid).style.display="none";
} 

function showSetMenu(mid)
{
    var m =document.getElementById(mid);
   if(m!=null)
   { 
        m.style.display="";
   } 
}

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers
function delayhidemenu(mid)
{
		delayhide=setTimeout("hidemenu('"+mid+"')",100)
}

function hidemenu(mid)
{
	if (document.getElementById(mid))
	{
		document.getElementById(mid).style.display="none";
    }
}
function clearhidemenu()
{
    if (window.delayhide)
    {
          clearTimeout(delayhide)
    }
}

var note_step = 0;
var note_oldtitle = document.title;
var note_timer;
function newnote() 
{
	note_step++;
　　if (note_step==3) {note_step=1}
　　if (note_step==1) {document.title = '【有新通知】' + note_oldtitle}
　　if (note_step==2) {document.title = '【◆请查收◆】' + note_oldtitle}
	note_timer = setTimeout("newnote();", 2000);
}

function changemood(uid)
{
    var divid =document.getElementById("newmood_index");
    divid.innerHTML="loading..."; 
    var Action = "uid="+uid;
	var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    divid.innerHTML="发生错误。";
							}
							else
							{
							   divid.innerHTML=returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/mood/edit.aspx?no-cache='+Math.random(),options);    
}

function editMoodNewPost()
{
        var cont=document.getElementById("editMood_index");
        var divid =document.getElementById("newmood_index"); 
        if(cont.value=='')
        {
            alert('请输入心情内容！');
            cont.focus();
            return false;
        }
        divid.innerHTML="loading..."; 
        var Action = "a=edit&content="+escape(cont.value);
        var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    divid.innerHTML="发生错误。";
							}
							else
							{
							   divid.innerHTML=returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/mood/edit.aspx?no-cache='+Math.random(),options);    
}
function editreset()
{
        var divid =document.getElementById("newmood_index"); 
        var Action = "a=get";
        var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    divid.innerHTML="发生错误。";
							}
							else
							{
							   divid.innerHTML=returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/Inc/Ajax/mood/edit.aspx?no-cache='+Math.random(),options);    
}

function onloadlogs(t)
{
        var divid =document.getElementById("dnynews"); 
        divid.innerHTML="loading...";
        var Action = "a="+t;
        var  options={  
					   method:'get',  
					   parameters:Action,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
							{
							    divid.innerHTML="发生错误。";
							}
							else
							{
							   divid.innerHTML=returnvalue;
							}
						}  
				   }; 
	new  Ajax.Request(RootDir+'/home/index.aspx?no-cache='+Math.random(),options);    
}

function onlineNumber(oid)
{
        var divid =document.getElementById(oid); 
        if(divid!=null)
        {
            divid.innerHTML="在线好友(-)";
            var Action = "";
            var  options={  
					       method:'get',  
					       parameters:Action,  
					       onComplete:function(transport)
						    {  
							    var returnvalue=transport.responseText;
							    if (returnvalue.indexOf("??")>-1)
							    {
							        divid.innerHTML="--";
							    }
							    else
							    {
							       divid.innerHTML=returnvalue;
							    }
						    }  
				       }; 
	        new  Ajax.Request(RootDir+'/Inc/ajax/index/online.aspx?no-cache='+Math.random(),options);    
	    }
}

function replaybook(did,sendid,recid)
{
//        alert(recid+"|SEND:"+sendid);
        var divid =document.getElementById("repay_book_"+did); 
        if(divid!=null)
        {
            divid.style.display="block";
            var Action = "pid="+did+"&recid="+recid+"&sendid="+sendid;
            var  options={  
					       method:'get',  
					       parameters:Action,  
					       onComplete:function(transport)
						    {  
							    var returnvalue=transport.responseText;
							    divid.innerHTML=returnvalue;
						    }  
				       }; 
	        new  Ajax.Request(RootDir+'/Inc/ajax/index/gbook.aspx?no-cache='+Math.random(),options);    
	    }
}

function sendreplybook(recid,sendid,pid)
{       
        //alert(recid+"|SEND:"+sendid);return false;
        var floatdiv = document.getElementById("sendstate_"+pid); 
        floatdiv.style.display="";
        if(document.getElementById("repcontent_"+pid).value=="")
        {
            floatdiv.innerHTML="<span class=\"reshow\">请填写留言内容!</span>";
            return false;
        }
        if(document.getElementById("repcontent_"+pid).value.length>200)
        {
            floatdiv.innerHTML="<span class=\"reshow\">留言最多字符为200个字符!</span>";
            return false;
        }
        var Action = "a=save&recid="+recid+"&sendid="+sendid+"&content="+escape(document.getElementById("repcontent_"+pid).value)+"&pid="+pid;
        var  options={  
				       method:'get',  
				       parameters:Action,  
				       onComplete:function(transport)
					    {  
						    var returnvalue=transport.responseText;
						    if (returnvalue=="succ")
						    {
						       replaybook(pid,sendid,recid);
						    }
						   else
						   {
                                floatdiv.innerHTML=returnvalue;return false;
						   } 
					    }  
			       }; 
        new  Ajax.Request(RootDir+'/Inc/ajax/index/gbook.aspx?no-cache='+Math.random(),options);    
}

function sendreplybookhome(recid,sendid,pid)
{       
        var floatdiv = document.getElementById("sendstate_"+pid); 
        floatdiv.style.display="";
        if(document.getElementById("repcontent_"+pid).value=="")
        {
            floatdiv.innerHTML="<span class=\"reshow\">请填写留言内容!</span>";
            return false;
        }
        if(document.getElementById("repcontent_"+pid).value.length>200)
        {
            floatdiv.innerHTML="<span class=\"reshow\">留言最多字符为200个字符!</span>";
            return false;
        }
        var Action = "a=save&recid="+recid+"&sendid="+sendid+"&content="+escape(document.getElementById("repcontent_"+pid).value)+"&pid="+pid;
        var  options={  
				       method:'get',  
				       parameters:Action,  
				       onComplete:function(transport)
					    {  
						    var returnvalue=transport.responseText;
						    if (returnvalue=="succ")
						    {
						       window.location.reload();
						    }
						   else
						   {
                                floatdiv.innerHTML=returnvalue;return false;
						   } 
					    }  
			       }; 
        new  Ajax.Request(RootDir+'/Inc/ajax/index/gbook.aspx?no-cache='+Math.random(),options);    
}

function delbook(id,recid)
{
        var Action = "a=del&id="+id;
        var  options={  
				       method:'get',  
				       parameters:Action,  
				       onComplete:function(transport)
					    {  
						    var returnvalue=transport.responseText;
						    if (returnvalue=="succ")
						    {
						       document.getElementById("book_li_"+id).style.display="none";
						       closeConfirm(); 
						    }
					    }  
			       }; 
        new  Ajax.Request(RootDir+'/Inc/ajax/index/gbook.aspx?no-cache='+Math.random(),options);    
}

function Tolsearch()
{
    var c=document.getElementById("s_keyt");
    if(c.value==""||c.value=="姓名、邮件...")
    {
        alert("请输入关键字！");return;
    }  
    if(c.value.length<2)
    {
        alert("最少2个字符！");return;
    }  
   window.top.location.href =RootDir+"/home/search/?Pr=0&City=0&Begin=0&End=0&Sex=2&TX=0&namekey="+escape(c.value)+""; 
}

function showdynMoodComment(infoid,moodid)
{
    var infoid=document.getElementById("mood_dyn_"+infoid);
    //alert(infoid.style.display);
    if(infoid.style.display=="none")
   {
        infoid.style.display="block";
   }  
   else
   {
        infoid.style.display="none";
   }
}

function closedyn(userID,obj)
{
	 var  options={  
					   method:'get',  
					   parameters:"a=clear&uid="+userID,  
					   onComplete:function(transport)
						{  
							var returnvalue=transport.responseText;
							if (returnvalue.indexOf("??")>-1)
								showDiv(obj,'Error');
							else
								var tempstr=returnvalue;
								showDiv(obj,tempstr);
						}  
				   }; 
        new  Ajax.Request(RootDir+'/Inc/ajax/index/dynSet.aspx?no-cache='+Math.random(),options);    
}

function CleardynSave(uid,obj)
{
 var  options={  
				   method:'get',  
				   parameters:"a=save&uid="+uid,  
				   onComplete:function(transport)
					{  
						var returnvalue=transport.responseText;
						if (returnvalue.indexOf("??")>-1)
						{
							alert("发生错误！");
					    }
						else
						{
						    alert(returnvalue);
							closediv($('div_closedyn'));
						}
					}  
			   }; 
    new  Ajax.Request(RootDir+'/Inc/ajax/index/dynSet.aspx?no-cache='+Math.random(),options);    
}

function showDiv(obj,content)
{
    var ExsitDivObj=document.getElementById("div_closedyn");
    if(ExsitDivObj!=null)ExsitDivObj.parentNode.removeChild(ExsitDivObj);
    var pos = getPosition(obj)
    var objDiv = document.createElement("div");
    objDiv.className="f_box";//For IE
    objDiv.style.position = "absolute";
	objDiv.id="div_closedyn";
	var tempheight=pos.y;
	var tempwidth1,tempheight1;
	var windowwidth=document.body.clientWidth;
	
	var isIE5 = (navigator.appVersion.indexOf("MSIE 5")>0) || (navigator.appVersion.indexOf("MSIE")>0 && parseInt(navigator.appVersion)> 4);
	var isIE55 = (navigator.appVersion.indexOf("MSIE 5.5")>0);
	var isIE6 = (navigator.appVersion.indexOf("MSIE 6")>0);
	var isIE7 = (navigator.appVersion.indexOf("MSIE 7")>0);

	if(isIE5||isIE55||isIE6||isIE7){var tempwidth=pos.x+305;}else{var tempwidth=pos.x+312;}
	objDiv.style.width = "235px";
    objDiv.innerHTML = content;
	if (tempwidth>windowwidth)
	{
		tempwidth1=tempwidth-windowwidth
		objDiv.style.left = (pos.x-tempwidth1) + "px";
	}
	else
	{
		if(isIE5||isIE55||isIE6||isIE7){objDiv.style.left = (pos.x + 10) + "px";}else{objDiv.style.left = (pos.x) + "px";}
	}
	if(isIE5||isIE55||isIE6||isIE7){objDiv.style.top = (pos.y+16) + "px";}else{objDiv.style.top = (pos.y+16) + "px";}

    objDiv.style.display = "";
//    document.onclick=function () 
//    { 
//       // if(objDiv.style.display==""){objDiv.style.display="none";}
//       closediv($('div_closedyn')); 
//     }
    document.body.appendChild(objDiv);
}


function lineheight()
{
    if(document.getElementById("midline")!=null&&document.getElementById("body_mid").clientHeight!=null){document.getElementById("midline").style.height=(document.getElementById('body_mid').clientHeight-300)+"px";} 
    if(document.getElementById("bmenuID")!=null&&document.getElementById("body_mid").clientHeight!=null)
    {
        if(document.getElementById('body_mid').clientHeight>250)
        { 
            document.getElementById("bmenuID").style.height=(document.getElementById('body_mid').clientHeight-40)+"px";
        }
    } 
    if(document.getElementById("bmenuIDs")!=null&&document.getElementById("body_mid").clientHeight!=null)
    {
        if(document.getElementById('body_mid').clientHeight>680)
        { 
            document.getElementById("bmenuIDs").style.height=(document.getElementById('body_mid').clientHeight-40)+"px";
        }
    } 
}

//滚动
function startMarquee(h, speed, delay, sid) {
	var t = null;
	var p = false;
	var o = $(sid);
	o.innerHTML += o.innerHTML;
	o.onmouseover = function() {p = true}
	o.onmouseout = function() {p = false}
	o.scrollTop = 0;
	function start() {
	    t = setInterval(scrolling, speed);
	    if(!p) {
			o.scrollTop += 2;
		}
	}
	function scrolling() {
	    if(p) return;
		if(o.scrollTop % h != 0) {
	        o.scrollTop += 2;
	        if(o.scrollTop >= o.scrollHeight/2) o.scrollTop = 0;
	    } else {
	        clearInterval(t);
	        setTimeout(start, delay);
	    }
	}
	setTimeout(start, delay);
}

function unlogin()
{
    alert("需要登录后才能查看！");
} 


