if (typeof ED.Utils == "undefined"){
	ED.Utils = {};
}

ED.Utils.StringUtils = {
	decodeLink: function ST_decodeLink(encodedLink){
		var decodedString = "";
		if (!encodedLink || typeof encodedLink != "string"){
			return decodedString;
		}
		decodedString = encodedLink.replace('$n0need1$', 'http://').replace('$n0need2$', 'www.')
		return decodedString;
	},
	/**
	 * Safely parse to int 
	 * @param {int|String} value
	 * @return {int} returns 0 if error parsing
	 */
	getInt: function ST_getInt(value){
		var returnInt = 0;
		if (!value){
			return returnInt;
		}
		if (typeof value === "number"){
			returnInt = value;
		}else{
			returnInt = parseInt(value.toString(), 10);
		}
		return returnInt;
	},
	/**
	 * Restore int type for objects. Useful for restoring int type for all object
	 * properties.
	 * @param {Object} referenceObject Initial object with correct types
	 * @param {Object} targetObject
	 */
	restoreIntTypeForObjectProperties: function ST_restoreIntTypeForObjectProperties(referenceObject, targetObject){
		if (!referenceObject || !targetObject
			|| typeof referenceObject !== "object"
			|| typeof targetObject !== "object"){
			return;
		}
		$.each(referenceObject, function(paramName, val) {
			if (typeof val === "number"){
				targetObject[paramName] = ED.Utils.StringUtils.getInt(targetObject[paramName]);
			}
	    });
	}
};
