document.write('<script language="JavaScript" type="text/JavaScript" src="http://www.sanook.com/global/global.js"></script>');
document.write('	<script language="javascript" src="http://ads.mweb.co.th/scripts/spac.js"></script>');

//==============images head game=====================
function image_headgame(){
	if (headgame != "") {
		document.write('<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">');
		document.write('<tr><td width="1" valign="top" bgcolor="#818181"><img src="/images/1x1.gif" width="1" height="1"></td>');
		document.write('<td bgcolor="#5C5C5C">');
/*
document.write('<table width="770"  height="34" border="0" align="center" cellpadding="0" cellspacing="0" background="/images/head_bg_small.gif">');
		document.write('<tr><td width="229"><img src="/images/head_game_'+headgame+'.gif" ></td>');
		document.write('<td width="541" align="right" valign="top"><script language="JavaScript">game_online();</script></td></tr>');
		document.write('</table>');

		document.write('<table width="770"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">');
		document.write('<tr><td align="center" valign="top"><img src="/images/head_'+headgame+'.jpg"></td></tr>');
		document.write('</table>');
*/
		document.write('<table width="770" height="5"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">');
		document.write('<tr><td></td></tr>');
		document.write('</table>');
		document.write('</td><td width="1" valign="top" bgcolor="#818181"><img src="/images/1x1.gif" width="1" height="1"></td></tr>');
		document.write('</table>');
	}
	else {
/*
		document.write('<table  width="780" align="center" cellpadding="0" cellspacing="0" bgcolor="#5C5C5C"> ');
		document.write('<tr bgcolor="#333333"><td height="8" bgcolor="#333333"><img src="images/grib_top.gif" width="780" height="8"></td></tr>');
		document.write('<tr bgcolor="#333333"><td bgcolor="#5C5C5C">');
		document.write('<table width="770"  height="37" border="0" align="center" cellpadding="0" cellspacing="0" background="images/head_bg.gif">');
		document.write('<tr><td width="244"><img src="images/head_game.gif" width="244" height="37"></td>');
		document.write('<td width="526" align="right" valign="top"><script language="JavaScript">game_online();</script></td></tr>');
		document.write('</table>');
		document.write('</td></tr></table>');
*/
	}
}

/*function minisite_forum(site) {
	document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/' + site + '_forum.js"></SCRIPT>');
}*/

//===================sanook serach==================
function sanook_search(){
	document.write('	<table border="0" cellspacing="0" cellpadding="0">');
	document.write('			<form name="frmSearch" method="GET" action="http://webindex.sanook.com/php/search.php">');
	document.write('                        <INPUT type=hidden value="Y" name=use_desc>');
	document.write('                        <INPUT type=hidden value="Y" name=use_keyword>');
	document.write('                        <INPUT type=hidden value="Y" name=use_title>');
	document.write('                        <INPUT type=hidden value="Y" name=use_url>');
	document.write('                <input type=hidden name="sw" value="WEBINDEX">');
	document.write('        <tr>');
	document.write('          <td width="21"><img src="/images/icon_search.gif" width="21" height="21"></td>');
	document.write('          <td width="40" align="center" class="fontWhite">ค้นหา:</td>');
	document.write('          <td width="130" align="right"><input name="q" type="text" class="fontForm" id="q" size="18"></td>');
	document.write('          <td width="40" align="right"><input type="Image" src="/images/button_go.gif" width="36" height="22" border="0"></td>');
	document.write('          <td width="5"></td>');
	document.write('        </tr>');
	document.write('</form>');
	document.write('      </table>');

}

//=================link fansite===================
function game_online(){
	document.writeln('<table cellpadding=0 width="100%">');
	document.writeln('<tr><td><a href="http://game.sanook.com/airtime/index.php"><img src="/images/g01.gif" border=0></a></td>');
	document.writeln('<td><a href="http://game.sanook.com/cheatcode"><img src="/images/g02.gif" border=0></a></td>');
	document.writeln('<td><a href="http://gamezone.sanook.com/"><img src="/images/g03.gif" border=0></a></td>');
	document.writeln('<td><a href="http://game.sanook.com/preview"><img src="/images/g04.gif" border=0></a></td></tr>');
	document.writeln('</table>');
/*
	document.write('<table border="0" cellpadding="0" cellspacing="0" class="fontWhite">');
	document.write( '<FORM name=frm_fansite>' );
	document.write('            <tr>');
	document.write('              <td>Game Online: &nbsp;</td>');
	document.write('              <td><select name="fansite" class="fontForm" id="fansite"  tabIndex=2 onchange="go_minisite(this.value)";>');
	document.write('                    <option value="" selected>.: Select Game :.</option>');
	document.write('                    <option value="/mu">&nbsp;&nbsp; MU Online</option>');
	document.write('                    <option value="/fairyland">&nbsp;&nbsp; Fairyland</option>');
	document.write('                    <option value="/kok">&nbsp;&nbsp; King of Kings</option>');
		//document.write('                    <option value="/ryl">&nbsp;&nbsp; RYL</option>');
	document.write('                  </select>');
	document.write('              </td>');
	document.write('                         <td width="30" align="center"><a href="javascript:go_minisite(document.frm_fansite.fansite.value);"><img src="/images/go.gif" width="18" height="18" border="0"></a></td>');
	document.write( '</FORM>' );
	document.write('            </tr>');
	document.write('          </table>');
*/
}

