some javascript code which is important for foo and bar