Button using JS with functionality of F11 keyboard key

I want to make a button which if pressed works as if F11 key on keyboard is pressed.
For button html would be like this (I think)

<button type="button" onclick="some function">FullScreen</button>

Now I don’t know what function would go in that onclick as I don’t have the JS. One more thing that would be nice if the text ‘FULLSCREEN’ changes to ‘NORMAL WINDOW’ when the button is pressed, so that the user could realize that they have to press the same button again to get out of fullscreen, it would be like toggle at every click text changes from ‘FULLSCREEN’ to ‘NORMAL WINDOW’ and then if pressed again changing to ‘FULLSCREEN’.

Scripting cannot reliably make things go fullscreen, sorry.
The closest to it is via a partially supported part of HTML5 - http://johndyer.name/native-fullscreen-javascript-api-plus-jquery-plugin/