var ajax = new sack();
var contentObj1
var contentObj2
var contentObj3
var contentObj4

var isLoaded1
var isLoaded2
var isLoaded3
var isLoaded4


function showContent1()	// Displaying content in the content <div>
{
	contentObj1.innerHTML = ajax.response;	// ajax.response is a variable that contains the content of the external file	
	isLoaded1 = true;
	if( !isLoaded2 )
		getAjaxFile2('../_php/logistic_getElements2.ajax.php')
	
}
function showContent2()	// Displaying content in the content <div>
{
	contentObj2.innerHTML = ajax.response;	// ajax.response is a variable that contains the content of the external file	
	isLoaded2 = true;
	if( !isLoaded3 )
		getAjaxFile3('../_php/logistic_getElements3.ajax.php')
}
function showContent3()	// Displaying content in the content <div>
{
	contentObj3.innerHTML = ajax.response;	// ajax.response is a variable that contains the content of the external file	
	isLoaded3 = true;
	if( !isLoaded4 )
		getAjaxFile4('../_php/logistic_getElements4.ajax.php')
}
function showContent4()	// Displaying content in the content <div>
{
	contentObj4.innerHTML = ajax.response;	// ajax.response is a variable that contains the content of the external file	
	isLoaded4 = true;
}

function showWaitMessage1()
{
	contentObj1.innerHTML = 'Incarcare logistica .....';
}
function showWaitMessage2()
{
	contentObj2.innerHTML = 'Incarcare logistica .....';
}
function showWaitMessage3()
{
	contentObj3.innerHTML = 'Incarcare logistica .....';
}
function showWaitMessage4()
{
	contentObj4.innerHTML = 'Incarcare logistica .....';
}
function getAjaxFile1(fileName)
{
	ajax.requestFile = fileName;	// Specifying which file to get
	ajax.onCompletion = showContent1;	// Specify function that will be executed after file has been found
	ajax.onLoading = showWaitMessage1;	// Action when AJAX is loading the file
	ajax.runAJAX();		// Execute AJAX function	
}
function getAjaxFile2(fileName)
{
	ajax.requestFile = fileName;	// Specifying which file to get
	ajax.onCompletion = showContent2;	// Specify function that will be executed after file has been found
	ajax.onLoading = showWaitMessage2;	// Action when AJAX is loading the file
	ajax.runAJAX();		// Execute AJAX function	
}
function getAjaxFile3(fileName)
{
	ajax.requestFile = fileName;	// Specifying which file to get
	ajax.onCompletion = showContent3;	// Specify function that will be executed after file has been found
	ajax.onLoading = showWaitMessage3;	// Action when AJAX is loading the file
	ajax.runAJAX();		// Execute AJAX function	
}
function getAjaxFile4(fileName)
{
	ajax.requestFile = fileName;	// Specifying which file to get
	ajax.onCompletion = showContent4;	// Specify function that will be executed after file has been found
	ajax.onLoading = showWaitMessage4;	// Action when AJAX is loading the file
	ajax.runAJAX();		// Execute AJAX function	
}

function initAjaxDemo()
{
	contentObj1 = document.getElementById('contentContainer1');
	contentObj2 = document.getElementById('contentContainer2');
	contentObj3 = document.getElementById('contentContainer3');
	contentObj4 = document.getElementById('contentContainer4');

	isLoaded1 = false ;
	isLoaded2 = false ;
	isLoaded3 = false ;
	isLoaded4 = false ;

	getAjaxFile1('../_php/logistic_getElements1.ajax.php');
//	getAjaxFile2('../_php/logistic_getElements2.ajax.php');
//	getAjaxFile3('../_php/logistic_getElements3.ajax.php');
//	getAjaxFile4('../_php/logistic_getElements4.ajax.php');
}
window.onload = initAjaxDemo;
