$j = jQuery.noConflict();

function isChecked(checkboxId){
	if(jQuery('#'+checkboxId).is(':checked')){
		return 1;
	}
	return 0;
}

function elementExists(elementId){
	return (jQuery('#'+elementId).length > 0);
}


jQuery.fn.closePopup = function() {
    this.css("position", "absolute");
    this.css("top", (jQuery(window).height() - this.height()) / 2 + jQuery(window).scrollTop() + "px");
    this.css("left", (jQuery(window).width() - this.width()) / 2 + jQuery(window).scrollLeft() + "px");
    return this;
}
jQuery.fn.center = function () {
    this.css("position", "absolute");
    this.css("top", (jQuery(window).height() - this.height()) / 2 + jQuery(window).scrollTop() + "px");
    this.css("left", (jQuery(window).width() - this.width()) / 2 + jQuery(window).scrollLeft() + "px");
    return this;
}

    jQuery(window).resize(function (e) {
        if (jQuery("#popupContact")) {
            jQuery("#popupContact").center();
        }
    });

  
function getAjaxHtml(controllerPath, method, params, target, callback) {
    jQuery.ajax({
        url: controllerPath,
        data: params,
        type: method,
        success: function (msg) {
            if (typeof callback == "function") callback(msg); 
            else alert('meh');    
        },
        error: function (msg) {
            alert("Data Not Saved: " + msg);
        }
    });
}




function popupAction(msg){
    jQuery("#popupContact,#backgroundPopup").remove();
    jQuery("body").append(msg);
    jQuery("#popupContact").center();
	jQuery("#popupContact").fadeIn();
    jQuery("#backgroundPopup").css({ "opacity": "0.7" });
    /*if (jQuery("#popupContact .popup_header_closeButton").has("div").length) {
        jQuery("#popupContact").delay(2301).fadeOut('slow');
        jQuery("#backgroundPopup").delay(2301).fadeOut("slow");
    }*/
    jQuery("#close-offer").click(function (e) {        
        jQuery("#popupContact").fadeOut('slow');
        jQuery("#backgroundPopup").fadeOut("slow");
    });

}

 jQuery(window).scroll(function (e) {
        if (jQuery("#popupContact")) {
            jQuery("#popupContact").center();
        }
    });

//getAjaxHtml('<?php echo url_for('@homepage_offertonewmember');?>', 'get', "", 'body', popupAction);






/*Used In profil & search to open/hide divs with buttons effects*/
function toggleMyMenus(menu){
	jQuery('#'+menu).toggle();
	jQuery('#hide_'+menu).toggle();
	jQuery('#show_'+menu).toggle();
}
function openMyMenus(menu){
	jQuery('#'+menu).show();
	jQuery('#hide_'+menu).show();
	jQuery('#show_'+menu).hide();
}
function closeMyMenus(menu){
	jQuery('#'+menu).hide();
	jQuery('#hide_'+menu).hide();
	jQuery('#show_'+menu).show();
}


//setCoverFlowLoader(true);
function setCoverFlowLoader(bool){
	if(bool){
		$j('#LoaderAjaxPrincipal').show();
		centerPopup('LAjaxTop',-170,0);
		centerPopup('LAjaxBG',-170,0);
	}else{
		$j('#LoaderAjaxPrincipal').hide();
	}
}

function timerLogout(){
	setTimeout("logout()", 3000);
}
function logout(){
	window.location = "/index.php/logout";
}


