/*
 * Included by anything that needs to use file-like functions.
 */

function showTempFileArea() {
	var tempFileArea = document.getElementById("tempFileArea");
	//tempFileArea.style.background = '#ccf';
	if (tempFileArea.style.display == 'none') {
		//fadeOpacityShowHide("tempFileArea", 0, 1, 10, 200);
		$("#tempFileArea").fadeIn(300);
	}
	document.getElementById("tempFileAreaFile").style.display = 'none';
	document.getElementById("tempFileAreaAdvice").style.display = '';
}

function hideTempFileArea() {
	document.getElementById("tempFileAreaAdvice").style.display = '';
	var tempFileArea = document.getElementById("tempFileArea");
	if (tempFileArea.style.display != 'none') {
		//fadeOpacityShowHide("tempFileArea", 1, 0, 30, 600);
		$("#tempFileArea").fadeOut(600);
	}
}

function putFileInTempArea(file) {
	//console.log("putting file in temp area: "+file.dbid);
	/* css only - should do db stuff since is used upon page loading to display already temp'd file */
	document.getElementById("tempFileAreaAdvice").style.display = 'none';
	document.getElementById("tempFileAreaFileIcon").src = file.iconSrc
	
	/* re-write the string into a breaking one */
	var name = '';
	for(var i=0; i<file.name.length; i++) { 
		name += file.name.charAt(i);
		if (i<file.name.length-1) {
			name += "<wbr>";
		}
	}
	
	document.getElementById("tempFileAreaFileName").innerHTML = name;
	document.getElementById("tempFileAreaFile").style.display = '';
	document.getElementById("tempFileArea").style.display = '';
	//document.getElementById("tempFileArea").style.background = '#ded';
}

