//Cityspk main JS.
var cityspk =
{
  types: {
    IMAGE:'Image',
    GLYPH:'Glyph',
    MESSAGE:'Message'
  },
  sizes: {
    THUMB_MINI:'mini',
    THUMB_MINI2:'mini2',
    THUMB_SQUARE: 'square',
    THUMB_SQUARE2: 'square2',
    THUMB_THUMB: 'thumb',
    THUMB_SMALL: 'small',
    THUMB_MEDIUM: 'medium',
    THUMB_ORIGINAL:'original'
  },
  displayModes: {
    GRID_MODE:'grid',
    LIST_MODE:'list'
  },
  sortOptions : {
    RAND: 'random',
    DATE_TAKEN: 'date_taken',
    DATE_POSTED: 'date_posted',
    TITLE: 'title',
    LITERAL: 'literal',
    NONE: 'none',
    DEFAULT_PAGESIZE: 64,
    PAGESIZE_128: 128,
    PAGESIZE_64: 64,
    PAGESIZE_32: 32,
    MAX_PAGESIZE: 500,
    DEFAULT_PAGE:1
  },
  searchParams : {
    DEFAULT_PRIVACY: 0,
    DEFAULT_FILTER: 'all'
  },
  filters: {
    ALL:'all',
    PUBLIC:'public',
    PRIVATE:'private',
    INCOMPLETE:'incomplete',
    RECENT:'recent'
  },
  states: {
    BKG_DEFAULT: 'BKG_DEFAULT',
    BKG_LIST: 'BKG_LIST',
    BKG_UPLOAD: 'BKG_UPLOAD',
    GLY_DEFAULT: 'GLY_DEFAULT',
    GLY_LIST: 'GLY_LIST',
    GLY_BREAK: 'GLY_BREAK',
    GLY_EFFECTS: 'GLY_EFFECTS',
    HELP_DEFAULT: 'HELP_DEFAULT'
  },

  SUCCESS:1,
  ERROR:0,
  
  lang: 'en',
  //Configuration, injected.
  config: {},
  //URL map, injected.
  urlmap: {},
  //Labels, injected.
  labels: {},
  //API holder
  api: {
    user: {},
    photos: {},
    albums: {},
    message: {},
    location: {}, 
    pager_endpoints: {}
  },
  //Form holder.
  form: {},
  //Layout & Format 
  format: {},
  //Organizer
  organizer: {}
}



cityspk.config['relative_root'] = "";
cityspk.config['http_root'] = "http://www.cityspk.ca";
cityspk.config['upload_maxfiles'] = "200";
cityspk.config['upload_maxsize'] = "8MB";
cityspk.config['host'] = "www.cityspk.com";

cityspk.urlmap['root'] = "";
cityspk.urlmap['home'] = "/home";
cityspk.urlmap['app_credits'] = "/credits";
cityspk.urlmap['app_about'] = "/about";
cityspk.urlmap['app_lang'] = "/language";
cityspk.urlmap['app_lang_en'] = "/language/en";
cityspk.urlmap['app_lang_fr'] = "/language/fr";
cityspk.urlmap['app_user'] = "/people";
cityspk.urlmap['app_user_home'] = "/people/home";
cityspk.urlmap['app_account'] = "/account";
cityspk.urlmap['app_user_profile'] = "/people/home/profile";
cityspk.urlmap['app_user_messages'] = "/people/home/messages";
cityspk.urlmap['app_user_photolist'] = "/people/home/photos";
cityspk.urlmap['app_user_glyphlist'] = "/people/home/glyphs";
cityspk.urlmap['app_user_friends'] = "/people/home/friends";
cityspk.urlmap['app_user_delete_msg'] = "/people/home/deleteMessage";
cityspk.urlmap['app_user_delete_photo'] = "/people/home/deletePhoto";
cityspk.urlmap['app_user_login'] = "/people/login";
cityspk.urlmap['app_user_logout'] = "/people/logout";
cityspk.urlmap['app_user_signup'] = "/people/signup";
cityspk.urlmap['app_user_password'] = "/people/home/password";
cityspk.urlmap['app_user_update'] = "/people/home/update";
cityspk.urlmap['app_user_change_password'] = "/people/processChangePassword";
cityspk.urlmap['app_user_reminder'] = "/people/reminder";
cityspk.urlmap['app_user_explore'] = "/people/explore";
cityspk.urlmap['app_search'] = "/search";
cityspk.urlmap['app_search_glyphs'] = "/search/glyphs";
cityspk.urlmap['app_search_photos'] = "/search/photos";
cityspk.urlmap['app_search_messages'] = "/search/messages";
cityspk.urlmap['app_blog'] = "http://blog.cityspk.com";
cityspk.urlmap['app_message'] = "/messages";
cityspk.urlmap['app_message_view'] = "/messages/view";
cityspk.urlmap['app_message_view_after_send'] = "/messages/confirm";
cityspk.urlmap['app_message_explore'] = "/messages";
cityspk.urlmap['app_message_process_draft'] = "/messages/processSaveDraft";
cityspk.urlmap['app_message_process_send'] = "/messages/processSend";
cityspk.urlmap['app_message_compose'] = "/messages/compose";
cityspk.urlmap['app_message_customize'] = "/messages/compose/customize";
cityspk.urlmap['app_message_create'] = "/messages/compose/create";
cityspk.urlmap['app_message_send'] = "/messages/compose/send";
cityspk.urlmap['app_photo'] = "/photo";
cityspk.urlmap['app_photo_organizer'] = "/photo/organize";
cityspk.urlmap['app_photo_explore'] = "/photos";
cityspk.urlmap['app_photo_functions'] = "/photos/organize";
cityspk.urlmap['app_photo_functions_album_add'] = "/photos/organize/addToAlbum?width=520&height=440";
cityspk.urlmap['app_photo_functions_album_remove'] = "/photos/organize/removeFromAlbum?width=520&height=440";
cityspk.urlmap['app_photo_functions_batch_context'] = "/photos/organize/batchImageContext?width=520&height=440";
cityspk.urlmap['app_photo_functions_batch_edition'] = "/photos/organize/batchEdition?width=520&height=440";
cityspk.urlmap['app_photo_functions_batch_glyphs'] = "/photos/organize/batchGlyphs?width=520&height=440";
cityspk.urlmap['app_photo_functions_batch_delete'] = "/photos/organize/batchSuppression?width=520&height=440";
cityspk.urlmap['app_photo_functions_single_edition'] = "/photos/organize/singleEdition?width=520&height=440";
cityspk.urlmap['app_upload'] = "/upload";
cityspk.urlmap['app_upload_step1'] = "/upload/step1";
cityspk.urlmap['app_upload_step2'] = "/upload/step2";
cityspk.urlmap['app_upload_step3'] = "/upload/step3";
cityspk.urlmap['app_upload_delete'] = "/upload/delete";
cityspk.urlmap['app_city'] = "/cities";
cityspk.urlmap['app_city_sympatico'] = "http://voyage.sympatico.msn.ca/CiteSPK/PhotosVillesDisponibles";
cityspk.urlmap['app_help'] = "/help";
cityspk.urlmap['app_help_faq'] = "/help/faq";
cityspk.urlmap['app_help_guide'] = "/help/guide";
cityspk.urlmap['app_help_howto'] = "/help/howto";
cityspk.urlmap['app_help_lexique'] = "/help/lexique";
cityspk.urlmap['app_help_tour'] = "/help/tour";
cityspk.urlmap['app_help_condition'] = "/help/condition";
cityspk.urlmap['app_help_privacy'] = "/help/privacy";
cityspk.urlmap['farm'] = "/farm";
cityspk.urlmap['farm_messages'] = "/farm/messages";
cityspk.urlmap['farm_photos'] = "/farm/photos";
cityspk.urlmap['farm_transmissions'] = "/farm/transmissions";
cityspk.urlmap['tools_jsconfig'] = "/tools/jslib.js";
cityspk.urlmap['api_json'] = "/json";

