Password = new ( Class.create({
    
    initialize : function()
    {
    },
    
    LockFunctions : false,
    
    PasswordWindow : new Window({
        container: "window",
        title: "Jelszó módosítás",
        width: 400,
        contentURL: "Components/Password/Password.php"
    }),
    
    ModifyPasswordClicked : function(event)
    {
        Event.stop(event);
        GlobalLoading.Start();
        
        this.PasswordWindow.Show();
        $("pwd1").focus();
        
        var thisClass = this;
        
        Event.observe("PasswordCancel", "click", function(event) { Event.stop(event); thisClass.PasswordWindow.Close(); } );
        Event.observe("PasswordModify", "click", this.ModifyPassword.bindAsEventListener(this));
        
        GlobalLoading.Stop();
    },
    
    ModifyPassword : function(event)
    {
        Event.stop(event);
        
        GlobalLoading.Start();
        
        if(!this.LockFunctions)
        {
            this.LockFunctions = true;
            if(this.CheckStrings())
            {
                var pars = "pwd=" + $("pwd1").value;
                    pars += "&pwd2=" + $("pwd2").value;
    
                ActionHandler.GetResponse(
                {
                    url: "Components/Profile/ProfileActionHandler.php",
                    action: "ModifyPassword",
                    parameters: pars
                });
                this.PasswordWindow.Close();
            }
            this.LockFunctions = false;
        }
        
        GlobalLoading.Stop();
    },
    
    CheckStrings : function()
    {
        var result = true;
        
        if($("pwd1").value == "" || $("pwd1").value == null)
        {
            $("pwd1Message").innerHTML = "A jelszó mező üres!";
            result = false;
        }
        else { $("pwd1Message").innerHTML = "&nbsp;"; }
        
        if($("pwd1").value != $("pwd2").value)
        {
            $("pwd2Message").innerHTML = "A jelszó és megerősítése nem egyezik!";
            result = false;
        }
        else { $("pwd2Message").innerHTML = "&nbsp;"; }
        
        return result;
    }
    
}))();
