/**
 * @author rgaumond
 */
function login()
{
	if ((!$("password").value) && (!$("userName").value)) {
		return false;
	}
	else if ((!$("password").value) || (!$("userName").value)) {
		$("login_alert").style.display="block";
	}
	else
	{	
		continueInfo();
		new Ajax.Updater('prompt_container', 'prompts/login.aspx', {evalScripts:true,
		  			parameters: {
						user_password:$("password").value,
						user_name:$("userName").value,
						execute:'login'
					},
		   			onComplete:function(){validate()}
					}); 	
	}	
}

function init_login()
{
	
	if ((!$("init_password").value) && (!$("init_userName").value)) {
		return false;
	}
	else if ((!$("init_password").value) || (!$("init_userName").value)) {
		$("init_login_alert").style.display="block";
	}
	else
	{	
		veil();
		continueInfo();
		new Ajax.Updater('prompt_container', 'prompts/login.aspx', {evalScripts:true,
		  			parameters: {
						user_password:$("init_password").value,
						user_name:$("init_userName").value,
						execute:'login'
					},
		   			onComplete:function(){showPrompt();validate()}
					}); 	
	}	
}

function navigateHome()
{
   window.location.href = "accueil.aspx";
}

function validate()
{
  if($("prompt_container").innerHTML!="True")
     showInfo(current_page);
  else
  {
    if(current_page=="activite")
        window.location.href = "activite.aspx";
    else
        window.location.href = "accueil.aspx";
  }
}

function lostMail()
{
    if($('courriel_lost').value ==null || $('courriel_lost').value=="")
        $('lost_mail_alert').style.display="block";
    else
    {
        hidePrompt();
        
        var theForm = $("nav_form");	
	    theForm.execute.value = "lost_info";
	    theForm.other_nav_info.value = $('courriel_lost').value;
	    theForm.action = "accueil.aspx";
	    theForm.submit();
	    veil();
    }    

}
