/* Center DIV on the page */
$.fn.center = function () {
    $(this).css("left", ( $(window).width() - $(this).width() ) / 2+$(window).scrollLeft() + "px");
	$(this).css("top", ( $(window).height() - $(this).height() ) / 2+$(window).scrollTop() + "px");
    return $(this);
}



/* Add the Share and Print links */
function siteTools() {
	var strTools = '\
		<li id="print"><a href="#"><img src="/images/icon/print.png" alt="" /></a></li>\
	';
	$('ul#utils').append(strTools);
}



/* Add icons and new window function to certain links on site */
function linkIcons() {
	$('a[href*=".pdf"], a[href*=".cgi"]').after('&nbsp;<img class="pdf" src="/images/icon/adobe-pdf.png" />').attr('target','_blank');
}



/* Style tweaks */
function cssTweaks() {
}



$(document).ready(function() {
	
	/* Run above functions */
	siteTools();
	linkIcons();
	cssTweaks();
	
	/* Add 'enhanced' class to body for any additional tweaks */
	$('body').addClass('enhanced');
	
	/* Share and Print functions */
	$('ul#utils li#print a').click(function () { print(); return false });

	$('ul#utils li#email a').click(function () { 
	    $('div#share').center().show(); 
	    return false; 
	});
	
	
});

