var DomainUrl = top.location.hostname;
var AuthUrl = top.location.hostname;

function Trim(){
	return this.replace(/\s+$|^\s+/g,"");
}
String.prototype.Trim=Trim;

function getObjValues(id){
	if(getObjects(id).value!=undefined)
		return getObjects(id).value.Trim();
	else
		return "";
}
function getObjects(id) { 	
	if (document.getElementById) { 
		return document.getElementById(id);
	} else if (document.all) { 
		return document.all[id]; 
	} else if (document.layers) { 
		return document.layers[id]; 
	} 
}


function createXMLHttpRequest(){
       	if (window.XMLHttpRequest) {//
		XMLHttpReq=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {//IE 浏览器
	     try {
			    XMLHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
	     } catch (e) {
		        try{
					XMLHttpReq=new ActiveXObject("Micrsost.XMLHTTP");
				} catch(e){}
	     }
        }
}
var cache = new Array();
function getHttpObject() {
    var objType = false;
    try {
        objType = new ActiveXObject('Msxml2.XMLHTTP');
    } catch(e) {
        try {
            objType = new ActiveXObject('Microsoft.XMLHTTP');
        } catch(e) {
            objType = new XMLHttpRequest();
        }
    }
    return objType;
}

function DtList(_id){
  document.getElementById("dtlist").innerHTML = '<li><img src="images/loading.gif" />&nbsp;数据读取中...</li>';
  var theHttpRequest = getHttpObject();
  theHttpRequest.onreadystatechange = function() {processAJAX();};
  theHttpRequest.open("GET", "ajax.php?ac=dt&id="+_id, true);
  theHttpRequest.send(null);
    function processAJAX(){
       if (theHttpRequest.readyState == 4) {
         if (theHttpRequest.status == 200) {
                document.getElementById("dtlist").innerHTML = unescape(theHttpRequest.responseText);
         } else {
		document.getElementById("dtlist").innerHTML = "您请求的页面出现异常错误";
         }
       }
   }
}

function Favdel(_id){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=favdel&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     location.replace(location);
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }

}

function usermb(_id){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=usermb&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     alert('设置成功！'); 
	                     location.replace(location);
	           } else if(msg == "Err_101"){
	                     alert('设置失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }

}

function topicdel(_id){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=topicdel&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     location.replace(location);
	           } else if(msg == "Err_102"){
	                     alert('该专集下有歌曲数据不能删除，请先移除该专集歌曲！'); 
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }

}

function picdel(_id){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=picdel&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     location.replace(location);
	           } else if(msg == "Err_102"){
	                     alert('该相册下有相片数据不能删除，请先移除该相册的相片！'); 
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }

}

function Paydel(_id){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=delpay&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     alert('删除成功！'); 
	                     location.replace(location); 
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }
}

function delnews(_id){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=delnews&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     alert('删除成功！'); 
	                     location.replace(location); 
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }
}

function delmsg(){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=delmsg",true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     alert('删除成功！'); 
	                     location.replace(location); 
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }
}

function dumsg(){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=dumsg",true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     location.replace(location); 
	           } else if(msg == "Err_101"){
	                     alert('操作失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }
}

function gbookhf(_id){
    var neir=getObjValues("CS_Hfneir"+_id);
    if(neir==""){
	alert('回复内容不能为空！'); return false;
    }
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=gbook&op=hf&id="+_id+"&neir="+neir,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     location.replace(location); 
	           } else if(msg == "Err_101"){
	                     alert('回复失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }
}

function delgbook(_id, _do){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=gbook&op="+_do+"&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     location.replace(location); 
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }
}

function delfriend(_id, _do){
    createXMLHttpRequest();
    XMLHttpReq.open("GET", "ajax.php?ac=delfriend&op="+_do+"&id="+_id,true);
    XMLHttpReq.onreadystatechange= function() {processAJAX();};
    XMLHttpReq.send(null);
    function processAJAX(){
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
	                     location.replace(location); 
	           } else if(msg == "Err_101"){
	                     alert('删除失败！'); 
	           } else {
	                alert(unescape(msg));
	           }
         } else {
		alert('您请求的页面出现异常错误');
         }
       }
   }
}

function weiboadd(){
         if(getObjValues("message")=="请发表您要说的话。"){
             document.getElementById('message').innerText='';
	     alert('微薄内容不允许为空！'); return false;
         }
	 createXMLHttpRequest();
	 XMLHttpReq.open("GET", "ajax.php?ac=weibo&neir=" + getObjValues("message"),true);
	 XMLHttpReq.onreadystatechange= weiboResponse;
	 XMLHttpReq.send(null);
}

function weiboResponse() {
	 if (XMLHttpReq.readyState==4){
	 if(XMLHttpReq.status==200){
	           var msg=XMLHttpReq.responseText;
	           if(msg == "Err_100"){
                             document.getElementById('message').innerText='';
	                     alert('微薄内容不允许为空！'); 
	           } else if(msg == "Err_101"){
	                     alert('微薄内容只能5-200个字！'); 
	           } else if(msg == "Err_102"){
                             document.getElementById('message').innerText='';
	                     DtList(1); 
	           } else if(msg == "Err_103"){
	                     alert('微薄发表失败！'); 
	           } else if(msg == "Err_104"){
	                     alert('不要这么急嘛，刚发完休息一下在发！'); 
	           } else {
	                alert(unescape(msg));
	           }
	 } else {
                      alert('您请求的页面出现异常错误！');
	        }
         }
}