//初始化ajax對象
var xmlhttp = false;

//初始化 Ajax 對象
function initXMLHttpRequest() {
        try  {
                if (window.XMLHttpRequest)
                {
                        xmlhttp = new XMLHttpRequest();
                }
                else
                {
                        var MSXML = ['MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
                        for(var n = 0; n < MSXML.length; n ++)
                        {
                                try
                                {
                                        xmlhttp = new ActiveXObject(MSXML[n]);
                                        break;
                                }
                                catch(e)
                                {
                                        xmlhttp = false;
                                }
                        }
                }
        } catch(e) {
             xmlhttp = false;  
        }
        
         if (!xmlhttp)
                alert("初始化對象錯誤");
}

//設置Div 的顯示 或者 掩藏
function setDivshowBlock() {
	completeDiv.style.display = "block";
}

function setDivshowNone() {
	completeDiv.style.display = "none";
}

//Ajax處理程序
//"getsearchtext_returndata.php?action=pritheebuy_ss&name="+escape(document.getelementbyid("username").value)
function ajaxAction(url){
	initXMLHttpRequest();

	xmlhttp.open("get",url,true);

	xmlhttp.onreadystatechange=function(){
		if (4==xmlhttp.readyState){
			if (200==xmlhttp.status || 0==xmlhttp.status){
				//獲取相應的代碼
				showOrHid(xmlhttp.responseText);
			}else{
				alert("发生错误!");
			}
		} else {
			;
		}
	}
	xmlhttp.send(null);
}

function ajaxAddHot(url){
	initXMLHttpRequest();

	xmlhttp.open("get",url,true);

	xmlhttp.onreadystatechange=function(){
		if (4==xmlhttp.readyState){
			if (200==xmlhttp.status || 0==xmlhttp.status ){
			}else{
				alert("发生错误!");
			}
		} else {
			;
		}
	}
	xmlhttp.send(null);
}

function ajaxaddBlog(url) {
        initXMLHttpRequest();

	xmlhttp.open("get",url,true);

	xmlhttp.onreadystatechange=function(){
		if (4==xmlhttp.readyState){
			if (200==xmlhttp.status || 0==xmlhttp.status){
			       alert(xmlhttp.responseText);
			       window.location.reload();
			}else{
				alert("发生错误!");
			}
		} else {
			;
		}
	}
	xmlhttp.send(null);
}

function ajaxCSS(url){
	initXMLHttpRequest();

	xmlhttp.open("get",url,true);

	xmlhttp.onreadystatechange=function(){
		if (4==xmlhttp.readyState){
			if (200==xmlhttp.status || 0==xmlhttp.status){
				//獲取相應的代碼
				//是不是顯示出來
				showView (xmlhttp.responseText);
			}else{
				alert("发生错误!");
			}
		} else {
			;
		}
	}
	xmlhttp.send(null);
}

function ajaxRefeHot (url) {
        initXMLHttpRequest();

        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                                //是不是顯示出來
                            showMsg(xmlhttp.responseText);
                        }else{
                                alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null);
}

function ajaxaddBookLink (url) {
       initXMLHttpRequest();

        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                                //是不是顯示出來
                          bookLinkMsg(xmlhttp.responseText);
                         // alert(xmlhttp.responseText);
                        }else{
                                alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null); 
}
function ajaxaddGuessFriend(url) {
        initXMLHttpRequest();

        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                                //是不是顯示出來
                              //  bookLinkMsg(xmlhttp.responseText);
                                 addGuessFriendMsg(xmlhttp.responseText);
                                 
                        }else{
                                alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null);
}

function ajaxaddarticelRss(url) {
        initXMLHttpRequest();

        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                                addarticelRssMsg(xmlhttp.responseText);
                        }else{
                                alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null);
}

function ajaxaddBlogPep (url) {
        initXMLHttpRequest();

        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                             //   addBlogPepMsg(xmlhttp.responseText);
                        	alert(xmlhttp.responseText);
                                  window.location.reload();
                        }else{
                                alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null); 
}

function ajaxaddAlbumAWD(url) {
        initXMLHttpRequest();

        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                               // addAlbumAWDMsg(xmlhttp.responseText);
                                alert(xmlhttp.responseText);
                                	window.location.reload();
                        }else{
                                alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null);
}

function ajaxAddArticePasswordHot(url) {
        initXMLHttpRequest();

        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                               var ar = xmlhttp.responseText.split(",");
                               addArticePwState(ar[0],ar[1]);
                        }else{
                               alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null);
}

function ajaxAblumn_pwState (url) {
        initXMLHttpRequest();
        
        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                //獲取相應的代碼
                                var ar = xmlhttp.responseText.split(",");
                                ablumn_pwState(ar[0],ar[1]);
                        }else{
                                alert("发生错误!");
                        }
                } else {
                }
        }
        xmlhttp.send(null);
}

function ajaxSendPwByArticeId(url) {
        initXMLHttpRequest();
        xmlhttp.open("get",url,true);

        xmlhttp.onreadystatechange=function(){
                if (4==xmlhttp.readyState){
                        if (200==xmlhttp.status || 0==xmlhttp.status){
                                SendPwByArticeId_pwState( xmlhttp.responseText);
                        }else{
                                alert("发生错误!");
                        }
                } else {
                        ;
                }
        }
        xmlhttp.send(null);
}