﻿function NewsletterObject(id,name, email)
{
    var o=this;
    this.name = name;
    this.email = email;
    var data;
    var action_Subscribe=true;
    this.getData = function()
    {
        return data;
    }
    this.Subscribe = function()
    {
        action_Subscribe=true;
        com.GS.DataHandler.AjaxHandler.Subscribe_Newsletter(name, email, o.CallBack);
    }
    this.CallBack = function(res)
    {
        data = res.value;
        if(data)
        {
            
                id.innerHTML="Thank you for subscribe <b>Global Smile&copy;</b>, we know that our success is only a measure of yours. ";
           
               
        }
        else
            id.innerHTML="Server error OR You email has be recorded";

    }
    this.UnSubscribe = function()
    { 
        action_Subscribe=false;
        com.GS.DataHandler.AjaxHandler.UnSubscribe_Newsletter(name, email, o.CallBack2);
    }
    this.CallBack2 = function(res)
    {
        data = res.value;
        if(data)
        {
            
                id.innerHTML="Thank you for Unsubscribe <b>Global Smile&copy;</b>, we know that our success is only a measure of yours. ";
           
               
        }
        else
            id.innerHTML="Server error OR There is no this email";

    }
}