fixed bug in addEvent function, added hide and show functions