//var centerWidth=document.documentElement.clientWidth/2;
var myWidth = 0;
    if(typeof (window.innerWidth) == 'number')
    {
        //Non-IE
        myWidth = window.innerWidth;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
    }
var centerWidth=myWidth/2;
var astitle=Array();
var aslink=Array();

function loadXML() {
    
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET","asheader/xml.aspx",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML;

    var root = xmlDoc.getElementsByTagName("news");
    var i;
    
    for(i=0;i<root.length;i++)
    {
        astitle[i]=root[i].getElementsByTagName("titlenews")[0].childNodes[0].nodeValue;
        aslink[i]=root[i].getElementsByTagName("linknews")[0].childNodes[0].nodeValue;
    }
}

function OverRPG()
{
	document.getElementById("tdRPG").style.backgroundImage="url(asheader/rpg/as_header_rpg_1.png)";
	document.getElementById("dvRPG").style.display="block";
	document.getElementById("dvRPG").style.left = centerWidth - 510 + "px";
}

function OutRPG()
{
	document.getElementById("tdRPG").style.backgroundImage="none";
	document.getElementById("dvRPG").style.display = "none";	
}

function OverCasual()
{
	document.getElementById("tdCasual").style.backgroundImage="url(asheader/casual/as_header_casuasl_1.png)";
	document.getElementById("dvCasual").style.display="block";
	document.getElementById("dvCasual").style.left = centerWidth - 400 + "px";
}

function OutCasual()
{
	document.getElementById("tdCasual").style.backgroundImage="none";
	document.getElementById("dvCasual").style.display="none";
}
function OverForum()
{
	document.getElementById("tdForum").style.backgroundImage="url(asheader/forum/as_header_forum_1.png)";
	document.getElementById("dvForum").style.display="block";
	document.getElementById("dvForum").style.left=centerWidth+170 + "px";
}

function OutForum()
{
	document.getElementById("tdForum").style.backgroundImage="none";
	document.getElementById("dvForum").style.display="none";
}

function ShowMsg()
{
	var pos=parseInt(Math.random()*5);
	document.getElementById("dvMsg").innerHTML= '<a href="' + aslink[pos] + '" target="_blank" class="title">' + astitle[pos] + '</a>';
	setTimeout("ShowMsg()",5000);
}