cityspk.labels['hpage_home_title'] = "CITYSPK";
cityspk.labels['hpage_home'] = "Home";
cityspk.labels['hpage_blog'] = "CITYBLOG";
cityspk.labels['hpage_blog_noentry'] = "No blog entry";
cityspk.labels['hpage_wiki'] = "Lexicon";
cityspk.labels['hpage_contest'] = "Contest";
cityspk.labels['hpage_press'] = "Press";
cityspk.labels['hpage_credits'] = "Credits";
cityspk.labels['hpage_condition'] = "Terms of use";
cityspk.labels['hpage_privacy'] = "Privacy";
cityspk.labels['hpage_info_about'] = "About CITYSPK";
cityspk.labels['hpage_info_concept'] = "Concept";
cityspk.labels['hpage_info_contact'] = "Contact us";
cityspk.labels['hpage_compose'] = "Compose a message";
cityspk.labels['hpage_explore'] = "Explore";
cityspk.labels['hpage_explore_msg_recent'] = "Recent messages";
cityspk.labels['hpage_explore_msg_pop'] = "Most viewed messages";
cityspk.labels['hpage_explore_photos_recent'] = "Recent photos";
cityspk.labels['hpage_explore_glyphs_recent'] = "Recent glyphes";
cityspk.labels['hpage_explore_city_recent'] = "New cities";
cityspk.labels['hpage_explore_city_incomplete'] = "Incomplete cities";
cityspk.labels['hpage_explore_members'] = "CITYSPK members";
cityspk.labels['hpage_help'] = "CITYSPK help";
cityspk.labels['hpage_help_howto'] = "How to";
cityspk.labels['hpage_help_faq'] = "FAQ";
cityspk.labels['hpage_help_guide'] = "Photographer's manual";
cityspk.labels['hpage_help_tour'] = "Guided tour";
cityspk.labels['hpage_search'] = "Search";
cityspk.labels['hpage_user_home'] = "My CITYSPK";
cityspk.labels['hpage_user_photos'] = "My photos";
cityspk.labels['hpage_user_messages'] = "My messages";
cityspk.labels['hpage_user_glyphs'] = "My glyphs";
cityspk.labels['hpage_user_friends'] = "My correspondents";
cityspk.labels['hpage_user_register'] = "Subscribe";
cityspk.labels['hpage_user_organizer'] = "Organize";
cityspk.labels['hpage_user_profile'] = "Profile";
cityspk.labels['hpage_user_edit'] = "My account";
cityspk.labels['hpage_user_please_register'] = "Please register to have access to";
cityspk.labels['menu_g_compose'] = "Compose";
cityspk.labels['menu_g_explore'] = "Explore";
cityspk.labels['menu_g_explore_area'] = "Places";
cityspk.labels['menu_g_explore_city'] = "Cities";
cityspk.labels['menu_g_explore_messages'] = "Messages";
cityspk.labels['menu_g_explore_members'] = "Members";
cityspk.labels['menu_g_account'] = "You";
cityspk.labels['menu_g_account_profile'] = "Profile";
cityspk.labels['menu_g_account_messages'] = "Messages";
cityspk.labels['menu_g_account_photos'] = "Photos";
cityspk.labels['menu_g_account_glyphs'] = "Glyphs";
cityspk.labels['menu_g_account_friends'] = "Friends";
cityspk.labels['menu_g_account_edit'] = "Account";
cityspk.labels['menu_g_account_organizer'] = "Organize";
cityspk.labels['menu_g_account_signup'] = "Sign up";
cityspk.labels['menu_u_subscription'] = "menu_u_subscription";
cityspk.labels['menu_u_help'] = "Help";
cityspk.labels['menu_u_language'] = "Français";
cityspk.labels['menu_slogan'] = "Get the world talking";
cityspk.labels['menu_u_deconnexion'] = "Logout";
cityspk.labels['menu_u_connexion'] = "Login";
cityspk.labels['home_tryit_text'] = "Try it!";
cityspk.labels['home_tryit_textbox'] = "Type your message here";
cityspk.labels['home_tryit_textbox_recompose'] = "Type your message here";
cityspk.labels['home_more_info_bt'] = "MORE INFO";
cityspk.labels['home_register_button'] = "Create your account";
cityspk.labels['home_register_button_text'] = "It only takes 2 minutes, it's free and you will be able to archive all your photos and messages.";
cityspk.labels['pub_form_title'] = "Create a virtual card with CITYSPK";
cityspk.labels['pub_form_text'] = "Compose. Send. Surprise!";
cityspk.labels['pub_form_title_slogan'] = "Get the world talking";
cityspk.labels['pub_see_all_cities'] = "CITYSPK cities";
cityspk.labels['pub_see_all_the_cities'] = "Other cities CITYSPK";
cityspk.labels['step1_err_required'] = "** required field";
cityspk.labels['step1_title'] = "Add photos";
cityspk.labels['step1_subtitle'] = "Step 1: Select your photos";
cityspk.labels['step1_description'] = "Select the files that you wish to transfer to your image bank.";
cityspk.labels['step1_help_metatitle'] = "Details (required)";
cityspk.labels['step1_help_meta'] = "Why are these fields required ?";
cityspk.labels['step1_help_meta_text'] = "To be part of CITYSPK, your photos must belong to a city, users will be able to travel in your images because of that information. <br /><br />Don't forget to include the neigbourhood in the tags <br />Use commas or spaces to separate your tags and Attach words with dash (ie. Chinatown, Mile-End, Latin-Quarter…).";
cityspk.labels['step1_help_tags'] = "Tags";
cityspk.labels['step1_tags_hint'] = "Use commas or spaces to separate your tags.";
cityspk.labels['step1_title_options'] = "Optional details";
cityspk.labels['step1_help_options'] = "Privacy";
cityspk.labels['step1_help_option_text'] = "You can decide whether your photos are private. By default, your images are public so that everyone can see them in your profile space. <br /><br /><b>Type</b><br /><br /> Choose one option if your upload is one type of images. You will then jump the type selection step.";
cityspk.labels['step1_help_privacy'] = "Privacy:";
cityspk.labels['step1_help_public'] = "Public";
cityspk.labels['step1_help_private'] = "Private";
cityspk.labels['step1_help_type'] = "Type :";
cityspk.labels['step1_help_glpyh'] = "Glyph";
cityspk.labels['step1_help_photo'] = "Photo";
cityspk.labels['step1_help_files_title'] = "Choose your images";
cityspk.labels['step1_help_files'] = "About images";
cityspk.labels['step1_help_files_text'] = "Image format must be: jpg and for each, weight must not exceed 10Mo. Select multiple or single file to put in your cue list, remove item from the until satisfaction. When you are ready, click NEXT and you will be automatically redirect to the next step when all the files are uploaded on CITYSPK. Do not interrupt this process.";
cityspk.labels['step1_upload_bt_files'] = "BROWSE";
cityspk.labels['step1_help_upload'] = "NEXT";
cityspk.labels['upload_received'] = "received, ... analyzing ...";
cityspk.labels['upload_queued'] = "Queued";
cityspk.labels['step2_title'] = "Add photos";
cityspk.labels['step2_subtitle'] = "Step 2: Identify the glyphs";
cityspk.labels['step2_description'] = "Select the images that correspond to glyphs. If there are none, please proceed to the next step.";
cityspk.labels['step2_continue'] = "NEXT";
cityspk.labels['step2_selected_images'] = "Selected glyphs";
cityspk.labels['step2_help_glyph'] = "What is a glyph?";
cityspk.labels['step2_help_glyph_text'] = "Glyphs are the building blocks of CITYSPK. <br /><br />Any letter, number, word or other written symbol can be a glyph.";
cityspk.labels['step2_help_glyph_spec1_title'] = "If the image contains a letter, a number or a symbol";
cityspk.labels['step2_help_glyph_spec1'] = "Please insure that:<br />&nbsp;&nbsp;&bull;&nbsp;that it is square-shaped,<br />&nbsp;&nbsp;&bull;&nbsp;that the full image of the letter, number or symbol appears,<br />&nbsp;&nbsp;&bull;&nbsp;and that it is clearly legible.";
cityspk.labels['step2_help_glyph_spec2_title'] = "If the image contains a word";
cityspk.labels['step2_help_glyph_spec2'] = "it can be rectangular. However, please insure that the word:<br />&nbsp;&nbsp;&bull;&nbsp;is horizontally aligned, <br />&nbsp;&nbsp;&bull;&nbsp;appears entirely and on its own, <br />&nbsp;&nbsp;&bull;&nbsp; and can be read from left to right.";
cityspk.labels['step2_help_specification'] = "";
cityspk.labels['step2_help_glyph_spec3_title'] = "Resolution";
cityspk.labels['step2_help_glyph_spec3'] = "The resolution of the glyph must be sufficient so that it can appear in a large format (500 x 500 pixels) in CITYSPK.";
cityspk.labels['step2_help_glyph_spec4_title'] = "";
cityspk.labels['step2_help_glyph_spec4'] = "";
cityspk.labels['step2_help_glyph_spec5_title'] = "";
cityspk.labels['step2_help_glyph_spec5'] = "";
cityspk.labels['step2_help_glyph_spec6_title'] = "";
cityspk.labels['step2_help_glyph_spec6'] = "";
cityspk.labels['step3_help_glyph'] = "Defining glyphs";
cityspk.labels['step3_help_glyph_spec1_title'] = "<br />Transcription :";
cityspk.labels['step3_help_glyph_spec1'] = "Retype exactly any number, letter, word or other symbol seen in the image.";
cityspk.labels['step3_help_glyph_spec2_title'] = "<br />Other meanings :";
cityspk.labels['step3_help_glyph_spec2'] = "It is possible that an image, without corresponding literally to a letter, a number or a word, has a symbolic or phonetic meaning that allows you to include it in a CITYSPK message. <br />For example : <br /><img src='../static/images/heart.gif' width='15' height='12' hspace='5' border='0'>= love or heart.<br /> U = You";
cityspk.labels['step3_title'] = "Add Photos";
cityspk.labels['step3_subtitle'] = "Step 3: Adding information";
cityspk.labels['step3_description'] = "This is the final step in order to fully incorporate your images to CITYSPK. Enter the basic information now and you can complete it later in the organizer.";
cityspk.labels['step3_title_glyph'] = "Glyphs";
cityspk.labels['step3_subtitle_glyph'] = "Type the words, letters or other sings appearing in the image.";
cityspk.labels['step3_title_image'] = "Photos";
cityspk.labels['step3_subtitle_image'] = "In order to be included in the CITYSPK image bank, your photos must have be identified by a title and accompanied by a description. This information personalizes and enriches the CITYSPK experience.";
cityspk.labels['step3_finish'] = "END";
cityspk.labels['step3_back'] = "BACK";
cityspk.labels['step3_field_literal'] = "Transcription ";
cityspk.labels['step3_field_meaning'] = "Other meanings ";
cityspk.labels['step3_meanings_hint'] = "Use commas or spaces to separate your meanings.";
cityspk.labels['step3_field_title'] = "Title";
cityspk.labels['step3_field_description'] = "Description";
cityspk.labels['login_subscribe_title'] = "Subscribe to CITYSPK";
cityspk.labels['login_subscribe_subtitle'] = "Subscribe to CITYSPK";
cityspk.labels['login_subscribe_description'] = "By subscribing to CITYSPK, you can create a profile page, save your messages and drafts, create and organize photo albums, submit photos and glyphs to the image bank and participate in the CITYSPK social network.";
cityspk.labels['login_subscribe_bt'] = "SUBSCRIBE";
cityspk.labels['login_signup_title'] = "Already a member?";
cityspk.labels['login_signup_username'] = "Email address";
cityspk.labels['login_signup_password'] = "Password";
cityspk.labels['login_signup_remember'] = "Remember me";
cityspk.labels['login_signup_forgetpass'] = "Forgotten password?";
cityspk.labels['login_signup_bt'] = "CONNECT";
cityspk.labels['login_remind_bt'] = "SEND";
cityspk.labels['login_remind_sent'] = "Mail sent";
cityspk.labels['login_title'] = "Open a session";
cityspk.labels['login_subtitle'] = "Starting a session will allow you to use all the features of CITYPSK,";
cityspk.labels['reminder_title'] = "Lost password";
cityspk.labels['reminder_subtitle'] = "Change password";
cityspk.labels['reminder_password'] = "Password";
cityspk.labels['reminder_password_confirm'] = "Confirmation";
cityspk.labels['reminder_change_bt'] = "SEND";
cityspk.labels['reminder_tagline'] = ", please change your password by clicking on the following link";
cityspk.labels['reminder_mail_from_name'] = "CITYSPK help";
cityspk.labels['reminder_mail_subject'] = "Changing your CITYSPK password.";
cityspk.labels['user_create_title'] = "Create your account";
cityspk.labels['user_create_description_title'] = "Once your account created, you will automatically have acces to your personnal space where you can manage your profile, messages, images and friends.";
cityspk.labels['user_create_mandatory_fields'] = "Personnal informations (required)";
cityspk.labels['user_create_account_type'] = "Type of account";
cityspk.labels['user_create_email'] = "Email";
cityspk.labels['user_create_email_valid'] = "Email confirmation";
cityspk.labels['user_create_username'] = "Member name";
cityspk.labels['user_create_password'] = "Password";
cityspk.labels['user_create_password_valid'] = "Password confirmation";
cityspk.labels['user_create_optionnal_fields'] = "More details (optional)";
cityspk.labels['user_create_sex'] = "Gender";
cityspk.labels['user_create_birtday'] = "Date of birth";
cityspk.labels['user_create_description'] = "Description";
cityspk.labels['user_create_validation'] = "Activate your account";
cityspk.labels['user_create_check_username_ok'] = "Username available";
cityspk.labels['user_create_check_username_nok'] = "Username not available";
cityspk.labels['user_create_email_taken_error'] = "Adress already registered";
cityspk.labels['user_create_mandatory_fields_help_title'] = "";
cityspk.labels['user_create_mandatory_fields_help_text'] = "";
cityspk.labels['user_create_country'] = "Country";
cityspk.labels['user_create_city'] = "City";
cityspk.labels['user_create_optionnal_fields_help_title'] = "";
cityspk.labels['user_create_optionnal_fields_help_text'] = "";
cityspk.labels['user_create_verification_fields'] = "";
cityspk.labels['user_create_verification_fields_help_title'] = "";
cityspk.labels['user_create_verification_fields_help_text'] = "You must have read and accept the privacy policy and terms of use to create an account on CITYSPK";
cityspk.labels['user_create_email_error'] = "Please enter your address";
cityspk.labels['user_create_email_valid_error'] = "Please confirm your address";
cityspk.labels['user_create_username_error'] = "Please enter username";
cityspk.labels['user_create_password_error'] = "Please enter password";
cityspk.labels['user_create_password_valid_error'] = "Please confirm password";
cityspk.labels['user_create_city_error'] = "";
cityspk.labels['user_create_agreement_error'] = "You must accept conditions";
cityspk.labels['user_create_captcha_error'] = "Incorrect entry";
cityspk.labels['user_create_captcha_reload'] = "reload";
cityspk.labels['user_create_type_captcha_text'] = "Please type the letters shown left";
cityspk.labels['user_profile_title'] = "Edit your profile";
cityspk.labels['user_profile_myaccount'] = "Your account";
cityspk.labels['user_profile_mystatus'] = "I am currently exploring";
cityspk.labels['user_profile_myavatar'] = "Your avatar";
cityspk.labels['user_update_explore'] = "";
cityspk.labels['user_profile_change_email'] = "Change your email address";
cityspk.labels['user_profile_change_password'] = "Change your password";
cityspk.labels['user_profile_save'] = "Update your profile";
cityspk.labels['user_profile_cancel'] = "Cancel";
cityspk.labels['user_profile_upload_image'] = "Upload an image :";
cityspk.labels['user_profile_help_password1'] = "A confirmation email will be sent to you";
cityspk.labels['user_profile_help_password2'] = "Click on the link to activate your new password";
cityspk.labels['user_profile_new_password'] = "New Password";
cityspk.labels['user_profile_success'] = "Profile saved";
cityspk.labels['user_profile_norecent_photos'] = "No new photos";
cityspk.labels['user_profile_norecent_messages'] = "No new messages";
cityspk.labels['action_edit'] = "Edit";
cityspk.labels['action_img_context'] = "Context Shot";
cityspk.labels['action_infos'] = "Informations";
cityspk.labels['action_glyphs'] = "Definitions";
cityspk.labels['action_add_tags'] = "Add tags";
cityspk.labels['metadata_literal'] = "Transcription";
cityspk.labels['metadata_date'] = "Date";
cityspk.labels['metadata_city'] = "City";
cityspk.labels['metadata_tags'] = "Keywords";
cityspk.labels['action_suppression'] = "Discard";
cityspk.labels['action_search'] = "Search";
cityspk.labels['metadata_title'] = "Title";
cityspk.labels['metadata_desc'] = "Description";
cityspk.labels['metadata_datetaken'] = "Taken";
cityspk.labels['metadata_dateposted'] = "Added";
cityspk.labels['action_album'] = "Classify";
cityspk.labels['action_sort'] = "Sort";
cityspk.labels['action_sort_date'] = "by date";
cityspk.labels['action_sort_alpha'] = "by title";
cityspk.labels['err_empty_datetaken'] = "Date taken missing";
cityspk.labels['err_empty_dateposted'] = "Date published missing";
cityspk.labels['err_empty_tag'] = "Keywords missing";
cityspk.labels['err_empty_title'] = "Title missing";
cityspk.labels['err_empty_description'] = "Incomplete description";
cityspk.labels['err_empty_imageCtxt'] = "No associated contextual image";
cityspk.labels['action_add_to_album'] = "Add to an album";
cityspk.labels['action_remove_from_album'] = "Remove from an album";
cityspk.labels['metadata_context'] = "Context";
cityspk.labels['metadata_meanings'] = "Meanings";
cityspk.labels['action_contribute'] = "Contribute to CITYSPK";
cityspk.labels['menu_display'] = "Filters";
cityspk.labels['menu_all'] = "All photos";
cityspk.labels['menu_recents'] = "Recent photos";
cityspk.labels['menu_incomplete'] = "Incomplete photos";
cityspk.labels['menu_publique'] = "Public photos";
cityspk.labels['menu_private'] = "Private photos";
cityspk.labels['menu_city'] = "Cities";
cityspk.labels['menu_albums'] = "My albums";
cityspk.labels['menu_cities_showall'] = "All cities";
cityspk.labels['menu_no_album'] = "All albums";
cityspk.labels['menu_non_classed_content'] = "Unclassified";
cityspk.labels['org_loading_message'] = "Loading ...";
cityspk.labels['org_title'] = "Organize your photos";
cityspk.labels['org_subtitle'] = "";
cityspk.labels['org_description'] = "";
cityspk.labels['org_selected_images_label'] = "Selection";
cityspk.labels['org_selected_images'] = "selected images";
cityspk.labels['org_upload_more_photos'] = "Add photos";
cityspk.labels['menu_photos'] = "Photos";
cityspk.labels['menu_glyphs'] = "Glyphs";
cityspk.labels['action_display'] = "Display";
cityspk.labels['org_select_all'] = "All";
cityspk.labels['org_unselect_all'] = "None";
cityspk.labels['org_back_profile'] = "Return to your homepage";
cityspk.labels['org_no_photos'] = "No photos for this selection";
cityspk.labels['org_clear_search'] = "Clear search";
cityspk.labels['org_run_search'] = "Launch search";
cityspk.labels['org_sort_alpha'] = "Sort by alphabetical order";
cityspk.labels['org_sort_date'] = "Sort by date published";
cityspk.labels['org_list_view'] = "Display as list";
cityspk.labels['org_grid_view'] = "Display as grid";
cityspk.labels['be_title'] = "Edit information";
cityspk.labels['be_type_image'] = "Image";
cityspk.labels['be_type_glyph'] = "Glyph";
cityspk.labels['be_type_legend'] = "Type";
cityspk.labels['be_cancel'] = "CANCEL";
cityspk.labels['be_save'] = "SAVE";
cityspk.labels['be_title_legend'] = "Titre";
cityspk.labels['be_tags_legend'] = "Mots-clés";
cityspk.labels['be_tags_text'] = "add keywords to these elements";
cityspk.labels['be_description_legend'] = "Description";
cityspk.labels['be_datetaken_legend'] = "Date";
cityspk.labels['be_datePosted_legend'] = "Publication";
cityspk.labels['be_privacy'] = "Status";
cityspk.labels['be_public'] = "Public";
cityspk.labels['be_private'] = "Private";
cityspk.labels['bic_title'] = "Choose contextual photo";
cityspk.labels['bic_cancel'] = "CANCEL";
cityspk.labels['bic_save'] = "SAVE";
cityspk.labels['bic_filter_context_images'] = "Amongst mes photos";
cityspk.labels['bic_filter_ci_filter'] = "--- Filter ---";
cityspk.labels['bic_filter_ci_all'] = "All";
cityspk.labels['bic_filter_ci_recent'] = "Most récent";
cityspk.labels['bic_filter_ci_incomplete'] = "Incomplete";
cityspk.labels['bic_filter_ci_private'] = "Private";
cityspk.labels['bic_filter_ci_public'] = "Public";
cityspk.labels['bic_filter_ci_filter_albums'] = "--- Albums ---";
cityspk.labels['bic_too_may_cities'] = "Please select glyphs from only one city.";
cityspk.labels['bic_help_title'] = "Title desc";
cityspk.labels['bic_help_text'] = "In order to be part of CITYSPK image bank, all the information must be completed";
cityspk.labels['bg_title'] = "Change definitions";
cityspk.labels['bg_cancel'] = "CANCEL";
cityspk.labels['bg_save'] = "SAVE";
cityspk.labels['bg_add'] = "Add";
cityspk.labels['bg_remove'] = "Remove";
cityspk.labels['bg_literal'] = "Transcription";
cityspk.labels['bg_meaning'] = "Other";
cityspk.labels['bs_title'] = "Remove selected photos";
cityspk.labels['bs_cancel'] = "CANCEL";
cityspk.labels['bs_save'] = "SAVE";
cityspk.labels['user_create_account_type_contrib'] = "";
cityspk.labels['user_create_account_type_explorer'] = "";
cityspk.labels['user_create_account_type_messager'] = "";
cityspk.labels['user_create_sex_m'] = "Homme";
cityspk.labels['user_create_sex_f'] = "Femme";
cityspk.labels['user_create_validate_verif_newsletter'] = "I want to susbcribe to the CITYSPK newsletter.";
cityspk.labels['user_create_validate_verif_agreement'] = "";
cityspk.labels['user_create_validate_verif_agreement_before_conditions'] = "I acccept the ";
cityspk.labels['user_create_validate_verif_agreement_link_conditions'] = "terms of use";
cityspk.labels['user_create_validate_verif_agreement_before_politic'] = "and the";
cityspk.labels['user_create_validate_verif_agreement_link_politic'] = "privacy policy";
cityspk.labels['album_add_title'] = "Add an album";
cityspk.labels['album_add_title_legend'] = "Title";
cityspk.labels['album_add_privacy'] = "Status";
cityspk.labels['album_add_public'] = "Public";
cityspk.labels['album_add_private'] = "Private";
cityspk.labels['album_add_save'] = "ADD";
cityspk.labels['album_add_cancel'] = "CANCEL";
cityspk.labels['album_page_title'] = "Photo album";
cityspk.labels['album_insert_title'] = "Add to an album";
cityspk.labels['album_insert_save'] = "ADD";
cityspk.labels['album_insert_cancel'] = "CANCEL";
cityspk.labels['album_remove_title'] = "Remove photos from an album";
cityspk.labels['album_remove_text'] = "You are about to remove these photos from the album ";
cityspk.labels['album_remove_text2'] = "";
cityspk.labels['album_remove_save'] = "REMOVE";
cityspk.labels['album_remove_cancel'] = "CANCEL";
cityspk.labels['album_delete_title'] = "Delete an album";
cityspk.labels['album_delete_photos'] = "Delete pictures inside too ?";
cityspk.labels['album_delete_save'] = "ERASE";
cityspk.labels['album_delete_cancel'] = "CANCEL";
cityspk.labels['album_edit_title'] = "Modify an album";
cityspk.labels['album_edit_title_legend'] = "Title";
cityspk.labels['album_edit_privacy'] = "Status";
cityspk.labels['album_edit_public'] = "Public";
cityspk.labels['album_edit_private'] = "Private";
cityspk.labels['album_edit_save'] = "SAVE";
cityspk.labels['album_edit_cancel'] = "CANCEL";
cityspk.labels['se_edit_next'] = "Next photo";
cityspk.labels['se_edit_prev'] = "Previous photo";
cityspk.labels['se_tags_hint'] = "Do not forget to include the neighbourhood in the tags (ex : Mile-end, West-Manhattan).";
cityspk.labels['se_cities_hint'] = "Please enter your country and city";
cityspk.labels['se_confirm_delete_bt'] = "Please confirm the removal of these photos";
cityspk.labels['se_confirm_delete'] = "You are about to remove these photos from your personnal space.";
cityspk.labels['user_profile_upload_photos'] = "Upload photos";
cityspk.labels['user_profile_organise_photos'] = "Organise your photos";
cityspk.labels['user_profile_related_mailers'] = "Correspondents";
cityspk.labels['user_profile_related_albums'] = "Albums";
cityspk.labels['user_profile_compose_msg'] = "Compose a message";
cityspk.labels['user_profile_last_receive_msg'] = "Last recieved messages";
cityspk.labels['user_profile_last_cityspk_photos'] = "Last photos on CITYSPK";
cityspk.labels['user_profile_cityspk_messages'] = "Messages";
cityspk.labels['user_profile_cityspk_photos'] = "Photos";
cityspk.labels['user_profile_cityspk_glyphs'] = "Glyphs";
cityspk.labels['user_profile_city_blogue'] = "SPKBLOG";
cityspk.labels['user_profile_current_located'] = "Now in";
cityspk.labels['user_profile_member_since'] = "Member since";
cityspk.labels['user_profile_myglyphs'] = "My glyphs";
cityspk.labels['user_profile_myphotos'] = "My photos";
cityspk.labels['user_profile_photos_dropdown_all'] = "All";
cityspk.labels['user_profile_photos_dropdown_cities'] = "City";
cityspk.labels['user_profile_photos_recents'] = "Recent photos";
cityspk.labels['user_profile_photos_all'] = "All photos";
cityspk.labels['user_profile_messages_all'] = "All messages";
cityspk.labels['user_profile_friends_all'] = "All friends of";
cityspk.labels['user_profile_pagination_received_msg'] = "Messages received";
cityspk.labels['user_profile_pagination_sent_msg'] = "Messages sent";
cityspk.labels['user_profile_pagination_draft_msg'] = "Drafts";
cityspk.labels['user_profile_pagination_mostviewed_msg'] = "Most seen messages";
cityspk.labels['user_profile_pagination_private_msg'] = "Private messages";
cityspk.labels['user_profile_see_profile'] = "See profile of";
cityspk.labels['user_profile_compose_box_text'] = "Compose a message";
cityspk.labels['explore_populaire'] = "Most popular";
cityspk.labels['explore_recent'] = "Most récent";
cityspk.labels['explore_recente'] = "Most recent";
cityspk.labels['explore_alpha'] = "Alphabetical sorting";
cityspk.labels['explore_by_category'] = "By categories";
cityspk.labels['explore_like'] = "As in";
cityspk.labels['explore_title_pub'] = "Advertising";
cityspk.labels['explore_back_message'] = "Return to my message";
cityspk.labels['photo_explore_related'] = "Related photos";
cityspk.labels['photo_explore_other_photo'] = "Other photos from";
cityspk.labels['photo_explore_album_photo'] = "Other photos from the album ";
cityspk.labels['photo_explore_related_glyphe'] = "This photo contains glyphs";
cityspk.labels['photo_explore_context'] = "The glyph comes from this photo";
cityspk.labels['photo_explore_published'] = "Published";
cityspk.labels['photo_explore_default_city'] = "CitySPK";
cityspk.labels['photo_explore_title'] = "Title : ";
cityspk.labels['tryit_compose_from_photo'] = "Compose a message with this photo";
cityspk.labels['photo_explore_view_added'] = "Added : ";
cityspk.labels['photo_explore_view_city'] = "City : ";
cityspk.labels['photo_explore_view_keywords'] = "Keywords : ";
cityspk.labels['member_explore_user_name'] = "Member name";
cityspk.labels['member_explore_from'] = "from";
cityspk.labels['member_explore_subscribe_from'] = "member since";
cityspk.labels['member_explore_year'] = "years";
cityspk.labels['member_explore_contact'] = "Contacts";
cityspk.labels['member_explore_title'] = "Explore correspondents";
cityspk.labels['member_explore_desc'] = "Anyone can be part of the CITYSPK community. In order to use the site to its full potential, you need only create a profile. You will then be able to manage your personal mailbox, grow a network of correspondents, and contribute to the bank of images and messages.";
cityspk.labels['member_explore_city_from'] = "City of origin";
cityspk.labels['member_explore_search_member'] = "Search for a correspondent";
cityspk.labels['member_explore_origine'] = "Origins of the correspondents";
cityspk.labels['member_explore_nofriends'] = "No friends yet";
cityspk.labels['member_explore_nofriends_loggued'] = "You don't have friends yet. To add a friend to your list, go to their profile page and click on add to my friends button";
cityspk.labels['city_explore_compose_msg'] = "Compose a message with glyphs from";
cityspk.labels['city_explore_more_photo'] = "More photos";
cityspk.labels['city_explore_msg_from'] = "Message from";
cityspk.labels['city_explore_more_cities'] = "Explore other cities";
cityspk.labels['city_explore_alpha'] = "Alphabetical order";
cityspk.labels['city_explore_uncomplete'] = "Incomplete cities";
cityspk.labels['city_explore_uncomplete_title'] = "Incomplete cities";
cityspk.labels['city_explore_uncomplete_item_photos'] = "Photos";
cityspk.labels['city_explore_uncomplete_item_glyphs'] = "Glyphs";
cityspk.labels['city_explore_area_title'] = "Explore cities";
cityspk.labels['city_explore_area_intro'] = "Each city in CITYSPK lets you access an assortment of photos, glyphs and messages created with local materials by the CITYSPK community.";
cityspk.labels['city_explore_search_label'] = "Search for cities";
cityspk.labels['city_explore_add_your_city'] = "Add a city";
cityspk.labels['city_explore_add_city_txt'] = "To add a city, you need to register, then you can start to collect photos, words and letters.";
cityspk.labels['city_explore_add_link_label'] = "Click here to start";
cityspk.labels['city_explore_related_items'] = "Words, letters and symbols from";
cityspk.labels['city_explore_related_photos'] = "Photos from";
cityspk.labels['city_explore_related_member'] = "Members from";
cityspk.labels['city_explore_no_user_for_city'] = "No members in this city";
cityspk.labels['city_explore_add_city_title'] = "Add your city";
cityspk.labels['city_explore_add_city_text'] = "Begin to type your city name and select the right location in the list. Once your city selected, it will be available in every CITYSPK lists";
cityspk.labels['message_create_message_create_title'] = "Compose";
cityspk.labels['message_create_create_title'] = "Compose";
cityspk.labels['message_create_composebox_send'] = "SPK AGAIN";
cityspk.labels['message_create_related_cities'] = "Cities";
cityspk.labels['message_create_related_tags'] = "Keywords";
cityspk.labels['message_create_customize_more'] = "Personalize your message.";
cityspk.labels['message_create_customize_more_add_image'] = "Add your own images";
cityspk.labels['message_create_customize_more_write_perso'] = "Write a personal message";
cityspk.labels['message_create_customize_more_invite_friends'] = "Invite other friends";
cityspk.labels['message_create_customize_more_change_letters'] = "Change, modify lettering";
cityspk.labels['message_create_customize_more_add_background'] = "Add a background image";
cityspk.labels['message_create_customize_more_apply_effects'] = "Apply effects";
cityspk.labels['message_create_customize_button'] = "Personnalize";
cityspk.labels['message_create_customize_title'] = "Advanced mail";
cityspk.labels['message_create_quicksend_button'] = "SEND";
cityspk.labels['message_create_quicksend_title'] = "Quick send";
cityspk.labels['message_create_quicksend_title_bt'] = "QUICK SEND";
cityspk.labels['message_create_or'] = "Or";
cityspk.labels['message_create_quicksend_you_like_message_very_much'] = "You like this message? Send it to your friends.";
cityspk.labels['message_create_quicksend_from'] = "From:";
cityspk.labels['message_create_quicksend_to'] = "To:";
cityspk.labels['message_create_quicksend_add_name'] = "Add a name";
cityspk.labels['message_create_select_city_button'] = "CHOOSE";
cityspk.labels['message_create_select_city_imageof'] = "Images from: ";
cityspk.labels['message_create_select_city_default'] = "Choose a city";
cityspk.labels['message_create_city_taken'] = "Place taken";
cityspk.labels['message_create_glyph_keywords'] = "Keywords :";
cityspk.labels['message_create_glyph_by'] = "by";
cityspk.labels['message_create_subscribe_to1'] = "Subscribe to ";
cityspk.labels['message_create_subscribe_to2'] = "and  profitez d'options avancées telles que :";
cityspk.labels['message_create_subscribe_text'] = "la sauvegarde de vos brouillons, confidentialité de vos images et messages, gestion de vos images personnelles";
cityspk.labels['message_create_bt_customize'] = "Customize";
cityspk.labels['message_create_prefill_sender_name'] = "Your name";
cityspk.labels['message_create_prefill_sender_email'] = "your email";
cityspk.labels['message_create_prefill_recipient_name'] = "Recipient's name";
cityspk.labels['message_create_prefill_recipient_email'] = "Recipient's email";
cityspk.labels['message_create_guest_user'] = "Anonymous";
cityspk.labels['message_compose_title'] = "Compose";
cityspk.labels['message_compose_sstitle'] = "Compose your message";
cityspk.labels['message_compose_type_your_message'] = "<br />";
cityspk.labels['message_compose_filter_by_city'] = "Choose a city";
cityspk.labels['message_compose_optionnal'] = "(optional)";
cityspk.labels['message_compose_city_list'] = "All cities";
cityspk.labels['message_compose_choose_bkg'] = "Choose a background for your message";
cityspk.labels['message_compose_submit'] = "SPK";
cityspk.labels['message_compose_or_section'] = "Or";
cityspk.labels['message_compose_choose_template'] = "Choose a template to modify";
cityspk.labels['message_compose_choose_category'] = "Choose amongst the following categories :";
cityspk.labels['message_compose_popular_categories'] = "Popular categories";
cityspk.labels['message_compose_see_more'] = "See more";
cityspk.labels['message_compose_insolites_categories'] = "Odd categories";
cityspk.labels['message_compose_travel_categories'] = "Travel categories";
cityspk.labels['message_compose_go_to_next_step'] = "NEXT";
cityspk.labels['custo_effects_blur'] = "Blur";
cityspk.labels['custo_effects_tint'] = "Tint";
cityspk.labels['custo_effects_mode'] = "Mode";
cityspk.labels['custo_effects_alpha'] = "Alpha";
cityspk.labels['custo_effects_mode_normal'] = "Normal";
cityspk.labels['custo_effects_mode_difference'] = "Difference";
cityspk.labels['custo_effects_mode_screen'] = "Screen";
cityspk.labels['custo_effects_mode_multiply'] = "Multiply";
cityspk.labels['custo_effects_mode_invert'] = "Invert";
cityspk.labels['message_customize_title'] = "Customize your message";
cityspk.labels['message_customize_subtitle'] = "";
cityspk.labels['message_customize_save_draft'] = "Save draft";
cityspk.labels['message_customize_send'] = "Send";
cityspk.labels['message_customize_send_evoluate'] = "Advanced send";
cityspk.labels['message_customize_item_owner'] = "by";
cityspk.labels['message_customize_item_keywords'] = "keywords";
cityspk.labels['message_customize_item_explore'] = "Explore";
cityspk.labels['message_customize_item_city'] = "City : ";
cityspk.labels['message_customize_item_apply'] = "Apply";
cityspk.labels['message_customize_item_cancel'] = "Cancel";
cityspk.labels['message_customize_change_glyph'] = "Change glyph";
cityspk.labels['message_customize_change_bkg_image'] = "Change background image";
cityspk.labels['message_customize_cityspk_suggest'] = "Suggestion from the CITYSPK image bank";
cityspk.labels['message_customize_break_glyphs'] = "I would like to separate the letter";
cityspk.labels['message_customize_filter_bank'] = "Cityspk bank";
cityspk.labels['message_customize_filter_mystuff'] = "My images";
cityspk.labels['message_customize_filter_by'] = "Filter by : ";
cityspk.labels['message_customize_exit_confirm'] = "SAVE";
cityspk.labels['message_customize_exit_cancel'] = "CANCEL";
cityspk.labels['message_customize_help_sup'] = "← Click on object you want to change in your message";
cityspk.labels['message_customize_help_inf'] = "Change, move glyphs. Change Background image. Apply effects";
cityspk.labels['message_customize_guest_sup'] = "Register to CITYSPK to access advanced options like:";
cityspk.labels['message_customize_guest_inf'] = "Save messages and drafts, privacy for your images and messages, manage your personal images";
cityspk.labels['message_customize_guest_subscribe'] = "REGISTER";
cityspk.labels['message_send_title'] = "Send your message";
cityspk.labels['message_send_subtitle'] = "Customize even more before send";
cityspk.labels['message_send_related_tags'] = "Keywords";
cityspk.labels['message_send_related_cities'] = "Cities";
cityspk.labels['message_send_attach_photos'] = "Attach images";
cityspk.labels['message_send_attach_photos_help_title'] = "Attaching images";
cityspk.labels['message_send_attach_photos_help_text'] = "You can upload and attach images to this message. However, the pictures will only be available to persons who will recieve this message. It will appear in message view.";
cityspk.labels['message_send_attach_photos_upload'] = "Add";
cityspk.labels['message_send_attach_photos_browse'] = "Browse your photos";
cityspk.labels['message_send_by_email'] = "Send to your correspondants";
cityspk.labels['message_send_by_email_help_title'] = "Personal note";
cityspk.labels['message_send_by_email_help_text'] = "The personal note will only be available to persons who will recieve this message. It will appear in notification email body and in message view.";
cityspk.labels['message_send_by_email_send_friends'] = "Send by email";
cityspk.labels['message_send_by_email_browse_friends'] = "Browse your CITYSPK correspondants ";
cityspk.labels['message_send_by_email_browse_nofriends'] = "Register to CITYSPK to add friends";
cityspk.labels['message_send_include_note'] = "Include a personnal note";
cityspk.labels['message_send_include_note_help_title'] = "Private or Public";
cityspk.labels['message_send_include_note_help_text'] = "Private messages are only available by people who have received a notification email with link to the message. The message will show as private in recipients and sender’s personal spaces. <br />Public messages will show in every pages of CITYSPK and can be send by other users but original author will always appear in the message information. <br />Message template will authorize anybody, member or not,  to use and modify a copy of the message to make it his creation.";
cityspk.labels['message_send_upload_bt_files'] = "SEND THE FILES";
cityspk.labels['message_send_add_tags_bt'] = "ADD";
cityspk.labels['message_send_from'] = "From";
cityspk.labels['message_send_to'] = "To";
cityspk.labels['message_send_email'] = "email";
cityspk.labels['message_send_add_name'] = "Add a recipient";
cityspk.labels['message_send_privacy_settings'] = "Privacy settings";
cityspk.labels['message_send_privacy_or'] = "Or";
cityspk.labels['message_send_showcase_on_cityspk'] = "Publish on CITYSPK";
cityspk.labels['message_send_private_on_cityspk'] = "This message is private and only the recipients will access to it";
cityspk.labels['message_send_agreement'] = "I have read an accept the ";
cityspk.labels['message_send_agreement_link_conditions'] = "Terms of use";
cityspk.labels['message_send_agreement_before_politic'] = "and";
cityspk.labels['message_send_agreement_link_politic'] = "Privacy policy";
cityspk.labels['message_send_agreement_template'] = "This message can be use by others to start their own";
cityspk.labels['message_send_choose_category'] = "Choose a category";
cityspk.labels['message_send_choose_category_popular'] = "Popular";
cityspk.labels['message_send_choose_category_insolite'] = "Unusual";
cityspk.labels['message_send_choose_category_travel'] = "Travel";
cityspk.labels['message_send_sender_error'] = "Please enter a name";
cityspk.labels['message_send_sender_email_error'] = "Please enter you email address";
cityspk.labels['message_send_friends_error'] = "Please select at least one friend";
cityspk.labels['message_send_recipient_error'] = "Please enter a valid email address";
cityspk.labels['message_send_note_error'] = "Please write a short note";
cityspk.labels['message_send_agreement_error'] = "You must accept the conditions";
cityspk.labels['message_send'] = "SEND";
cityspk.labels['message_send_back_editor'] = "MODIFY MESSAGE";
cityspk.labels['message_mail_subject'] = "You just got a CITYSPK message";
cityspk.labels['message_mail_copy_subject'] = "You have sent a CITYSPK message!";
cityspk.labels['message_mail_copy_from_name'] = "CITYSPK";
cityspk.labels['message_mail_copy_from_email'] = "transmission@cityspk.com";
cityspk.labels['message_mail_condition'] = "Terms of use";
cityspk.labels['message_mail_politic'] = "Privacy";
cityspk.labels['sendtofriend_link_home'] = "Visit CITYSPK and browse thousands of photos";
cityspk.labels['sendtofriend_message_link'] = "Click on this link to see the whole message";
cityspk.labels['sendtofriend_photo_link'] = "Click on this link to see the whole image";
cityspk.labels['sendtofriend_message_title'] = "A friend wants to share this message with you!";
cityspk.labels['sendtofriend_photo_title'] = "A friend wants to share this picture with you!";
cityspk.labels['sendtofriend_condition'] = "Terms of use";
cityspk.labels['sendtofriend_politic'] = "Privacy";
cityspk.labels['message_view_head_title'] = "Message view";
cityspk.labels['message_view_head_subtitle'] = "";
cityspk.labels['message_view_reply'] = "REPLY";
cityspk.labels['message_view_added_on'] = "Added : ";
cityspk.labels['message_view_cities'] = "Cities : ";
cityspk.labels['message_view_keywords'] = "Keywords : ";
cityspk.labels['message_view_category'] = "Catégory : ";
cityspk.labels['message_view_use_template'] = "Template";
cityspk.labels['message_view_modify'] = "Modify";
cityspk.labels['message_view_delete'] = "Delete";
cityspk.labels['message_view_send'] = "Send";
cityspk.labels['message_view_attachments'] = "Attached Images";
cityspk.labels['message_view_use_it_as_template'] = "Use as template";
cityspk.labels['message_confirm_head_title'] = "Message sent";
cityspk.labels['message_confirm_head_subtitle'] = "";
cityspk.labels['message_confirm_title'] = "Your message has been sent !";
cityspk.labels['message_confirm_text'] = "All the correspondants has received your invitation to discover your message. A copy has been sent to you too";
cityspk.labels['message_confirm_link_to_message'] = "Click on this link to see the whole message";
cityspk.labels['message_explore_title'] = "Explore messages";
cityspk.labels['message_explore_text_share'] = "";
cityspk.labels['message_explore_categories_popular'] = "Popular categories";
cityspk.labels['message_explore_categories_recent'] = "Recent categories";
cityspk.labels['message_explore_view_message'] = "See message";
cityspk.labels['search_title_photos'] = "Photos";
cityspk.labels['search_title_glyphs'] = "Glyphs";
cityspk.labels['search_title_messages'] = "Messages";
cityspk.labels['search_categories'] = "Categories";
cityspk.labels['search_label'] = "Search";
cityspk.labels['share_title'] = "Share";
cityspk.labels['share_explain_text_message'] = "View this message on CITYSPK";
cityspk.labels['share_explain_text_content'] = "View this picture on CITYSPK";
cityspk.labels['share_url'] = "URL : ";
cityspk.labels['share_code'] = "Code : ";
cityspk.labels['share_send_to_friend'] = "Send to a friend : ";
cityspk.labels['share_to'] = "To :";
cityspk.labels['share_from'] = "From : ";
cityspk.labels['share_social_label'] = "Submit to social networks";
cityspk.labels['share_mail_from_name'] = "CITYSPK";
cityspk.labels['share_mail_subject'] = "A friend has sent you a CITYSPK message!";
cityspk.labels['share_to_error'] = "Please enter a valid adress";
cityspk.labels['share_from_error'] = "Please enter a valid adress";
cityspk.labels['share_mail_success'] = "Email sent!";
cityspk.labels['share_photo_mail_subject'] = "A friend has sent you a CITYSPK message!";
cityspk.labels['share_message_mail_subject'] = "A friend has sent you a CITYSPK picture!";
cityspk.labels['share_photo_mail_body'] = "A friend is inviting you on CIYTYSPK to discover the following picture:";
cityspk.labels['share_message_mail_body'] = "A friend is inviting you on CIYTYSPK to discover the following message:";
cityspk.labels['location_picker_country'] = "Country : ";
cityspk.labels['location_picker_city'] = "City : ";
cityspk.labels['month_jan'] = "January";
cityspk.labels['month_feb'] = "February";
cityspk.labels['month_mar'] = "March";
cityspk.labels['month_apr'] = "April";
cityspk.labels['month_may'] = "May";
cityspk.labels['month_jun'] = "June";
cityspk.labels['month_jul'] = "July";
cityspk.labels['month_aug'] = "August";
cityspk.labels['month_sep'] = "September";
cityspk.labels['month_oct'] = "October";
cityspk.labels['month_nov'] = "November";
cityspk.labels['month_dec'] = "December";
cityspk.labels['view_photo'] = "View photo";
cityspk.labels['view_photo_share'] = "";
cityspk.labels['advertising'] = "Advertising";
cityspk.labels['confirm_box_title'] = "Confirmation";
cityspk.labels['confirm_box_save'] = "ERASE";
cityspk.labels['confirm_box_cancel'] = "CANCEL";
cityspk.labels['confirm_box_text'] = "You are about to erase this message, please confirm or cancel.";
cityspk.labels['save'] = "Saving";
cityspk.labels['destroy'] = "Destruction";
cityspk.labels['insert'] = "Insert";
cityspk.labels['remove'] = "remove";
cityspk.labels['in'] = "in";
cityspk.labels['from'] = "From";
cityspk.labels['moderation_flagged'] = "This content has been flagged for moderation";
cityspk.labels['moderation_locked'] = "This content has been locked private by the moderators.";
cityspk.labels['moderation_abuse'] = "This content has been removed by the moderators.";
cityspk.labels['moderation_flag'] = "Flag as abusive";
cityspk.labels['fl_feature_home'] = "Homepage";
cityspk.labels['fl_feature_bg'] = "Background";
cityspk.labels['fl_glyph_validated'] = "Valid glyph";
cityspk.labels['fl_glyph_rejected'] = "Invalid glyph";
cityspk.labels['fl_cc_allow_derivatives'] = "Permit derivative works";
cityspk.labels['fl_cc_allow_commercial'] = "Permit commercial uses (outside cityspk)";
cityspk.labels['fl_cc_force_license'] = "Permit derivative works but under the same license";
cityspk.labels['help_main_title'] = "Help";
cityspk.labels['help_faq_title'] = "Frequently asked questions on CITYSPK";
cityspk.labels['err_not_authenticated'] = "Not authenticated";
cityspk.labels['err_no_results'] = "No results found.";
cityspk.labels['err_not_owner'] = "This object isn't yours";
cityspk.labels['err_unknown_size'] = "Size unknown";
cityspk.labels['unauthorized'] = "Unauthorized access";
cityspk.labels['err_file_not_found'] = "File not found";
cityspk.labels['err_email_invalid'] = "Invalid email";
cityspk.labels['err_username_invalid'] = "Username unknown";
cityspk.labels['err_private_pagetitle'] = "This page is private.";
cityspk.labels['err_private_page'] = "You have been denied access to this page.";
cityspk.labels['err_back_home'] = "Return to homepage";
cityspk.labels['err_system_pagetitle'] = "System error";
cityspk.labels['err_system'] = "A system error has occurred";
cityspk.labels['err_404title'] = "This page does not exist.";
cityspk.labels['err_404'] = "This page does not exist in CITYSPK.";
cityspk.labels['err_missing_param'] = "Missing parameter";
cityspk.labels['i_wrong_password'] = "incorrect password";
cityspk.labels['i_wrong_login'] = "Username unknown";
cityspk.labels['i_sent_password'] = "i_sent_password";
cityspk.labels['i_anonymous'] = "i_anonymous";
cityspk.labels['i_authenticated'] = "i_authenticated";
cityspk.labels['i_location_lookup'] = "i_location_lookup";
cityspk.labels['i_location_countries'] = "i_location_countries";
cityspk.labels['i_location_cities'] = "i_location_cities";
cityspk.labels['i_user_created'] = "i_user_created";
cityspk.labels['i_username_not_available'] = "i_username_not_available";
cityspk.labels['i_username_available'] = "i_username_available";
cityspk.labels['i_user_deleted'] = "i_user_deleted";
cityspk.labels['i_tag_list'] = "i_tag_list";
cityspk.labels['i_meaning_list'] = "i_meaning_list";
cityspk.labels['i_up_pending'] = "i_up_pending";
cityspk.labels['i_up_show_file'] = "i_up_show_file";
cityspk.labels['i_up_file_processed'] = "i_up_file_processed";
cityspk.labels['i_thumb_path'] = "i_thumb_path";
cityspk.labels['i_match_glyhs'] = "i_match_glyhs";
cityspk.labels['opensearch_write'] = "Write a message in Cityspk!";
cityspk.labels['opensearch_photos'] = "Find photos on Cityspk!";
cityspk.labels['opensearch_messages'] = "Find messages on Cityspk!";
cityspk.labels['opensearch_glyphs'] = "Find glyphs on Cityspk!";
/**/


