// 
// NOTE: REQUIRES jQuery to be LOADED
//

// this function is called by the flash uplodaer only if ALLLL files were uploaded successfully
function toggleUploader()
{

	setTimeout('$("#backgroundPopup").hide()', 800);
	setTimeout('$("#popup").fadeOut("slow")', 800);

	popupStatus = 0;
	popupStatus = 0;
	$("#no_files_message").hide();
	
}

// this function is called by the flash uploader if upload success
function loadFileDiv( path_id, file_name)
{

	// IF PHOTO!
	if($("#global_path").attr('path_flag') == 'a')
	{
	
		$.get('/files_ajax_divs.php?a=add_photo&file_name='+file_name+'&path_id='+path_id+'&sid='+Math.random(),function(data){
			$(data).appendTo('#new_photo_divs');
		}); 
		
		window.location.hash="new_photos"; 
		
	}
	
	// IF FILE!
	else
	{
	
		var duplicate = false;
		$("input[name=files]").each(
		function() {
			var id = this.id.substring(1, this.id.length);

			var this_file_name = $('#x'+id).attr('file_name')

			if(this_file_name == file_name)
			{
				$('#'+id).remove();
				duplicate = true;
			}
			
		}
		);
	
		if(duplicate == false)
		{
		
			// update pagination FOR NEW FILES ONLY!! SICK AJAX
			var min = $('#min').html();
			var max = $('#max').html();
			var file_count = $('#file_count').html();
			if(min == 0)
				min = 1;
			$('#min').html(min);
			$('#max').html(++max);
			$('#file_count').html(++file_count);
			
		}
	
		$.get('/files_ajax_divs.php?a=add_file&file_name='+file_name+'&path_id='+path_id+'&path='+$("#global_path").attr("path")+'&sid='+Math.random(),function(data){
			$(data).prependTo('#new_file_divs');
		}); 
	
		setTimeout('file_list.redoRows()', 350);
		
	}
	
}

// this function is called by the flash uploader if upload failure
function uploaderError(path_id, file_name)
{

	// if file already errored out and div is displayed already
	if($('#error').is(":visible"))
	{
	
		var content = $('#error_file_names').html();
		
		content = content+', '+file_name;
		
	
	}
	
	// if error occured and is first file
	else
	{
	
		$('#error').show();
	
		var content = file_name;
		
	}

	$('#error_file_names').html(content);

}




function makeAction(id)
{

	switch(id)
	{
		case "download":
			file_list.hideMenu();
			file_list.doDownload();
			file_list.deselectAll();
		break;
		
		case "delete":
			file_list.hideMenu();
			file_list.deleteDiv();
		break;
		
		case "unlink":
			file_list.hideMenu();
			file_list.unlinkDiv();
		break;
		
		case "move":
			file_list.hideMenu();
			file_list.moveDiv();
		break;

		case "send_file":
			file_list.hideMenu();
			file_list.sendFileDiv();
		break;
		
		case "share":
			file_list.hideMenu();
			file_list.shareDiv();
		break;
		
		case "members":
			file_list.hideMenu();
			file_list.membersDiv();
		break;
		
		case "unshare":
			file_list.hideMenu();
			file_list.unshareDiv();
		break;
		
		case "upload":
			file_list.uploadDiv();
		break;
		
		case "edit":
			file_list.hideMenu();
			file_list.doEdit();
			file_list.deselectAll();
		break;
		
		case "get_public_link":
			file_list.hideMenu();
			file_list.publicLinkDiv();
		break;
		
		case "view_photo":
			file_list.hideMenu();
			file_list.viewPhoto();
			file_list.deselectAll();
		break;
		
		case "version_history":
			file_list.hideMenu();
			file_list.historyDiv();
		break;

	}

}


// create object of file list
function object_list()
{
	
	this.selected_order= new Array();
	this.selected= new Array();
	this.folder_stat = new Array();
	this.old_color=new Array();
	this.count=0;
	this.last_count=0;
	this.popup_id = 0;
	this.last_id = 0;
	this.select = 0;
	this.create_folder_div = 0;
	this.one_selected = 0;
	this.oldNameHolder = ''; // used to keep track of the existing File Name div.  Needed for rename canceling.
	this.path= '';
	this.toggleAllSet = false;
	this.masterCheckboxClicked = false; // used to keep track of when the master checkbox is clicked.  Needed for weird mouseover/out issues
	this.rename_id = 0; // used to keep track of the id where the rename box is displayed
	
}

var file_list = new object_list();


// function to build a list of the selected ids so we can neatly pass it into PHP as a single string
object_list.prototype.buildIdList = function()
{

	var id_list = 'li';

	$("input[name=files]:checked").each(
		function() {
			var id = this.id.substring(1, this.id.length);
				id_list += ','+id;	
		}
		);
	
	return id_list;
	
}

// select single file
object_list.prototype.selectOne = function(ob, single) 
{

	// hide existing rename box if showing already
	if(this.rename_id != 0)
		file_list.cancelRename(this.rename_id);
				
	if(single == undefined) 
		single = true;
	
	// user clicks checkbox, also highlight row
	if($("#x"+ob).is(':checked') && single == false)
	{
		this.selectRow(ob);
	}
	
	// if user unclicks checkbox, dehighlight row
	else if(single == false)
	{	
		this.deselectRow(ob);
	}
	
	// if user clicks row and checkbox is checked already, then deselect
	else if($("#x"+ob).is(':checked') && single == true)
	{
		this.deselectRow(ob);
	}
	
	// if user clicks row and checkbox is not checked already, select row
	else
	{
		this.deselectAll(false);
		this.selectRow(ob);
	}
	
	if($("input[name=files]:checked").length>0)
		this.showMenu(ob)
	else
		this.hideMenu();

}

// function used to select row (change background color, check checkbox)
object_list.prototype.selectRow = function(row) 
{

	$("#"+row).toggleClass("my_files_row_on", true);
	$("#x"+row).attr('checked', true);

}

// function used to deselect row (change background color, uncheck checkbox)
object_list.prototype.deselectRow = function(row) 
{
	
	$("#"+row).toggleClass("my_files_row_on");
	$("#x"+row).attr('checked', false);

}