function go_minisite(url) {
	goto_page(url);
}

function goto_page(url) {
	if (url != '') {
		location.href = url;
	}
}

function footer_sponser() {
	document.write('<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">');
	document.write('	        <tr> ');
	document.write('	          <td>		  ');
	document.write('		  <table width="765" height="116" border="0" align="center" cellpadding="0" cellspacing="0" background="/images/sponsor_bg.gif">');
	document.write('              <tr> ');
	document.write('                <td width="6" valign="top"><img src="/images/sponsor_left.gif" width="6" height="94"></td>');
	document.write('                <td valign="top"><table width="100%" height="116" border="0" cellpadding="0" cellspacing="0">');
	document.write('                    <tr> ');
	document.write('                      <td height="70" align="center"><img src="/images/sponsor.gif" width="453" height="70"></td>');
	document.write('                    </tr>');
	document.write('                    <tr> ');
	document.write('                      <td height="23" align="right"><img src="/images/sponsor_buttom.gif" width="223" height="23"></td>');
	document.write('                    </tr>');
	document.write('                </table></td>');
	document.write('                <td width="6" align="right" valign="top"><img src="/images/sponsor_right.gif" width="7" height="116"></td>');
	document.write('              </tr>');
	document.write('            </table>');
	document.write('			</td>');
	document.write('	        </tr>');
	document.write('	      </table>');
/*	document.write('	<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">');
	document.write('        <tr> ');
	document.write('          <td><table width="765" height="77" border="0" align="center" cellpadding="0" cellspacing="0" background="/images/sponsor_bg.gif">');
	document.write('              <tr> ');
	document.write('                <td width="6" valign="top"><img src="/images/sponsor_left.gif" width="6" height="58"></td>');
	document.write('                <td><table width="100%" height="58" border="0" cellpadding="0" cellspacing="0">');
	document.write('                    <tr> ');
	document.write('                      <td height="54" align="center"><img src="/images/sponsor.gif" width="753" height="34"></td>');
	document.write('                    </tr>');
	document.write('                    <tr> ');
	document.write('                      <td height="23" align="right"><img src="/images/sponsor_buttom.gif" width="223" height="23"></td>');
	document.write('                    </tr>');
	document.write('                  </table></td>');
	document.write('                <td width="6" align="right" valign="top"><img src="/images/sponsor_right.gif" width="7" height="77"></td>');
	document.write('              </tr>');
	document.write('            </table></td>');
	document.write('        </tr>');
	document.write('      </table>');*/
}

//=============== today => 'DDMMYYYY' ===============
var stoday = "";
var now = new Date();
if (now.getDate() <= 9) {
	stoday += "0" + now.getDate();
} else {
	stoday += now.getDate();
}
if ((now.getMonth()+1) <= 9) {
	stoday += "0" + (now.getMonth()+1);
} else {
	stoday += (now.getMonth()+1);
}
stoday += now.getYear();

//================play webgame================
function play_webgame() {
	document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/'+stoday+'.js"></SCRIPT>');
	}

//=============== today wallpaper  ===============
document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/today_wpp.js"></SCRIPT>');
function today_wallpaper() {
	document.write("<a href=\"" + arr_lnk[eval(stoday)] + "\"><img src=\"" + arr_img[eval(stoday)] + "\" border=\"0\"></a>");
	document.write("<a href=\"" + arr_lnk[eval(stoday)]+"\"><p class=\"fontHeader\">"+ arr_txt[eval(stoday)]+"</p></a>");
}