//Pager setup
cityspk.api.pager_endpoints.user = cityspk.urlmap.api_json+'/user/pager';
cityspk.api.pager_endpoints.photo = cityspk.urlmap.api_json+'/photo/pager';
cityspk.api.pager_endpoints.location = cityspk.urlmap.api_json+'/location/pager';
cityspk.api.pager_endpoints.message = cityspk.urlmap.api_json+'/message/pager';
cityspk.api.pager_endpoints.transmission = cityspk.urlmap.api_json+'/transmission/pager';

cityspk.api.pager = function(callback, endpoint, searchParams, searchOptions, searchContext)
{
   var parameters = {};
   parameters['searchParams'] = searchParams;
   parameters['searchOptions'] = searchOptions;
   parameters['searchContext'] = searchContext;
    
   jQuery.ajax({
    url: endpoint,
    data:{ parameters: JSON.stringify(parameters) },
    success:callback
   });
}


jQuery.ajaxSetup({ type:"POST", dataType:'json',  error: cityspk.errorHandler });

/**
 * Standard error handler.
 * @param {Object} XMLHttpRequest
 * @param {Object} textStatus
 * @param {Object} errorThrown
 */
cityspk.errorHandler = function(XMLHttpRequest, textStatus, errorThrown)
{
  alert('Ajax Error: '+textStatus+' :: '+errorThrown);
};

