var ContactDemoForm = function(){};

/***
 * Init the form
 * @returns {undefined}
 */
ContactDemoForm.Init = function(){
    Event.AddById("btnSendDemoContact", "click", ContactDemoForm.SaveElement);
};

/***
* Get the Id of element 
*/
ContactDemoForm.GetId = function(){
    return Form.GetId("ContactDemoFormForm");
};

/*
* Save the Element
*/
ContactDemoForm.SaveElement = function(e){
   
    
    if(Form.IsValid("ContactDemoFormForm"))
    {
        Animation.AddLoading("ContactDemoFormForm");
           
        let request = new Http("Crm", "SendContact");
        
        contactForm = Form.Serialize("ContactDemoFormForm");
        
        request.SetData(contactForm);

        request.Post(data => {

            Animation.RemoveLoading("ContactDemoFormForm");
            Animation.Show("ContactDemoFormForm");
            Animation.Load("ContactDemoFormForm", Language.GetCode("Cms.ContactDemoFormRecevied"));
        });
    }
};

