function indexOfPos( a, pos ) {
    if((!a) || (a.length === 0)) return -1;
    for(var i = 0; i < a.length; ++i) {
      if( (a[i].x === pos.x) && (a[i].y === pos.y) )
        return i;
    }
    return -1;	
  }
// return index of {x,y} object pos in array a
return index of {x,y} object pos in array a
return index of { x y } object pos in array a
function indexOfPos( a, pos ) {
    if((!a) || (a.length === 0)) return -1;
    for(var i = 0; i < a.length; ++i) {
      if( (a[i].x === pos.x) && (a[i].y === pos.y) )
        return i;
    }
    return -1;	
  }
function indexOfPos ( a , pos ) { if ( ( ! a ) || ( a . length === 0 ) ) return - 1 ; for ( var i = 0 ; i < a . length ; ++ i ) { if ( ( a [ i ] . x === pos . x ) && ( a [ i ] . y === pos . y ) ) return i ; } return - 1 ; }
return index of {x,y} object pos in array a
return index of { x y } object pos in array a