function createForm(name, action, isMultipart, method) {    
    var theform  = document.createElement("form");    
    
    if (method.toLowerCase() == "get")
        theform.setAttribute("method", "get");
    else
        theform.setAttribute("method", "post");
    
    theform.setAttribute("name", name);    
    theform.setAttribute("id", name);   
    theform.setAttribute("action", action);
           
    if (isMultipart)
        theform.encoding = "multipart/form-data";
    
    return theform;
}   

function createField(fType, name, initialValue, extraAttributes) {
    var field = document.createElement("input");
    
    fType = fType.toLowerCase();
    
   
    field.setAttribute("type", fType);
    field.setAttribute("name", name);
    field.setAttribute("value", initialValue); 

    for (var k in extraAttributes) {
        field.setAttribute(k, extraAttributes[k]);
    }
    
    return field;
}