/*
 * Navigation functions for slijterijheesen.nl
 * (C) 2010 by ExpaNet Internet Solutions
 * 
 * Functions:
 * 
 * @LoadSection
 * @LoadPage
 * @LoadText
 * @LoadImage
 */
var xmlHttp;

// Used in main links on top
function LoadSection(Menu, Image, Text) {
	LoadMenu(Menu);
	LoadText(Text);
	LoadImage(Image);
}

// Used in menu links
function LoadPage(Image, Text) {
	LoadText(Text);
	LoadImage(Image);
}

// This function is used be the LoadSection function, but can be called upon by itself.
function LoadText(Text) {
	document.getElementById("tekst_rechts").innerHTML = "Loading";
	
	xmlHttp1=GetXmlHttpObject()
	if (xmlHttp1==null)
	 {
	 alert ("Browser does not support HTTP Request");
	 return;
	 } 
	xmlHttp1.onreadystatechange=LoadTextstateChanged ;
	xmlHttp1.open("GET","pages/" + Text,true);
	xmlHttp1.send(null);
}

function LoadTextstateChanged() 
{ 
if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
 { 
	
	document.getElementById("tekst_rechts").innerHTML=xmlHttp1.responseText;

 } 
}

//This function is used be the LoadSection function, but can be called upon by itself.
function LoadMenu(Menu) {
	document.getElementById("tekst_submenu").innerHTML = "Loading";
	
	xmlHttp2=GetXmlHttpObject()
	if (xmlHttp2==null)
	 {
	 alert ("Browser does not support HTTP Request");
	 return;
	 } 
	xmlHttp2.onreadystatechange=LoadMenustateChanged ;
	xmlHttp2.open("GET","menu/" + Menu,true);
	xmlHttp2.send(null);
}

function LoadMenustateChanged() 
{ 
if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
 { 
	
	document.getElementById("tekst_submenu").innerHTML=xmlHttp2.responseText;

 } 
}

//This function is used be the LoadSection function, but can be called upon by itself.
function LoadImage(Image) {
	document.getElementById("image_midden").style.backgroundImage="url('images/pages/" + Image + "')";
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