//================today screenshot================
document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/today_screen.js"></SCRIPT>');
function today_screenshot() {
	document.write("<a href=\"" + arr_lnk_sh[eval(stoday)] + "\"><img src=\"" + arr_img_sh[eval(stoday)] + "\" border=\"0\"></a>");
	document.write("<a href=\"" + arr_lnk_sh[eval(stoday)]+"\"><p class=\"fontHeader\">"+ arr_txt_sh[eval(stoday)]+"</p></a>");
	}
	/*function today_screenshot(size) {
	if (size=='small')
	{
	document.write("<a href=\"" + arr_lnk_sh[eval(stoday)] + "\"><img src=\"" + arr_img_sh[eval(stoday)] + "\" border=\"0\" width=\"150\" height=\"113\"></a>");
	document.write("<font =><a href=\"" + arr_lnk_sh[eval(stoday)]+"\"><p class=\"fontHeader\">"+ arr_txt_sh[eval(stoday)]+"</p></a>");
	}else if (size=='big'){
	document.write("<a href=\"" + arr_lnk_sh[eval(stoday)] + "\"><img src=\"" + arr_img_sh[eval(stoday)] + "\" border=\"0\"></a>");
	document.write("<font =><a href=\"" + arr_lnk_sh[eval(stoday)]+"\"><p class=\"fontHeader\">"+ arr_txt_sh[eval(stoday)]+"</p></a>");
   }
}*/

//=============== display true hit stat ===============
/*function true_hit() {
	document.write('<!--* tag true hits add on 16 may 2002 *-->');
	document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#666699">');
	document.write('  <tr>');
	document.write('    <td align="center">');
	document.write('	<!--BEGIN WEB STAT CODE---->');
	document.write('	<SCRIPT LANGUAGE="javascript1.1"> page="gamesindex";<\/SCRIPT>');
	document.write('	<SCRIPT LANGUAGE="javascript1.1" src="http://truehits2.gits.net.th/data/d0004461.js"><\/SCRIPT>');
	document.write('	<!-- END WEBSTAT CODE -->');
	document.write('    </td>');
	document.write('  </tr>');
	document.write('</table>');
	document.write('<!--* end tag true hits add on 16 may 2002 *-->');
}*/

//=============== block ===============
function Arrow(Arrowname) {
		if (cat == 'mu') {
			document[Arrowname].src = (document[Arrowname].src.indexOf('arrow_on.gif') != -1) ? '/mu/images/arrow_off.gif' : '/mu/images/arrow_on.gif';
		} else if (cat == 'fairyland') {
			document[Arrowname].src = (document[Arrowname].src.indexOf('button_on.gif') != -1) ? '/fairyland/images/button_off.gif' : '/fairyland/images/button_on.gif';
		} else {
			document[Arrowname].src = (document[Arrowname].src.indexOf('arrow_on.gif') != -1) ? '/images/arrow_off.gif' : '/images/arrow_on.gif';
		}
}
//=============== end block ===============

document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/fl_mmagic.js"></SCRIPT>');
function fl_mmagic() {
	
	//========= default =========
	arr_fl_id[0] = "47958";
	arr_fl_im[0] = "http://www.mobilemagic.sanook.com/content/pictureGallery/000/121120.gif";
	arr_fl_id[1] = "47961";
	arr_fl_im[1] = "http://www.mobilemagic.sanook.com/content/pictureGallery/000/121123.gif";
	arr_fl_id[2] = "47964";
	arr_fl_im[2] = "http://www.mobilemagic.sanook.com/content/pictureGallery/000/121126.gif";

	document.write('<table width="100%" border="0" cellspacing="2" cellpadding="2">');
	document.write('<tr valign="top">');
	for (i=0; i<3; i++) {
		if (arr_fl_id[eval(stoday + i)] == undefined) {
			document.write('  <td align="center"><a href="http://mobilemagic.sanook.com/fairy/" target="new"><img src=\"' + arr_fl_im[i] + '\" width="70" border="0"></a><br><font color="#FF0000" size="-4">' + arr_fl_id[i] + '</font></td>');
		} else {
			document.write('  <td align="center"><a href="http://mobilemagic.sanook.com/fairy/" target="new"><img src=\"' + arr_fl_im[eval(stoday + i)] + '\" width="70" border="0"></a><br><font color="#FF0000" size="-4">' + arr_fl_id[eval(stoday + i)] + '</font></td>');
		}
	}
	document.write('</tr>');
	document.write('</table>');
}

function minisite_forum(site) {
	document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/' + site + '_forum.js"></SCRIPT>');
}

