var CANVAS_WIDTH = 980;
var CANVAS_HEIGHT = 1400;
var CANVAS_WIDTH_HALF = CANVAS_WIDTH * 0.5;
var CANVAS_HEIGHT_HALF = CANVAS_HEIGHT * 0.5;

var EDGEBOARD_X = 100;
var EDGEBOARD_Y = 100;

var FPS = 30;
var FPS_TIME = 1000 / FPS;
var DISABLE_SOUND_MOBILE = false;

var PRIMARY_FONT = "comfortaa";
var PRIMARY_FONT_COLOUR = "#ffffff";
var SECONDARY_FONT_COLOUR = "#000000";

var FONT_SIZE_INTERFACE = "36px ";
var FONT_SIZE_MENU_BEST_SCORE = "36px ";
var FONT_SIZE_CREDITS = "36px ";
var FONT_SIZE_HELP = "32px ";
var FONT_SIZE_MSG_BOX = "26px ";
var FONT_SIZE_ARE_YOU_SURE = "36px ";
var FONT_SIZE_TITLES = "60px ";
var FONT_SIZE_LEVEL_BUTTON = "60px ";
var FONT_SIZE_END_PANEL_TITLE = "40px ";
var FONT_SIZE_END_PANEL_TEXT = "36px ";
var FONT_SIZE_TEXT_MESSAGE = "60px ";

var LEVELS_NUMBER = 12;
var ALL_LEVELS_UNLOCKED = false;    // SET TO TRUE TO HAVE ALL THE LEVELS AVAILABLE
var COIN_SIZE = 52;
var DIVE_VALUE;
var DIVE_VALUE_GOOD;
var DIVE_VALUE_PERFECT;
var PLANE_WAIT_TIME;
var PLANE_SPEED;
var MESSAGE_GAMEWIN_DELAY = 2000;   // IN MS
var MESSAGE_GAMEOVER_DELAY = 500;   // IN MS
var TEXT_MESSAGES_SPEED = 1500;     // IN MS
var RESET_STAGE_FADE_SPEED = 2000;  // IN MS
var TUTORIAL_FADEOUT_SPEED = 3000;  // IN MS
var COIN_SPEED = 1000;              // IN MS
var CAMERA_MOVEMENT_SPEED = 200;    // IN MS        
var CAMERA_CANVAS_OFFSET = 500;
var CAMERA_CANVAS_MIN_Y = -20;
var CAMERA_CANVAS_MAX_Y = 200;
var ENTRY_ANGLE_MIN;
var ENTRY_ANGLE_MAX;
var FLOOR_Y_START  = CANVAS_HEIGHT - 70;
var DIVE_OFFSET_PERFECT;
var DIVE_OFFSET_GOOD;
var DIVE_OFFSET_POOR;
var FLIP_VALUE;

var NUM_ROWS_PAGE_LEVELS = 5;
var NUM_COLS_PAGE_LEVELS = 3;

var HEAD_STANDING = 0;
var HEAD_PREPARATION = 1;
var HEAD_DIVING = 2;
var HEAD_HIT = 3;

// BOX 2D SETTINGS
var TIMESTEP = 1/60;
var VELOCITY_ITERATIONS = 10;
var POSITION_ITERATIONS = 10;
var UPDATE_LOOP_VAR = 3;
var DEBUG_BOX2D = false;
var DEBUG_BOX2D_ALPHA = 0.3;
var WORLD_SCALE = 100;
var GRAVITY = 4.5;
var PLAYER_RESET_TIMER = 1000; // IN MS

// FIXTURES ID
var FIXTURE_HEAD            = 0;
var FIXTURE_RIGHTBOTTOMLEG  = 1;
var FIXTURE_LEFTBOTTOMLEG   = 2;
var FIXTURE_RIGHTTOPLEG     = 3;
var FIXTURE_LEFTTOPLEG      = 4;
var FIXTURE_RIGHTARM        = 5;
var FIXTURE_LEFTARM         = 6;
var FIXTURE_TORSO           = 7;
var FIXTURE_WATER           = 8;
var FIXTURE_TRAMPOLINE      = [9,10,11];
var FIXTURE_RIGHTFOOT       = 12;
var FIXTURE_LEFTFOOT        = 13;

// BOX 2D BODY SETTINGS
var STATIC_BODY         = 0;
var KINEMATIC_BODY      = 1;
var DYNAMIC_BODY        = 2;
var CONTACT_BEGIN       = 0;
var CONTACT_END         = 1;
var CONTACT_PRESOLVE    = 2;
var CONTACT_POSTSOLVE   = 3;

// PLAYER MOVEMENTS SETTINGS
var VERTICAL_FORCE_UP_PREPARATION   = -50;
var HORIZONTAL_FORCE_PREPARATION    = -40;
var HORIZONTAL_FORCE_PREPARATION_BACK = 100;
var VERTICAL_FORCE_UP_JUMP          = -100;
var VERTICAL_FORCE_RIGHT_JUMP       = 25;
var VERTICAL_FORCE_UP_TRAMPOLINE    = -50;
var VERTICAL_FORCE_RIGHT_TRAMPOLINE = 20;
var BODY_ROTATION_TORQUE            = 5;
var VERTICAL_FORCE_WATER            = -50;

var ENABLE_FULLSCREEN;
var ENABLE_CHECK_ORIENTATION;

var STATE_LOADING        = 0;
var STATE_MENU           = 1;
var STATE_HELP           = 2;
var STATE_GAME           = 3;
var STATE_LEVELSELECTION = 4;
var ON_MOUSE_DOWN   = 0;
var ON_MOUSE_UP     = 1;
var ON_MOUSE_OVER   = 2;
var ON_MOUSE_OUT    = 3;