﻿function onOverLineBox_En(obj)
{
	obj.style.backgroundImage = 'url(images/linebox_hover.png)';
	ShowEventById_En(obj.id);
}

function onOutLineBox_En(obj)
{
	obj.style.backgroundImage = 'url(images/linebox_normal.png)';
}

function onOverLineBox_Vi(obj)
{
	obj.style.backgroundImage = 'url(images/linebox_hover.png)';
	ShowEventById_Vi(obj.id);
}

function onOutLineBox_Vi(obj)
{
	obj.style.backgroundImage = 'url(images/linebox_normal.png)';
}

// Ajax
var xmlHttp;

function CreateXMLHttpRequest()
{
	if(window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function ShowEventById_En(id)
{
	xmlHttp = CreateXMLHttpRequest();
	xmlHttp.onreadystatechange = ShowEventInCenterBox;
	var serverURL = "controller/ajax/GetEventByIdInCenterBox_En.php?id=" + id + "&t=" + new Date().getTime();
	xmlHttp.open("POST", serverURL, true);
	xmlHttp.send(null);
}

function ShowEventById_Vi(id)
{
	xmlHttp = CreateXMLHttpRequest();
	xmlHttp.onreadystatechange = ShowEventInCenterBox;
	var serverURL = "controller/ajax/GetEventByIdInCenterBox_Vi.php?id=" + id + "&t=" + new Date().getTime();
	xmlHttp.open("POST", serverURL, true);
	xmlHttp.send(null);
}

function loadLeftMain(id, language)
{
	xmlHttp = CreateXMLHttpRequest();
	xmlHttp.onreadystatechange = ShowIntroduce;
	var serverURL;
	if(id == 1)
		serverURL = "includes/introduce1.php?language=" + language + "&t=" + new Date().getTime();
	if(id == 2)
		serverURL = "includes/introduce2.php?language=" + language + "&t=" + new Date().getTime();
	if(id == 3)
		serverURL = "includes/introduce3.php?language=" + language + "&t=" + new Date().getTime();
	xmlHttp.open("POST", serverURL, true);
	xmlHttp.send(null);
}

function ShowEventInCenterBox()
{
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		document.getElementById("divCenterBox").innerHTML = xmlHttp.responseText;
	}
}

function ShowIntroduce()
{
	if(xmlHttp.readyState == 4 && xmlHttp.status == 200)
	{
		document.getElementById("divContentLeftMain").innerHTML = xmlHttp.responseText;
	}
}