/*

Author: Johnc
Start Date: 30/10/06

*/

/*
These constants are used by both the serializer() and deserializer() objects to switch various bits
of functionality and catergorize the different data types.

There are two sets, the first is raw (un-constructed) data types created on the fly:

var frog 		= "fish";	//typeof string
var num 		= 21;		//typeof number
var fowl 		= true;		//typeof boolean

These have a typeof of that is representative of their actual type.

However, if the constructor for a data type is used, is typeof become object, same as objects and array's.

To differentiate between these you can use instanceof to work out what the constructor object was:

var frog 			= new String("fish");						//typeof object, intanceof string
var num 			= new Number(21);							//typeof object, intanceof number
var fowl 			= new Boolean(true);						//typeof object, intanceof boolean
var animalsArray 	= new Array("Fish","Frog","Fowl");			//typeof object, intanceof array

The constants are set as strings due to the fact they return to the deserializer function as a string.

This is intended to be of academic interest - the code should correctly identify, encode and re-construct the
different data types.

*/

// Functionality switchs

// If set to true, any functions found as parts of an object
// will be extracted and rebuilt. If set to false, the function
// will become a NULL value.
// It should be noted that in general functions should not be
// included in objects that are sent to an LMS as suspend data
// as it would inflate the size considerably.
var CONST_SERIALIZE_FUNCTIONS = true;

// In general this should be set to true so as to avoid any
// accidental text based glitches.
// However in the case of very tight size limits, experiment
// with turning this off to reduce string length as the escaping
// can inflate string size considerably depending on the data
// being encoded.
var CONST_ESCAPE_STRING_BASED_DATA = true;

// typeof variables
var CONST_UNDEFINED = "0";
var CONST_STRING = "1";
var CONST_NUMBER = "2";
var CONST_BOOLEAN = "3";
var CONST_FUNCTION = "4";

// instanceof variables
var CONST_OBJ_NULL = "5";
var CONST_OBJ_DATE = "6";
var CONST_OBJ_ARRAY = "7";
var CONST_OBJ_OBJECT = "8";
var CONST_OBJ_STRING = "9";
var CONST_OBJ_NUMBER = "10";
var CONST_OBJ_BOOLEAN = "11";

// Used to indicate the item has been used.
var CONST_USED_ITEM = "999";

// Used as a cap on the encoded data's string length. Currently set at 3k.
var MAX_STRING_LENGTH = 3072;