function minisite_mmagic(site) {
	//define default mmagic in minisite_manager.js
	//you have to include data file before call this function
	//document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/mu_mmagic.js"></SCRIPT>');

	
	/*//========= default =========
	arr_minisite_id = new Array();
	arr_minisite_im = new Array();
	arr_minisite_id[0] = "479587";
	arr_minisite_im[0] = "http://www.mobilemagic.sanook.com/content/pictureGallery/000/121120.gif";
	arr_minisite_id[1] = "479617";
	arr_minisite_im[1] = "http://www.mobilemagic.sanook.com/content/pictureGallery/000/121123.gif";
	arr_minisite_id[2] = "479647";
	arr_minisite_im[2] = "http://www.mobilemagic.sanook.com/content/pictureGallery/000/121126.gif";*/

	document.write('<table width="100%" border="0" cellspacing="2" cellpadding="2">');
	document.write('<tr valign="top">');
	var arr_tmpsite_id = eval("arr_" + site + "_id");
	var arr_tmpsite_im = eval("arr_" + site + "_im");
	for (i=0; i<3; i++) {

		//document.write( arr_tmpsite_id[eval(stoday + i)] + "<br>");
		if (arr_tmpsite_id[eval(stoday + i)] == undefined) {
			document.write('  <td align="center"><a href="' + minisite_mmagic_url  + '" target="new"><img src=\"' + arr_minisite_im[i] + '\" width="70" border="0"></a><br><font color="#FF0000" size="-4">' + arr_minisite_id[i] + '</font></td>');
		} else {
			document.write('  <td align="center"><a href="' + minisite_mmagic_url + '" target="new"><img src=\"' + arr_tmpsite_im[eval(stoday + i)] + '\" width="70" border="0"></a><br><font color="#FF0000" size="-4">' + arr_tmpsite_id[eval(stoday + i)] + '</font></td>');
		}
	}
	document.write('</tr>');
	document.write('</table>');
}

function minisite_mmagic(site) {
	//define default mmagic in minisite_manager.js
	//you have to include data file before call this function
	//document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/mu_mmagic.js"></SCRIPT>');

	document.write('<table width="100%" border="0" cellspacing="2" cellpadding="2">');
	document.write('<tr valign="top">');
	var arr_tmpsite_id = eval("arr_" + site + "_id");
	var arr_tmpsite_im = eval("arr_" + site + "_im");
	for (i=0; i<3; i++) {

		//document.write( arr_tmpsite_id[eval(stoday + i)] + "<br>");
		if (arr_tmpsite_id[eval(stoday + i)] == undefined) {
			document.write('  <td align="center"><a href="' + minisite_mmagic_url  + '" target="new"><img src=\"' + arr_minisite_im[i] + '\" width="70" border="0"></a><br><font color="#FF0000" size="-4">' + arr_minisite_id[i] + '</font></td>');
		} else {
			document.write('  <td align="center"><a href="' + minisite_mmagic_url + '" target="new"><img src=\"' + arr_tmpsite_im[eval(stoday + i)] + '\" width="70" border="0"></a><br><font color="#FF0000" size="-4">' + arr_tmpsite_id[eval(stoday + i)] + '</font></td>');
		}
	}
	document.write('</tr>');
	document.write('</table>');
}

/*function footer(){
			document.write('<scritp lauguage="javascript" src="/home/www/sanook/game/wwwroot/htdocs/footer.html"></script>');
			document.write('<SCRIPT LANGUAGE="JavaScript" SRC="/js/today_wpp.js"></SCRIPT>');
}*/

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//-------link ryl, fairy, rag, mu --------------------
function piclink_gameonline(){
document.write('<tr>');
document.write('    <td valign="top" bgcolor="#818181"></td>');
document.write('    <td bgcolor="#5C5C5C"><table width="770"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">');
document.write('        <tr>');
document.write('          <td align="center" valign="top">');
document.write('          <table width="760" height="78" border="0" cellpadding="0" cellspacing="0" background="/gameonline/images/allgame_bg.gif">');
document.write('            <tr>');
document.write('              <td align="center"><table width="98%"  border="0" cellspacing="0" cellpadding="0">');
document.write('                <tr align="center">');
document.write('                  <td><img src="/gameonline/images/fairy_online.gif" width="180" height="60"></td>');
document.write('                  <td><img src="/gameonline/images/mu_online.gif" width="180" height="60"></td>');
document.write('                  <td><img src="/gameonline/images/ragnarok.gif" width="180" height="60"></td>');
document.write('                  <td><img src="/gameonline/images/ryl_online.gif" width="180" height="60"></td>');
document.write('                </tr>');
document.write('              </table></td>');
document.write('            </tr>');
document.write('          </table>');
document.write('          </td>');
document.write('          </tr>');
document.write('      </table></td>');
document.write('    <td valign="top" bgcolor="#818181"></td>');
document.write('  </tr>');
}
