


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("You may have an older version of the installer. Please update it and try again.", args);    },
	"IDS_FILEHACKED": function (args) { return replaceLabelArgs("You may have an older version of some files. Please update and try again.", args);    },
	"IDS_UNABLETOLAUNCH": function (args) { return replaceLabelArgs("The game was succesfully downloaded, but could not launch.", args);    },
	"IDS_UNABLETODOWNLOAD": function (args) { return replaceLabelArgs("The server did not recognize the URL and could not download.", 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("The Windows user doesnt have the right permissions to create a new folder on this computer.", args);    },
	"IDS_CANNOTCONNECT": function (args) { return replaceLabelArgs("There is a communication problem that is mostly likely related to a firewall issue.", args);    },
	"IDS_ERRORREQUESTINGSTATUS": function (args) { return replaceLabelArgs("The status request for a file failed.", args);    },
	"IDS_ERRORREQUESTINGFILE": function (args) { return replaceLabelArgs("The status request for a file indicated that the file was not available.", args);    },
	"IDS_ERRORREQUESTINGLEN": function (args) { return replaceLabelArgs("We were unable to retrieve the length of the file.", args);    },
	"IDS_UNABLETOWRITE": function (args) { return replaceLabelArgs("The installer could not write the file to the filesystem. This may be due to a permissions issue, or the file may be in use.", args);    },
	"IDS_INSTALLATIONPROBLEM": function (args) { return replaceLabelArgs("Installation Problem", args);    },
	"IDS_CANNOTALLOCATE": function (args) { return replaceLabelArgs("Not enough heap memory to store the digest.", args);    },
	"IDS_LOADFAILED": function (args) { return replaceLabelArgs("Cant load the digest file. This could be due to a network issue or a down server.", args);    },
	"IDS_FOLDERREQUIRED": function (args) { return replaceLabelArgs("There was a problem writing to the folder.", args);    },
	"IDS_PACKAGENOTLOADED": function (args) { return replaceLabelArgs("The digest file was not completely downloaded.", 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("No message for <b>ID_UNKNOWN</b>, add to properties file", args);    }	
};

var errors = {
	"accessDenied": "This user can not receive personal messages.",
    "error.characterNotFound": "We\'re having a problem finding that character, but don\'t worry, we\'ll find them soon. Try again in a little while, please.",
    "charList.unknownError": "Something\'s wrong. While we look into it, please try again.",
    "commentNotFound": "We can\'t find the comment you wanted to delete. Did a robgoblin take it?",
    "duplicateFavorite": "This image is already a favorite. You must really like it!",
    "error.accountInUse": "There is already a character from this account in game.",
    "error.accountQuotaExceeded": "You\'ve saved too much stuff to the website. Delete some stuff and try again!",
    "error.cannotAssignGateway": "To run the game, we need to use something called a \'gateway.\' Right now, we can\'t find one to use. Try again later, please!",
    "error.cannotCreateCharacter": "You can\'t create a character right now. Give it a try later.",
    "error.cannotDeleteCharacter": "You can\'t delete that character right now. Give it a try later.",
    "error.cannotDeleteImage": "That image can\'t be deleted right now. Try later, please.",
    "error.cannotLoadCharacter": "We\'re having problems loading up that character right now. Can you please try again later?",
    "error.cannotPersistObject": "We\'re having a problem showing you that object right now. Sorry.",
    "error.cannotReadFile": "We can\'t read that file right now. Sorry.",
    "error.cannotScaleImage": "That image cannot be scaled.",
    "error.cannotUpdateImage": "That image could not be updated.",
    "error.cannotValidateImage": "We\'re having a problem confirming which image that is. Please try again in a while.",
    "error.connect": "Our servers are unavailable right now. Please try again later.",
    "error.duplicatePollFromTemplate": "You\'ll need to close your first poll before you can start this one.",
    "error.imageNotOfRequiredSize": "This image isn\'t the right size.",
    "error.imageNotSpecified": "Please select an image first!",
    "error.imageTooBig": "That image is too large. Sorry.",
    "error.invalidOwner": "Only the account owner can do that!",
    "error.maximumCharacterLimitReached": "Sorry, you have too many characters on your account.",
    "error.missingCharacterId": "Please supply the character ID.",
    "error.nameTaken": "Sorry, that name is already taken.",
    "error.unknown": "We\'re tracking down this problem and fixing it. Try again soon!",
    "error.unsupportedFileFormat": "That looks like the wrong type of file.",
    "error.unsupportedImageType": "That looks like the wrong kind of image type.",
    "error.userLogin": "You\'ll need to log in to view this page.",
    "error.userNotBetaEligible": "You need to be flagged for the Free Realms Beta to see that.",
    "favoriteQuotaExceeded": "You already have all the favorites you can handle! Delete some, and you can add this one.",
    "filterDeny": "You can\'t use that name.",
    "friendsList.characterNotFound": "We can\'t find that friend right now. Maybe they are taking a break.",
    "friendsList.kicked": "To see your friends list, you\'ll need to log out of the game first.",
    "friendsList.notAuthorized": "We can\'t log into the chat right now. Please try again later.",
    "friendsList.notRegistered": "Characters need to log into the game to meet new friends!",
    "friendsList.unknownError": "Friends list under maintenance.",
    "imageGallery.unknownError": "We are fixing a problem with the Image Gallery. Please come back later.",
    "imageNotFound": "We can\'t find that image. Those darn robgoblins steal everthing!",
    "insufficientPermissions": "You need super top-secret clearance to do that sort of stuff!",
    "invalidOperation": "You can only \'add\' or \'remove\'.",
    "invalidOwner": "The person logged into this character is not the owner of this character.",
    "kicked": "The chat session ended because you logged into the game.",
    "main.unknownError": "We\'re fixing something over here. Please come back later.",
    "messagesList.unknownError": "We\'re repairing a problem with the message lists. Please try later.",
	"messagesList.validation.commentTextRequired": "You must enter text to leave a comment.",
	"messagesList.validation.commentTextMaxLength": "You have entered more than 180 characters.",
    "nameAvailable": "That name is available!",
    "nameTaken": "That name is not available. Sorry.",
    "newsFeed.unknownError": "Please log in to see news feeds.  If you are already logged in, please try again in a few minutes.",
    "notAuthorized": "You aren\'t authorized to do that!",
    "notFriends": "You need to be a friend to post on someone else\'s page.",
    "notOwner": "You can\'t delete a comment that you didn\'t write with one of your characters.",
    "notRegistered": "Please register your character before trying to chat!",
    "oneFavoriteRequired": "You have to have at least one favorite in your gallery. We\'re sure you like at least ONE of these!",
    "permissionsForm.unknownError": "We\'re having a problem determining your permissions right now. Please try again later.",
    "persistanceError": "Sorry, there was a problem saving that. Please try again.",
	"portraitGallery.noImagesFound": "You don\'t have any portraits in your gallery right now.",
    "unknownError": "We\'re fixing a problem right now. Can you try again later? Thanks!",
    "userLogin": "That person isn\'t logged in.",
    "validation.characterIdRequired": "The character ID field is required.",
    "validation.characterNotFound": "We\'re having a problem locating that character right now. Please try again later.",
    "validation.commentIdRequired": "The comment field is required.",
    "validation.commentTextMaxLength": "The amount of text in the comment is too much. Sorry.",
    "validation.commentTextRequired": "The comment text 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 and 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 consist only 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": "Please choose a different server.",
    "validation.serverRequired": "Please choose a different 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 have to enter a zone."
}