I want to amalgamate these two functions into one, Any ideas?  function toggleVisibility() {        document.getElementById('regStart').style.visibility = 'hidden';        document.getElementById('regPage').style.visibility = 'visible';        document.getElementById('facebook').src = /images/js project/FacebookGray.png        document.getElementById('google').src = /images/js project/GoogleGray.png        document.getElementById('winlive').src = /images/js project/WinLiveGray.png        document.getElementById('yahoo').src = /images/js project/YahooGray.png}function toggleSave() {    document.getElementById('regStart').style.visibility = 'visible';    document.getElementById('regPage').style.visibility = 'hidden';    document.getElementById('facebook').src = /images/js project/FacebookDepressed.ico    document.getElementById('google').src = /images/js project/GoogleDepressed.ico    document.getElementById('winlive').src = /images/js project/WinLiveDepressed.ico    document.getElementById('yahoo').src = /images/js project/YahooDepressed.ico  } 
Amalgamate two toggle functions into one
javascript;beginner
function toggleVisibility() {    var temp = document.getElementById('regStart').style.visibility    document.getElementById('regStart').style.visibility = document.getElementById('regPage').style.visibility;    document.getElementById('regPage').style.visibility = temp;    var suffix = Gray.png;    if ( 'hidden' === temp ) {        suffix = Depressed.ico;    }    document.getElementById('facebook').src = /images/js project/Facebook + suffix;    document.getElementById('google').src = /images/js project/Google + suffix;    document.getElementById('winlive').src = /images/js project/WinLive + suffix;    document.getElementById('yahoo').src = /images/js project/Yahoo + suffix;}The first insight is that you want to swap the visibility settings for regStart and regPage.  So use the normal swap format with a temp variable.  The second insight is that your image paths have the same start for both cases of each image.  So the beginning can be a constant value for each image. The third insight is that your image paths have the same ending for all images in a particular case.  So based on the value of temp (arbitrarily chosen as the shortest variable name), change the ending.  I also normalized the indentation.  It was inconsistent in your original functions.  