var xmlhttp

function unloadsmallpicture()
{
document.small_image.src='Gallery_icons/empty_pic_before.jpg';
document.getElementById('small01').style.border ="none";
document.getElementById('small02').style.backgroundColor = "#262128";
document.getElementById('small02').innerHTML = "&nbsp;";

}

function loadsmallpicture()
{
document.getElementById('small01').style.border ="2px solid #999999";
document.getElementById('small02').style.backgroundColor = "#999999";
document.getElementById('small02').innerHTML = "<font style=\'font: bold 15px/1.5em Arial; color:#FFFFFF\'>BEFORE</font>";
} 

function loadingimg(img)
{
	xmlhttp = getXmlHttpObject();

	if(xmlhttp == null)
	{
		alert("Your browser does not support Ajax!");
		return;
	}
	var url = "loadingimg.php?big="+img;
	//url = url + "&sid=" + Math.random();
	
	unloadsmallpicture();
	document.big_image.src='Gallery_Icons/empty.jpg';


	xmlhttp.onreadystatechange = stateChanged3;
	xmlhttp.open("GET", url, true);
	xmlhttp.send(null);
}

function screenres()
{
	xmlhttp = getXmlHttpObject();

	if(xmlhttp == null)
	{
		alert("Your browser does not support Ajax!");
		return;
	}
	var width = screen.width;
	var height = screen.height;
	var url = "mainpage.php?screenwidth="+width+"&screenheight="+height;
	xmlhttp.onreadystatechange = stateChanged;
	xmlhttp.open("GET", url, true);
	xmlhttp.send(null);
}
function checkgallery(str, str2)
{
	xmlhttp = getXmlHttpObject();

	if(xmlhttp == null)
	{
		alert("Your browser does not support Ajax!");
		return;
	}
	var url = "loadcat.php?album="+str+"&page="+str2;

	unloadsmallpicture();
	document.big_image.src='Gallery_Icons/empty.jpg';
    
	xmlhttp.onreadystatechange = stateChanged4;
	xmlhttp.open("GET", url, true);
	xmlhttp.send(null);
}

function showgallery(str, str2)
{
	xmlhttp = getXmlHttpObject();

	if(xmlhttp == null)
	{
		alert("Your browser does not support Ajax!");
		return;
	}
	var url = "loadcontents.php?album="+str+"&page="+str2;
	unloadsmallpicture();
	document.big_image.src='Gallery_Icons/empty.jpg';
    
	xmlhttp.onreadystatechange = stateChanged2;
	xmlhttp.open("GET", url, true);
	xmlhttp.send(null);
}

function stateChanged()
{
	if(xmlhttp.readyState  == 4)
	{
		document.getElementById("gallerycont").innerHTML = xmlhttp.responseText;
	}
}
function stateChanged2()
{
	if(xmlhttp.readyState  == 4)
	{
		document.getElementById("gallerycont").innerHTML = xmlhttp.responseText;
	}
	else
	{
		document.getElementById("gallerycont").innerHTML = "<img src='loading2.gif' border='0'> <font style='color:#DDDDDD; font-size:10px; font-family:Arial'>Loading...</font>";

	}
}

function stateChanged3()
{
	if(xmlhttp.readyState  == 4)
	{
		document.getElementById("big_image").innerHTML = xmlhttp.responseText;
	}
	else
	{
		document.getElementById("big_image").innerHTML = "<br><br><div align='center'><img src='loading.gif' border='0'><br><font style='color:#DDDDDD; font-size:10px; font-family:Arial'>Loading...</font></div>";
	}
}
function stateChanged4()
{
	if(xmlhttp.readyState  == 4)
	{
		document.getElementById("nav").innerHTML = xmlhttp.responseText;
	}
}

function getXmlHttpObject()
{
	var xmlhttp = null;
	try
	{
		xmlhttp = new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	return xmlhttp;
}