if (typeof (BCNTRY) == "undefined") { BCNTRY = {}; }
if (typeof (BCNTRY.msgConfig) == "undefined") { BCNTRY.msgConfig = {}; }

// first one empty so the index corresponds to the rating this[1:] is the first string, not the second

BCNTRY.msgConfig.ratings = [
"Click a star to set your rating",
"Straight up sucks",
"Not recommended",
"Adequate for the job",
"Pretty cool",
"Love it"
];

BCNTRY.msgConfig.general = {
	commProb: "We're having communication difficulties.  Please try again."
};

BCNTRY.msgConfig.user = {
	logoutLink: "Click here to logout"
};

BCNTRY.msgConfig.review = {
	values: {
		0:   "All good.",
		15:  "You must sign in to submit a review.",
		32:  "You must sign in to submit a review.",
		33:  "You must sign in to submit a review.",
		42:  "Please select a star rating.",
		43:  "Please shorten your Display Name to less than 32 characters.",
		44:  "Please shorten your Username to less than 32 characters.",
		45:  "Please enter your Display Name, or select 'Post Anonymously'.",
		46:  null,
		56:  null,
		57:  "Display Name is already in use. Please enter another name.",
		58:  "Product SKU does not match review item.",
		81:  "Username must be valid email address.",
		87:  "Display Name is already in use. Please select another name.",
		90:  "Unknown failure",
		91:  "Unknown failure",
		92:  "Unknown failure",
		99:  "Security error: Logged-in user does not match submitted Username.",
		110: 'You are missing a \'link_id\' parameter.',
		120: 'Please give this review a title.',
		130: 'Please give this review a comment.',
		140: 'Please select a star rating.',
		150: 'This review requires a catalog.',
		successfulReview: "Thank you for submitting a review!",
		pleaseLogin: "You must login to leave a review.",
		nonUniqueName: "This name is already taken, please choose another display name",
		uniqueName: "", // This should really never be shown
		needsTitle: 'Need a title. Try: Recommended... Or not.',
		titleTooBig: 'The title must be less than 255 characters.',
		needsReview: 'Umm... Where\'s the review?  Please type it below.',
        needsRank: 'Please select a star rating.',
		loginLink: "to submit a review.",
		createdAccount: "Thanks for creating an account!  Now you can leave a review for this product.",
		justPostedRating: "You'll see it on this page within the next 24 hours."
	},
	
	ranges: [{ start: 100, end: 140, msg: "Please, please send a '$param' parameter. 	where $param is 'link_id', 'review_title', 'review_comments', 'review_rank','review_catalog'"}],
	
	getValueInRange: function (inVal){
		// need to think this through
		// finding whether a number is in any of the ranges is kinda inelagant
		// get all ranges
		for (var n=0; n< this.ranges.length; n++){
			// for each range
			var theRange = this.ranges[n];
			// is number between them?
			if ((inVal <= theRange.end)&&(inVal >= theRange.start)){
				return theRange.msg;
			}
		}
	},
	
	getVal: function(inVal){
		var msgString = this.values[inVal];
		
		if (msgString === null){
			msgString = this.getValueInRange(inVal);
		}
		
		if (msgString === null){
			msgString = "Unknown Error "+ inVal + "occurred.";
		}
		return msgString;
	}
};
