var domok;
var skn;

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
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 getObject(Id) {
	if (document.all) return document.all[Id];
	return document.getElementById(Id);
}

function PopUpBlockerDetected()
{
	var msg;
	msg = "Oops, a Pop-Up blocker has been detected on your computer.\r\n";
	msg+= "This website needs Pop-Up windows to offer the content you asked for.\r\n";
	msg+= "We advise you to disable this software to browse our website;\r\n";
	msg+= "eGSM will NOT show ANY advertisting Pop-Up !\r\n";
	msg+= "Sometimes, you just have to keep the [Ctrl] key pressed to authorize Pop-Ups";
	alert(msg);
}
function PopUp(Url, Width, Height)
{
	var Top = (screen.height - Height) / 2;
	var Left = (screen.width - Width) / 2;
	var pW = window.open("","_blank","top="+Top+",left="+Left+",width="+Width+",height="+Height+",resizable=no,status=yes,menubar=no,toolbar=no,scrollbars=no");
	if ((pW == null) || (typeof(pW) == "undefined"))
	{
		PopUpBlockerDetected();
		return false;
	}
	try {
		pW.name;
	}
	catch(e) {
		PopUpBlockerDetected();
		return false;
	}
	pW.location = Url;
}

function StartJS() {
	MM_reloadPage(true);
	domok = document.getElementById;
	if (domok)
	{
		skn = document.getElementById("topdecklink").style;
		if(navigator.appName.substring(0,3) == "Net")
		{
			document.captureEvents(Event.MOUSEMOVE);
		}
		document.onmousemove = get_mouse;
	}
}

function poplink(Name, postdate, Mota,tinhtrang)
{
	content =	"<table width=300 border=0 cellpadding=0 cellspacing=0 class=tableinfo>";
	content+=		"<tr height=13>";
	content+=			"<td><b>Tên phim: <font color=red>" + Name + "</b></font></td>";
	content+=		"</tr>";
	content+=		"<tr height=13>";
	content+=			"<td><b>Ngày đăng: </b>" + postdate + "</td>";
	content+=		"</tr>";
	content+=		"<tr height=13>";
	content+=			"<td><b>Số tập: </b>" + Mota + " tập</td>";
	content+=		"</tr>";
	content+=		"<tr height=13>";
	content+=			"<td><b>Thể loại: <font color=red>" + tinhtrang + "</b></font></td>";
	content+=		"</tr>";
	content+=	"</table>";

	if (domok)
	{
		document.getElementById("topdecklink").innerHTML = content;
		skn.visibility = "visible";
	}
}

function get_mouse(e)
{
	ns = (navigator.appName.substring(0,3) == "Net");
	x = ( ns ? e.pageX : (event.x + document.body.scrollLeft) );
	y = ( ns ? e.pageY : (event.y + document.body.scrollTop) );
	skn.left = x - 0;
	skn.top = y+20;
}

function killlink()
{
	if (domok)
	{
		skn.visibility = "hidden";
	}
}

/*
 * Page resellers
 */

function ViewZone(Zone, Visible)
{
	var Obj;
	if (Obj = getObject("Zone" + Zone)) {
		Obj.style.display = ( Visible ? "block" : "none" );
	}
}
function SwitchZone(Zone)
{
	getObject("DarkMapId").src = "/img/map/" + Zone + "-Dark.gif";
	ViewZone("America", false);
	ViewZone("Europe", false);
	ViewZone("Africa", false);
	ViewZone("East", false);
	ViewZone("Australia", false);
	ViewZone(Zone, true);
}
function OpenCloseCountry(Country)
{
	var Style;
	Style = getObject("Country" + Country).style;
	Style.display = ( Style.display == "" ? "none" : "" );
}
function RolloverZone(Zone)
{
	if (Zone == "") {
		getObject("LightMapId").src = "/img/map/blank.gif";
	}
	else {
		getObject("LightMapId").src = "/img/map/" + Zone + "-Light.gif";
	}
}

