/// <reference path="CustomSerializerWCFService.aspx" />
function onFailed(error)
{
    alert(error);
}


function Save()
{
    /*
    var entity = {"Address":$get("businessEntityAddress").value, "City":$get("businessEntityCity").value,
                    "State":$get("businessEntityState").value, "Zip":$get("businessEntityZip").value};
    */
    
    var entity = new Sys.StringBuilder();
    entity.append("{");
    entity.append("\"Address\":");
    entity.append("\"");
    entity.append($get("businessEntityAddress").value);
    entity.append("\"");
    entity.append(",");
    entity.append("\"City\":");
    entity.append("\"");
    entity.append($get("businessEntityCity").value);
    entity.append("\"");
    entity.append(",");
    entity.append("\"State\":");
    entity.append("\"");
    entity.append(+$get("businessEntityState").value);
    entity.append("\"");
    entity.append(",");
    entity.append("\"Zip\":");
    entity.append("\"");
    entity.append($get("businessEntityZip").value);
    entity.append("\"");
    entity.append("}");

    tempuri.org.CustomSerializerService.Save(entity.toString(),onSuccess,onFailed);

    }

function onSuccess(result)
{
    $get("businessEntityId").innerHTML = result.Id;
}