function closeAlertBox(goto){
	if(goto != null)
		window.location = goto;
}
function closeAlertBoxTimer(time,redirectionText){
	$j('#lb_alertTopTimer').html('<img src="/images/ajax-loader_l.gif"  />');
	time--;
	//setTimeout("closeAlertBoxTimer('"+time+"' , '"+redirectionText+"')", 1000);
}
function openAlertBox(texte, autoClose, closeAfter , url , redirectionText){
	
	$j('#lb_alert').show();
	$j('#lb_alertTop').show();
	$j('#lb_alertBg').show();
	
	if(redirectionText == null){
		redirectionText	=	"votre profil";
	}
	
	$j('#lb_alertTopContent').html(texte);
	
	centerPopup('lb_alertTop',0,0);
	centerPopup('lb_alertBg',0,0);
	$j('#lb_alert').show();
	if(autoClose){
		setTimeout("closeAlertBoxTimer('"+closeAfter+"' , '"+redirectionText+"')", 0);
		setTimeout("closeAlertBox('"+url+"')", closeAfter*1000);
	}
	centerPopup('lb_alertTop',0,0);
	centerPopup('lb_alertBg',0,0);
}



function closeAlertTimer(){
	$j('#lb_alertTop').hide("slow");
	$j('#lb_alertBg').hide("slow");
}

function setAlert(texte, closeAfter ){
	$j('#lb_alertTopContent').html(texte);

	$j('#lb_alert').show();
	$j('#lb_alertTop').show();
	$j('#lb_alertBg').show();
	centerPopup('lb_alertTop',0,0);
	centerPopup('lb_alertBg',0,0);
	
	setTimeout("closeAlertTimer('"+closeAfter+"')", closeAfter*1000 );
}

function setAlertSecureConfirmation(texte, function_callback ){
	$j('#lb_alertTopContent').html(texte);

	$j('#lb_alert').show();
	$j('#lb_alertTop').show();
	$j('#lb_alertBg').show();
	centerPopup('lb_alertTop',0,0);
	centerPopup('lb_alertBg',0,0);
	
	//setTimeout("closeAlertTimer('"+closeAfter+"')", closeAfter*1000 );
}






function updateAjaxImStatus(status, status_string)
{
	Status.set(status, Languages.get(status_string));
}

function updateDisplayingStatus(status) {

	jQuery.ajax(
	{
		type:'POST',
		dataType:'html',
		success:function(data, textStatus){jQuery('#status_toogle').html(data);},
		beforeSend:function(XMLHttpRequest){jQuery('#status_toogle').html('Chargement ...');},
		url:'/status/'+status
	});
}

function updateStatusSuccess(data,name,startText){
	//if(data==""){
	//	data=startText;
	//}else{
		anative = data;
		data	=	name+" "+data;
	//}
	
	
	jQuery("div[@id=startStatusLoader]").hide();
	jQuery("div[@id=status_submit]").hide();
	jQuery("div[@id=startStatusChange]").show();
	
	//jQuery("input[@id=personal_message_fake]").attr("value",data) ;
	jQuery("input[@id=personal_message_fake]").val(data) ; 
	jQuery("textarea[@id=personal_message]").val(anative) ;
	setAlert("Votre statut a bien &eacute;t&eacute; sauvegard&eacute;", 1 );
}
function updateStatusLoading(){

	//$j("div[@id=startStatusLoader]").show();
	$j("div[@id=startStatusChangeReal]").hide();
}

function submitJQueryForm(formId, url , updateDivId, loaderId , arrayData ){
	var form	=	$j('#'+formId) ;
	jQuery.ajax(
		{
		type:'POST',
		dataType:'html',
		data:form.serialize(),success:function(data, textStatus){
			$j('#'+updateDivId).html(data);
		},
		beforeSend:function(XMLHttpRequest){
			$j("#"+loaderId).show();
		},
		complete:function(XMLHttpRequest, textStatus){
			$j("#"+updateDivId).show();
			$j("#"+loaderId).hide();
		},
		url:url}
		);
		return false;
}

function setSelectorOfAll(checkbox, prefixe, count){
	var checked_status = "";
	if(checkbox.checked)checked_status="checked";

	for(var i=0;i<count;i++){
		$j("#"+prefixe+""+i).attr("checked", checked_status) ;
	}
}

function openBottomLink(menu){
	if(menu == 'cgv'){
		loadDistantPopUp("/index.php/inscription/getCGV")
	}else if (menu == 'faq'){
		loadDistantPopUp("/index.php/inscription/getFAQ")
	}else if (menu == 'contact'){
		loadDistantPopUp("/index.php/inscription/getContact")
	}
}

