function addActivity(newname, unplanned){
    if (!unplanned){
        unplanned=false;
    }
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/add_activity', true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    var send_string = 'name='+newname;
    if (unplanned){
        send_string += '&unplanned=1';
    }
    self.xmlHttpReq.send(send_string);
    return self.xmlHttpReq;
}
function showActivity(code){
    this.location.href = '/pomming/activity/'+code;
}
function changeActivityProperty(code, property, newvalue){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/change_activity_property/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('property='+property+'&newvalue='+newvalue);
    return self.xmlHttpReq;
}
function makeActivityNormal(code){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/make_activity_normal/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('');
    return self.xmlHttpReq;
}
function makeActivityFuture(code){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/make_activity_future/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('');
    return self.xmlHttpReq;
}
function discardActivity(code){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/discard_activity/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('');
    return self.xmlHttpReq;
}
function finishActivity(code){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/finish_activity/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send("");
    return self.xmlHttpReq;
}


function addPomodoro(activityCode){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/add_pomodoro/'+activityCode, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('');
    return self.xmlHttpReq;
}
function showPomodoro(code){
    this.location.href = '/pomming/pomodoro/'+code;
}
function discardPomodoro(code){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/discard_pomodoro/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('');
    return self.xmlHttpReq;
}
function finishPomodoro(code){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/finish_pomodoro/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('');
    return self.xmlHttpReq;
}

function addLog(code, text){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/add_log/', true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    send = 'text='+text+'&code='+code;
    self.xmlHttpReq.send(send);
    return self.xmlHttpReq;
}
function discardLog(code){
    var xmlHttpReq = false;
    var self = this;
    self.xmlHttpReq = new XMLHttpRequest();
    self.xmlHttpReq.open('POST', '/pomming/quick/discard_log/'+code, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.send('');
    return self.xmlHttpReq;
}

