﻿// *******
// ACCOUNT
// *******

function loginCheck(dalert,mode)
{

    if(mode=="login")
    {
    
    	var oForm = document.getElementById("formRAccount");
        	
    	if(oForm)
    	{
        	
		    var nickname = oForm.nickname.value;
		    var password = oForm.password.value;

		    if(!nickname || !password)
		    {

			    alert(dalert);
    		
    		    return false;
    		
		    }
		    else
		    {
    		
			    return true;
    	
		    }

        }
        
    }
    else if(mode=="password")
    {
    
    	var oForm = document.getElementById("formRPassword");
        	
    	if(oForm)
    	{
        	
    	    var email = oForm.email.value;
    	    
	        if(!email)
	        {

		        alert(dalert);
    		
		        return false;
    		    
	        }
	        else
	        {
    		
		        return true;
    	
	        }

        }
        
    }
    else
    {
	
	    return false;
	    
    }

}

function loginDisplay(mode)
{

    var divLogin = document.getElementById('top_account_div_login');
    var divPassword = document.getElementById('top_account_div_password');
    var divAlert = document.getElementById('top_account_div_alert');

    if(divLogin && divPassword && divAlert)
    {
    
        if(mode=="login")
        {
        
            divLogin.style.display = 'block';
            divPassword.style.display = 'none';
            divAlert.style.display = 'none';
        
        }
    
        if(mode=="password")
        {
        
            divLogin.style.display = 'none';
            divPassword.style.display = 'block';
            divAlert.style.display = 'none';

        }

    }

}