function loadDistantPopUp(url){
	//appel Ajax de l'url
	jQuery.ajax
	({
		url: url,
		type:'POST',
		dataType:'html',
		complete:function(XMLHttpRequest, textStatus){},
		success:function(data, textStatus){
			jQuery('#distantPopUpDiv').html(data);
			closeOpenDistantPopUp(true);
		}
	});
	return false;
}
function closeOpenDistantPopUp(bool){
	if(bool){
		jQuery('#distantPopUpDiv').show();
	}else{
		jQuery('#distantPopUpDiv').hide();
	}
	return true;
}



function isIE(){
	return (navigator.appName == "Microsoft Internet Explorer");
}

function updateMenuPricipalMsgCount(count){
	if (count>0) {
		jQuery("#messages_in_menu_button").html('Messages ('+count+')');
	} else {
		jQuery("#messages_in_menu_button").html('Messages');
	}
}

function updateUnreadMsgCount(count) {
	updateMenuPricipalMsgCount(count);
	if (count>0) {
		//$j("#UMC_link").html(count+' Messages');
		//$j("#UMC_containter").fadeIn(500);
		//$j("#inbox_right_menu").text('( '+count+' )');
	} else {
		//$j("#UMC_containter").fadeOut(2000);
		//$j("#inbox_right_menu").empty();
	}
}

/*Fonctions de la barre de navigations du bas V2: */

$j(document).ready(function() {
	// jquery rulez
	
	$j('#chat_zone_bt_menu').click(function() { // hide, show contacts list
		$j('#chat_zone_menu').toggle(/*'slow'*/);
	});
	$j('#chat_zone_menu_header_bt_close').click(function() { // hide contacts list
		$j('#chat_zone_menu').hide(/*'slow'*/);
	});
	$j('#chat_onglet_conversation_0 .chat_onglet_conversation_pseudo').click(function() { // hide, show contact chat
		$j('#chat_zone_conversation').toggle(/*'slow'*/);
	});
	$j('#chat_zone_conversation_tools_minimise').click(function() { // hide contact chat
		$j('#chat_zone_conversation').hide(/*'slow'*/);
	});
	$j('#chat_zone_conversation_tools_close').click(function() { // delete contact chat
		$j('#chat_zone_conversation').hide(/*'slow'*/);
		$j('#chat_onglet_conversation_0').hide(/*'slow'*/);
		// to be continue...
	});
	$j('#chat_onglet_conversation_0 .chat_onglet_conversation_close').click(function() { // delete contact chat
		$j('#chat_zone_conversation').hide(/*'slow'*/);
		$j('#chat_onglet_conversation_0').hide(/*'slow'*/);
		// to be continue...
	});
});	

function toogleMyMenu(){
	$j('#chat_zone_menu').toggle(/*'slow'*/);
}

window.chatInworldCount	=	0	;
window.xdb_members_list		=	new Array() 	;
function xdb_chat_user_new(memberId, url ,unreadMessages , sexe ){
	jQuery.ajax
		({
		url: url,
		type:'POST',
		dataType:'html',
		complete:function(XMLHttpRequest, textStatus){ xdb_addNewChatUser(memberId  ); },
		success:function(data, textStatus){ xdb_onLoadDistantChat(data, memberId , sexe  , unreadMessages ); }
		});
	return false;
}

function xdb_addNewChatUser(memberId){
	//xdb_openWindowForUser(memberId,window.chatInworldCount++);
}

function xdb_openWindowForUser(memberId,i){
	//
}

