/*------------------------------------------- Ajax ---------------------------------------------*/

var objXmlHttp = getObjAjax();
var subXmlHttp = getObjAjax();

function getObjAjax()
{
	try
	{
		XmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			XmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}

	return XmlHttp;
}

function changerMenu(command)
{
	objXmlHttp.open("GET", "ajax.php?contenu=" + command + "&rnd=" + Math.random(), true);
	objXmlHttp.send(null);

	objXmlHttp.onreadystatechange=function()
	{
		if(objXmlHttp.readyState==4)
		{
			var result = objXmlHttp.responseText;

			document.getElementById("main").innerHTML = result;
		}
	}
}

function changerSubMenu(command)
{
	subXmlHttp.open("GET", "ajax.php?contenu=" + command + "&rnd=" + Math.random(), true);
	subXmlHttp.send(null);

	subXmlHttp.onreadystatechange=function()
	{
		if(subXmlHttp.readyState==4)
		{
			var result = subXmlHttp.responseText;

			document.getElementById("thumbnails").innerHTML = result;
		}
	}
}

function changerAction(action)
{
	document.getElementById("thumbnails").innerHTML = "";
		
	if (action == "weblog")
	{
		document.location.href="index.php";
	} else {
		if (document.getElementById('checkmenu').value == "sousmenu" && document.getElementById('checkmenu').value != "webdesign" && document.getElementById('checkmenu').value != "photography" && document.getElementById('checkmenu').value != "drawing")
		{
			Effect.SlideUp('sousmenu');
			changerSubMenu(action + "-sub");
			changerMenu(action);
			document.body.className = action;
			//document.getElementById('body').className = "action";
			document.getElementById('checkmenu').value = action;
			document.getElementById('checkslide').value = "slidedown_demoA";
			//Effect.Appear('main', { duration: 3.0 });
		} else {
			document.getElementById('checkmenu').value = action;
			if (document.getElementById('checkmenu').value == "prints" || document.getElementById('checkmenu').value == "webdesign" || document.getElementById('checkmenu').value == "photography" || document.getElementById('checkmenu').value == "drawing")
			{
				document.getElementById('checkmenu').value = "sousmenu";
				document.getElementById('checkslide').value = "slidedown_demoA";
				Effect.SlideDown('sousmenu');
				changerSubMenu(action + "-sub");
				changerMenu(action);
				document.body.className = action;
				//Effect.Appear('main', { duration: 3.0 });
				//document.getElementById('body').className = "action";
			}
			else {
			document.getElementById('checkslide').value = "slidedown_demoA";
			changerSubMenu(action + "-sub");
			changerMenu(action);
			document.body.className = action;
			//Effect.Appear('main', { duration: 3.0 });
			//document.getElementById('body').className = "action";
			}
		
		}
	}
	
}



function keepSousmenu(action) {
	changerSubMenu(action + "-sub");
	changerMenu(action);
	document.body.className = action;
	//document.getElementById('checkmenu').value = action;
	document.getElementById('checkslide').value = "slidedown_demoL";
}


function accordeon(id) {
	var checker = document.getElementById('checkslide').value;
	if (checker != '0')
	{
		document.getElementById('checkslide').value = id;
		Effect.SlideUp(checker);
		Effect.SlideDown(id);
	}
	else {
	document.getElementById('checkslide').value = id;
	Effect.SlideDown(id);
	}
}


/*------------------------------- thumbnails ------------------------------*/

