Added function definition
Added cookies to loginscript, implemented on index.html