// function to show popup menu
object_list.prototype.showMenu = function(row) {
	var rowTop = $('#'+row).offset().top;
	var menuOffset = 10;
	var flag = '';
	
	// if menu isnt showing
	if($('#file_action_menu_popup').css('display') == 'none')
	{
		
		$('#file_action_menu_popup').css('top', rowTop-menuOffset);
		$('#file_action_menu_popup').fadeIn('fast');
		$('#file_action_menu_popup').draggable({cancel: "div[name='file_action_button']"});
	}
	else
		$('#file_action_menu_popup').animate({"top": rowTop-menuOffset}, "slow");
	
	// get flag from unique identifier (remember 'x' is first character though by default)
	$("input[name=files]:checked").each(
	function() {
		flag = this.id.substring(1, 2);
	}
	);

	// selecting host
	if(flag == 'h')
	{
	
		$('#files_popup_open').show();
		$('#files_popup_rename').show();
		$('#files_popup_share').hide();
		$('#files_popup_download').hide();
		$('#files_popup_move').hide();
		$('#files_popup_delete').hide();
		$('#files_popup_email').hide();
		$('#files_popup_edit').hide();
		$('#files_popup_history').hide();
		$('#files_popup_public').hide();
		$('#files_popup_private').hide();
		$('#files_popup_unshare').hide();
		$('#files_popup_members').hide();
		$('#files_popup_public_link').hide();
		$('#files_popup_unlink').show();
		$("#menu_unlink_text").html("Unlink");
	
	}
	
	// selecting path
	else if(flag == 'p')
	{
	
		$('#files_popup_open').show();
		$('#files_popup_rename').show();
		$('#files_popup_share').show();
		$('#files_popup_download').show();
		$('#files_popup_delete').show();
		$("#menu_delete_text").html("Delete");
		$('#files_popup_email').hide();
		$('#files_popup_edit').hide();
		$('#files_popup_history').hide();
		$('#files_popup_private').show();
		$('#files_popup_public').show();
		$('#files_popup_unshare').hide();
		$('#files_popup_members').hide();
		$('#files_popup_public_link').hide();
		
		// for shared folders
		if($("input[name=files]:checked").attr('shared') == '1')
		{
		
			// if NOT the owner, user cant deletem rename or MOVE the file!
			if($("input[name=files]:checked").attr('is_owner') == '0')
			{
				
				$('#files_popup_delete').hide();
				$('#files_popup_move').hide();
				$('#files_popup_rename').hide();
				
			}
			
			$('#files_popup_unshare').show();
			$('#files_popup_members').show();
			$('#files_popup_private').hide();
			$('#files_popup_public').hide();
		
		}
		
		// for paths outside web root
		if($("input[name=files]:checked").attr('host_id') == '0')
		{
			$('#files_popup_share').show();
			$('#files_popup_unlink').hide();
		}
		else
		{
		
			$('#files_popup_unshare').hide();
			$('#files_popup_share').hide();
			$('#files_popup_unlink').show();
			$("#menu_unlink_text").html("Unsync");
		}
			
	}
	// selecting file
	else if(flag == 'f')
	{

		$('#files_popup_open').hide();	
		$('#files_popup_rename').show();
		$('#files_popup_share').hide();
		$('#files_popup_download').show();
		$('#files_popup_delete').show();
		$("#menu_delete_text").html("Delete");
		$('#files_popup_email').show();
		$('#files_popup_edit').show();
		$('#files_popup_history').show();
		$('#files_popup_unshare').hide();
		$('#files_popup_members').hide();
		$('#files_popup_public_link').show();
		$('#files_popup_unlink').hide();
		
		// for public files
		if($("input[name=files]:checked").attr('is_public') == 1)
		{
			$('#files_popup_private').show();
			$('#files_popup_public').hide();
		}
		else
		{
			$('#files_popup_private').hide();
			$('#files_popup_public').show();
		}
		
		// for Edit Document button
		if(
			($("input[name=files]:checked").attr('file_type') != "doc") && 
			($("input[name=files]:checked").attr('file_type') != "docx") && 
			($("input[name=files]:checked").attr('file_type') != "rtf") && 
			($("input[name=files]:checked").attr('file_type') != "odt") && 
			($("input[name=files]:checked").attr('file_type') != "sxw") &&
			($("input[name=files]:checked").attr('file_type') != "html") &&
			($("input[name=files]:checked").attr('file_type') != "txt") &&
			($("input[name=files]:checked").attr('file_type') != "xls") &&
			($("input[name=files]:checked").attr('file_type') != "xlsx") &&
			($("input[name=files]:checked").attr('file_type') != "ods") &&
			($("input[name=files]:checked").attr('file_type') != "sxc") &&
			($("input[name=files]:checked").attr('file_type') != "csv") &&
			($("input[name=files]:checked").attr('file_type') != "tsv") &&
			($("input[name=files]:checked").attr('file_type') != "ppt") &&
			($("input[name=files]:checked").attr('file_type') != "pps") &&
			($("input[name=files]:checked").attr('file_type') != "odp") &&
			($("input[name=files]:checked").attr('file_type') != "sxi")
		)
		$('#files_popup_edit').hide();

		// FOR FUTURE - view for image types
		/*
		if(
			($("input[name=files]:checked").attr('file_type') != "bmp") &&
			($("input[name=files]:checked").attr('file_type') != "gif") && 
			($("input[name=files]:checked").attr('file_type') != "jpg") && 
			($("input[name=files]:checked").attr('file_type') != "png") && 
			($("input[name=files]:checked").attr('file_type') != "psd") && 
			($("input[name=files]:checked").attr('file_type') != "pspimage") && 
			($("input[name=files]:checked").attr('file_type') != "thm") && 
			($("input[name=files]:checked").attr('file_type') != "tif") &&
			($("input[name=files]:checked").attr('file_type') != "yuv")		
		)
		$('#files_popup_view').hide();
		*/

	}

	// if in another host
	if($("#global_path").attr('host_id') != 0)
	{
		
		$('#files_popup_move').hide();
	
	}
	else
	{
	
		$('#files_popup_move').show();
	
	}
	
	// if selecting more than one file
	if($("input[name=files]:checked").length>1)
	{
		$('#files_popup_rename').hide();
		$('#files_popup_open').hide();
		$('#files_popup_history').hide();
		$('#files_popup_edit').hide();
		$('#files_popup_email').hide();
		$('#files_popup_unshare').hide();
		$('#files_popup_members').hide();
		$('#files_popup_public_link').hide();
		
		// for shared folders
		$("input[name=files]:checked").each(
			function() {
			
			if($(this).attr('shared') == '1')
			{
		
				// if NOT the owner, user cant deletem rename or MOVE the file!
				if($(this).attr('is_owner') == '0')
				{
					
					$('#files_popup_delete').hide();
					$('#files_popup_move').hide();
					
				}
	
			}	
			
			}
		);

		// hide menu if selecting more than one host
		var host_cnt = 0;
		$("input[name=files]:checked").each(
			function() {
				flag = this.id.substring(1, 2);
				if(flag == 'h')	
					host_cnt++;
			}
		);
		
		if(host_cnt > 0)
			$('#file_action_menu_popup').hide();
		
	}
	
}


// function to hide popup menu
object_list.prototype.hideMenu = function() 
{

	$('#file_action_menu_popup').hide();

}

// function to show checkbox popout
object_list.prototype.show_master_checkbox_div = function() 
{
	
	if(this.masterCheckboxClicked == true)
		this.masterCheckboxClicked = false;
	else
		this.masterCheckboxClicked = true;
		
	$('#checkmark_menu').toggle();
	$("#checkbox_header").toggleClass("checkbox_header_on");	
	
}

// function to change class of mastercheckbox popout upon mouseOut
object_list.prototype.checkbox_mouse_out = function() 
{
	if(this.masterCheckboxClicked == false)
		$("#checkbox_header").toggleClass("checkbox_header_over");
		
}

// function to change class of mastercheckbox popout upon mouseOver
object_list.prototype.checkbox_mouse_over = function() 
{

	if(this.masterCheckboxClicked == false)
		$("#checkbox_header").toggleClass("checkbox_header_over");

}


object_list.prototype.toggleAll = function() {

	// if files are not set, then set them
	if(this.toggleAllSet == false)
	{

		this.selectAll();
		
		this.toggleAllSet = true;
	
	}

	else if(this.toggleAllSet == true)
	{

		this.deselectAll(true);
	
	}

}

