$(document).ready(function() {
    // - - - SHARING LINKS - - - //
    var thisURL = encodeURIComponent(location.href);
	var thisTitle = encodeURIComponent($('#news-article-heading').html());
	var thisDescription = $('meta[name=DC.description]').attr('content');
	var thisSource = $('a:first', '#title2').html();
    
	// standard link separator
	var separator = " <span class='linkseparator'>|</span> ";
	
	// Link URLs separated out here for convenience
	var facebook = '<a id="facebook" name="fb_share" type="icon_link" href="http://www.facebook.com/sharer.php?u=' + thisURL + '&t=' + thisTitle + '">Facebook</a>';
	var linkedin = '<a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&url=' + thisURL + '&title=' + thisTitle + '&summary=' + thisDescription + '&source=' + thisSource + '" >LinkedIn</a>';
	var twitter = '<a id="twitter" href="http://twitter.com/home?status=' + thisURL + '" >Twitter</a>';
	
	// untested
	//~ var digg = '<a id="digg" href="http://digg.com/submit?url=" + thisURL +"&title=" + thisTitle + "&bodytext=" + thisDescription + "&media=news&topic=educational" >Digg</a>';
	//~ var delicious = '<a id="delicious" href="http://delicious.com/save">Delicious</a>';
  
	// Add the URLs
    $("#news-content-text").append('<p id="sharelinks">Share: ' + facebook + separator + linkedin + separator + twitter + '</p>');
	// all links:
	//~ $('#news-content-text').append("<p id='sharelinks'>Share: " + facebook + separator + linkedin + separator + twitter + separator + digg + separator + delicious + "</p>");
	
	// For delicious rather than hard-coding the onclick action as suggested, attach the behaviour using jQuery:
    /*
	$('#delicious').click(
		function() {
			window.open('http://delicious.com/save?v=5&noui&jump=close&url="' + thisURL + '&title=' + thisTitle+ '"', 'delicious','toolbar=no,width=550,height=550');
			return false;
		}
	);
	*/
    
	// Could write a function to add this behaviour to all the links in order to maintain a consistent experience:
    /*
	$('#twitter').click(function() {
        window.open('http://twitter.com/home?status=' + thisURL, 'Twitter','toolbar=no,width=550,height=550');
        return false;
    });
    */
  

  // - - - RENDERING FIX - - - //
  /* sets min-height to avoid news-pic-quote-column overlapping with the footer */
 var picQuoteColumn = $('#news-pic-quote-column');
    if(picQuoteColumn.length >0) {
        var columnHeight = $('#news-pic-quote-column').outerHeight() + "px";
        $('#news-content-container').css('min-height', columnHeight);
    }

});



