My toggle wants a cookie

Hello code masters,

It’s your neighborhood friendly G@MeF@Ce trying to add a cookie to a div toggle.
I’ve done searches and found numerous topics regarding the same issue but written differently and didn’t know how to apply it to my code.
I’ve also started reading tutorials about cookies and realized that I’m over-doing things ~ so I’m asking for help ^,^

here’s what I am working with (yes the block is to be displayed on load)


<script language="javascript">

function toggle5(showHideDiv, switchImgTag) {

        var ele = document.getElementById(showHideDiv);

        var imageEle = document.getElementById(switchImgTag);

        if(ele.style.display == "block") {

                ele.style.display = "none";

imageEle.innerHTML =
'<img src="SHOW IMAGE">';
//set cookie?
        }
        else {
                ele.style.display = "block";

imageEle.innerHTML =
'<img src="HIDE IMAGE">';
//set cookie?
        }
}


</script>

<div id="headerDivImg">
    <div id="titleTextImg">need a cookie</div>
    <a id="imageDivLink" href="javascript:toggle5('contentDivImg', 'imageDivLink');">
<img src="HIDE IMAGE"></a>
</div>
<div id="contentDivImg" style="display: block;">yes please</div>