/**
 * Verify if a username is available for use, call function callback on completion.
 * @param {Object} callback
 * @param {Object} username
 */
cityspk.api.user.usernameAvailability = function(callback, username) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/checkUsernameAvailability',
     data: { parameters: JSON.stringify({ username:username}) }, 
     success: callback
     });
};


/**
 * Verify if a username is in use on the system.
 * @param {Object} callback
 * @param {Object} username (MANDATORY)
 */
cityspk.api.user.checkUsernameValidity = function(callback, username) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/checkUsernameValidity',
     data: { parameters: JSON.stringify({ username:username}) },
     success: callback
     });
};


/**
 * Verify if an email is available for use, call function callback on completion.
 * @param {Object} callback
 * @param {Object} email (MANDATORY)
 */
cityspk.api.user.checkEmailAvailability = function(callback, email) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/checkEmailAvailability',
     data:{ parameters: JSON.stringify({ email:email}) } , 
     success: callback
     });
};


/**
 * Verify if an email is in use on the system.
 * @param {Object} callback
 * @param {Object} username (MANDATORY)
 */
cityspk.api.user.checkEmailValidity =  function(callback, email) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/checkEmailValidity',
     data: { parameters: JSON.stringify({ email:email}) }, 
     success: callback
     });
};

/**
 * check if captcha text typed match the computed one
 * @param {Object} callback
 * @param {Object} username (MANDATORY)
 */
