


function replaceLabelArgs (label, args) {
	var argCount = 0;

	if(typeof args !== "object") {
		label = label.replace("{0}", args);
	} else {
		argCount = args.length;
		for(i=0; i < argCount; i = i + 1) {
			var replaceArgs = "{" + i + "}";
			label = label.replace("{" + i + "}", args[i]);
		}
	}
	return label;

}

var pluginErrors = {
	"IDS_PACKAGEDIGESTHACKED": function (args) { return replaceLabelArgs("This web page is using the Sony Online Entertainment Installer.  The security check failed for the package digest. If you are on a non-Sony web page, the site may be attempting to hijack your computer.", args);    },
	"IDS_FILEHACKED": function (args) { return replaceLabelArgs("This web page is using the Sony Online Entertainment Installer.  The security check failed for one of the files. If you are on a non-Sony web page, the site may be attempting to hijack your computer.", args);    },
	"IDS_UNABLETOLAUNCH": function (args) { return replaceLabelArgs("Unable to launch {0}", args);    },
	"IDS_UNABLETODOWNLOAD": function (args) { return replaceLabelArgs("Unable to download {0}", args);    },
	"IDS_NODXREDIST": function (args) { return replaceLabelArgs("The DirectX redistribution file was not found on the web site", args);    },
	"IDS_NOVSREDIST": function (args) { return replaceLabelArgs("The VS2005 redistribution file was not found on the web site", args);    },
	"IDS_NEEDPERMISSION": function (args) { return replaceLabelArgs("No message for <b>IDS_NEEDPERMISSION</b>, add to properties file", args);    },
	"IDS_CANNOTCONNECT": function (args) { return replaceLabelArgs("Unable to connect directly to the Internet. You may be behind a corporate firewall.", args);    },
	"IDS_ERRORREQUESTINGSTATUS": function (args) { return replaceLabelArgs("Error requesting status of {0}", args);    },
	"IDS_ERRORREQUESTINGFILE": function (args) { return replaceLabelArgs("Error requesting file {0}", args);    },
	"IDS_ERRORREQUESTINGLEN": function (args) { return replaceLabelArgs("Error getting content length of {0}", args);    },
	"IDS_UNABLETOWRITE": function (args) { return replaceLabelArgs("Unable to write to {0}. The file may be in use or you may lack the necessary permissions to install.", args);    },
	"IDS_INSTALLATIONPROBLEM": function (args) { return replaceLabelArgs("Installation Problem", args);    },
	"IDS_CANNOTALLOCATE": function (args) { return replaceLabelArgs("Cannot allocate memory for digest", args);    },
	"IDS_LOADFAILED": function (args) { return replaceLabelArgs("Package load failed or was canceled ({0})", args);    },
	"IDS_FOLDERREQUIRED": function (args) { return replaceLabelArgs("The folder parameter must be specified", args);    },
	"IDS_PACKAGENOTLOADED": function (args) { return replaceLabelArgs("Package not loaded -- cant install", args);    },
	"IDS_SHOWERRORMESSAGE": function (args) { return replaceLabelArgs("SHOW ERROR MESSAGE", args);    },
	"IDS_PROPERTIES": function (args) { return replaceLabelArgs("Properties...", args);    },
	"IDS_ABOUT": function (args) { return replaceLabelArgs("About {0}...", args);    },
	"IDS_DOWNLOADING": function (args) { return replaceLabelArgs("Downloading {0}...", args);    },
	"IDS_DOWNLOADED": function (args) { return replaceLabelArgs("Downloaded {0}.", args);    },
	"IDS_LAUNCHING": function (args) { return replaceLabelArgs("Launching {0}.", args);    },
	"IDS_ALREADYLAUNCHED": function (args) { return replaceLabelArgs("Already launched {0}.", args);    },
	"IDS_INSTALLINGREDIST": function (args) { return replaceLabelArgs("Installing Required Library", args);    },
	"ID_UNKNOWN": function (args) { return replaceLabelArgs("An unknown error occured", args);    }	
};