//xdb_onLoadDistantChat(data, memberId ,  sexe , '');
function xdb_onLoadDistantChat(data, memberId ,  sexe , unreadMessages ){
	
	if(unreadMessages == null)unreadMessages='';
	
	var provArray	=	new Array();
	provArray['sexe']=sexe;
	provArray['unreadMessages']=unreadMessages;
	window.xdb_members_list[memberId] = provArray;
	
	$j('body').append(data);
	
	data	=	'<div id="chat_onglet_conversation_'+memberId+'" class="chat_onglet_conversation"><div class="chat_onglet_conversation_message">'+window.xdb_members_list[memberId]['unreadMessages']+'</div><div onclick="xdb_toogle_xdb_chat_window(\''+memberId+'\' , \''+window.xdb_members_list[memberId]['sexe']+'\' )" id="chat_onglet_conversation_texte'+memberId+'" class="chat_onglet_conversation_pseudo">'+memberId+'</div><div class="chat_onglet_conversation_close"><a href="javascript:void(0);" onclick="xdb_close_xdb_chat_window(\''+memberId+'\')"><img src="/images/chat/bt_onglet_close.gif" title="Fermer la conversation" alt="X" /></a></div></div>';
	$j('#chat_zone_onglets_conversations_mask').append(data);
	
	if(window.xdb_members_list[memberId]['unreadMessages'] == ''){
		xdb_minimise_active_xdb_chat_window();
		xdb_maximise_xdb_chat_window(memberId);
	}else{
		
	}
	
	xdb_setSelectedWindow(memberId);
}

function getFromCookieOpenedChat(){
	//
}
window.lastSelectedWindow	=	null	;
function xdb_setSelectedWindow(memberId){
	window.lastSelectedWindow	=	memberId;
}

function xdb_close_xdb_chat_window(memberId){
	$j('#xdb_chat_window_'+memberId).hide(/*'slow'*/);
	$j('#chat_onglet_conversation_'+memberId).hide(/*'slow'*/);
	if(window.lastSelectedWindow == memberId){
		window.lastSelectedWindow	=	null;
	}
}

function xdb_minimise_active_xdb_chat_window(){
	if(window.lastSelectedWindow != null){
		xdb_minimise_xdb_chat_window(window.lastSelectedWindow)
	}
	window.lastSelectedWindow	=	null;
}

function xdb_maximise_xdb_chat_window(memberId){
	var sexe= window.xdb_members_list[memberId]['sexe'] ;
	$j('div[id=\'chat_onglet_conversation_'+memberId+'\']').addClass(sexe+'_selected');
	$j('div[id=\'chat_onglet_conversation_texte'+memberId+'\']').addClass(sexe+'_color');
	$j('div[id=\'xdb_chat_window_'+memberId+'\']').toggle(/*'slow'*/);
	xdb_setSelectedWindow(memberId);
}
function xdb_minimise_xdb_chat_window(memberId){
	var sexe= window.xdb_members_list[memberId]['sexe'] ;
	$j('div[id=\'chat_onglet_conversation_'+memberId+'\']').removeClass(sexe+'_selected');
	$j('div[id=\'chat_onglet_conversation_texte'+memberId+'\']').removeClass(sexe+'_color');
	$j('div[id=\'xdb_chat_window_'+memberId+'\']').toggle(/*'slow'*/);
}
function xdb_toogle_xdb_chat_window(memberId){
	if($j('div[id=\'xdb_chat_window_'+memberId+'\']').css("display") == 	"none"){
		if(window.lastSelectedWindow != memberId){
			
			xdb_minimise_xdb_chat_window(window.lastSelectedWindow);
		}
		xdb_maximise_xdb_chat_window(memberId);
	}else{
		xdb_minimise_xdb_chat_window(memberId);
	}
}


/*Original Functions of Templates*/