cityspk.api.user.checkCaptchaChecksum =  function(callback, text, ids) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/checkCaptchaChecksum',
     data: { parameters: JSON.stringify({ text: text, ids: ids}) }, 
     success: callback
     });
};

/**
 * reload captcha data
 * @param {Object} callback
 * @param {Object} username (MANDATORY)
 */
cityspk.api.user.loadCaptcha =  function(callback, length) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/loadCaptcha',
     data: { parameters: JSON.stringify({ length: length}) }, 
     success: callback
     });
};
/**
 * Perform the password change for the valid reminder_id.
 * @param {Object} callback
 * @param {Object} reminder_id (MANDATORY)
 * @param {Object} new_password  (MANDATORY)
 */
cityspk.api.user.reminderChangePassword = function(callback, reminder_id, new_password) 
{
  var parameters = {};
  parameters['reminder_slug'] = reminder_id;
  parameters['password'] = new_password;
 
  jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/reminderChangePassword',
     data: { parameters: JSON.stringify(parameters) }, 
     success: callback
   });
};

  
/**
 * Update the current user profile.
 * 
 * userParams: 
   * birthdate [String] (YYYY-MM-DD) 
   * sex [String] M or F
   * description [String] profile description
   * livingLocation [int] ID of the user living location (if not present, not updated) 
   * presentLocation [int] ID of the user current location (if not present, not updated) 
   * avatarURL [String] Location of this user avatar. (if not present, not updated) 
   * 
 * @param {Object} callback
 * @param {Object} profileData
 */
