var html=new Array();
var temp=new Array();

/**
 * output the content
 */
function loading() {
	var myDiv=document.getElementById("content");

	if(temp[0] && temp[1] && temp[2]) {
 		myDiv.innerHTML+=html['folders'];
		myDiv.innerHTML+=html['images'];
		myDiv.innerHTML+=html['files'];
//		alert(myDiv.innerHTML);
		setIndicator('hidden');
	}
}

/**
 *	gets the data for the path (breadcrumb)
 *
 *	@param	string		folder		the folder that has to be displayed
 */
function getPath(folder) {
	var url="actions.php?a=getPath&f="+folder;
	doIt(url, outputPath, 0);
}

/**
 *	gets the folders/albums
 *
 *	@param	string		folder		the folder that has to be displayed
 */
function getFolders(folder) {
	var url="actions.php?a=getFolders&f="+folder;
	doIt(url, outputFolders, 1);
}

/**
 *	gets the images/thumbnails
 *
 *	@param	string		folder		the folder that has to be displayed
 */
function getImages(folder) {
	var url="actions.php?a=getImages&f="+folder;
	doIt(url, outputImages, 2);
}

/**
 *	gets the files
 *
 *	@param	string		folder		the folder that has to be displayed
 */
function getFiles(folder) {
	var url="actions.php?a=getFiles&f="+folder;
	doIt(url, outputFiles, 3);
}

/**
 *	gets a single photo
 *
 *	@param	string		folder		the folder where the photo is located
 *	@param	string		photo		the photo that has to be displayed
 */
function getPhoto(folder, photo) {
	var url="actions.php?a=getPhoto&f="+folder+"&p="+photo;
	doIt(url, outputPhoto, 4);
}

/**
 *	puts the data when its recieved in the array
 */
function outputPath() {
	var myDiv=document.getElementById("path");
	if (xmlHttp[0].readyState==4 || xmlHttp[0].readyState=="complete") {
		myDiv.innerHTML=xmlHttp[0].responseText;
		loading();
	}
}

/**
 *	puts the data when its recieved in the array
 */
function outputFolders() {
	temp[0]=false;
	if (xmlHttp[1].readyState==4 || xmlHttp[1].readyState=="complete") {
		html['folders']=xmlHttp[1].responseText;
		temp[0]=true;
		loading();
	}
}

/**
 *	puts the data when its recieved in the array
 */
function outputImages() {
	temp[1]=false;
	if (xmlHttp[2].readyState==4 || xmlHttp[2].readyState=="complete") {
		html['images']=xmlHttp[2].responseText;
		temp[1]=true;
		loading();
	}
}

/**
 *	puts the data when its recieved in the array
 */
function outputFiles() {
	temp[2]=false;
	if (xmlHttp[3].readyState==4 || xmlHttp[3].readyState=="complete") {
		html['files']=xmlHttp[3].responseText;
		temp[2]=true;
		loading();
	}
}

/**
 *	puts the data when its recieved in the array
 */
function outputPhoto() {
	var myDiv=document.getElementById("content");
	if (xmlHttp[4].readyState==4 || xmlHttp[4].readyState=="complete") {
		myDiv.innerHTML+=xmlHttp[4].responseText;
		setIndicator('hidden');
	}
}

