﻿// JScript 文件


var xmlHttp_ajax;
function createXMLHttpRequest_ajax()
{
    xmlHttp_ajax=null;
    if(window.ActiveXObject)
    {
        xmlHttp_ajax = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if(window.XMLHttpRequest)
    {
        xmlHttp_ajax = new XMLHttpRequest();
    }
}
var r_url_ajax;
var r_txt_ajax;
var obj_ajax;
function startRequest_ajax(r_url,r_data,r_txt,obj)
{
    r_url_ajax=r_url;
    r_txt_ajax=r_txt;
    obj_ajax=obj;
    
    createXMLHttpRequest_ajax();
    xmlHttp_ajax.onreadystatechange = handleStateChange_ajax;
    xmlHttp_ajax.open("POST","../ajax/"+r_url,true);
    xmlHttp_ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
    xmlHttp_ajax.send(r_data);
}
function handleStateChange_ajax()
{
    if(xmlHttp_ajax.readyState==4)
    {

        //alert(xmlHttp_ajax.responseText);
        if(xmlHttp_ajax.status==200)
        {
            try{obj_ajax.disabled=false;}catch(e){}
            txt=xmlHttp_ajax.responseText; 
            if(r_url_ajax=="innphoto.aspx")
            {
                document.getElementById("photolist").innerHTML=txt;
            }
            else if(r_url_ajax=="delofficialgonglve.aspx")
            {
                arrtxt=txt.split("ｓ");
                if(arrtxt[1]=="ok")
                {
                    alert("删除成功！");
                    document.getElementById('span_official').innerHTML="<IMG hspace=4 src='../images/upload2.gif' align=absMiddle border=0><A style='cursor:hand' onclick=\"officialclick('"+arrtxt[0]+"','0',this);\" class=h6 title=设置为官方攻略 >[设为官方]</A>";
                }
                else alert(arrtxt[1]);
            }
        }
        
    }
    else  
    {
        try{obj_ajax.disabled=true;}catch(e){}
        if(r_url_ajax=="innphoto.aspx")document.getElementById("photolist").innerHTML="<DIV class=h6 style='BACKGROUND: url(../images/loading_large.gif) no-repeat center top; PADDING-TOP: 40px; TEXT-ALIGN: center;'>正在加载...</DIV>";
    }
} 


//周围透明黑底的弹出框。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
var onclick_ajax="";
function layerblur_ajax(ifshow)
{
    document.getElementById("div_focus_ajax").innerHTML="";
   try
    {
        if(document.getElementById('Layer_ajax').style.display!='none')document.getElementById('Layer_ajax').style.display='none';
    }catch(e1){}
    
	if(ifshow!="")
	{
	    if(ifshow=="gonglvelogo")
	    {
	        document.getElementById('span_official').innerHTML="<IMG hspace=4 src='../images/upload2.gif' align=absMiddle border=0><A style='cursor:hand' onclick=\"officialclick('"+onclick_ajax+"','0',this);\" class=h6 title=修改官方攻略 >[修改官方]</A> <IMG hspace=4 src='../images/star_e.gif' align=absMiddle border=0><A style='cursor:hand' onclick=\"officialclick('0','"+onclick_ajax+"',this);\" class=h6 title=删除官方攻略 >[删除官方]</A>";
	    }
	    else if(ifshow.indexOf("addmenu")!=-1)
	    {
	        startRequest_addmenu("addmenu.aspx","","div_menu");
	        document.getElementById('div_menu').focus();
	    }
	}
	else if(onclick_ajax!="")
	{
	    if(onclick_ajax=="innphoto")
	    {
	        onclick_ajax="";
	        startRequest_ajax("innphoto.aspx","","",null);
	    }
	}
}
function addIframe_ajax(width,height,url,top)
{
    if(document.getElementById("div_focus_ajax").innerHTML=="")
    {
        document.getElementById("div_focus_ajax").innerHTML="<IFRAME name=frame_ajax id=frame_ajax  frameBorder=0 width="+width+" height="+height+" scrolling=no ></IFRAME>";
        document.getElementById('frame_ajax').src=url;
    }
    document.getElementById('Layer_ajax').style.top=0;
    document.getElementById('Layer_ajax').style.left=0;
	document.getElementById('Layer_ajax').style.display='block';
	
	document.getElementById('Layer_ajax').style.width=document.body.clientWidth;
	document.getElementById('Layer_ajax').style.height=document.body.clientHeight;
	document.getElementById("div_focus_ajax").style.marginTop=top;
	try
	{
	    document.getElementById("frame_ajax").focus();
	}catch(e){}
}
//。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
