Profile = new ( Class.create({
    
    initialize : function() {},
    
    DefaultEmail : "Írd ide az email címed...",
    
    DefaultName : "Írd ide a neved...",
    
    DefaultDescription : "Írd ide a hozzászólásodat...",
    
    LoadTo: function(container)
    {
        DOMExtender.AddInput("commentForm", "commentEmail", this.DefaultEmail, null);
        DOMExtender.AddInput("commentForm", "commentName", this.DefaultName, null);
        DOMExtender.AddTextArea("commentForm", "commentDescription", this.DefaultDescription, null);
        $("commentForm").insert('<div class="buttonLine"><a id="sendButton" class="button">Hozzászólás elküldése</a></div>');
        
        Event.observe('sendButton', 'click', this.SendButtonClick.bindAsEventListener(this));
    },
    
    SendButtonClick : function(event)
    {
        Event.stop(event);
        if(this.Validate())
        {
            var pars = "commentEmail=" + $("commentEmail").value;
                pars += "&commentName=" + encodeURIComponent($("commentName").value);
                pars += "&commentDescription=" + encodeURIComponent($("commentDescription").value);
                pars += "&profileID=" + $("profileID").value;
                
            ActionHandler.GetResponse(
            {
                url: "Components/Profile/ProfileActionHandler.php",
                action: "AddComment",
                parameters: pars
            });
            alert("A hozzászólás megerősítéséhez szükséges linket elküldtük a megadott e-mail címedre");
            
            var i = document.location.toString().indexOf('#');
            if(i > 0) { document.location = document.location.toString().substring(0, i); }
            else { document.location = document.location; }
        }
    },
    
    Validate : function()
    {
        if($("commentEmail").value == this.DefaultEmail)
        {
            $("commentEmail").setStyle({color: "#f00"});
            return false;
        }
        if($("commentName").value == this.DefaultName)
        {
            $("commentName").setStyle({color: "#f00"});
            return false;
        }
        if($("commentDescription").value == this.DefaultDescription)
        {
            $("commentDescription").setStyle({color: "#f00"});
            return false;
        }
        return true;
    }
    
}))();
