function readynamevalue(pform){
    param_array = new Array();
    theform = pform;

    for(i=0;i<theform.elements.length;i++){
        var the_element = theform.elements[i];
        switch (the_element.type){
            // bypass buttons
            case "button":
            case "submit":
            case "reset":
                break;

            // checkboxes/radio buttons - only return the value if the control is checked
            case "checkbox":
            case "radio":
                if(!the_element.checked){
                    break;
                }

            // text/hidden/password all return the values
            case "text":
            case "hidden":
            case "password":
                param_array.push(encodenamevalue(the_element.name,the_element.value));
                break;

            // everything else
            default:
                switch(the_element.tagName.toLowerCase()){
                    case "select":
                    if(the_element.selectedIndex != -1){
                        param_array.push(encodenamevalue(the_element.name,the_element.options[the_element.selectedIndex].value));
                    }
                    break;
                    default:
                        param_array.push(encodenamevalue(the_element.name,the_element.value));
                        break;
                }
        }
    }
    return param_array.join("&");
}

function encodenamevalue(pname,pvalue){
    var wrk_param = encodeURIComponent(pname);
    wrk_param += "=";
    wrk_param += encodeURIComponent(pvalue);
    return wrk_param;
}