cityspk.api.user.setProfile = function(callback, userParams) 
{ 
  jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/setProfile',
     data: { parameters: JSON.stringify(userParams) }, 
     success: callback
   });
};

/**
 * Change the user's email and update folder structure accordingly
 */
cityspk.api.user.setEmail = function(callback, email)
{
  var parameters = {};
  parameters['email'] = email;
 
  jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/setEmail',
     data: { parameters: JSON.stringify(parameters) }, 
     success: callback
   });
}

/**
 * Change the user's password (requires the previous password for security)
 */
cityspk.api.user.setPassword = function(callback, old_pwd, new_pwd)
{
  var parameters = {};
  parameters['old_password'] = old_pwd;
  parameters['password'] = new_pwd;
 
  jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/setPassword',
     data: { parameters: JSON.stringify(parameters) }, 
     success: callback
   });
}
 
  
/**
 * Request a password reminder email to the specified address (must be valid)
 * @param {Object} callback
 * @param {Object} email (MANDATORY)
 */
cityspk.api.user.reminder = function(callback, email) 
{
  var parameters = {};
  parameters['email'] = email;
 
  jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/reminder',
     data: { parameters: JSON.stringify(parameters) }, 
     success: callback
   });
};

/**
 * Perform login.
 * @param {Object} callback
 * @param {Object} username (MANDATORY)
 * @param {Object} passsword  (MANDATORY)
 */
