// Constructor
function App (name,
              etat,
              startLeft,
              endLeft,
              speed,
              enlargeML,
              enlargeMT,
              centerLeft,
              centerTop,
              content) {

// Properties
    this.name_ = name;
    this.etat_ = etat;
    this.startLeft_ = startLeft;
    this.endLeft_ = endLeft;
    this.speed_ = speed;
    this.enlargeML_ = enlargeML;
    this.enlargeMT_ = enlargeMT;
    this.centerLeft_ = centerLeft;
    this.centerTop_ = centerTop;
    this.content_ = content;
    this.domElem_ = $element(name);

// Méthodes
    this.getNameApp = getNameApp;
    this.getEtat = getEtat;
    this.getStartLeft = getStartLeft;
    this.getEndLeft = getEndLeft;
    this.getSpeed = getSpeed;
    this.getEnlargeML = getEnlargeML;
    this.getEnlargeMT = getEnlargeMT;
    this.getCenterLeft = getCenterLeft;
    this.getCenterTop = getCenterTop;
    this.getContent = getContent;
    this.getDomElem = getDomElem;

    this.setEtat = setEtat;

    this.getAJAXRequest = getAJAXRequest;
}

function getNameApp(){
    return this.name_;
}

function getEtat(){
    return this.etat_;
}

function getStartLeft(){
    return this.startLeft_;
}

function getEndLeft(){
    return this.endLeft_;
}

function getSpeed(){
    return this.speed_;
}

function getEnlargeML(){
    return this.enlargeML_;
}

function getEnlargeMT(){
    return this.enlargeMT_;
}

function getCenterLeft(){
    return this.centerLeft_;
}

function getCenterTop(){
    return this.centerTop_;
}

function getContent(){
    return this.content_;
}

function getDomElem(){
    return this.domElem_;
}

function setEtat(etat){
    this.etat_ = etat;
}

function getAJAXRequest(){
    var content;
    content = 'opened_' + this.getContent();

    $.ajax({
        type: "GET",
        url: 'App/header_app.php',
        //data: "content=" + this.getContent() + "&id=" + this.getNameApp()[3],
        data: "&id=" + this.getNameApp()[3],
        success: function(data){
            document.getElementById(content).innerHTML = data;
            $.ajax({
                url: "App/" + content + ".php",
                success: function(data){
                    document.getElementById(content).innerHTML += data;
                }
            });
        }
    });
}

var TypeEtat = {
    close: 0,
    open: 1,
    move: 2,
    hide: 3
};
