
	var fifu_filecount = 0;
	var fifu_errorcount = 0;

	function fifu_selectcount(count){
		fifu_filecount = count;
		$('#fifucount').show();
		fifu_update_count(fifu_filecount);
	}	
	
	function fifu_debug(message){
		alert(message);
	}
	
	function fifu_complete(ReturnJSON){
		var fObj = jQuery.parseJSON(ReturnJSON);
		
		if (fObj.filename != 'error'){
	
			// add image to session structure
			$("#updater").load("ajax/galleryImage.cfm?action=new&fn="+fObj.filename);
			
		} else {
			fifu_errorcount = fifu_errorcount + 1;
		}
		fifu_filecount = fifu_filecount - 1;
		fifu_update_count(fifu_filecount);
	}
	
	function fifu_update_count(count){
		if (count){
			$('#count').html('Uploading '+ count +' file(s)... please wait.');
		} else {
			$('#count').html('');
			$('#fifucount').html('<tr><td colspan="4" id="count"></td></tr><tr class="head"><td>File Name</td><td>Size</td><td>File Type</td><td>Status</td></tr>');
			$('#fifucount').hide();
			// makesort('uploadpreview'); // make sortable
		}
	}

	function fifu_idClean(string){
		string = string.replace('#', '');
		string = string.replace('.', '');
		string = string.replace(' ', '');
		return string;
	}
	
	function fifu_selected(filename,filesize,filetype){ // sent from flash for each file selected
		var newrow = '<tr id="'+fifu_idClean(filename)+'"><td>'+filename+'</td><td>'+filesize+'</td><td>'+filetype+'</td><td>uploading...</td></tr>';
		$('#fifucount').append(newrow);
	}
	function fifu_loaded(filename){ // sent from flash for each file loaded
		$('#fifucount tr#'+fifu_idClean(filename)).children('td:eq(3)').html('processing...');
		$('#'+fifu_idClean(filename)).attr('id',null);
	}	
	
	
	
function photosDelete(photoIndex){
	$("#updater").load("ajax/galleryImage.cfm?action=delete&photoIndex="+photoIndex);
}	
