


/** Messages */
var Messages = {
	/** General messages */
	general_error_disconnected : 'You have been disconnected. Please login and try again.',
	general_error_unknown : 'An error occured. Please contact administrator or try again.',
	general_error_no_permalink : 'Error : This resource has no permalink',
	general_error_resource_protected : 'The requested resource is protected.',
	general_validate : 'Ok',
	general_download : 'Download',
	general_video : 'Video',
	general_picture : 'Image',
	general_text : 'Text',
	general_audio : 'Sound',
	general_media : 'Media',
	
	delete_success : 'Deletion has been made successfully',
	save_success : 'Saved successfully',
	create_success : 'Creation has been made successfully',
	modif_user_success : 'Your modifications have been saved successfully',

	notifications_close: 'Close',

    favorite_new_directory: 'New circuit',
    
    share_favorite_success_add : 'Saved !',
    
    
    /** Ez Publish */
    // Contact form
	ezpublish_contact_success: 'ezpublish.contact_success',

	/** Personal space */
	// Miscellaneous
	personalspace_hello : 'Hello!',
	personalspace_groups_noselect : 'personalspace.groups.noselect',
	personalspace_favorites_added : 'Bookmark(s) added',
	personalspace_favorites_added_none :'No boomark was added. ',
	personalspace_favorites_added_history_ignore : '\u00A0It is not allowed to bookmark a query',
	personalspace_favorites_added_already :'This resource is already in your bookmarks.',
	blank_link : 'This link opened a new page',
	thesaurus_rules_link: '\/en\/About\/Manuel-utilisateur-de-l-espace-personnel\/MES-CONTRIBUTIONS\/Consultation-du-thesaurus#thesaurus-search',
    indexing_code: '\/en\/About\/Manuel-utilisateur-de-l-espace-personnel\/MES-CONTRIBUTIONS\/Consultation-du-thesaurus#indexing-code',
	user_alerts : 'Group related alerts',

	// Session
	personalspace_session_timeout: 'You have been disconnected from your personal account. Your browsing history is no more registered.',

	// Contribution
	share_contribute_success : 'Contribution added',
	share_contribute_fail : 'Error while adding contribution',
	share_contribute_delete_success : 'Your deletion suggest has been saved',
	share_contribute_delete_fail : 'Error while suggesting deletion',
	share_contribute_revoked_keyword : 'This keyword is not authorized on this resource. <br\/>You can read the <a style=\"font-weight:bold;\" href=\"{0}\" target=\"_blank\">indexation code<\/a> or send a free contribution.',
	share_contribute_forbidden_keyword : 'This keyword is not authorized. <br\/>You can read the <a style=\"font-weight:bold;\" href=\"{0}\" target=\"_blank\">indexation code<\/a> or send a free contribution.',
	share_contribute_empty : 'Warning, field is empty.',
	share_contribute_waiting_keyword: 'This keyword has already been suggested by another contributor. <br \/>It is currently being validated by Centre Pompidou. ',
	share_contribute_already_proposed_keyword: 'This keyword has already been suggested.',
	// History
	keyword_history_submit_success : 'Modifications have been saved successfully.',
	keyword_history_submit_fail : 'An error occured. Please, contact the administrator. ',
	keyword_history_submit_alert_added : 'Your subscription to this resource is registred. You can find it in your personal area. ',
	keyword_history_submit_alert_removed : 'Your subscription to this resource is canceled.',
	
	// Administration
	personalspace_useradmin_noSelectedGroup : 'No group has been selected',
	user_subscriptions_edited : 'Users inetersts',
	user_subscriptions_own : 'My interests',

	// Confirm messages
	confirm_banishment: 'Do you really want to banish this user?',
	confirm_unbanishment: 'Do you really want to restore this user?',
	confirm_deletion: 'Do you really want to delete this user?',
	confirm_user_deletion: 'Do you really want to delete your account?',
    confirm_user_edutheque_unbind: 'Vous souhaitez d\u00E9lier votre compte CPV et votre compte Eduth\u00E8que. Apr\u00E8s validation, vous naurez plus acc\u00E8s aux ressources Eduth\u00E8que pr\u00E9sent\u00E9es sur ce site. Pour acc\u00E9der de nouveau \u00E0 ces ressources, vous devrez vous authentifier de nouveau sur le site www.edutheque.fr',
    confirm_alert_deletion: 'Do you really want to delete this alert?',
	confirm_bookmark_category_deletion: 'Do you really want to delete this circuit and all bookmarks?',
	
	lang_fr: 'French',
	lang_es: 'Spanish',
	lang_en: 'English',
	
	// Media viewers
	//     Map viewer
	mapviewer_functions_fullscreen : 'Toggle full screen',
	
	//Downloadable resources
	download_form_title: 'Resources choice :',
	download_form_resources_ready : 'Data are ready'
};

/**
 * Get localized message
 * 
 * @param key
 * @param defaultValue
 */
function _(key, defaultValue) {
	var msg = Messages[key];
	if (msg != null) {
		return msg;
	} else if (defaultValue != undefined) {
		return defaultValue;
	}
	return key;
};


/**
	Validator messages
*/
$(document).ready(function(){
	jQuery.extend(jQuery.validator.messages, {
	    required: "Please fill this mandatory field",
	    remote: "Please correct the item",
	    emailRequired:  "Please enter your email address",
	    emailRegex:  "Please enter a valid email address",
	    url: "Please enter a valid URL",
	    number: "Please enter a number",
	    radio: "Please select an item",
	    eula:  "Please accept the general terms of use of the website",
	    equal: jQuery.validator.format("Value not equal with the previous field"),
	    max: jQuery.validator.format("Please enter a value smaller than {0}"),
	    maxChar: jQuery.validator.format("Please provide at most {0} characters"),
	    min: jQuery.validator.format("Please enter a value larger than {0}"),
	    minChar: jQuery.validator.format("Please provide at least {0} characters"),
	    ezSelectMin :  "Please choose one or two options", 
	   	ezSelectMax :  "Please choose no more than two options", 
		ezFileUpload:  "Please upload only PDF or Word documents",
		ezsurveySelect:  "Please select",
		ezsurveyRadios:  "Please choose one option",
		ezsurveyCheckboxes:  "Please choose one or more options",
		ezwithdrawformCheckboxes:  "Please chose the right(s) claimed"
	});
});
