<!--#include file="../inc/NoDown.asp"-->
var LoadStar=10;	//判断0为新加载场景，10为刚进入
var LoadStarX=0;	//镜头位置
var LoadStarY=0;
var PK_Freak=0;	//0为未处于PK状态.其它为怪物ID
var PK_MyKill=0; //1为本方攻击状态
function $(){return document.getElementById?document.getElementById(arguments[0]):eval(arguments[0]);}
var MapWidth=0;
var MapHeight=0;
//加载完成后
window.onload=function() {
ScroMainBut();
$("XH_Sound").innerHTML='<object id="SE" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="480"><param name="movie" value="Music/SE.swf" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="Music/SE.swf" width="0" height="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed></object>'
GetMapHtml();
}

function GetMapHtml() {
LoadStarY=0;
LoadStarX=0;
$('XH_LoadText').innerHTML='0%';
$('XH_LoadLine').style.width='0px';
$('XH_Loading').style.display='block';
$('XH_Player').style.top=XH_Top;
$('XH_Myname').style.top=XH_Top-11;
$('XH_Player').style.left=XH_Left;
$('XH_Myname').style.left=XH_Left-10;
$("XH_MapF").innerHTML='<object id="Map_F" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="0" height="0"><param name="movie" value="Map/map'+XH_OnMap+'_f.swf" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="Map/map'+XH_OnMap+'_f.swf" width="0" height="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed></object>';
$("XH_MapT").innerHTML='<object id="Map_T" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="0" height="0"><param name="movie" value="Map/map'+XH_OnMap+'_t.swf" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="Map/map'+XH_OnMap+'_t.swf" width="0" height="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed></object>';
MapLoading();
}

function MapLoading() {
var N=parseInt(Map_F.PercentLoaded())+parseInt(Map_T.PercentLoaded())+parseInt(SE.PercentLoaded())/10;
$('XH_LoadText').innerHTML="　"+Math.floor(N/210*100) + '%　';
$('XH_LoadLine').style.width=N/210*250;
if (N < 210) {
	window.setTimeout("MapLoading()",100);
	}else{
	$('XH_LoadJSNow').style.display='none';
	if (PK_Freak!==0) {
		LoadMap.src="js/Main_PK.js";
		}else{
		window.setTimeout("LoadMaps()",200);
		if ((XH_Uid!==1)&&(XH_Uid!==12)&&(LoadStar==10)) {window.setTimeout("PlayMusic(MusicN);GameAjax('ShowMess.asp?action=send&c=FF9C00&SN=系统信息&msg=网友[ '+XH_Name+' ]登陆进来了&','XH_MsgList',1)",2000)}
		}
	LoadStar=0;		//判断0为新加载
	}
}
function LoadMaps() {
var MapJs='GameMap/scene'+XH_OnMap+'_'+XH_Room+'.js';
LoadMap.src=MapJs;
actor=new movingMan(new Point(XH_Left+33,XH_Top+95));
}
//场景切换完成后
function GoingNow() {
$("Map_F").style.width=$("Map_T").style.width=MapWidth;
$("Map_F").style.height=$("Map_T").style.height=MapHeight;
$('XH_Myname').style.display='block';
MapHtml();
if (LoadStar==0) {
LoginScroll();
LoadStar=LoadStar+1;
PlaySE(4);
$("XH_Loading").style.display='none';
	}else{
Scrolling();
}
window.setTimeout("$('XH_LoadJSNow').style.display='none';AjaxInfo();",1500);
//此行调试场景时使用
//$("Map_T").style.display='none';
}

function ScroMainBut() {
$("power_hp").style.width=Math.floor(XH_MyHp/XH_MyAll)*140;
$("power_mp").style.width=Math.floor(XH_MyMp/XH_MyAll)*140;
$("C_2").scrollLeft=110;
$("C_3").scrollLeft=218;
$("C_4").scrollLeft=272;
$("C_5").scrollLeft=326;
$("C_6").scrollLeft=380;
$("C_7").scrollLeft=56;
$("C_8").scrollLeft=28;
$("R_2").scrollLeft=28;
$("C_9").scrollLeft=488;
$("C_10").scrollLeft=596;
$("C_11").scrollLeft=542;
$("C_12").scrollLeft=434;
$("C_13").scrollLeft=164;
$("C_14").scrollLeft=164;
//popmsg(XH_Name,"欢迎登陆宝贝的部落<br>最近更新: 完善私聊/音乐,加入简单PK效果",250,100);
}

function SMainMenu(Num) {PlaySE(17);$("XH_MainMenu_C_S1").scrollLeft=Num}

//加载PK场景
function XH_LoadPK() {
AjaxClear();
ClearAllUser();
$('XH_Myname').style.display='none';
$(XH_MyTalkId).innerHTML='';
XH_WayList="";
PlaySE(5);
$("XH_LoadJSNow").style.display='block';
window.setTimeout("XH_LoadPKIng()",850);
}

function XH_LoadPKIng() {
if (PK_Freak!==0) return;
PK_Freak=1;
$("XH_MapF").innerHTML='<object id="Map_F" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="480"><param name="movie" value="Map/PK_f.swf" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="Map/PK_f.swf" width="780" height="480" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed></object>';
$("XH_MapT").innerHTML='<object id="Map_T" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="780" height="480"><param name="movie" value="Map/PK_t.swf" /><param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><embed src="Map/PK_t.swf" width="780" height="480" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" wmode="transparent"></embed></object>';
$('XH_LoadText').innerHTML='0%';
$('XH_LoadLine').style.width='0px';
$('XH_Loading').style.display='block';
//控制角色显示位置
$(XH_MyTalkId).style.top=185;
$(XH_MyTalkId).style.left=155;
$(XH_MyTalkId).style.zIndex=15;
$("XH_Player").style.top=220;
$("XH_Player").style.left=250;
$("XH_Player").scrollTop=917;
MapLoading()
}

function XH_LoadPK_Over() {
AjaxClear();
PK_Freak=0;
$(XH_MyTalkId).innerHTML='';
$(XH_MyTalkId).style.zIndex=26;
$(XH_MyTalkId).style.left=XH_Left-95;
$(XH_MyTalkId).style.top=XH_Top-35;
$("Power_npc_bg").style.display='none';
$("XH_LoadJSNow").innerHTML='<span id="XH_LoadJSText">正在缓冲...</span>';
$('XH_Myname').style.display='none';
PlaySE(5);
window.setTimeout("GetMapHtml()",850);
}