function WriteHtml() {
    document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-family:Tahoma; font-size:11px; color:#122a62"><tr><td height="29" align="center" background="asheader/as_header_bg.gif"><table width="1000" border="0" cellspacing="0" cellpadding="0"><tr><td width="179" height="29" align="center" valign="middle"><img src="asheader/as_header_as.gif" width="179" height="29" /></td><td id="tdRPG" width="82" align="center" valign="middle" style="background-repeat:no-repeat; background-position:center;font-family:Tahoma; font-size:11px; color:#122a62;cursor:pointer" onmouseover="OverRPG()" onmouseout="OutRPG()">Game RPG</td><td width="1" align="center" valign="middle"><img src="asheader/as_header_break.gif" width="1" height="29" /></td><td id="tdCasual" width="152" align="center" valign="middle" style="background-repeat:no-repeat; background-position:center;font-family:Tahoma; font-size:11px; color:#122a62; cursor:pointer" onmouseover="OverCasual()" onmouseout="OutCasual()">Game Casual &amp; Webgame</td><td width="1" align="center" valign="middle"><img src="asheader/as_header_break.gif" width="1" height="29" /></td><td width="335" align="center" valign="middle" style="color:#F00; font-weight:bold"><div id="dvMsg"></div></td><td width="1" align="center" valign="middle"><img src="asheader/as_header_break.gif" width="1" height="29" /></td><td id="tdForum" width="73" align="center" valign="middle" style="background-repeat:no-repeat; background-position:center;font-family:Tahoma; font-size:11px; color:#122a62; cursor:pointer" onmouseover="OverForum()" onmouseout="OutForum()">Diễn Đàn</td><td width="1" align="center" valign="middle"><img src="asheader/as_header_break.gif" width="1" height="29" /></td><td width="108" align="center" valign="middle" style="cursor:pointer"><a href="https://secure.playpark.vn/member/which/refill.asp" target="_blank"><img src="asheader/as_header_cash.gif" width="108" height="29" border="0" /></a></td><td width="1" align="center" valign="middle"><img src="asheader/as_header_break.gif" width="1" height="29" /></td><td width="66" align="center" valign="middle" style="cursor:pointer;font-family:Tahoma; font-size:11px; color:#122a62;">Hỗ Trợ</td></tr></table></td></tr></table>');
    document.write('<div id="dvRPG" style="width:469px; position:absolute; display:block; top:25px; left:0px; z-index:999" onmouseover="OverRPG()" onmouseout="OutRPG()"><table width="469" border="0" cellspacing="0" cellpadding="0"><tr><td width="5" rowspan="2"><img src="asheader/rpg/as_header_rpg_left.png" width="5" height="113" /></td><td width="469"><table width="469" border="0" cellspacing="0" cellpadding="0" style="font-family:Tahoma; font-size:10px; color:#122a62"><tr><td colspan="4" style="background-color:#0253a2; font-family:Verdana; color:#fff; padding:2px" align="center">Để có thể chơi được những game onlin RPG - Nhập vai dưới đây,<br /> bạn cần đăng ký tài khoản <b>@PassPort</b></td></tr><tr><td width="169" height="65" align="center" valign="bottom" style="background-image:url(asheader/rpg/as_header_rpg_30.png); background-repeat:no-repeat;"><a href="https://asiasoftpassport.asiasoft.net.vn/member/register/register.aspx" target="_blank" class="register">Đăng ký</a> | <a href="https://asiasoftpassport.asiasoft.net.vn/member/Login.aspx" target="_blank" class="register">Đăng nhập</a><br> <a href="https://asiasoftpassport.asiasoft.net.vn/ap/FindPassword.asp" target="_blank" class="register">Quên mật khẩu</a></td><td width="100"><a href="http://tt.playpark.vn/" target="_blank"><img src="asheader/rpg/as_header_rpg_32.png" width="100" height="65" border="0" /></a></td><td width="100"><a href="http://db.playpark.vn/" target="_blank"><img src="asheader/rpg/as_header_rpg_33.png" width="100" height="65" border="0" /></a></td><td width="100"><a href="http://3k.playpark.vn/" target="_blank"><img src="asheader/rpg/as_header_rpg_35.png" width="100" height="65" border="0" /></a></td></tr><tr><td width="169" height="21" style="background-image:url(asheader/rpg/as_header_rpg_31.png)"></td><td width="100" align="center" valign="middle" style="background-image:url(asheader/rpg/as_header_rpg_40.png); background-repeat:no-repeat">Thiên tử</td><td width="100" align="center" valign="middle" style="background-image:url(asheader/rpg/as_header_rpg_40.png);background-repeat:no-repeat">Độc bá</td><td width="100" align="center" valign="middle" style="background-image:url(asheader/rpg/as_header_rpg_40.png);background-repeat:no-repeat">Tam quốc chí</td></tr></table></td><td width="5" rowspan="2"><img src="asheader/rpg/as_header_rpg_right.png" width="5" height="113" /></td></tr><tr><td height="5" colspan="3"><img src="asheader/rpg/as_header_rpg_bottom.png" width="369" height="5" /></td></tr></table></div>');
    document.write('<div id="dvCasual" style="width:379px; position:absolute; display:block; top:25px; left:100px; z-index:999" onmouseover="OverCasual()" onmouseout="OutCasual()"><table width="379" border="0" cellspacing="0" cellpadding="0"><tr><td width="5" rowspan="2"><img src="asheader/casual/as_header_casuasl_left.png" width="5" height="113" /></td><td width="369" height="108"><table width="369" border="0" cellspacing="0" cellpadding="0" style="font-family:Tahoma; font-size:11px; color:#122a62"><tr><td colspan="3" style="background-color:#9fd900; font-family:Verdana; color:#FFF; padding:2px" align="center">Để có thể chơi được những game online Casual & Webgame,<br /> bạn cần đăng ký tài khoản <b>@PlayID</b></td></tr><tr><td width="169" align="center" valign="bottom" style="background-image:url(asheader/casual/as_header_casuasl_30.png)"><a href="https://secure.playpark.vn/member/disclaimer.asp" target="_blank" class="register">Đăng ký</a> | <a href="http://member.playpark.vn/member/dangnhap.asp" target="_blank" class="register">Đăng nhập</a><br> <a href="https://secure.playpark.vn/member/forgetpwd/quenmatkhau.asp" target="_blank" class="register">Quên mật khẩu</a></td><td width="100"><a href="http://gaw.playpark.vn/" target="_blank"><img src="asheader/casual/as_header_casuasl_32.png" width="100" height="65" border="0" /></a></td><td width="100"><a href="http://lt.playpark.vn/" target="_blank"><img src="asheader/casual/as_header_casuasl_34.png" width="100" height="65" border="0" /></a></td></tr><tr><td width="169" height="21" style="background-image:url(asheader/casual/as_header_casuasl_31.png)"></td><td width="100" align="center" valign="middle" style="background-image:url(asheader/casual/as_header_casuasl_40.png)">Thế Giới Bá Vương</td><td width="100" align="center" valign="middle" style="background-image:url(asheader/casual/as_header_casuasl_40.png)">Linh Thú</td></tr></table></td><td width="5" rowspan="2"><img src="asheader/casual/as_header_casuasl_right.png" width="5" height="113" /></td></tr><tr><td height="5"><img src="asheader/casual/as_header_casuasl_bottom.png" width="369" height="5" /></td></tr></table></div>');
    document.write('<div id="dvForum" style="width:274px; position:absolute; display:block; top:25px; left:0px; z-index:999" onmouseover="OverForum()" onmouseout="OutForum()"><table width="274" border="0" cellspacing="0" cellpadding="0"><tr><td width="5" rowspan="2"><img src="asheader/forum/as_header_forum_left.png" width="5" height="127" /></td><td width="264" height="122"><table width="264" border="0" cellspacing="0" cellpadding="0" style="font-family:Tahoma; font-size:11px; color:#122a62; background-color:#FFF"><tr><td colspan="2" height="26" style="background-image:url(asheader/forum/as_header_forum_2.png); height:26px" align="center"><a href="http://forum.playpark.vn" class="register" target="_blank">Diễn đàn chính</a></td></tr><tr><td width="132" valign="top" height="90" align="left"><ul style="list-style-image:url(asheader/forum/as_header_forum_bullet.gif); margin:0px; padding:5px; margin-left:10px ;line-height:15px;"><li class="forum"><a href="http://forum.playpark.vn/forumdisplay.php?f=961" target="_blank" class="forum">Thiên tử</a></li><li class="forum"><a href="http://forum.playpark.vn/forumdisplay.php?f=682" target="_blank" class="forum">Độc bá</a></li><li class="forum"><a href="http://forum.playpark.vn/forumdisplay.php?f=144" target="_blank" class="forum">Tam quốc chí</a></li></ul></td><td width="132" valign="top" align="left"><ul style="list-style-image:url(asheader/forum/as_header_forum_bullet.gif); padding:15px; line-height:15px; margin-top:-10px; margin-bottom:0px"><li><a href="http://forum.playpark.vn/forumdisplay.php?f=823" target="_blank" class="forum">Thế Giới Bá Vương</a></li><li><a href="http://forum.playpark.vn/forumdisplay.php?f=759" target="_blank" class="forum">Linh Thú</a></li></ul></td></tr></table></td><td width="5" rowspan="2"><img src="asheader/forum/as_header_forum_right.png" width="5" height="127" /></td></tr><tr><td height="5"><img src="asheader/forum/as_header_forum_bottom.png" width="264" height="5" /></td></tr></table></div>');
}

function hidedivtag(){
    document.getElementById("dvRPG").style.display = "none";
    document.getElementById("dvCasual").style.display = "none";
    document.getElementById("dvForum").style.display = "none";
    }

loadXML();
WriteHtml();
ShowMsg();
//hidedivtag();