// function to deselect all files from list
object_list.prototype.deselectAll = function(clearMenu) 
{

	$("input[name=files]:checked").each(
	function() {
		var id = this.id.substring(1, this.id.length);
		//alert(id);
		$(this).attr('checked', false);
		$("#"+id).toggleClass("my_files_row_on");

		// hide existing rename box if showing already
		if(file_list.rename_id != 0)
			file_list.cancelRename(file_list.rename_id);

	}
	);

	if(clearMenu != false)
		this.hideMenu();
	
	$('input[name=master_checkbox]').attr('checked', false);
	this.toggleAllSet = false;
	this.masterCheckboxClicked = false;
	$("#checkbox_header").removeClass("checkbox_header_on");
	$("#checkbox_header").removeClass("checkbox_header_over");
	$("#checkbox_header").addClass("checkbox_header");
	$('#checkmark_menu').hide();

}

// function to select all files from list
object_list.prototype.selectAll = function() 
{

	$("input[name=files]:not(:checked)").each(
	function() {
		var id = this.id.substring(1, this.id.length);
		var flag = this.id.substring(1, 2);
		
		// dont select hosts! pointless!!!!!!!!!
		if(flag != 'h')
		{
		
			$(this).attr('checked', true);
			$("#"+id).toggleClass("my_files_row_on");
			
		}

	}
	);

	$('input[name=master_checkbox]').attr('checked', true);
	$("#checkbox_header").removeClass("checkbox_header_on");
	$("#checkbox_header").removeClass("checkbox_header_over");
	$("#checkbox_header").addClass("checkbox_header");
	$('#checkmark_menu').hide();

	if($("input[name=files]:checked").length>0)
		this.showMenu($("input[name=files]").first().attr('id'))
	else
		this.hideMenu();
		
}

// function to select only Public files
object_list.prototype.selectPublic = function() 
{

	this.deselectAll(false);
	$("input[name=files]").each(
	function() {
		var id = this.id.substring(1, this.id.length);
		if($("#x"+id).attr('is_public') == "1")
		{
			$(this).attr('checked', true);
			$("#"+id).toggleClass("my_files_row_on");
		}	
	}
	);

	$('input[name=master_checkbox]').attr('checked', true);
	$("#checkbox_header").removeClass("checkbox_header_on");
	$("#checkbox_header").removeClass("checkbox_header_over");
	$("#checkbox_header").addClass("checkbox_header");
	$('#checkmark_menu').hide();

	if($("input[name=files]:checked").length>0)
		this.showMenu($("input[name=files]").first().attr('id'))
	else
		this.hideMenu();

}

// function to select only Private files
object_list.prototype.selectPrivate = function() 
{

	this.deselectAll(false);
	$("input[name=files]").each(
	function() {
		var id = this.id.substring(1, this.id.length);
			
		if($("#x"+id).attr('is_public') != "1")
		{
			$(this).attr('checked', true);
			$("#"+id).toggleClass("my_files_row_on");
		}	
	}
	);

	$('input[name=master_checkbox]').attr('checked', true);
	$("#checkbox_header").removeClass("checkbox_header_on");
	$("#checkbox_header").removeClass("checkbox_header_over");
	$("#checkbox_header").addClass("checkbox_header");
	$('#checkmark_menu').hide();
	
	if($("input[name=files]:checked").length>0)
		this.showMenu($("input[name=files]").first().attr('id'))
	else
		this.hideMenu();

}

// function to select only Shared folders
object_list.prototype.selectShared = function() {
	this.deselectAll(false);
	$("input[name=files]").each(
	function() {
		var id = this.id.substring(1, this.id.length);
			
		if($("#x"+id).attr('shared') == "1")
		{
			$(this).attr('checked', true);
			$("#"+id).toggleClass("my_files_row_on");
		}	
	}
	);

	$('input[name=master_checkbox]').attr('checked', true);
	$("#checkbox_header").removeClass("checkbox_header_on");
	$("#checkbox_header").removeClass("checkbox_header_over");
	$("#checkbox_header").addClass("checkbox_header");
	$('#checkmark_menu').hide();
	
	if($("input[name=files]:checked").length>0)
		this.showMenu($("input[name=files]").first().attr('id'))
	else
		this.hideMenu();

}

// function to make a file Public
object_list.prototype.makePublic = function()
{
	this.hideMenu();

	var id_list = this.buildIdList();
	var action=new String("/files_action.php?a=make_public&filelist=");
	action+=id_list;
	action=action+"&sid="+Math.random();

	$.get(action);
	
	$("input[name=files]:checked").each(
	function() {
		var id = this.id.substring(1, this.id.length);
			
		$('#name_icon_'+id).html('<img border="0" src="/view/images/public.png" style="padding-top: 7px; padding-left: 6px;" />');
		// adjust is_public attribute for AJAX!
		$("#x"+id).attr('is_public', 1);
		
	}
	);
	
	this.deselectAll();
	
}
	
// function to make a file Private	
object_list.prototype.makePrivate = function()
{

	this.hideMenu();
	var id_list = this.buildIdList();
	var action=new String("/files_action.php?a=make_private&filelist=");
	action+=id_list;
	action=action+"&sid="+Math.random();	

	$.get(action);
	
	$("input[name=files]:checked").each(
	function() {
		var id = this.id.substring(1, this.id.length);
			
		$('#name_icon_'+id).html('');
		// adjust is_public attribute for AJAX!
		$("#x"+id).attr('is_public', 0);
		
	}
	);
	
	this.deselectAll();
	
}

// function to navigate up a level (Up button)
object_list.prototype.navigateFolder = function()
{
	
	var path = window.location.pathname;

	// check to make sure last character is a slash, if not, add it MOFO!
	if(path.charAt(path.length-1) != '/')
		path = path+'/';
	
	window.location = (path+$("input[name=files]:checked").attr('url')+"/");

}
	
// function to show Version History popup
object_list.prototype.historyDiv = function()
{

	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	$("#popup_title").html("Version History");
	$("#popup_content").html("<br /><br />Loading...<br /><br />");

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=version_history");
	var id;	
	
	$("input[name=files]:checked").each(
		function() {
			id = this.id.substring(1, this.id.length);
				action=action+"&id="+id;	
		}
		);
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;
			$("#popup_content").html(content);
				
		}
	}

	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to make a file active, used with Version History
object_list.prototype.makeActive = function(new_file_id)
{
	
	var new_file_id = new_file_id.substring(7);

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=make_active&id=");
	action+=new_file_id;
	action+="&sid="+Math.random();

	self.location = action;

}

object_list.prototype.restoreFiles = function(){

		var id_list = this.buildIdList();
		
		var action=new String("/files_action.php?a=restore_files&filelist=");
		action+=id_list;
		self.location = action;

}

// function to display a photo nicely that is not in a photo album (NOT IMPLEMENTED YET)
object_list.prototype.viewPhoto = function()
{

	var id_list=this.buildIdList();
	var cnt=0;
	var filecount=0;
	
	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		filecount++;
		}
	}

	var action=new String("/files_action.php?a=view_photo&filelist=");
	action+=id_list;
	action+="&filecnt=";
	action+=filecount;

	window.open(action,'Edit_Document','width=1000,height=900');
	
}

