Fixed issue with getNumberOfVisibleElements()

curLength was set to 1 but there was a call to curLength++ before looping through the elements so it would always skip for the first element and therefore always be 1 off from the true number.  I set curLength to 0 so it will not skip the first element.