Formation of quarkonium states at RHIC