// function to do delete action to database
object_list.prototype.doDelete = function()
{

	var cnt=0;
	var id_list = this.buildIdList();

	var action=new String("/files_action.php?a=delete&filelist=");
	action+=id_list;
	action=action+"&sid="+Math.random();

	var xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=action;


	xmlHttp.onreadystatechange = function()
	{ 
	
		if (xmlHttp.readyState==4)
		{

			var cnt = 0;
			$("input[name=files]:checked").each(
			function() {
				cnt++;
				var id = this.id.substring(1, this.id.length);
				$("#"+id).remove();
			}
			);
			
			// update pagination!! SICK AJAX
			var min = $('#min').html();
			var max = $('#max').html();
			var file_count = $('#file_count').html();
			if(max - cnt == 0)
			{
				min = 0;
				$('#no_files_message').show();
			}
			
			$('#min').html(min);
			$('#max').html(max-cnt);
			$('#file_count').html(file_count-cnt);
			
			file_list.redoRows();
			disablePopup();

		}
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	$('#files_message_div').slideDown;

}

// function to do unlink action to database
object_list.prototype.doUnlink = function()
{

	var cnt=0;
	var id_list = this.buildIdList();

	var action=new String("/files_action.php?a=unlink&filelist=");
	action+=id_list;
	action=action+"&sid="+Math.random();

	var xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=action;


	xmlHttp.onreadystatechange = function()
	{ 
	
		if (xmlHttp.readyState==4)
		{

			var cnt = 0;
			$("input[name=files]:checked").each(
			function() {
				cnt++;
				var id = this.id.substring(1, this.id.length);
				$("#"+id).remove();
			}
			);
			
			// update pagination!! SICK AJAX
			var min = $('#min').html();
			var max = $('#max').html();
			var file_count = $('#file_count').html();
			if(max - cnt == 0)
			{
				min = 0;
				$('#no_files_message').show();
			}
			
			$('#min').html(min);
			$('#max').html(max-cnt);
			$('#file_count').html(file_count-cnt);
			
			file_list.redoRows();
			disablePopup();

		}
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

// function to do Move action to database
object_list.prototype.doMove = function(path_id) 
{

	var cnt=0;
	var id_list = this.buildIdList();

	var action=new String("/files_action.php?a=move_files&filelist=");
	action+=id_list;
	action+="&path_id=";
	action+=path_id;
	action+="&sid="+Math.random();

	var xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=action;

	xmlHttp.onreadystatechange = function()
	{ 
	
		if (xmlHttp.readyState==4)
		{

			var response = xmlHttp.responseText;
			
			if(response != "error" && response != "error2" && response != "error3")
			{
			
				$("input[name=files]:checked").each(
				function() {
					var id = this.id.substring(1, this.id.length);
					$("#"+id).remove();
				}
				);
			
				file_list.redoRows();
			
			}
			
			// else show error message
			else if(response == "error")
			{
		
				show_message_div("You cannot move a folder into itself.", "files_message_div");
			
			}
			else if(response == "error2")
			{
		
				show_message_div("You cannot move a folder into one of its subfolders.", "files_message_div");
			
			}
			else if(response == "error3")
			{
		
				show_message_div("You already have a file or path with that same name. Please check for duplicates before moving here.", "files_message_div");
			
			}
			
			
			disablePopup();

		}
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	$('#files_message_div').slideDown;

}

// function to show create folder div
object_list.prototype.show_create_folder_div = function(flag, folder_level) 
{

	if(this.create_folder_div == 0)
	{

		this.create_folder_div = 1;
		
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
	  
			alert ("Your browser does not support AJAX!");
			return;
		}	 
	
		var action=new String("/files_ajax_divs.php?");
		action=action+"a=create_folder";
		action=action+"&f="+folder_level;
		action=action+"&flag="+flag;
		action=action+"&sid="+Math.random();
	
		xmlHttp.onreadystatechange = function()
		{ 
			
			if (xmlHttp.readyState==4)
			{ 
				
				var row = document.createElement('div');
				row.id  = 'new_folder_row';
				row.innerHTML=xmlHttp.responseText;

				document.getElementById('new_folder_div').appendChild(row);
				document.getElementById('new_folder_form').new_folder_field.focus();
				document.getElementById('new_folder_form').new_folder_field.select();

			}
		}

		xmlHttp.open("GET",action,true);
		xmlHttp.send(null);
	
	}

}

// function to do create folder action to database
object_list.prototype.create_folder = function(path,name,flag) 
{

	// hide old div
	var new_folder_div = document.getElementById("new_folder_row");
	document.getElementById('new_folder_div').removeChild(new_folder_div);
	this.create_folder_div = 0;

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=create_folder&parent_path=");
	action+=path;
	action+="&name=";
	action+=name;
	action+="&flag=";
	action+=flag;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var path_id= xmlHttp.responseText;		
			file_list.show_new_path_row(path_id);
			
			$('#no_files_message').hide();
			
			// ajax vagination again!! i mean pagination sry! 
			var min = $('#min').html();
			var max = $('#max').html();
			var file_count = $('#file_count').html();
	
			if(min == 0)
			{
				min = 1;
			}
				
			$('#min').html(min);
			$('#max').html(++max);
			$('#file_count').html(++file_count);

		}
	}

	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to do show new path row in files table
object_list.prototype.show_new_path_row = function(unique_id) 
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 
	
	var action=new String("/files_ajax_divs.php?");
	action=action+"a=add_path";
	action=action+"&path="+$("#global_path").attr('path');
	action=action+"&id="+unique_id;
	action=action+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			var row = document.createElement('div');
			row.innerHTML=xmlHttp.responseText;
			$('#new_file_divs').prepend(row);
			file_list.redoRows();
			//$("#no_files_message").hide();

		}
	}

	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);
	
}

// separate function to dynamically find width remaining of files name because we need to have popup menu come up if clicked
function fillwidth(unique_id) 
{
	
	var name = '#name_'+unique_id;
	var name_icon = '#name_icon_'+unique_id;
	var name_width = $(name).width();
	var name_icon_width = $(name_icon).width();

	var filler_width = 390 - name_width - name_icon_width;
	$('#name_filler_'+unique_id).width(filler_width);

}

// function to show rename input field
object_list.prototype.show_rename_div = function(page_no) 
{

	var action=new String("/files_ajax_divs.php?");
	action=action+"a=rename";
	action=action+"&page_no="+page_no;
	action=action+"&sid="+Math.random();
	var id;	

	$("input[name=files]:checked").each(
		function() {
			id = this.id.substring(1, this.id.length);
				action=action+"&id="+id;	
				
			// set global rename_id
			file_list.rename_id = id;
			file_list.oldNameHolder = $('#name_'+id).attr('innerHTML');
		
		}
		);
		
	
	$('#name_'+id).load(action);
	
	this.hideMenu();
		
}

// function to cancel rename div and display original plain text file name
object_list.prototype.cancelRename = function(id) 
{	

	$('#name_'+id).html(this.oldNameHolder);	

	// reset global rename_id
	file_list.rename_id = 0;
	
}

// function to rename action call to database
object_list.prototype.rename_file = function(id, name, oldName) 
{

	if(name == oldName)
	{
		file_list.cancelRename(id);
		return;
	}
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?");
	action=action+"a=rename";
	action=action+"&id="+id;
	action=action+"&path="+$("#global_path").attr('path');
	action=action+"&name="+name;
	action=action+"&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
						
			//var rename_div = document.createElement('div');
			rename_div =xmlHttp.responseText;
			var file_id = "name_box_"+id;
			$("#"+file_id).html(rename_div);

		}
	}

	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);
	
	$(document).ready(function(){
	
		setTimeout(function(){fillwidth(id)},1000);

	});
	
	disablePopup();

}

// function to do download action
object_list.prototype.doDownload = function() 
{

	var id_list=this.buildIdList();
	var cnt=0;
	var filecount=0;


	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		filecount++;
		}
	}

	var action=new String("/files_action.php?a=download&filelist=");
	action+=id_list;
	action+="&filecnt=";
	action+=filecount;

	self.location=action;

}