function showUpdateMembersStateZero() {
	var divTwoFirst = $j('#two_first_update_membres');
	var divTwoLast= $j('#two_last_update_membres');
	var img_min = $j('#ico_min_update_membres');
	var img_show_max = $j('#ico_show_max_update_membres');
	var link_show_max = $j('#link_show_max_update_membres');
	var link_min_max = $j('#link_min_max_update_membres');
	var img_show_min = $j('#ico_show_min_update_membres');
	var link_show_min = $j('#link_show_min_update_membres');
	var span_img_show_min = $j('#span_ico_show_min_update_membres');
	var div_all_content = $j('#update_membres_all_content');
	var footer = /*DoubleDolars*/$j('#updates .small_grad_push_footer');

	divTwoFirst.css('display', 'none');
	divTwoLast.css('display', 'none');
	img_min.attr('src') = 'images/ico_max_push.gif';
	link_min_max.attr('href') = 'javascript:showUpdateMembersStateTwo()';
	link_show_max.attr('href') = 'javascript:showUpdateMembersStateTwo()';
	img_show_max.attr('src') = 'images/ico_show_max_push.gif';
	link_show_min.attr('href') = '';
	img_show_min.attr('src') = '';
	span_img_show_min.css('display', 'none');
	div_all_content.css('display', 'block');
	footer.css('background-image', 'url("/images/footer_grad_push2.gif")');
}

function showUpdateMembersStateTwo() {
	var divTwoFirst = $j('#two_first_update_membres');
	var divTwoLast= $j('#two_last_update_membres');
	var img_min = $j('#ico_min_update_membres');
	var img_show_max = $j('#ico_show_max_update_membres');
	var link_show_max = $j('#link_show_max_update_membres');
	var link_min_max = $j('#link_min_max_update_membres');
	var img_show_min = $j('#ico_show_min_update_membres');
	var link_show_min = $j('#link_show_min_update_membres');
	var span_img_show_min = $j('#span_ico_show_min_update_membres');
	var div_all_content = $j('#update_membres_all_content');
	var footer = /*DoubleDolars*/$j('#updates .small_grad_push_footer');
	
	divTwoFirst.css('display', 'block');
	divTwoLast.css('display', 'none');
	img_min.attr('src') = 'images/ico_min_push.gif';
	link_min_max.attr('href') = 'javascript:showUpdateMembersStateZero()';
	link_show_max.attr('href') = 'javascript:showUpdateMembersStateFour()';
	img_show_max.attr('src') = 'images/ico_show_max_push.gif';
	link_show_min.attr('href') = 'javascript:showUpdateMembersStateZero()';
	img_show_min.attr('src') = 'images/ico_show_min_push.gif';
	span_img_show_min.css('display', 'inline');
	div_all_content.css('display', 'block');
	footer.css('background-image', 'url("/images/footer_grad_push3.gif")');
}	

function showUpdateMembersStateFour() {
	var divTwoFirst = $j('#two_first_update_membres');
	var divTwoLast= $j('#two_last_update_membres');
	var img_min = $j('#ico_min_update_membres');
	var img_show_max = $j('#ico_show_max_update_membres');
	var link_show_max = $j('#link_show_max_update_membres');
	var link_min_max = $j('#link_min_max_update_membres');
	var img_show_min = $j('#ico_show_min_update_membres');
	var link_show_min = $j('#link_show_min_update_membres');
	var span_img_show_min = $j('#span_ico_show_min_update_membres');
	var div_all_content = $j('#update_membres_all_content');
	
	divTwoFirst.css('display', 'block');
	divTwoLast.css('display', 'block');
	img_min.attr('src') = 'images/ico_min_push.gif';
	link_min_max.attr('href') = 'javascript:showUpdateMembersStateZero()';
	link_show_max.attr('href') = 'javascript:showUpdateMembersStateTwo()';
	img_show_max.attr('src') = 'images/ico_show_min_push.gif';
	link_show_min.attr('href') = '';
	img_show_min.attr('src') = '';
	span_img_show_min.css('display', 'none');
	div_all_content.css('display', 'block');
}		