cityspk.api.user.login = function(callback, email, password, remember) 
{
  var parameters = {};
  parameters['email'] = email;
  parameters['password'] = password;
  parameters['remember'] = remember;
  
  jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/login',
     data: { parameters: JSON.stringify(parameters) }, 
     success: callback
   });
};

/**
 * Perform logout.
 * @param {Object} callback
 */
cityspk.api.user.logout = function(callback) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/logout',
     data: {  }, 
     success: callback
     });
};

/**
 * Get a list of locations this user has content in.
 * @param {Object} callback
 */
cityspk.api.user.getLocations = function(callback) 
{
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/getLocations',
     data: {  }, 
     success: callback
     });
};

/**
 * Add another user as a friend of the currently-logged one
 */
cityspk.api.user.addFriend = function(callback, friendId)
{
   var parameters = {};
   parameters['friendId'] = friendId;
   
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/addFriend',
     data:{ parameters: JSON.stringify(parameters) },
     success: callback
     });
}

/**
 * Remove a user from the currently-logged user's friend list
 */
cityspk.api.user.removeFriend = function(callback, friendId)
{
   var parameters = {};
   parameters['friendId'] = friendId;
   
   jQuery.ajax({
     url: cityspk.urlmap.api_json+'/user/removeFriend',
     data:{ parameters: JSON.stringify(parameters) },
     success: callback
     });
}

/**
 * Perform a user search.
 * 
 * searchParams:
 * emails [Array] Search users whose email matches one of the ones provided.
 * roles [Array] Search users whose role matches one of the ones provided.
 * username [String] Search users whose username (partially) matches the one provided
 * sex [String] Search only males ('M') or females ('F')
 * min_birthDate [String] (YYYY-MM-DD)
 * max_birthDate [String] (YYYY-MM-DD)
 * newsletter [Boolean] Only return users subscribed to the newsletter
 * livingLocations [Array] Search users whose livingLocationId matches one of the given location IDs
 * presentLocations [Array] Search users whose presentLocationId matches one of the given location IDs
 *    
 * searchOptions:
 * pagesize [int] Elements per page. Maxmum value is 256.
 * page [int] Page to start results at
 * sort [String] How ordering is performed
 *    'random' for randomized order
 *    'popular' for ordering by popularity
 *    'recent' for ordering by recentness (TBD)
 *    'a-z' for ordering alphabetically by username
 *
 * @param searchParams Object[optional]
 * @param searchOptions Object[optional]
 */
cityspk.api.user.search =  function(callback, searchOptions, searchParams) 
{    
  var params = {};
  
  params['searchOptions'] = searchOptions;
  params['searchParams'] = searchParams;
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/user/search',
    data: { parameters: JSON.stringify(params)  },
    success:callback
   });
};


/**
 * Perform a location lookup and return data on location by ID.
 * 
 * ids [Array] Array of location ID to lookup. (MANDATORY)
 * 
 * @param {Object} callback
 * @param {Array} ids=null
 */
cityspk.api.location.lookup = function(callback, ids)
{
  
   var parameters = {};
   parameters['ids'] = ids;
    
   jQuery.ajax({
    url: cityspk.urlmap.api_json+'/location/lookup',
    data:{ parameters: JSON.stringify(parameters) },
    success:callback
   });
};

/**
 * Activate a new location
 *
 * @param {string} country: the country name
 * @param {string} city: as given in the autocomplete box (city, region)
 */
cityspk.api.location.addLocation = function(callback, country, city)
{  
   var parameters = {};
   parameters['country'] = country;
   parameters['city'] = city;
    
   jQuery.ajax({
    url: cityspk.urlmap.api_json+'/location/addLocation',
    data:{ parameters: JSON.stringify(parameters) },
    success:callback
   });
}

/**
 * Perform a location search.
 * 
 * searchParams:
 * active [Boolean] If true, returns only active cities (default), otherwise returns only inactive cities
 * country [String] Filter results by country (either countryId or name of country)
 * region [String] Filter results by region
 * city [String] Retrieve locations whose city name matches (partially) the given one.
 * min_population [int] Only return locations with a population count >= min_population
 * max_population [int] Only return locations with a population count <= max_population
 * min_photocount [int]
 * max_photocount [int]
 * min_glyphcount [int]
 * max_glyphcount [int]
 * min_messagecount [int]
 * max_messagecount [int]
 * completion [String]
 *   'incomplete' Returns cities with completeness < 1
 *    'complete' Returns cities with completeness >= 1
 *    
 * searchOptions:
 * pagesize [int] Elements per page. Maxmum value is 256.
 * page [int] Page to start results at
 * sort [String] How ordering is performed
 *    'random' for randomized order
 *    'popular' for ordering by popularity
 *    'recent' for ordering by recentness (TBD)
 *    'completeness' for ordering by completeness
 *    'a-z' for ordering alphabetically by username
 *
 * @param searchParams Object[optional]
 * @param searchOptions Object[optional]
 */
cityspk.api.location.search =  function(callback, searchOptions, searchParams) 
{    
  var params = {};
  
  params['searchOptions'] = searchOptions;
  params['searchParams'] = searchParams;
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/location/search',
    data: { parameters: JSON.stringify(params)  },
    success:callback
   });
};

/**
 * Load the user's temporary message, indexed by session_id().
 * 
 * @param {Object} callback
 */
cityspk.api.message.loadTmp =  function(callback) 
{    
  var params = {};
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/loadTmp',
    data: { parameters: JSON.stringify(params)  },
    success:callback
   });
};

/**
   * This function takes a source message and "establishes" it as the current user's new tmp message.
   * If the source message is one of the user's drafts, the message is *moved* to tmp status.
   * If the source message is a template or a public message, the message is *copied* as tmp.
   *
   * Any previous tmp messages are destroyed.
   */
cityspk.api.message.moveToTmp = function(callback, slug)
{
  var params = { 'slug' : slug };
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/moveToTmp',
    data: { parameters: JSON.stringify(params)  },
    success:callback
   });
}

/**
 * Removes a message from the database (the message cannot be public).
 */
cityspk.api.message.destroy = function(callback, slug)
{
  var params = { 'slug' : slug };
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/destroy',
    data: { parameters: JSON.stringify(params)  },
    success:callback
   });
}



/**
 * Flag message as innapropriate. Sent to moderation.
 *
 * messageParams:
 * slug [String] The slug of the image to flag. (MANDATORY)
 * 
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.message.flag = function(callback, messageParams) 
{    
  if(!messageParams['slug'])
  {
     throw "slug is required for message.flag";
     return;
  }
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/flag',
    data: { parameters: JSON.stringify(messageParams) },
    success:callback
   });
};



/**
 * API Function for moderators to moderate content.
 * 
 * params:
 * slug [String] Slug of the photo to moderate (MANDATORY)
 * action [String] Action to perform:
 *  'clear': Clear moderation flag (approve this content)
 *  'lock' : Lock the content as private. User will not be able to change it.
 *  'abuse': Fully set this content as abusive. (effectively like a delete)
 *  
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.message.moderate = function(callback, messageParams) 
{    
  if(!messageParams['slug'])
  {
     throw "slug is required for message.moderate";
     return;
  }
  if(!messageParams['action'])
  {
     throw "action is required for message.moderate";
     return;   
  }
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/moderate',
    data: { parameters: JSON.stringify(messageParams) },
    success:callback
   });
   
   return false;
};



/**
 * Perform a message search
 * 
 * searchParams:
 * min_date_posted [String] (YYYY-MM-DD)
 * max_date_posted [String] (YYYY-MM-DD)
 * 
 * text [String] Search mesasge with this text in 'text', and 'tags'.
 * user_id [String] Which user to search messages from. String 'me' or 'self to search user's own.
 * locations [Array] Array of locations ids messages have to be member of.
 * tags [Array] Array of tags to match.
 * tag_mode [String] Either OR combination of tags, or AND combination. Defaults to OR.
 * 
 * searchOptions:
 * pagesize [int] Elements per page. Maxmum value is 256.
 * page [int] Page to start results at
 * sort [String] How ordering is performed
 *    'random' for randomized order
 *    'date_posted' for ordering by date uploaded
 *    'text' for ordering by picture title.
 *    
 * editor_mask [int] Flag totals to bit-and with the content.
 * editor_mask_mode [String] AND or OR to apply on the editor_mask bit mask.
 * 
 * cc_mask [int] Creative commons mask (total) to match.
 * cc_mask_mode [String] AND or OR to apply on the editor_mask bit mask.
 * 
 * @param {Object} callback
 * @param {Object} searchOptions
 * @param {Object} searchParams
 */
cityspk.api.message.search = function(callback, searchOptions, searchParams) 
{
  var params = {};
  
  params['searchOptions'] = searchOptions;
  params['searchParams'] = searchParams;
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/search',
    data: { parameters: JSON.stringify(params)  },
    success:callback
   });
};

/**
 * This method searches for the cityspk templates and returns a list of CSMMessage objects.
 *
 * @param {Object} callback
 * @param {int} The number of items to return
 * @param {int} Return only templates belonging to this category.
 */
cityspk.api.message.getTemplates = function(callback, pagesize, categoryId)
{
  var params = {};
  
  params['pagesize'] = pagesize;
  params['category'] = categoryId;
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/getTemplates',
    data: { parameters: JSON.stringify(params) },
    success:callback
  });
};

