var animDefaults = {
  getPoseFromBank: function(bType, bPose){
    return this.bank[bType].poses[bPose];
  },
  getRandomPoseNameFromBank: function(bType){  
    var accumulator = [];
    for (var propertyName in this.bank[bType].poses)
      if (this.bank[bType].poses[propertyName].random)
        accumulator.push(propertyName);
    return accumulator[Math.floor(Math.random() * accumulator.length)];
  }
};

var animJourney = Ext.apply({
  bank: {
    'shadow': {
      image: '/common/helpers/journey/journey.png',
      poses: {
        'normal': {
            top: 20,
            left: 0,
            width: 48,
            height: 7,
            xoff: 0,
            yoff: -69
          }
        }
    },
    'body': {
      image: '/common/helpers/journey/journey.png',
      poses: {
        'normal': {
            random: true,
            top : 0,
            left : 3,
            width : 40,
            height : 55,
            xoff : 0,
            yoff : 0,
            faceleft : 1,
            facetop : 0
          },
        'stoppy': {
            top : 0,
            left : -2,
            width : 51,
            height : 56,
            xoff : 0,
            yoff : -83,
            faceleft : 6,
            facetop : 4
          },
        'info': {
            top : 0,
            left : -2,
            width : 51,
            height : 56,
            xoff : -51,
            yoff : -83,
            faceleft : 6,
            facetop : 4
          },
        'squeeze': {
            top : 0,
            left : 3,
            width : 41,
            height : 56,
            xoff : -102,
            yoff : -83,
            faceleft : 1,
            facetop : 0
          },
        'sponge': {
            top : 0,
            left : 3,
            width : 42,
            height : 56,
            xoff : -145,
            yoff : -83,
            faceleft : 1,
            facetop : -10
          }
        }
      },
      'mouth': {
        image: '/common/helpers/journey/journey.png',
        poses: {
          'huge': {
              random: true,
              top : 36,
              left : 7,
              width : 26,
              height : 6,
              xoff : -196,
              yoff : -72
            },
          'cheer': {
              random: true,
              top : 37,
              left : 15,
              width : 10,
              height : 9,
              xoff : -173,
              yoff : -70
            },
          'shocked': {
              random: true,
              top : 37,
              left : 15,
              width : 11,
              height : 9,
              xoff : -184,
              yoff : -70
            },
          'frown': {
              random: true,
              top : 38,
              left : 14,
              width : 19,
              height : 6,
              xoff : 0,
              yoff : -62
            },
          'worried': {
              random: true,
              top : 38,
              left : 16,
              width : 11,
              height : 6,
              xoff : -29,
              yoff : -55
            },
          'surprised': {
              random: true,
              top : 38,
              left : 19,
              width : 8,
              height : 8,
              xoff : -21,
              yoff : -61
            },
          'unsure': {
              random: true,
              top : 38,
              left : 12,
              width : 21,
              height : 5,
              xoff : 0,
              yoff : -76
            },
          'teeth': {
              random: true,
              top : 35,
              left : 18,
              width : 15,
              height : 11,
              xoff : -49,
              yoff : -70
            },
          'teeth-open': {
              random: true,
              top : 35,
              left : 18,
              width : 15,
              height : 11,
              xoff : -66,
              yoff : -70
            },
          'tounge': {
              random: true,
              top : 35,
              left : 18,
              width : 16,
              height : 11,
              xoff : -84,
              yoff : -70
            },
          'tounge2': {
              random: true,
              top : 35,
              left : 18,
              width : 13,
              height : 10,
              xoff : -159,
              yoff : -70
            },
          'puffed': {
              random: true,
              top : 35,
              left : 15,
              width : 15,
              height : 9,
              xoff : -105,
              yoff : -70
            },
          'gasp': {
              random: true,
              top : 35,
              left : 15,
              width : 14,
              height : 9,
              xoff : -123,
              yoff : -71
            },
          'yell': {
              random: true,
              top : 32,
              left : 12,
              width : 19,
              height : 12,
              xoff : -139,
              yoff : -69
            },
          'void': {
              random: true,
              top : 38,
              left : 18,
              width : 6,
              height : 2,
              xoff : -32,
              yoff : -64
            },
          'smile': {
              random: true,
              top : 34,
              left : 14,
              width : 19,
              height : 6,
              xoff : 0,
              yoff : -55
            }
          }
        },
      'eyes': {
        image: '/common/helpers/journey/journey.png',
        poses: {
          'up-left': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -40,
              yoff : 0
            },
          'left': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -40,
              yoff : -23
            },
          'down-left': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -40,
              yoff : -46
            },
          'up': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -67,
              yoff : 0
            },
          'center': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -67,
              yoff : -23
            },
          'down': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -67,
              yoff : -46
            },
          'up-right': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -94,
              yoff : 0
            },
          'right': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -94,
              yoff : -23
            },
          'down-right': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -94,
              yoff : -46
            },
          'question': {
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -148,
              yoff : -0
            },
          'alert': {
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -148,
              yoff : -23
            },
          'error': {
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -148,
              yoff : -46
            },
          'info': {
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -175,
              yoff : -0
            },
          'heart': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -175,
              yoff : -23
            },
          'wide': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -175,
              yoff : -46
            },
          'squished': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -202,
              yoff : -0
            },
          'loopy': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -202,
              yoff : -23
            },
          'dilated': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -202,
              yoff : -46
            },
          'half': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -121,
              yoff : -23
            },
          'closed': {
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -121,
              yoff : -46
            },
          'open': {
              random: true,
              top : 6,
              left : 7,
              width : 27,
              height : 23,
              xoff : -121,
              yoff : 0
            }
          }
        }
      }
    }, animDefaults);