// function to do zoho edit action
object_list.prototype.doEdit = function() 
{
	
	var id_list=this.buildIdList();
	var cnt=0;
	var filecount=0;

	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		filecount++;
		}
	}

	var action=new String("/files_action.php?a=edit&filelist=");
	action+=id_list;
	action+="&filecnt=";
	action+=filecount;

	window.open(action,'Edit_Document','width=1000,height=900');

}


// function needed to auto submit Zoho form
object_list.prototype.doZohoForm= function () 
{
	
    document.getElementById('zoho_edit').submit();
	
}

// function to show Move Files div
object_list.prototype.moveDiv=function() 
{

	//centering with css
	centerPopup();
	//load popup
	loadPopup();

	var cnt=0;
	var id_list = this.buildIdList();

	$("#popup_title").html("Move File");			
	$("#popup_content").html("<br /><br />Loading...<br /><br />");

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=move_div&filelist=");
	action+=id_list;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}


	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to show Send Files div
object_list.prototype.sendFileDiv=function() 
{

	//centering with css
	centerPopup();
	//load popup
	loadPopup();

	var cnt=0;
	var id_list = this.buildIdList();
	
	$("#popup_title").html("Email File");		
	$("#popup_content").html("<br /><br />Loading...<br /><br />");

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 
	
	var action=new String("/files_action.php?a=send_file_div&filelist=");
	action+=id_list;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}

	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);
	
}

