
$(document).ready(function() {  


var sharethis = $('div#sharethis')

sharethis.fadeTo(0, .3)

sharethis.hover(
    function () {
        $(this).fadeTo("fast", 1)
   },
    function () {
        $(this).fadeTo("slow", .3)
   }
   );

$('table.zebra tr:odd').css('background', '#ddd');

$('div.embeddedDocument').hide();

var embeddedDocumentControls 	= '<div class="controls"><a href="javascript:;" class="hideEmbedded">Close</a></div>';
var embeddedDocument			= $('div.embeddedDocument')


embeddedDocument.prepend(embeddedDocumentControls);
embeddedDocument.append(embeddedDocumentControls);

$('a.showEmbedded').click(
	function() {
		embeddedDocument.fadeIn('slow');
	});

$('a.hideEmbedded').click(
	function() {
		embeddedDocument.fadeOut('fast');
	});


$('div.zipup').hide();
$('a.zipup').toggle(
	function() {
		$(this).parent('h3').next('div.zipup').slideDown('fast');
		$(this).css("backgroundImage", "url(/img/unfolded.gif)");
	},
	function() {
		$(this).parent('h3').next('div.zipup').slideUp('fast');
		$(this).css("backgroundImage", "url(/img/folded.gif)");
	});



$(window).load(function() { // stuff that goes wrong if executed while elements are still loading 

  var imageDivs = $("div.image, #mainImg, div.secondary, #primary")

  imageDivs.each(function(){
    var imgWidth = $("img", this).width();
    $(this).width(imgWidth + 6);
    if (imgWidth > 300) {
      $(this).css("float", "none").css("clear", "both").css("margin", "2em auto");
      };
  });

}); //End window.load

}); //End document.ready
