var projectroom = {
	box: {
		get: function(element_id, load_msg, intUserId) {
			intUserId = typeof intUserId != 'undefined' ? intUserId : false;
			
			// check if element exists
			if (jQuery('#' + element_id).length > 0) { 
				// load msg before update
				jQuery('#' + element_id).html('<img src="' + doc_root + 'misc/icons/loader.gif" style="padding-top:10%;padding-left:48%;padding-right:48%;"/>' +
						'<div style="padding:37%;padding-top:0;" >' + load_msg + '</div>');
				jQuery.post(doc_root + 'includes/ajax/project.' + element_id + '.get.php', {
					// post params
					intUserId: intUserId
				}, function (data, status) {
					jQuery('#' + element_id).html(data);
					if ('client-info' == element_id) {
						// view client info window
						jQuery('#project-starter-client-info').css({
							'position' : 'absolute',
							'width' : 600
						}).appendTo('#columns').fadeIn(function(){
							jQuery(this).dropShadow();
						});
						// position of the event-editor
						center_div = 'project-starter-client-info'; // defined global
//						center_offset = 300;
						jQuery(window).scroll(util.position);				
						util.position();						
					}
				},'json');
			}
		}
	},
	brainstorming : {
		renumber_list : function() {
			var sort_order = 1;
			jQuery('ul li.br-default-listelement span.br-sort-number').each(function(i) {
				jQuery(this).text(sort_order);
				sort_order ++;
			}); 	
		},
		
		change_rank : function(brainstorming_id, from_rank, to_rank) {
			jQuery.post(doc_root + "includes/ajax/projectroom.brainstorming.change-rank.php", {
				projectroom_id : projectroom_id,
				brainstorming_id : brainstorming_id,
				from_rank : from_rank,
				to_rank : to_rank
			}, function(data, status) {
				
			});
		}
	},
	/**
	 * adds a module from "available-modules" div to the
	 * current project. Visible in the "added-modules" div
	 */
	add_module : function(module_id) {
		// call experts searc exec to add user to the project in a session
		jQuery.post(doc_root + "includes/ajax/projectroom.session-module.php", {
			type: 'add_module',
			module_id: module_id,
			project_id: jQuery('#saveProjectId').val()
		}, function (data, status) { 
			projectroom.update_added_modules(); // wird nicht gehen
			
		}, "json");
	
	},
	/**
	 * adds a module from "available-modules" div to the
	 * current project. Visible in the "added-modules" div
	 */
	remove_module : function(module_id) {
		// call experts searc exec to add user to the project in a session
		jQuery.post(doc_root + "includes/ajax/projectroom.session-module.php", {
			type: 'remove_module',
			module_id: module_id,
			project_id: jQuery('#saveProjectId').val()
		}, function (data, status) { 
			projectroom.update_added_modules(); // wird nicht gehen
		}, "json");
	
	},
	update_added_modules : function() {
		jQuery.post(doc_root + "includes/ajax/projectroom.session-module.php", {
			type: 'get_added_modules',
			project_id: jQuery('#saveProjectId').val()
		}, function (data, status) { // async call returns the new content for added-experts
			jQuery('#added-modules').html(data);
		}, 'json');
	},
	
	
	/**
	 * 
	 * @param {} initsave
	 */
	create : {
		projectstarter : {
			
			/**
			 * initializes the selectfield with all keyusers.
			 * Preselects the starter if available.
			 * @param {} project_id
			 */
			init : function(project_id) {
				project_id = typeof project_id != 'undefined' ? project_id : false;
				if (project_id > 0) {
					jQuery.post(doc_root + 'includes/ajax/projectroom.keyusers-select.get.php', {
						project_id : project_id
					}, function( data, status) {
						// append options to select field
						jQuery('#intUserIdProjectstarter').append(data);
						
					}, 'json');
				}
			}
		},
		project : function() {
			technology_search.start_project(true);
			jQuery('#tabNew').trigger('click');
//			// create an project (simulate search before createing (in php-call))
//			jQuery.post(doc_root + '', {
//				custom_project: true
//			}, function (data, status) {
//				// create an projectroom for the project
//				jQuery.post(doc_root + '', {
//				
//				}, function (rdata, rstatus) {
//					// open the new created projectroom 	
//				});
//					
//			});
		}
	},
	
	/**
	 * Removes closed Project from Database, after storing a file backup
	 */
	remove_from_database: function() {
		var ok = confirm("Sind Sie sicher, dass die beendeten Projekte entgültig aus der Datenbank entfernt werden sollen?");
		
		if (ok) {
			jQuery.post(doc_root + 'includes/ajax/project.remove-from-database.php', {
	
			}, function(data, status) {
				// reload closed projects
				projectroom.box.get('closed-projects', gt.gettext("Lade Projekte..."));
			});
		}
	},
	/**
	 * Saves the projectroom.
	 * 
	 * @param {boolean} initsave - true if its an insert, false if its an update
	 */
	save : function(initsave) {
		initsave = typeof initsave != 'undefined' ? initsave : false; 

		// check room-name entered at real save
		if (!initsave) {
			var check_room_name = jQuery('#strProjectName').val();
			check_room_name = jQuery.trim(check_room_name);
			if ('' == check_room_name) {
				$('#strProjectName').addClass('form-error');
				$('#tabRoomstart').trigger('click');
				return;
			}
		}
		// check if global var from templates/base/administration/projectroom.php 
		// projectroom_id is numeric 
		projectroom_id = !isNaN(projectroom_id) ? projectroom_id : false;

		// check if files are queued for uploading
		// create from description fields url params
		var desc_params = '';
		
		jQuery(jQuery.find("input[id^='uploadfile_description']")).each(function(i) {
			desc_params += '&filedescription_' + i + '=' + jQuery(this).val();
		});

		jQuery(jQuery.find("input[type=radio]:checked")).each(function(i) {
			desc_params += '&filecategory_' + i + '=' + jQuery(this).val();
			
		});
		
//		alert(desc_params);
		
		if (jQuery.find("input[id^='projectroom-uploadfiles']").length > 1) { // 0th one is always empty
//			alert('upload!');
			jQuery('#fileupload-form').ajaxSubmit({
				url: doc_root  + 'includes/ajax/fileupload_handler.php?projectroom_id=' + projectroom_id + desc_params,
				clearFrom: true,
				resetForm: true,
				success: function(data, status) {
					// remove uploaded files from div using remove-function of the plugin
					jQuery('.remove-link').each(function(){
						jQuery(this).trigger('click');
					});
					
					// submit projectroom-values after uploading projektfiles 
					projectroom.submit_form(initsave);
				}
			});				
//			
//			YAHOO.util.Connect.setForm('fileupload-form', true);
//			YAHOO.util.Connect.asyncRequest('POST', doc_root  + 'includes/ajax/fileupload_handler.php?projectroom_id=' + projectroom_id + desc_params, {
//				upload: function(objData) {
//					
//					// remove uploaded files from div using remove-function of the plugin
//					jQuery('.remove-link').each(function(){
//						jQuery(this).trigger('click');
//					});
//					
//					// submit projectroom-values after uploading projektfiles 
//					projectroom.submit_form(initsave);
//			  	}
//			});			
		}
		else {
			projectroom.submit_form(initsave);
		}
	},
	
	submit_form : function(initsave) {
		initsave = typeof initsave != 'undefined' ? initsave : false; 
		// check if global var projectroom_id is numeric 
		projectroom_id = !isNaN(projectroom_id) ? projectroom_id : false;

		var props = {project_id: jQuery('#saveProjectId').val(),
					project_starter_user_id : jQuery('#intUserIdProjectstarter').val(),
					project_name: '',
					project_category: '',
					project_short_description: '',
					project_description: '',
					project_date_from: '',
					project_date_to: ''};
		

		// read form if its not a init-save
		if (!initsave) {
			props.project_name = jQuery('#strProjectName').val();
			props.project_category = jQuery('#intProjectCategory').val();
			props.project_short_description = jQuery.wymeditors(0).html();
			props.project_description = jQuery.wymeditors(1).html();


			props.project_date_from = jQuery('#RoomFromDate').val();
			props.project_date_to = jQuery('#RoomToDate').val();
		}
		
		// submit the form for saving
		jQuery.post(doc_root + "includes/ajax/projectroom.save.php", {
			init: initsave,
			room_id: projectroom_id, 
			project_id: props.project_id,
			project_category: props.project_category,
			project_name: props.project_name,
			project_short_description: props.project_short_description, 
			project_description: props.project_description, 
			project_date_from: props.project_date_from,
			project_date_to: props.project_date_to,
			project_starter_user_id: props.project_starter_user_id			
		}, function (data, status) { 
			if (typeof data.init != 'undefined' && data.init) { // do sth after initial save of the project room
				// save project id for later save in a global var 
				// defined in top of projectroom.php
				projectroom_id = data.load_room_id;
				jQuery('#intProjectRoomId').val(projectroom_id); // set hidden value projectroom.php
				
				
				if (initsave) {
					jQuery('#intProjectroomId').val(projectroom_id); // set hidden value projectroom.php
					projectroom.load_properties(projectroom_id);
					projectroom.box.get('available-modules', gt.gettext("Lade verfügbare Module ..."));
					projectroom.load('properties', projectroom_id);
					//	projectroom.load('modules', projectroom_id);
					user.box.get('project-search-cloud', projectroom_id);
					projectroom.box.get('added-moderator', gt.gettext("Lade Moderator"), projectroom_id);
					projectroom.box.get('added-leader', gt.gettext("Lade Projektleiter"), projectroom_id);
					
					
				}
				jQuery('.locker').fadeOut('normal');
			}
			else {
				var stayhere = confirm(gt.gettext("Der Projektraum wurde gespeichert!") + '\n'+
						gt.gettext("Wollen Sie den Projektraum weiter bearbeiten (sonst Umleitung zur Projektraumübersicht)?"));
				if( stayhere == false ){
					jQuery.post(doc_root + "includes/ajax/projectroom.reset-session-vars.php", {});
					window.location.href = doc_root + "user/project/" + data.load_room_id; // redirect to project overview after saving
				}
				else{
					// if we save in projectroom-new then redirect to projectroom 
					if (typeof project_id !== 'undefined') {
						window.location.href = doc_root + "administration/projectroom/" + data.load_room_id + "/" + data.user_id; // redirect to edditing-projects
					}
					else {
						window.location.reload(); //just reload this page
					}
				}
			}
		}, "json");		
	},
	
	
	update : {
		image: function() {
			//jQuery("#formImage").attr('action', doc_root  + 'includes/ajax/projectroom.update.image.php');
			jQuery('#formImage').ajaxSubmit({
				url: doc_root  + 'includes/ajax/projectroom.update.image.php',
				clearFrom: true,
				resetForm: true,
				success: function(data, status) {
					jQuery('#project-picture').html('<img id="projectRoomImage" class="userPic" width="140" alt="Projektbild" ' +
							'src="' + doc_root + 'includes/ajax/getfile.php?filename='+ data + '"/>');
					
					
					
				}
			});

		} // end image	
	},
	load:  function(type, projectroom_id) {
		
		// Lock screen
		jQuery.post(doc_root + "includes/ajax/projectroom.load-" + type + ".php", {
				projectroom_id: projectroom_id
		}, function (data, status) {
			if ('properties' == type) {
				projectroom.fillin_properties(data);	
			}
			if ('modules' == type) {
				for (index in data) {
					projectroom.add_module(data[index]);
				}
			}
			
			if ('files' == type) {
				projectroom.update_uploaded_files_box(data, projectroom_id);
			}
			
			if ('brainstormings' == type) {

				jQuery('#added-brain').html(data);
				jQuery("#sortable-list").sortable({
					update: function(event, ui) {
						var previous_number = jQuery('span.br-sort-number', ui.item).text();
						projectroom.brainstorming.renumber_list();
						var current_number = jQuery('span.br-sort-number', ui.item).text();
						var br_id = (jQuery(ui.item).attr('id').split('-'))[2];
						
						projectroom.brainstorming.change_rank(br_id, previous_number, current_number);
					}
				});
				jQuery("#sortable-list").disableSelection();
			
			}
			
			if ('categories' == type) {
				jQuery('#intProjectCategory').html(data);
			}
			//The order on the brainstormins list
			if ('brainstormings-order' == type) {
				jQuery('#brains-list-order').html(data);
			}
			
			if ('project_responsible' == type) {
				projectroom.load_project_responsibles();
			}
			
		}, "json");		
	},
	
	update_uploaded_files_box : function(files, projectroom_id) {
		jQuery('#uploaded-project-files').html(files);
		// unlock 
		jQuery('.locker').fadeOut('normal');
		
		// init multifile
//		jQuery('#projectroom-uploadfiles').MultiFile(max_upload_files); // init fileuploader
	},
	
	
	remove_file : function(media_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.remove-file.php", {
				projectroom_id: projectroom_id,
				media_id: media_id
		}, 
			/**
			 * @param {Array} data - array of remaining files assigned to a project.
			 */
		function (data, status) {
			projectroom.update_uploaded_files_box(data, projectroom_id);
		}, "json");				
	},
	
	//=============================================================================================
	//=============================================================================================
		
	read_object_var: function(obj){
		
		var str = '';
		for(prop in data){
			for(val in prop)
			{
			str+=val + ' value :'+ prop[val]+'\n';//Concate prop and its value from object
			}
		}
		alert(str);
	},
	
	calendar: function(field_id){
		jQuery("#"+field_id).datepicker({ dateFormat: 'dd.mm.yy' });
	},
	
	add_new_brainstorming: function(projectroom_id){
		projectroom.edit_brainstorming(0, projectroom_id);
	},
	
	show_brainstormings : function() {
		// update added-experts div
		jQuery.post(doc_root + "includes/ajax/projectroom.load-brainstormings.php", {
			projectroom_id: jQuery('#intProjectroomId').val(),
			order: jQuery('#brains-list-order').val()
		}, function (data) { // async call returns the new content for added-experts
			jQuery('#added-brain').html(data);
			jQuery("#sortable-list").sortable({
			update: function(event, ui) {
				var previous_number = jQuery('span.br-sort-number', ui.item).text();
				projectroom.brainstorming.renumber_list();
				var current_number = jQuery('span.br-sort-number', ui.item).text();
				var br_id = (jQuery(ui.item).attr('id').split('-'))[2];
				
				projectroom.brainstorming.change_rank(br_id, previous_number, current_number);
			}
		});
			jQuery("#sortable-list").disableSelection();			
		}, "json");		
	},
	
	edit_brainstorming : function(brain_id, projectroom_id) {
		//Brain-Data
		jQuery.post(doc_root + "includes/ajax/projectroom.edit-brainstorming.php", {
			type: 'set_brain_properties',
			brain_id: brain_id,
			projectroom_id: projectroom_id
		}, function (data) {
			jQuery('#edit-brain').html(data.html);
			jQuery('#strBrainShortDescription').val(data.editor_short_content);
			jQuery('#strBrainDescription').val(data.editor_content);
			
			projectroom.calendar('BrainFromDate');
			projectroom.calendar('BrainToDate');
			
			var brain_id = jQuery('#saveBrainId').val();
			var projectroom_id = jQuery('#saveProjectRoomId').val();
			
			projectroom.show_brain_experts(brain_id, projectroom_id);
			
			jQuery('#brain-uploadfiles').MultiFile(max_upload_files); // init fileuploader
			
			if( typeof jQuery('#saveBrainId').val() != 'undefined' ){
				var brain_id = jQuery('#saveBrainId').val();
				projectroom.update_brain_uploaded_files_box(brain_id);
			}
			
			//wyswyg editor
			//if (typeof jQuery.wymeditors(1) == 'undefined') { 
			delete core.wymconfig.html;
			var wym = jQuery('.wymeditor-brain-short-description').wymeditor(core.wymconfig);
			var wym = jQuery('.wymeditor-brain-long-description').wymeditor(core.wymconfig);
			jQuery('.wym_classes').hide(); // hide classes in wymeditor
		}, "json");					
	},
	
	deactivate_brainstorming : function(brain_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.toggle-brainstorming-status.php", {
				type: 'deactivate_brainstorming',
				brain_id: brain_id,
				projectroom_id: projectroom_id
		}, 
			function (data) {
				projectroom.show_brainstormings();
			}, "json");				
	},
	
	activate_brainstorming : function(brain_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.toggle-brainstorming-status.php", {
				type: 'activate_brainstorming',
				brain_id: brain_id,
				projectroom_id: projectroom_id
		}, 
			function (data) {
				projectroom.show_brainstormings();
			}, "json");				
	},
	
	show_brain_experts: function(brain_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.edit-brainstorming-users.php", {
			type: 'show_brain_experts',	
			brain_id: brain_id,
			projectroom_id: projectroom_id
		}, 
			function (data) {
				if(data[2]){
					handle_new_added_project_members();
				}
				jQuery('#project-experts').html(data[0]);
				jQuery('#brain-added-experts').html(data[1]);
			}, "json");				
	},
	
	handle_new_added_project_members: function(){
//		alert('List changed!');
//		var stayhere = confirm('Sie haben new Pro!\n'+
//						'Wollen den Projektraum weiterhin einrichten?');
//				if( stayhere == false ){
//					//
//				}else{
//					//
//				}
	},
	
	add_brain_expert: function(user_id, brain_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.edit-brainstorming-users.php", {
			type: 'add_brain_expert',	
			brain_id: brain_id,
			user_id: user_id,
			projectroom_id: projectroom_id
		}, 
			function (data) {
				jQuery('#project-experts').html(data[0]);
				jQuery('#brain-added-experts').html(data[1]);
			}, "json");				
	},
	
	set_brain_moderator: function(user_id, brain_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.edit-brainstorming-users.php", {
			type: 'set_brain_moderator',	
			brain_id: brain_id,
			user_id: user_id,
			projectroom_id: projectroom_id
		}, 
			function (data) {
				//jQuery('#project-experts').html(data[0]);
				jQuery('#brain-added-experts').html(data[1]);
			}, "json");				
	},
	
	remove_brain_expert: function(user_id, brain_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.edit-brainstorming-users.php", {
				type: 'remove_brain_expert',
				brain_id: brain_id,
				user_id: user_id,
				projectroom_id: projectroom_id
			}, 
				function (data) {
					jQuery('#project-experts').html(data[0]);
					jQuery('#brain-added-experts').html(data[1]);
				}, "json");						
	},
	
	reorder_brainstormings: function(){
		jQuery.post(doc_root + "includes/ajax/projectroom.brainstormings-order.save.php", {
				order: jQuery('#brains-list-order').val(),
				projectroom_id: jQuery('#intProjectroomId').val()
			}, function (data) {
					projectroom.show_brainstormings();
			}, "json");	
	},
	
	save_brainstorming : function(brain_id, projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.edit-brainstorming.php", {
				type: 'save_brainstorming',
				brain_id: brain_id,
				projectroom_id: projectroom_id,
				strBrainName: jQuery('#strBrainName').val(),
				intRating: jQuery('#intRating').val(),
				strResolution: jQuery('#strResolution').val(),
				strBrainShortDescription: jQuery.wymeditors((WYMeditor.INSTANCES).length-2).html(),
				strBrainDescription: jQuery.wymeditors((WYMeditor.INSTANCES).length-1).html(),
				dtmBrainFromDate: jQuery('#BrainFromDate').val(),
				dtmBrainFromHour: jQuery('#BrainFromHour').val(),
				dtmBrainFromMinute: jQuery('#BrainFromMinute').val(),
				dtmBrainToDate: jQuery('#BrainToDate').val(),
				dtmBrainToHour: jQuery('#BrainToHour').val(),
				dtmBrainToMinute: jQuery('#BrainToMinute').val(),
				feedback:  gt.gettext("Das Brainstorming wurde erfolgreich gespeichert")
		}, 
			function (data) {
				//data is an array of (projectroom_id, brain_id, feedback_text)			
				//--Handling Brainstormings Uploaded Files
				var desc_params = '';
				
				jQuery(jQuery.find("input[id^='uploadfile_description']")).each(function(i) {
					var id_attr = jQuery(this).attr('id');
					desc_params += '&filedescription_' + id_attr.substring(id_attr.length-1) + '=' + jQuery(this).val();
//					desc_params += '&filedescription_' + (i) + '=' + jQuery(this).val();
				});
				
				jQuery(jQuery.find("input[type=radio]:checked")).each(function(i) {
					desc_params += '&filecategory_' + (i) + '=' + jQuery(this).val();
				});
								
				if (jQuery.find("input[id^='brain-uploadfiles']").length > 1) { // 0th one is always empty
					YAHOO.util.Connect.setForm('brain-fileupload-form', true);
					YAHOO.util.Connect.asyncRequest('POST',doc_root  + 'includes/ajax/fileupload_handler.php?brain_id=' + data[1] + desc_params, {
						upload: function(objData) {
							//alert(objData.responseText);
							jQuery('upload-debug').html(objData.responseText);
							// remove uploaded files from div using remove-function of the plugin
							jQuery('.remove-link').each(function(){
								jQuery(this).trigger('click');
							});
						}
					});			
				}
//				else {
//					alert('no files detected');	
//				}
				//-----
				
				projectroom.load('brainstormings', data[0]);
				jQuery('#edit-brain').html(data[2]);
								
			}, "json");				
	},
	
	update_brain_uploaded_files_box : function(brain_id) {
			jQuery.post(doc_root + "includes/ajax/projectroom.load-brainstorming-files.php", {
					brain_id: brain_id
			}, 
		
			function(data){

				jQuery('#uploaded-brain-files').html(data);
				// unlock 
				jQuery('.locker').fadeOut('normal');		
		}, "json");
	},	
	
	remove_brain_file : function(media_id, brain_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.remove-brainstorming-file.php", {
				brain_id: brain_id,
				media_id: media_id
		}, 
			/**
			 * @param {Array} data - array of remaining files assigned to a brainstorming.
			 */
			function (data, status) {
				projectroom.update_brain_uploaded_files_box(brain_id);	
			}, "json");				
	},

	//=============================================================================================
	//=============================================================================================

	fillin_properties : function(props, expertview) {
		jQuery('#saveProjectId').val(props.intProjectId);
		jQuery('#strProjectName').val(props.strNameDe);
	    // check if a editor already loaded
		// as this function is beeing called for creating a projectroom too
		// a wym editor is already beeing initialized in the html part of the script.
	    
		if (typeof jQuery.wymeditors(0) == 'undefined') { 
		    
		    var wymconf = core.wymconfig;
		    
		    
			wymconf.html = props.strShortDescription;
		    jQuery('.wymeditor-short-description').wymeditor(wymconf);
		    
		    
		    wymconf.html = props.strDescriptionDe;
		    jQuery('.wymeditor-instance').wymeditor(wymconf);

		    
		    //jQuery('.wym_iframe iframe').css('height', '400px');
		    jQuery('.wym_classes').hide();
	    }
	    
	    projectroom.create.projectstarter.init(props.intProjectId);
	    
	    // date from
		jQuery("#RoomFromDate").val(props.fromDay + '.' + props.fromMonth + '.' + props.fromYear);

		jQuery("#RoomFromDate").datepicker({
			defaultDate: new Date(new Number(props.fromYear), new Number(props.fromMonth), new Number(props.fromDay)),
			//altField: '#Register',
			dateFormat: 'dd.mm.yy',
			changeMonth: true,
			changeYear: true
		});							

		jQuery("#RoomToDate").val(props.toDay + '.' + props.toMonth + '.' + props.toYear);
		jQuery("#RoomToDate").datepicker({
			defaultDate: new Date(new Number(props.toYear), new Number(props.toMonth), new Number(props.toDay)),
			//altField: '#Register',
			dateFormat: 'dd.mm.yy',
			changeMonth: true,
			changeYear: true
		});							
		if (jQuery.trim(props.strPath).length > 0) {
			jQuery('#project-picture').html('<img id="projectRoomImage" class="userPic" width="140" alt="Projektbild" ' +
							'src="' + doc_root + 'includes/ajax/getfile.php?filename='+ props.strPath + '"/>');
		}
	},
		
	/**
	 * GUI-function to show only the experts from the search cloud.
	 * 
	 * php-Script loads all experts from the search-object correlating with the 
	 * technolgy-search-result.
	 *  
	 * @param {String} container_element - id of the element (usually a div) 
	 * to contain the expert list.
	 * 
	 */
	show_searchcloud_experts : function(container_element, projectroom_id) {
		
		$('#expert-details-content').html('<img src="' + doc_root + 'misc/icons/loader.gif" style="padding-top:10%;padding-left:47%;padding-right:47%;"/>' +
				'<div style="padding:42%;padding-top:0;" >' + gt.gettext("Lade Experten ...") + '</div>');
		jQuery.post(doc_root + "includes/ajax/projectroom.searchcloud-experts.get.php", {
			projectroom_id: projectroom_id			
		}, 
		function (data, status) {
			jQuery('#' + container_element).html(data.expert_list);
			jQuery('.tooltip').tooltip({
			    track: true, 
			    delay: 0, 
			    showURL: false, 
			    opacity: 1, 
			    fixPNG: true, 
			    showBody: " - ", 
			   // extraClass: "pretty fancy", 
			    top: -15, 
			    left: 15 
			});
		}, "json");
	},
	/**
	 * @see show_searchclound_experts method
	 * @param {} container_element
	 */
	show_administrators: function(container_element, projectroom_id) {
		$('#expert-details-content').html('<img src="' + doc_root + 'misc/icons/loader.gif" style="padding-top:10%;padding-left:47%;padding-right:47%;"/>' +
				'<div style="padding:42%;padding-top:0;" >' + gt.gettext("Lade Experten ...") + '</div>');
		jQuery.post(doc_root + "includes/ajax/projectroom.administrators.get.php", {
			projectroom_id: projectroom_id
		}, 
		function (data, status) {
			jQuery('#' + container_element).html(data.expert_list);	
			jQuery('.tooltip').tooltip({
			    track: true, 
			    delay: 0, 
			    showURL: false, 
			    opacity: 1, 
			    fixPNG: true, 
			    showBody: " - ", 
			    //extraClass: "pretty fancy", 
			    top: -15, 
			    left: 15 
			});
		}, "json");
	},
	set_leader : function(user_id, room_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.set-leader.php", {
			intUserId : user_id,
			projectroom_id : room_id
		}, function (data, status) {
			projectroom.box.get('added-leader', gt.gettext("Lade Projektleiter"), room_id);
			team.render();
		}, "json");			
	},
	set_moderator : function(user_id, room_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.set-moderator.php", {
			intUserId : user_id,
			projectroom_id : room_id
		}, 
		function (data, status) {
			projectroom.box.get('added-moderator', gt.gettext("Lade Projektleiter"), room_id);
			projectroom.box.get('added-leader', gt.gettext("Lade Projektleiter"), room_id);
			team.render();			
		}, "json");			
	},
	load_properties : function(projectroom_id) {
		jQuery.post(doc_root + "includes/ajax/projectroom.load-session-properties.php", {
			projectroom_id : projectroom_id
		}, 
		function (data, status) {
			// TODO move hide loading div here
			// update view
			projectroom.box.get('added-moderator', gt.gettext("Lade Moderator"), projectroom_id);
			projectroom.box.get('added-leader', gt.gettext("Lade Projektleiter"), projectroom_id);
			projectroom.box.get('added-experts', gt.gettext("Lade Team"), projectroom_id);
			// TODO
//			jQuery('.locker').hide();
		}, "json");			
	}
};