// function to show Delete Files div
object_list.prototype.deleteDiv=function() 
{

	//centering with css
	centerPopup();
	//load popup
	loadPopup();

	var cnt=0;
	var id_list = this.buildIdList();
	var flag = '';
	var isFile = false;
	var isFolder = false;
	var isShared = false;
	var isOwner = false;
	
	$("#popup_title").html("Delete");
	$("#popup_content").html("<br /><br />Loading...<br /><br />");
	
	$("input[name=files]:checked").each(
	function() {
		flag = this.id.substring(1, 2);
		if(flag == 'f')
			isFile = true;
		else if(flag == 'p')
			isFolder = true;
		
		if($(this).attr('shared') == "1")
			isShared = true;
			
		if($(this).attr('is_owner') == "1")
			isOwner = true;
			
	}
	);

	// if selecting one file
	if($("input[name=files]:checked").length == 1)
	{
	
		// if selecting ONLY a file, NOT SHARED
		if(isFile == true && isShared == false)
			$("#popup_content").html("Are you sure you want to delete this file?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: This will delete the original copy stored on <br />your computers as well.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doDelete()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
		// if selecting ONLY a folder, NOT SHARED
		else if(isFolder == true && isShared == false)
			$("#popup_content").html("Are you sure you want to delete this folder?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: This will delete the original copy stored on <br />your computers as well.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doDelete()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
	
		// if selecting only shared folders, not the owner
		else if(isShared == true && isFile == false && isFolder == true)
			$("#popup_content").html("Are you sure you want to delete this shared folder?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: This will delete the original copy stored on <br />your computers as well.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doDelete()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
	
	}
	
	// if selecting more than one
	else
	{
	
		// if selecting ONLY files, NOT SHARED
		if(isFile == true && isFolder == false && isShared == false)
			$("#popup_content").html("Are you sure you want to delete these files?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: This will delete the original copy stored on <br />your computers as well.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doDelete()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
		// if selecting ONLY folders, NOT SHARED
		else if(isFolder == true && isFile == false && isShared == false)
			$("#popup_content").html("Are you sure you want to delete these folders?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: This will delete the original copy stored on <br />your computers as well.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doDelete()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
		// if selecting only shared folders, not the owner
		else if(isShared == true && isFile == false && isFolder == true)
			$("#popup_content").html("Are you sure you want to delete these folders?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: This will delete the original copy stored on <br />your computers as well.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doDelete()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
		// if selecting a bunch of shit
		else
			$("#popup_content").html("Are you sure you want to delete these files<br /> and folders?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: This will delete the original copy stored on <br />your computers as well.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doDelete()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
	
		
	
	}
	
}

// function to show Unlinking Files div
object_list.prototype.unlinkDiv=function() 
{

	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	var flag;
	var what;
	$("input[name=files]:checked").each(
	function() {
		flag = this.id.substring(1, 2);
		
		if(flag == 'f')
		{
		
		
			what = 'file';
			
		}
		else if(flag == 'p')
		{
		
			$("#popup_title").html("Unsync Folder");	
			$("#popup_content").html("Are you sure you want to unsync this folder from <br />your Gigmax?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: You will still have access to its files on the <br /> device itself, but nowhere else.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doUnlink()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
		
		}
		else if(flag == 'h')
		{
			$("#popup_title").html("Unlink Device");	
			$("#popup_content").html("Are you sure you want to unlink this device from <br />your Gigmax?<br /><br /><span style=\"color: red; font-size: 9pt; font-weight: bold;\">Note: You will still have access to all of this device's <br />files on the device itself, but nowhere else.</span><br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doUnlink()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
		
		}
			
	}
			
	);
	
}

// function to show Upload Files div
object_list.prototype.uploadDiv=function(path_id, sid) 
{

	var cnt=0;
	var id_list = this.buildIdList();

	var flash_file = false;
	
	// if album, then load album uploader
	if($("#global_path").attr('path_flag') == 'a')
	{
		flash_file = 'album_uploader.swf';
		$("#popup_title").html("Upload Photos");
	}
	else
	{
		flash_file = 'files_uploader.swf';
		$("#popup_title").html("Upload Files");
	}
	
	var content = 
	
		'<div id = "file_uploader" style="margin-left: 10px; z-index: -2; overflow: hidden; width: 330px; height: 140px;">'+

		'Click the browse button to select files to upload.  Your files will begin uploading automatically.'+
	
		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="330" height="100" id="Main" align="middle">'+
				'<param name="movie" value="/view/files/flash/'+flash_file+'" />'+
				'<param name="quality" value="high" />'+
				'<param name="bgcolor" value="#ffffff" />'+
				'<param name="play" value="true" />'+
				'<param name="loop" value="true" />'+
				'<param name="wmode" value="window" />'+
				'<param name="scale" value="showall" />'+
				'<param name="menu" value="true" />'+
				'<param name="devicefont" value="false" />'+
				'<param name="salign" value="" />'+
				'<param name="allowScriptAccess" value="sameDomain" />'+
                '<param name="flashvars" value="sid='+sid+'&f='+path_id+'" />'+
				'<!--[if !IE]>-->'+
				'<object type="application/x-shockwave-flash" data="/view/files/flash/'+flash_file+'" width="330" height="100">'+
					'<param name="movie" value="/view/files/flash/'+flash_file+'" />'+
					'<param name="quality" value="high" />'+
					'<param name="bgcolor" value="#ffffff" />'+
					'<param name="play" value="true" />'+
					'<param name="loop" value="true" />'+
					'<param name="wmode" value="window" />'+
					'<param name="scale" value="showall" />'+
					'<param name="menu" value="true" />'+
					'<param name="devicefont" value="false" />'+
					'<param name="salign" value="" />'+
					'<param name="allowScriptAccess" value="sameDomain" />'+
                    '<param name="flashvars" value="sid='+sid+'&f='+path_id+'" />'+
				'<!--<![endif]-->'+
					'<a href="http://www.adobe.com/go/getflash">'+
						'<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />'+
					'</a>'+
				'<!--[if !IE]>-->'+
				'</object>'+
				'<!--<![endif]-->'+
			'</object>'+
		
		
		'</div>'+
		'<div id="error" style="display: none; margin-top: 0px; margin-bottom: 18px; margin-left: 8px; margin-right: 14px; color: red; text-align: left; font-size: 8pt;">'+
		'<span style="font-weight: bold;">The following files could not uploaded.  Please try uploading them again: </span>'+
		'<span id="error_file_names"></span>.'+
		'</div>'+
		'<div style="margin-left: -8px; font-size: 9pt; z-index: 100; overflow: visible;"><a href="javascript: void(0);" onClick="file_list.simpleUploadDiv(\''+path_id+'\',\''+sid+'\');">Having trouble with Flash?  Try out our simple uploader!</a></div>';

	$("#popup_content").html(content);
	
}

// function to show SIMPLE Uploading Files div
object_list.prototype.simpleUploadDiv=function(path_id, sid) 
{

	var cnt=0;
	var id_list = this.buildIdList();
	
	var content = '<form enctype="multipart/form-data" action="/uploader.php?sid='+sid+'&p='+path_id+'" method="POST" name="uploader" id="uploader">'+
					'<input type="file"  name="file1" style="margin: 3px;" /><br />'+
					'<input type="file"  name="file2" style="margin: 3px;" /><br />'+
					'<input type="file"  name="file3" style="margin: 3px;" /><br />'+
					'<br /><div class="submit_form_button" onClick="$(\'#uploader\').submit();">UPLOAD</div>'+
					'</form>'+
					'<br />'+
					'<div style="margin-left: -8px; font-size: 9pt;"><a href="javascript: void(0);" onClick="file_list.uploadDiv(\''+path_id+'\',\''+sid+'\');">Back</a></div>';

	$("#popup_title").html("Upload Files");
	$("#popup_content").html(content);
	
}

// function to call sending files action to database
object_list.prototype.doSendFiles = function( email, message ) 
{
	
	var id_list=this.buildIdList();
	var cnt=0;
	var filecount=0;

	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		filecount++;
		}
	}

	var action=new String("/files_action.php?a=send_file&filelist=");
	action+=id_list;
	action+="&email=";
	action+=email;
	action+="&message=";
	action+=message;
	action+="&r="+Math.random();
	
	// if on a community page
	if($("#community_page").attr('username') != undefined)
	{
		var username = $("#community_page").attr('username');
		action+="&username="+username;
	}
	

	this.deselectAll();

	var xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	} 
	var url=action;

	xmlHttp.onreadystatechange = function()
	{ 
	
		if (xmlHttp.readyState==4)
		{ 
		
			var result = xmlHttp.responseText;
	
			if(  result == 1 )
				show_message_div("Your files have been successfully sent. They will receive a link to access the files shortly.", 'files_message_div');
				
			else if( result == 2)
				show_message_div("You must enter a valid email address!", 'files_message_div');
				
			else 
				show_message_div("Error sending email! Please try again later!", 'files_message_div');
				
			$( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );

		}
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

// function to call making files Public action to database
object_list.prototype.doUnlockFiles = function()
{

	var id_list="li";
	var cnt=0;
	var file_cnt=0;


	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		file_cnt++;
		
		}
	}


	var action=new String("/files_action.php?a=unlock&filelist=");
	action+=id_list;
	action+="&filecnt=";
	action+=file_cnt;

}

// function to call making files Private action to database
object_list.prototype.doLockFiles = function()
{

	var id_list="li";
	var cnt=0;
	var file_cnt=0;


	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		file_cnt++;
		}
	}

	var action=new String("/files_action.php?a=lock&filelist=");
	action+=id_list;
	action+="&filecnt=";
	action+=file_cnt;

}



var xmlHttp;

function enter_pressed(e){
var keycode;
if (window.event) keycode = window.event.keyCode; 
else if (e) keycode = e.which; 
else return false; 
return (keycode == 13); 
}

// function to call Share folder action to database 
object_list.prototype.shareDiv = function(type_in_addresses)
{
	
	if(type_in_addresses == undefined)
		type_in_addresses = false;

	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	$("#popup_title").html("Share");			
	$("#popup_content").html("<br /><br />Loading...<br /><br />");

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=share_file_div");
	action+="&type_in_addresses="+type_in_addresses;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to show get public link popup div
object_list.prototype.publicLinkDiv = function()
{
	
	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	$("#popup_title").html("Public Link");			
	$("#popup_content").html("<br /><br />Loading...<br /><br />");

	// build files selected list
	var id_list=this.buildIdList();
	var cnt=0;
	var filecount=0;

	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		filecount++;
		}
	}
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 
	var id_list=this.buildIdList();
	var cnt=0;
	var filecount=0;

	for(cnt in this.selected)
	{
		if(this.selected[cnt]==1){
		id_list+=",";
		id_list+=cnt;
		filecount++;
		}
	}

	var action=new String("/files_action.php?a=public_link");
	action+="&filelist="+id_list;
	action+="&sid="+Math.random();
	
	// if on a community page
	if($("#community_page").attr('username') != undefined)
	{
		var username = $("#community_page").attr('username');
		action+="&username="+username;
	}
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// show div for unsharing paths
object_list.prototype.unshareDiv=function() 
{
	
	//centering with css
	centerPopup();
	//load popup
	loadPopup();

	$("#popup_title").html("Unshare");
	$("#popup_content").html("Are you sure you no longer want to share<br /> these folders?<br /><br /><a href=\"javascript:void(0);\" onClick=\"file_list.doUnshare()\" class=link><img src=\"/view/images/yes_box.png\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<img src=\"/view/images/no_box.png\" border=\"0\" onClick=\"disablePopup();\" style=\"cursor: pointer;\">");
	
}

// function to call UNshare folder action to databsae 
object_list.prototype.doUnshare=function() 
{

	// build file list
	var id_list = this.buildIdList();
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=unshare");
	action+="&filelist="+id_list;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
		
			var result = xmlHttp.responseText;
			var cnt = 0;
			
			if(result == 1)
			{

				$("input[name=files]:checked").each(
				function() {
					var id = this.id.substring(1, this.id.length);
					$("#"+id+"_icon").attr("src", "/view/images/folder_icon.png");
					cnt++;
				}
				);

			}
			else
			{
				
				$("input[name=files]:checked").each(
				function() {
					var id = this.id.substring(1, this.id.length);
					$("#"+id).remove();
					cnt++;
				}
				);
				
			}
			
			// update pagination!! SICK AJAX
			var min = $('#min').html();
			var max = $('#max').html();
			var file_count = $('#file_count').html();
			if(max - cnt == 0)
			{
				min = 0;
				$('#no_files_message').show();
			}
			
			$('#min').html(min);
			$('#max').html(max-cnt);
			$('#file_count').html(file_count-cnt);
				
			//file_list.redoRows();
			disablePopup();
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to show new files table when sorting
function showFiles(path, min, max, file_count, flag)
{

	var sort_no = max-min+1;

	if(sort_no != 25 && sort_no != 50 && sort_no != 100)
				sort_no = "all";
	
	if(max > file_count)
	{
		max = file_count;
		
	}
		
	if(min < 1)
	{
		max = sort_no;
		min = 1;
	}
		
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/get_files.php?");
	action+="min="+min;
	action+="&max="+max;
	action+="&p="+path;
	action+="&flag="+flag;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
		
			$("#file_org_row").hide();
			
			// show new div
			var content = xmlHttp.responseText;
			$("#files_page").html(content);			
			
			// update pagination link		
			
			if(sort_no != 25)
			{
			
				$("#25").removeClass("file_num_text_on");
				$("#25").addClass("file_num_text");
			
			}
			if(sort_no != 50)
			{
			
				$("#50").removeClass("file_num_text_on");
				$("#50").addClass("file_num_text");
			
			}
			if(sort_no != 25)
			{
			
				$("#100").removeClass("file_num_text_on");
				$("#100").addClass("file_num_text");
			
			}
			if(sort_no != "all")
			{
			
				$("#all").removeClass("file_num_text_on");
				$("#all").addClass("file_num_text");
			
			}
			$("#"+sort_no).removeClass("file_num_text");
			$("#"+sort_no).addClass("file_num_text_on");
			//$("#popup_content").html(content);
				
		
			$("#viewing_files").html(min+" - "+max+" of "+file_count);
				
		}
	}

	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to Search 
function search(key, path)
{

	$("#files_list").hide();
	$('#file_org_row').hide();
	$("#search_results").show();
	$("#search_results").html("<div style=\"padding: 50px; font-weight: bold; font-size: 14pt; margin: auto; text-align: center; width: 500px;\">Searching...</div>");		

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=search");
	action+="&key="+key;
	action+="&path="+path;
	action+="&sid="+Math.random();
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			// show new div
			var content = xmlHttp.responseText;
			if(content == 1)
			{
		
				$('#file_org_row').show();
				$("#search_results").hide();
				$("#files_list").show();
			
			}
			else
			{
				
				$("#search_results").show();
				$("#search_results").html(content);	
			
			}		
				
		}
	}

	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);
	
}

// function to My Friends popup div
function showFriendsDiv()
{
	
	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	$("#popup_title").html("My Friends");			
	$("#popup_content").html("<br /><br />Loading...<br /><br />");

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=get_friends");
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to show Notifications popup div
function showNotificationsDiv()
{
	
	// first hide new notifications div
	$('#notifications_div').hide();
	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	$("#popup_title").html("Notifications");			
	$("#popup_content").html("<br /><br />Loading...<br /><br />");

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=get_new_notifications");
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to call ignore invite act
function ignoreInvite(id)
{

	var notification_id = id.substring(7);

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=ignore_invite");
	action+="&notification_id="+notification_id;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			var content = xmlHttp.responseText;
			
			// first check if its a file or friend invite
			if(content.search('friend_invite') != -1)			
			{
				
				var first_split_at=content.indexOf('friend_invite')+13;
				var second_split_at=content.indexOf('^');
				var new_friend_requests = content.substring(first_split_at, second_split_at);
				var total_pending_requests = content.substring(second_split_at+1);
				
				// if no more friend requests, remove Friend Requests..... div
				if(new_friend_requests == 0)
					$('#pending_friends_box').remove();
				else
					$('#pending_friends_number').html(new_friend_requests);
			
			}
			
			// if not then file invite
			else
			{
			
				var first_split_at=content.indexOf('folder_invite')+13;
				var second_split_at=content.indexOf('^');
				var new_file_requests = content.substring(first_split_at, second_split_at);
				var total_pending_requests = content.substring(second_split_at+1);
		
				// if no more file requests, remove File Requests..... div
				if(new_file_requests == 0)
					$('#pending_folders_box').remove();
				else
					$('#pending_folders_number').html(new_file_requests);
			
			}
			
			$('#'+notification_id).remove();
			
			if(total_pending_requests == 0)
				disablePopup();
				
		}
		
				
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to call accept invite action to database 
function acceptInvite(id)
{

	var notification_id = id.substring(7);

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=accept_invite");
	action+="&notification_id="+notification_id;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			var content = xmlHttp.responseText;		
		
			// first check if its a file or friend invite
			if(content.search('friend_invite') != -1)			
			{
				
				var first_split_at=content.indexOf('friend_invite')+13;
				var second_split_at=content.indexOf('-');
				var third_split_at=content.indexOf('^');
				var new_friend_count = content.substring(first_split_at, second_split_at);
				var new_friend_requests = content.substring(second_split_at+1, third_split_at);
				var total_pending_requests = content.substring(third_split_at+1);
			
				// remove notification row
				$('#'+notification_id).remove();
				
				// update friend count in sidebar
				$('#friends_count').html(new_friend_count);
				
				// update link for My Friends box if now has 1 friend
				if(new_friend_count == 1)
					$("#view_friends_link").attr('onClick', 'showFriendsDiv()');
				
				// if no more friend requests, remove Friend Requests..... div
				if(new_friend_requests == 0)
					$('#pending_friends_box').remove();
				else
					$('#pending_friends_number').html(new_friend_requests);
				
				var pending_friends_header_width = $('#pending_friends_header').width();
				var pending_friends_number_width = $('#pending_friends_number').width();
				var pending_friends_view_width = $('#pending_friends_view').width();
				var filler_width = 164 - pending_friends_header_width - pending_friends_view_width - pending_friends_number_width;
				$('#pending_friends_filler').width(filler_width);
				
			}
			
			// if file then display new row in file table
			else
			{
			
				var first_split_at=content.indexOf('folder_invite')+13;
				var second_split_at=content.indexOf('-');
				var third_split_at=content.indexOf('?');
				var fourth_split_at=content.indexOf('!');
				var fifth_split_at=content.indexOf('^');
				var sixth_split_at=content.indexOf('&');
				
				var unique_id = content.substring(first_split_at, second_split_at);
				var path = content.substring(second_split_at+1, third_split_at);
				var shared_file_count = content.substring(third_split_at+1, fourth_split_at);
				var total_pending_requests = content.substring(fourth_split_at+1, fifth_split_at);
				
				if(sixth_split_at != -1)
				{
					var new_file_requests = content.substring(fifth_split_at+1, sixth_split_at);
					var new_friend_count = content.substring(sixth_split_at+1);
				}
				else
					var new_file_requests = content.substring(fifth_split_at+1);
					
				
				// add file to table
				file_list.show_new_path_row(unique_id);
				
				// remove notification row
				$('#'+notification_id).remove();
				
				// update number of shared files
				$('#stats_number_shared').html(shared_file_count);
				
				// if no more file requests, remove File Requests..... div
				if(new_file_requests == 0)
					$('#pending_folders_box').remove();
				else
					$('#pending_folders_number').html(new_file_requests);
									
				var pending_folders_header_width = $('#pending_folders_header').width();
				var pending_folders_number_width = $('#pending_folders_number').width();
				var pending_folders_view_width = $('#pending_folders_view').width();
				var filler_width = 164 - pending_folders_header_width - pending_folders_view_width - pending_folders_number_width;
				$('#pending_folders_filler').width(filler_width);
				
				var shared_header_width = $('#stats_header_shared').width();
				var shared_number_width = $('#stats_number_shared').width();
				var filler_width = 166 - shared_header_width - shared_number_width;
				$('#stats_filler_shared').width(filler_width);
				
				// update pagination FOR NEW FILES ONLY!! SICK AJAX
				var min = $('#min').html();
				var max = $('#max').html();
				var file_count = $('#file_count').html();
				if(min == 0)
					min = 1;
				$('#min').html(min);
				$('#max').html(++max);
				$('#file_count').html(++file_count);
				
			}
		
			if(total_pending_requests == 0)
				disablePopup();
		
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to show remove friend confirmation div 
function removeFriend(id)
{
	
	var contact_id = id.substring(7);
	
	$('#overlay_'+contact_id).show();

}

// function to cancel remove friend/hide confirm div
function removeFriendCancel(id)
{
	
	var contact_id = id.substring(7);
	
	$('#overlay_'+contact_id).hide();

}

// function to call remove friend action to database 
function removeFriendConfirm(id)
{
	
	var contact_id = id.substring(7);
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 

	var action=new String("/files_action.php?a=remove_friend");
	//action+="&user_id="+user_id;
	action+="&contact_id="+contact_id;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			var new_friend_count = xmlHttp.responseText;	
			
			$('#'+contact_id).remove();
			$('#overlay_'+contact_id).hide();
			
			// update friend count in sidebar
			$('#friends_count').html(new_friend_count);
			
			if(new_friend_count == 0)
				disablePopup();
		
			var contact_header_width = $('#contact_header').width();
			var contact_number_width = $('#contact_number').width();
			var contact_view_width = $('#contact_view').width();
			var filler_width = 186 - contact_header_width - contact_view_width - contact_number_width;
			$('#contact_filler').width(filler_width);	
			
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to build friends list  
object_list.prototype.buildcontactList = function() 
{
	var id_list = 'li';

	$("input[name=contact_list]:checked").each(
		function() {
			var id = $(this).val();		
				id_list += ','+id;	
		}
		);
	
	return id_list;

}

// function to call share files function
object_list.prototype.shareFiles = function(friends) 
{

	// build contact list from checkboxes if going through friends
	if(friends == true)
	{
	
		var contact_list = this.buildcontactList();

		$("input[name=contact_list]:checked").each(
		function() {
			var id = $(this).val();			
			//alert(id);
		}
		);
		
	}
	else
	{

		var contact_list = $('#contact_area').val();

	}
		
	// build file list
	var id_list = this.buildIdList();
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 
	
	// if contact list is empty
	if(contact_list == 'li')
		return false;
	
	var action=new String("/files_action.php?a=share_files&type=folder_invite");
	action+="&contact_list="+contact_list;
	action+="&filelist="+id_list;
	action+="&friends="+friends;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);
	
}

// function to call invite friends function
object_list.prototype.inviteFriends = function() {

	var contact_list = $('#contact_area').val();
	
	if(contact_list == "Begin adding friends by entering their email addresses here (separated by commas).")
		return;
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 
	
	var action=new String("/files_action.php?a=invite_friends");
	action+="&contact_list="+contact_list;
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);
	
}

// function to show Find Friends popup div
function findFriends()
{
	
	// first hide new notifications div
	$('#notifications_div').hide();
	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	$("#popup_title").html("Find Friends");	

	var content = '<div style="text-align: center; padding-right: 12px;">'+
		'<b>Find your friends and easily share folders with them. Select a method:</b>'+
		'<div style="text-align: left; padding-left: 14px;">'+
		'<br />'+
		'<div style="margin-bottom: 4px; font-size: 9pt; height: 24px; line-height: 24px;">'+
		'<input type="radio" name="find_friends_method" value="post" style="margin-top: 5px; padding: 0;"> Post about Gigmax'+
		'<img src="/view/images/facebook.png" style="margin-left: 4px;" alt="Facebook" title="Facebook" />'+
		'<img src="/view/images/twitter.png" style="margin-left: 4px;" alt="Twitter" title="Twitter" />'+
		'</div>'+
		/*
		'<div style="margin-bottom: 4px; font-size: 9pt; height: 24px; line-height: 24px;">'+
		'<input type="radio" name="find_friends_method" value="import" style="margin-top: 5px; padding: 0;"> Import existing contact list'+
		'<img src="/view/images/gmail.png" style="margin-left: 4px;" alt="Gmail" title="Gmail" />'+
		'<img src="/view/images/yahoo.png" style="margin-left: 4px;" alt="Yahoo" title="Yahoo" />'+
		'<img src="/view/images/msn.png" style="margin-left: 4px;" alt="Hotmail" title="Hotmail" />'+
		'<img src="/view/images/aol.png" style="margin-left: 4px;" alt="AOL" title="AOL" />'+
		'<img src="/view/images/linkedin.png" style="margin-left: 4px;" alt="LinkedIn" title="LinkedIn" />'+
		'</div>'+
		*/
		'<div style="margin-bottom: 4px; font-size: 9pt; height: 24px; line-height: 24px;">'+
		'<input type="radio" name="find_friends_method" value="type" style="margin-top: 5px; padding: 0;"> Type in email addresses'+
		'</div>'+
		'</div>'+
		'<br /><div class="submit_form_button" onClick="findFriendsSelect();">NEXT</div>'+
		'</div>';
	
	$("#popup_content").html(content);

}

// function to show the selected Find Friends method (type in, import, share/post)
function findFriendsSelect()
{
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 
	
	var option = $('input:radio[name=find_friends_method]:checked').val();
	
	if(option == "type")
	{
	
		var action=new String("/files_action.php?a=type_in_friends");
	
	
	}
	else if(option == "import")
	{
	
		var action=new String("/files_action.php?a=import_friends");
	
	}
	else if(option == "post")
	{
	
		var action=new String("/files_action.php?a=post_to_friends");
	
	}
	else
	{
	
		return;
	
	}
	
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to show the selected Find Friends method (type in, import, share/post)
function findFriendsPost()
{
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	 
	
	var action=new String("/files_action.php?a=post_to_friends");
	action+="&sid="+Math.random();
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);

}

// function to show the members of a Shared folder popup div
object_list.prototype.membersDiv = function() 
{

	//centering with css
	centerPopup();
	//load popup
	loadPopup();
	
	$("#popup_title").html("View Members");			
	$("#popup_content").html("<br /><br />Loading...<br /><br />");
		
	var id;	
	var action=new String("/files_action.php?a=show_shared_users");
	action+="&sid="+Math.random();
	$("input[name=files]:checked").each(
		function() {
			id = this.id.substring(1, this.id.length);
				action=action+"&id="+id;	
		
		}
		);
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
  
		alert ("Your browser does not support AJAX!");
		return;
	}	
	
	xmlHttp.onreadystatechange = function()
	{ 
		
		if (xmlHttp.readyState==4)
		{ 
			
			// show new div
			var content = xmlHttp.responseText;		
			$("#popup_content").html(content);
				
		}
	}
	
	xmlHttp.open("GET",action,true);
	xmlHttp.send(null);
	
}

// function to redo the color of the rows in the files table
object_list.prototype.redoRows = function()
{
	var cnt = 0;
	$("input[name=files]").each(
	function() {
	
		var id = this.id.substring(1, this.id.length);
	
		cnt++;
	
		if(cnt%2==0)
		{
			$("#"+id).removeClass('my_files_row_even');
			$("#"+id).removeClass('my_files_row_odd');
			$("#"+id).attr("class", "my_files_row_even");
		
		}
		else
		{
			$("#"+id).removeClass('my_files_row_even');
			$("#"+id).removeClass('my_files_row_odd');
			$("#"+id).attr("class", "my_files_row_odd");
		
		}
		
		
	}
	);

}

// function to change color of row in files table upon mouseover
object_list.prototype.mouseover_row = function(unique_id) 
{
	$("#"+unique_id).toggleClass("my_files_row_on", true);
		
}

// function to change color of row in files table upon mouseout
object_list.prototype.mouseout_row = function(unique_id) 
{
	
	// only remove if its not selected!
	var cnt = 0;
	var selected = false;
	
	$("input[name=files]:checked").each(
	function() {
	
		var id = this.id.substring(1, this.id.length);
	
		if(id == unique_id)
			selected = true;
	
	}
	);
	
	if(selected == false)
		$("#"+unique_id).toggleClass("my_files_row_on", false);
	
}



