﻿// � 2007-2008, Applied Geographics, Inc.  All rights reserved.

// Ag.ArgumentEncoder (class)

// Define our namespace
Type.registerNamespace("Ag");

Ag.ArgumentEncoder = function() {
  if (arguments.length !== 0) {
    throw Error.parameterCount();
  }
}

Ag.ArgumentEncoder.registerClass("Ag.ArgumentEncoder");

// Static Methods

Ag.ArgumentEncoder.decode = function(sArgumentData, destination) {
  /// <summary>Decode the value and set our state</summary>
  var sJson = decodeURIComponent(sArgumentData);
  var properties = Sys.Serialization.JavaScriptSerializer.deserialize(sJson);
  
  if (arguments.length === 2) {
    $common.applyProperties(destination, properties);
  }
  
  return properties;
}

Ag.ArgumentEncoder.encode = function(argument) {
  /// <summary>Encode the argument and return it as a string</summary>
  /// <returns>An encoded string</returns>
  var sJson = Sys.Serialization.JavaScriptSerializer.serialize(argument);
  return encodeURIComponent(sJson);
}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();