moved openItem / closeItemfunctions out of onload