var errors = {
    "characterNotFound": "The characterId value was not found in the database.",
    "charList.unknownError": "An internal error has occurred.  Please try again later.",
    "commentNotFound": "The comment didnt exist in the database to delete.",
    "duplicateFavorite": "This image has already been marked as a favorite.",
    "error.accountInUse": "This station account is in use.",
    "error.accountQuotaExceeded": "You have exceeded the number of allowed files for this account.",
    "error.cannotAssignGateway": "The game server was unable to assign a gateway to launch the game with.",
    "error.cannotCreateCharacter": "The character couldnt be created on the game server.",
    "error.cannotDeleteCharacter": "The character couldnt be deleted on the game server.",
    "error.cannotDeleteImage": "The image could not be deleted.",
    "error.cannotLoadCharacter": "Requested character could not be found.",
    "error.cannotPersistObject": "There was an error persisting an object.",
    "error.cannotReadFile": "File could not be read.",
    "error.cannotScaleImage": "The image cannot be scaled.",
    "error.cannotUpdateImage": "The image could not be updated.",
    "error.cannotValidateImage": "The image cannot be Validated.",
    "error.connect": "Commuication failure with the game server.",
    "error.duplicatePollFromTemplate": "This poll may not be republished until your first poll has closed.",
    "error.imageNotOfRequiredSize": "The image is smaller/larger than the size required.",
    "error.imageNotSpecified": "You havent selected an image for this action.",
    "error.imageTooBig": "The image is too large for the operation.",
    "error.invalidOwner": "The user does not own the character and is unable to perform the requested action.",
    "error.maximumCharacterLimitReached": "You have exceeded the maximum number of characters on your account.",
    "error.missingCharacterId": "You must supply a character id.",
    "error.nameTaken": "The name is already taken.",
    "error.unknown": "This action failed due to unknown reasons.",
    "error.unsupportedFileFormat": "The image is of an unsupported file format.",
    "error.unsupportedImageType": "The image is of an unsupported image type.",
    "error.userLogin": "You need to be logged in to view this page.",
    "error.userNotBetaEligible": "You are unable to access that content. This account is not set up with access for the FreeRealms Beta.",
    "favoriteQuotaExceeded": "You cannot add more favorites since you have exceeded the maximum allowed.",
    "filterDeny": "\"The name doesnt pass profanity/reserved filters, not available.\"",
    "friendsList.characterNotFound": "The character was not found in our database.",
    "friendsList.kicked": "\"You are currently playing FreeRealms. In order to access your Friends List from your Profile Page, you must be logged out of the game.<br> Please Note: If your Friends List does not load after leaving the game, try refreshing your Profile page.\"",
    "friendsList.notAuthorized": "The account login failed to the chat server.",
    "friendsList.notRegistered": "The character is a new character and hasnt had a chance to be registered in the chat system (by logging into game).",
    "friendsList.unknownError": "An unknown error has occurred. Please try again later.",
    "imageGallery.unknownError": "An internal error has occurred.  Please try again later.",
    "imageNotFound": "Requested image is not found in the db.",
    "insufficientPermissions": "User does not have sufficient permissions for the requested operation.",
    "invalidOperation": "Invalid opCode value specified. It can only be add or remove.",
    "invalidOwner": "Logged in user is not the owner of this character.",
    "kicked": "The chat session was kicked due to logging into game.",
    "main.unknownError": "An internal error has occurred.  Please try again later.",
    "messagesList.unknownError": "An internal error has occurred.  Please try again later.",
    "nameAvailable": "Name is available.",
    "nameTaken": "\"Name is taken, not available.\"",
    "newsFeed.unknownError": "An internal error has occurred.  Please try again later.",
    "notAuthorized": "The user is not authorized to perform the requested action.",
    "notFriends": "The person posting isnt a friend of the character that they are posting the comment on.",
    "notOwner": "Tried to delete a comment that wasnt made on one of your characters.",
    "notRegistered": "The chat login failed and the user hasnt had a chance to register the character.",
    "oneFavoriteRequired": "You cannot remove this favorite since at least one favorite is required in the gallery.",
    "permissionsForm.unknownError": "An internal error has occurred.  Please try again later.",
    "persistanceError": "There was an error saving the data.",
    "unknownError": "\"Unknown error, try again later.\"",
    "userLogin": "The user is not logged in.",
    "validation.characterIdRequired": "The characterId field is required.",
    "validation.characterNotFound": "The character id was not found or was not specified when it is required.",
    "validation.commentIdRequired": "Missing required field: commentId.",
    "validation.commentTextMaxLength": "The commentText field exceeds the maximum length.",
    "validation.commentTextRequired": "The commentText field is required.",
    "validation.idRequired": "You must enter the id of the character to delete.",
    "validation.imageIdRequired": "Missing required field: ImageId.",
    "validation.incorrectAnswerLength": "The Answer length you have provided is invalid. Answers must be between 1 & 40 characters.",
    "validation.incorrectQuestionLength": "A poll question requires a minimum of 5 characters and a maximum of 200 characters.",
    "validation.keyRequired": "Missing required field: key.",
    "validation.locationRequired": "Please specify a location value.",
    "validation.modelCustomizationRequired": "Please specify a model customization value.",
    "validation.modelRequired": "Please specify a model value.",
    "validation.nameFormat": "The name must only contain of alphanumeric characters.",
    "validation.nameInvalid": "You have entered an invalid name.",
    "validation.nameRequired": "Please enter a character name.",
    "validation.newsContentRequired": "Please enter content for this news item.",
    "validation.opCodeRequired": "Missing required field: opCode.",
    "validation.pageOutOfRange": "The page must be greater than 0.",
    "validation.pageSizeOutOfRange": "The page size must be between 1 and 50.",
    "validation.pollAnswersRequired": "You have not provided enough poll Answers. At least 2 poll Answers are required for poll creation.",
    "validation.pollQuestionRequired": "You must have a question to create a poll.",
    "validation.queryRequired": "Missing required field: query.",
    "validation.queryTooBroad": "The query must be at least 3 characters in length.",
    "validation.questionNotLongEnough": "A poll question requires a minimum of 5 characters and a maximum of 200 characters.",
    "validation.serverIdRequired": "You must enter a server id.",
    "validation.serverRequired": "Missing required field: server.",
    "validation.skinToneRequired": "Please specify a skin tone value.",
    "validation.tooFewAnswers": "You have not provided enough poll Answers. At least 2 poll Answers are required for poll creation.",
    "validation.tooManyAnswers": "You have created too many poll Answers. A maximum of 20 Answers are allowed for poll creation.",
    "validation.zoneRequired": "You must enter a zone."    
}