
function FormToObject(form, object) {

   var theForm = $(form).serializeArray();

   $(theForm).each(function(i) {
      object[theForm[i]["name"]] = theForm[i]["value"];
   });

   return object;

}

function CookiesToObject(object) {

   var cookies = document.cookie.split(";");
   var cookie;

   $(cookies).each(function(i) {
       cookie = cookies[i].split("=");
       cookie[0] = $.trim(cookie[0]);
       cookie[1] = $.trim(cookie[1]);
       if(cookie[0] == "PHPSESSID") return true;
       object[cookie[0]] = cookie[1];
   });

   return object;

}