var PropertyFactory = function() { 

	this.Types = {string:0, bool:1, int:2, float:3}
	
	this.RemoveUndefined = true;

	this.Bind = function(obj, objPropName, jsonObj, jsonPropName, type) { 
        var result = false;
        if (jsonPropName in jsonObj) {
			var value = eval("jsonObj." + jsonPropName);
			var toEval = "";
			
			switch(type)
			{
				case this.Types.string:
					toEval = "obj." + objPropName + " = new String('" + value + "')";
					break;
				case this.Types.int:
					toEval = "obj." + objPropName + " = parseInt('" + value + "')";
				  break;
				case this.Types.float:
					toEval = "obj." + objPropName + " = parseFloat('" + value + "')";
				  break;
				  case this.Types.bool:
					toEval = "obj." + objPropName + " = ('" + value + "'.toLowerCase() === 'true')";
				  break;
				default:
			}
			
			eval(toEval);
			result = true;
        }
        else
        {
			if (this.RemoveUndefined)
			{
				eval("delete obj." + objPropName);
			}
			result = false;
        }
        return result;
    };
	
}; 