function showMembersAnnivStateZero() {
	var divTwoFirst = $j('#two_first_anniv_membres');

	var divTwoLast= $j('#two_last_anniv_membres');
	var img_min = $j('#ico_min_anniv_membres');
	var img_show_max = $j('#ico_show_max_anniv_membres');
	var link_show_max = $j('#link_show_max_anniv_membres');
	var link_min_max = $j('#link_min_max_anniv_membres');
	var img_show_min = $j('#ico_show_min_anniv_membres');
	var link_show_min = $j('#link_show_min_anniv_membres');
	var span_img_show_min = $j('#span_ico_show_min_anniv_membres');
	var div_all_content = $j('#anniv_membres_all_content');
	var footer = /*DoubleDolars*/$j('#anniversaires .small_grad_push_footer');
	
	divTwoFirst.css('display', 'none');
	divTwoLast.css('display', 'none');
	img_min.attr('src') = 'images/ico_max_push.gif';
	link_min_max.attr('href') = 'javascript:showMembersAnnivStateTwo()';
	link_show_max.attr('href') = 'javascript:showMembersAnnivStateTwo()';
	img_show_max.attr('src') = 'images/ico_show_max_push.gif';
	link_show_min.attr('href') = '';
	img_show_min.attr('src') = '';
	span_img_show_min.css('display', 'none');
	div_all_content.css('display', 'none');
	footer.css('background-image', 'url("/images/footer_grad_push2.gif")');
}

function showMembersAnnivStateTwo() {
	var divTwoFirst = $j('#two_first_anniv_membres');
	var divTwoLast= $j('#two_last_anniv_membres');
	var img_min = $j('#ico_min_anniv_membres');
	var img_show_max = $j('#ico_show_max_anniv_membres');
	var link_show_max = $j('#link_show_max_anniv_membres');
	var link_min_max = $j('#link_min_max_anniv_membres');
	var img_show_min = $j('#ico_show_min_anniv_membres');
	var link_show_min = $j('#link_show_min_anniv_membres');
	var span_img_show_min = $j('#span_ico_show_min_anniv_membres');
	var div_all_content = $j('#anniv_membres_all_content');
	var footer = /*DoubleDolars*/$j('#anniversaires .small_grad_push_footer');
	
	divTwoFirst.css('display', 'block');
	divTwoLast.css('display', 'none');
	img_min.attr('src') = 'images/ico_min_push.gif';
	link_min_max.attr('href') = 'javascript:showMembersAnnivStateZero()';
	link_show_max.attr('href') = 'javascript:showMembersAnnivStateFour()';
	img_show_max.attr('src') = 'images/ico_show_max_push.gif';
	link_show_min.attr('href') = 'javascript:showMembersAnnivStateZero()';
	img_show_min.attr('src') = 'images/ico_show_min_push.gif';
	span_img_show_min.css('display', 'inline');
	div_all_content.css('display', 'block');
	footer.css('background-image', 'url("/images/footer_grad_push3.gif")');
}	

function showMembersAnnivStateFour() {
	var divTwoFirst = $j('#two_first_anniv_membres');
	var divTwoLast= $j('#two_last_anniv_membres');
	var img_min = $j('#ico_min_anniv_membres');
	var img_show_max = $j('#ico_show_max_anniv_membres');
	var link_show_max = $j('#link_show_max_anniv_membres');
	var link_min_max = $j('#link_min_max_anniv_membres');
	var img_show_min = $j('#ico_show_min_anniv_membres');
	var link_show_min = $j('#link_show_min_anniv_membres');
	var span_img_show_min = $j('#span_ico_show_min_anniv_membres');
	var div_all_content = $j('#anniv_membres_all_content');
	
	divTwoFirst.css('display', 'block');
	divTwoLast.css('display', 'block');
	img_min.attr('src') = 'images/ico_min_push.gif';
	link_min_max.attr('href') = 'javascript:showMembersAnnivStateZero()';
	link_show_max.attr('href') = 'javascript:showMembersAnnivStateTwo()';
	img_show_max.attr('src') = 'images/ico_show_min_push.gif';
	link_show_min.attr('href') = '';
	img_show_min.attr('src') = '';
	span_img_show_min.css('display', 'none');
	div_all_content.css('display', 'block');
}	

