// setFacebookShareAnchor: takes dynamically set variables, myPageURI and myPageTitle, encodes them, then puts them together into a URL formatted for Facebook Sharing.
// It next creates an href attribute inside an empty anchor tag with id facebookShareAnchor and populates that attribute with the formatted URL.

function setFacebookShareAnchor() {
    var myPageURIEncoded=encodeURIComponent(myPageURI),
		myPageTitleEncoded=encodeURIComponent(myPageTitle),
		facebookShareLink="http://www.facebook.com/sharer.php?u=",
		facebookShareTitlePiece="&t=",
		myFacebookShareURL = facebookShareLink + myPageURIEncoded + facebookShareTitlePiece + myPageTitleEncoded,
        myFacebookShareAnchor = document.getElementById('facebookShareAnchor');
    myFacebookShareAnchor.setAttribute('href', myFacebookShareURL);
    myFacebookShareAnchor.innerHTML = "Share with your friends!";
}

// setStyleById: given an element id, style property and 
// value, apply the style.
// args:
//  i - element id
//  p - property
//  v - value
//
function setStyleById(i, p, v) {
	var n = document.getElementById(i);
	n.style[p] = v;
}