/**
 * Send a message to another email
 * @param {Object} callback
 * @param {string} from : the email of the sender
 * @param {string} to : the email of the recipient
 * @param {string} share_slug : A valid slug for a CSMMessage
 */
cityspk.api.message.sendToFriend = function(callback, from, to, share_slug)
{
  var parameters = {};
  parameters['from'] = from;
  parameters['to'] = to;
  parameters['share_slug'] = share_slug;
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/message/sendToFriend',
    data: { parameters: JSON.stringify(parameters) },
    success:callback
   });
};

/**
 * Perform a photo search.
 *    
 * searchOptions:
 * pagesize [int] Elements per page. Defaults to 100, maximum 500.
 * page [int] Page to start results at
 * sort [String] How ordering is performed
 *    'random' for randomized order
 *    'date_taken' for ordering by taken date (exif date if available)
 *    'date_posted' for ordering by date uploaded
 *    'title' for ordering by picture title.
 *    'literal' for ordering by literal.
 *    'none' for no special ordering (entry ordered)
 * 
 * searchParams:
 * text [String] Search in title, tags, description, literal and meanings.
 * recent [String] If present, show only images present in the last upload.
 * min_date_taken [String] (YYYY-MM-DD)
 * max_date_taken [String] (YYYY-MM-DD)
 * min_date_posted [String] (YYYY-MM-DD)
 * max_date_posted [String] (YYYY-MM-DD)
 * user_id [String] Which user to seach photos from. String 'me' or 'self' to search own.
 * privacy [int] Get photos of this privacy type (if searching with user_id 'me')
 *   1. Public photos
 *   50. Private photos.
 *   
 * completion [String] Completion setting
 *   'incomplete': Return photos that are not deemed complete
 *   'complete': Return photosthat are deemed complete
 *   
 * locations [Array] Array of locations ids photos have to be member of.
 * albums [Array] Array of albums photos have to be member of.
 * tags [Array] Array of tags to match.
 * tag_mode [String] Either OR combination of tags, or AND combination. Defaults to OR.
 * 
 * orientation [String] 'landscape', 'portrait', or 'square' for square-only orientation.
 * type [String] Search for either 'Image' or 'Glyph' types.
 * match_words [Array] Find glyphs matching the input words. If this is defined, type is forced to Glyph.
 * match_level [int] When performing a match_words query, the level of matching:
 *    1. perfect literal match
 *    2. perfect literal or meaning match
 *    
 * editor_mask [int] Flag totals to bit-and with the content.
 * editor_mask_mode [String] AND or OR to apply on the editor_mask bit mask.
 * 
 * cc_mask [int] Creative commons mask (total) to match.
 * cc_mask_mode [String] AND or OR to apply on the editor_mask bit mask.
 * 
 * @return 
 * @param searchOptions Object[optional]
 * @param searchParams Object[optional]
 */
cityspk.api.photos.search =  function(callback, searchOptions, searchParams) 
{    
  var params = {};
  
  params['searchOptions'] = searchOptions;
  params['searchParams'] = searchParams;
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/search',
    data: { parameters: JSON.stringify(params)  },
    success:callback
   });
};

/**
 * Set the meta information about a photo.
 * All parameters are optional and a write to the image meta will only be made
 * if the key exists in the photoParams. To erase a value, define the key with
 * an empty string.
 * 
 * photoParams:
 * slug [String] The slug of the image to edit. (MANDATORY)
 * title [String] The title of the image
 * description [String] The description for the image
 * datePosted [String] YYYY-MM-DD HH:MM:SS Date the image was posted (uploaded) 
 * dateTaken [String] YYYY-MM-DD HH:MM:SS Date the image was taken (uploaded) 
 * type [String] Either 'Image' or 'Glyph'
 * privacy [String] Privacy setting of the photo
 *   1. public
 *   50. private
 * 
 * tags [Array] Array of tags that apply to this image.
 * literal [String] The literal meaning of the image (glyph)
 * meanings [Array] Array of alternate meanings of the image (glyph)
 * context [String] Image slug of the context image of this image. (glyph)
 * 
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.photos.edit = function(callback, photoParams) 
{ 
  if(!photoParams['slug']) throw 'Missing slug parameter to photos.edit()';
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/edit',
    data: { parameters: JSON.stringify(photoParams)  },
    success:callback
   });
};

/**
 * Add tags to the photo specified as slug. If the tag does not exist, it will be created
 * and added. If the tag is already applied on this object, we simply ignore it.
 * 
 * Current user must own the photo of course.
 * 
 * photoParams:
 * slug [String] The slug of the image to edit. (MANDATORY)
 * tags [Array] Array of tag strings to add to this photo
 * 
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.photos.addTags = function(callback, photoParams) 
{ 
  if(!photoParams['slug']) throw 'Missing slug parameter to photos.edit()';
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/addTags',
    data: { parameters: JSON.stringify(photoParams)  },
    success:callback
   });
};

/**
 * Erase a photo, use must have write perms on it. (own it).
 * photoParams:
 * slug [String] the unique slug of the photo to erase.
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.photos.erase = function(callback, photoParams)
{  
  if(!photoParams['slug']) throw 'Missing slug parameter to photos.delete()';
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/delete',
    data: { parameters: JSON.stringify(photoParams)  },
    success:callback
   });
};


/**
 * Get the data associated with specifid picture ids. Must all be owned by current user.
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.photos.getInfo = function(callback, photoParams) 
{    
  if(!photoParams['slugs']) throw "slugs array is required for photos.getInfo";
  
  var parameters = new Array();
  parameters['slugs'] = photoParams['slugs'];
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/getInfo',
    data: { parameters: JSON.stringify(parameters) },
    success:callback
   });
};

/**
 * Flag photo as innapropriate. Sent to moderation.
 *
 * photoParams:
 * slug [String] The slug of the image to flag. (MANDATORY)
 * 
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.photos.flag = function(callback, photoParams) 
{    
  if(!photoParams['slug'])
  {
     throw "slug is required for photos.flag";
     return;
  }
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/flag',
    data: { parameters: JSON.stringify(photoParams) },
    success:callback
   });
   return false;
};

/**
 * API Function for moderators to moderate content.
 * 
 * params:
 * slug [String] Slug of the photo to moderate (MANDATORY)
 * action [String] Action to perform:
 *  'clear': Clear moderation flag (approve this content)
 *  'lock' : Lock the content as private. User will not be able to change it.
 *  'abuse': Fully set this content as abusive. (effectively like a delete)
 *  
 * @param {Object} callback
 * @param {Object} photoParams
 */
cityspk.api.photos.moderate = function(callback, photoParams) 
{    
  if(!photoParams['slug'])
  {
     throw "slug is required for photos.moderate";
     return;
  }
  if(!photoParams['action'])
  {
     throw "action is required for photos.moderate";
     return;   
  }
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/moderate',
    data: { parameters: JSON.stringify(photoParams) },
    success:callback
   });
   
   return false;
};


/**
 * Get the temporary uploads of a session.
 * @param {Object} callback
 */
cityspk.api.photos.getTmpAttachments = function(callback)
{
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/getTmpAttachments',
    data: { parameters: JSON.stringify({}) },
    success:callback
   });
};

/**
 * Send a picture to another email
 * @param {Object} callback
 * @param {string} from : the email of the sender
 * @param {string} to : the email of the recipient
 * @param {string} share_slug : A valid slug for a CSMContent
 */
cityspk.api.photos.sendToFriend = function(callback, from, to, share_slug)
{
  var parameters = {};
  parameters['from'] = from;
  parameters['to'] = to;
  parameters['share_slug'] = share_slug;
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/photo/sendToFriend',
    data: { parameters: JSON.stringify(parameters) },
    success:callback
   });
};


/**
 * Get the albums for the specified user id or 'me'.
 * If no userid specified, calling user is assumed.
 * @param {Object} callback
 * @param {Object} user_id
 */
cityspk.api.albums.getList = function(callback, user_id)
{
  if(!user_id) user_id = 'me';
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/album/getList',
    data:{  },
    success:callback
   });
};




/**
 * Create an album for this user.
 * 
 * albumOptions;
 * name [String] name of the album
 * privacy [int] 1 (public), 50 (private)
 * @param {Object} callback
 */
cityspk.api.albums.create = function(callback, albumOptions)
{
  if(!albumOptions['name']) throw "Missing name for albums.create()";
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/album/create',
    data:{ parameters:JSON.stringify(albumOptions) },
    success:callback
   });
};



/**
 * Create an album for this user.
 * 
 * albumOptions;
 * slug [String] slug of the album (MANDATORY)
 * name [String] name of the album (MANDATORY)
 * privacy [int] 1 (public), 50 (private)
 * @param {Object} callback
 */
cityspk.api.albums.edit = function(callback, albumOptions)
{
  if(!albumOptions['slug']) throw "Missing slug for albums.edit()";
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/album/edit',
    data:{ parameters:JSON.stringify(albumOptions) },
    success:callback
   });
};


/**
 * Erase a user album by slug.
 * albumOptions:
 * slug [String] The slug ID of the album to delete. (MANDATORY)
 * deleteContent [String] If defined, content of the album will also be destroyed.
 * @param {Object} callback
 */
cityspk.api.albums.erase = function(callback, albumOptions)
{
  if(!albumOptions['slug']) throw "Missing slug for albums.delete()";
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/album/delete',
    data:{ parameters:JSON.stringify(albumOptions) },
    success:callback
   });
};

/**
 * Insert photos into a user album. Must own all items.
 * 
 * albumOptions;
 * slug [String] slug of the album (MANDATORY)
 * photos [Array] Array of photo slugs to remove (MANDATORY)
 * @param {Object} callback
 */
cityspk.api.albums.insert = function(callback, albumOptions)
{
  if(!albumOptions['slug']) throw "Missing slug for albums.insert()";
  if(!albumOptions['photos']) throw "Missing photos array for albums.insert()";
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/album/insert',
    data:{ parameters:JSON.stringify(albumOptions) },
    success:callback
   });
};


/**
 * Remove photos from a user album. Must own all items.
 * 
 * albumOptions;
 * slug [String] slug of the album (MANDATORY)
 * photos [Array] Array of photo slugs to remove (MANDATORY)
 * @param {Object} callback
 */
cityspk.api.albums.remove = function(callback, albumOptions)
{
  if(!albumOptions['slug']) throw "Missing slug for albums.remove()";
  if(!albumOptions['photos']) throw "Missing photos array for albums.remove()";
  
  jQuery.ajax({
    url: cityspk.urlmap.api_json+'/album/remove',
    data:{ parameters:JSON.stringify(albumOptions) },
    success:callback
   });
};







