Improved post searching

toLowerCase and indexOf replaced with regexp
Merged repetitive lines into a single function

If password was not stored in cookie, it was asked from user. For this
separate code was written along with function call(to get password from
cookie). Now it has been merged.