Html5 & Javascript Collisions In The Game Platform (Y-Axis)

Hi
The problem affects only the X axis. I have not created a conflict for the X axis
I can not deal with the collision when the next platform is higher than the previous one.
My all code: http://wklej.org/id/928010/
That’s how it works: http://galeriagiza.pl/cartmanPytanie1.html

The most important part of the code:

    // JUMP FIGURE
    if(jump>0)
    {
      y_figure-=4;
      jump-=4;
    }
    else
    {
      for(p=0;p<numberBlocksLand;p++)
      {
        if(x_figure>=(oX[p]+speed) && x_figure<=(oX[p]+widthBlock+speed))
        {
          if(y_figure<(oY[p]-heightFigure))
          {
            y_figure+=2;
            if(y_figure==(oY[p]-heightFigure)) stopJump=0;
          }
        }
      }
    }

I tried to create an auxiliary variable widthFigureHelp:

var widthFigureHelp=0;
(...)
    if(jump>0)
    {
      y_figure-=4;
      jump-=4;
    }
    else
    {
      for(p=0;p<numberBlocksLand;p++)
      {
        if(oY[p]>oY[p+1]) widthFigureHelp=widthFigure; // width=50;
        else widthFigureHelp=0;

        if(x_figure>=(oX[p]+speed) && x_figure<=(oX[p]+widthBlock+speed-widthFigureHelp))
        {
          if(y_figure<(oY[p]-heightFigure))
          {
            y_figure+=2;
            if(y_figure==(oY[p]-heightFigure)) stopJump=0;
          }
        }
      }
    }

That’s how it works: http://galeriagiza.pl/cartmanPytanie2.html
Then almost works - but at the time of the jump figure stops until the statue will move to its width…
I very ask for help.