function OnDblEvent(id_event)
{
	 show_ajax_popin( 	"Evènement", 
			 			"", 
			 			"http://192.168.1.21/docapolis_project2/web/frontend_dev.php/agenda/displayEvent?id_event="+id_event,
	 					"500" );
}

/**
*Select left menu entry
*
*/
function selectLeftMenuEntry( menu )
{
	$$('.option').each( function(e)
	{
		if( e.hasClassName('activate') )
		{
			e.removeClassName('activate');
		}
	});
	menu.className='activate option';
}

function ajaxLoaderManagement( elmt )
{	
	switch( elmt )
	{
		case 'task':
			var content_loaded = '<div class="ajax_loading_task"></div>';
			$("task_content_data").update( content_loaded );
		break;
		case 'module':
			var content_loaded = '<div class="ajax_loading_module"></div>'; 
			$("content").update( content_loaded );
		break;
		default:
			var content_loaded = '<div class="ajax_loading"></div>';
			$("task_content_data").update( content_loaded );
	}
	
}

/**
*Select task menu entry
*
*/
function selectTaskMenuEntry( menu )
{
	$$('.sub_menu_task').each( function(e)
	{
		if( e.hasClassName('activate') )
		{
			e.removeClassName('activate');
		}
	});

	$(menu).addClassName('activate');
}

function blindEffect( id )
{
	if ($(id).visible())
	{
		Effect.BlindUp( id,{
										duration :0.5
									});
	}
	else
	{
		Effect.BlindDown( id,{
			duration :0.5
		});
	}
		
}

function researchObserver()
{
	Event.observe( $("search_name"), "keyup", function(){
		new Ajax.Updater( 'members_list_selection',
													URL_ROOT+'admin/getMembersProject',
													{
														evalScripts: true,
														parameters: { name: $F('search_name'), id_task: $F('search_id_task') }
													}
						)
	} );
}

function isCheck()
{
	var isCkecked = false;
	
	$$(".check").each( function(e){
		if(e.checked)
		{
			isCkecked = true;
		}
	});
	
	return isCkecked;
}

function toggleCheckBoxes( checkbox )
{
	if(checkbox.checked)
	{
		$$(".check").each( function(e){
										e.checked = true;
						}	);
	}else
	{
		$$(".check").each( function(e){
			e.checked = false;
					}	);	
	}
}

/*
function updateCheckList()
{
	var formCheck = false;
	var checkListUser = '';

	$$(".check").each( function(e){
		if(e.checked===true)
		{
			formCheck = true;
			checkListUser += e.id+";";
		}
	});
	if( formCheck===true )
	{
		new Ajax.Updater( 'content', URL_ROOT+'admin/updateTaskConfirmStep3', { evalScripts: true,
																				parameters: { members: checkListUser }  
						} );
	}
	else
	{
		alert("Vous devez ajouter au moins un utilisateur")
	}
}*/


/**
* Opens an embeded javascript window for Splitgames website.
*
* @param  string  id         DOM element id
* @param  int     width      Width of window
* @param  int     height     Height of window
* @param  string  classname  CSS class name to use
*/
function openWindow(id, width, height, classname, title)
{
	
	return Dialog.info({
					url: "http://192.168.1.21/docapolis_projet/web/frontend_dev.php/project/signupProject",
				 	options: { method: 'get' }
				}, 
				{
					className: 	"docapolis",
					title: 		"test",
					hideEffect: Element.hide,
					okLabel: 	"Close",
					closable: true
				});
}

/**
* Opens the js login window
*
* @param  string  id         DOM element id
*/
function openLoginWindow(id, title)
{
	return Dialog.info({
				url: "http://192.168.1.21/docapolis_projet/web/frontend_dev.php/project/askToSignupSingleProject?id_project=3",
			 	options: { method: 'get' }
			}, 
			{
				className: 	"docapolis",
				title: 		"test",
				hideEffect: Element.hide,
				okLabel: 	"Close",
				width: 200,
				height:	200,
				closable: true
			});
			
}

function projectRegistration(id_project)
{
	
	new Ajax.Updater( 'content_popin_register', URL_ROOT+'project/signupProject', { 
														evalScripts: true,
														success: openLoginWindow("project_window", "Inscription"),
														parameters: { project: id_project } 
													} );
}

function menuContactList( letter )
{
	$$('ul#list_letter > li').each( function(e)
	{
		if( e.hasClassName('selected') )
		{
			e.className = '';
			e.down().className='';
		}
	});
	
	var link 		= $(letter);
	var li_parent 	= link.up(); 
	
	link.addClassName('selected');
	li_parent.addClassName('selected');
}