//window.addEvent('domready', function() {
$j(document).bind('ready', function() {
	var listStatus = new Array('Bient�t les vacances, ras le bol du boulot','M�tro, boulot, dodo', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit', 'Cras dapibus mauris');
	var delayHidden = 2000;
	var timer;
	
	function getRealLeft(el){
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
	xPos += tempEl.offsetLeft;
	tempEl = tempEl.offsetParent;
		}
		return xPos;
	}
	
	function getRealRight(el){
		xPos = el.offsetLeft +
		el.offsetWidth;
	   
		tempEl = el.offsetParent;
		while (tempEl != null) {
	xPos += tempEl.offsetLeft;
	tempEl = tempEl.offsetParent;
		}
		return xPos;
	}
	
	function getRealTop(el){
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
	yPos += tempEl.offsetTop;
	tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
	
	function getRealBottom(el){
		yPos = el.offsetTop +
		el.offsetHeight;
		tempEl = el.offsetParent;
		while (tempEl != null) {
	yPos += tempEl.offsetTop;
	tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
	$j("#status_toogle_bt").bind('click', function() {
	//$j('#status_toogle_bt').addEvent('click', function(){
		if(this.get('text') == "Online" ) this.set('text','Offline');
		else this.set('text','Online');
	});
	$j("#search_field").bind('focus', function() {
	//$j('#search_field').addEvent('focus', function(){					
		if (this.get('value') == "mot clef, r�gion, pseudo") {
			this.set('value', '')
		};				
	});
	$j("#search_field").bind('blur', function() {
	//$j('#search_field').addEvent('blur', function(){
		if (this.get('value') == "") {
			this.set('value', 'mot clef, r�gion, pseudo');
		}
	});
	$j("#status_title").bind('focus', function() {
	//$j('#status_title').addEvent('focus', function(){
		showListStatus();
	});
	$j("#status_sub_link").bind('click', function() {
	//$j('#status_sub_link').addEvent('click', function(){
		showListStatus();
		$j(document).bind('mousemove', function(event) {
		//document.addEvent('mousemove', function(event){
			if (timer == null) {
				timer = window.setTimeout(timeoutFunction(event), delayHidden);
			}							
		});
	});
	
	function timeoutFunction(event) {
		return function() {
			hideListStatus(event);
		}
	}
	
	function showListStatus() {
		$j('#status_select').empty();
		$j('#status_title').val('value', '');
			
		/*$j(listStatus).each(function(item, index){
			var status = new Element('div');
			status.set('text',item);
			status.addEvent('click',function(){
				$j('#status_title').val(this.get('text'));
				$j('#status_select').css('display','none');	
			});
			status.injectInside($j('#status_select'));
		});
		
		$j('#status_select').css('display','block');*/	
	}
	/*
	function hideListStatus(event) {
		var divElement = $j('#status_select');
		var trickExecuted = false;
		if (divElement.css('display') == 'none') {
			divElement.style.visibility = "hidden";
			divElement.style.display = "block";
			trickExecuted = true;
		}
		
		var left = getRealLeft(divElement);
		var right = getRealRight(divElement);
		var top = getRealTop(divElement);
		var bottom = getRealBottom(divElement);
		
		if (trickExecuted) {
			divElement.style.display = "none";
			divElement.style.visibility = "visible";
		}
		
		var mouseX = event.page.x;
		var mouseY = event.page.y;
		
		if(!(left < mouseX && mouseX < right && top < mouseY && mouseY < bottom)) {
			divElement.css('display','none');
		}
		
		clearTimeout(timer);
		timer = null;
	}
	*/			
	if(isIE()) {
		var divElement = $j('#status_select');
		
		var trickExecuted = false;
		if (divElement.getStyle('display') == 'none') {
			divElement.style.visibility = "hidden";
			divElement.style.display = "block";
			trickExecuted = true;
		}
		
		divElement.css('top', divElement.getStyle('top').toInt() - 142);
		
		if (trickExecuted) {
			divElement.style.display = "none";
			divElement.style.visibility = "visible";
		}
	}
});	




