//functions.js
function createform (e, thedate){
theObject = document.getElementById("createtask");
theObject.style.visibility = "visible";
theObject.style.height = "200px";
theObject.style.width = "200px";
var posx = 0;
var posy = 0;
posx = e.clientX + document.body.scrollLeft;
posy = e.clientY + document.body.scrollTop;
theObject.style.left = posx + "px";
theObject.style.top = posy + "px";
//The location we are loading the page into.
var objID = "createtask";
var serverPage = "theform.php?thedate=" + thedate;
var obj = document.getElementById(objID);
processajax (serverPage, obj, "get", "");
}

//Functions to submit a form.
function getformvalues (fobj, valfunc){
var str = "";
aok = true;
var val;
//Run through a list of all objects contained within the form.
for(var i = 0; i < fobj.elements.length; i++){
if(valfunc) {
if (aok == true){
val = valfunc (fobj.elements[i].value,fobj.elements[i].name);
if (val == false){
aok = false;
}
}
}
str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
}
//Then return the string values.
return str;
}
function submitform (theform, serverPage, objID, valfunc){
var file = serverPage;
var str = getformvalues(theform,valfunc);
//If the validation is ok.
if (aok == true){
obj = document.getElementById(objID);
processajax (serverPage, obj, "post", str);
}
}