$(document).ready(function()
{
	
	
	$('body').addClass('javascript-enabled');

	
	$('div.puff').each(addPuffAnimation);

    
});






// plugin dependency: jquery.easing.1.3
function addPuffAnimation() {
    var $this = $(this);
    var slidingPanel = $this.children('.widgetText:first');
    // assumes the concealed text is a p
    
    this.myHeight = $this.outerHeight(); 
    // mouseout/mouseover
    // NOTE: Please refrain from adding offsets here. Tweak the CSS if changing the positioning
    this.inPos = $this.children('img:first').outerHeight();
    this.outPos = this.myHeight - slidingPanel.outerHeight();
    
    // reposition link text elements at bottom (part overflowing)
    slidingPanel.css({ 'top' : this.inPos + 'px' });			
    
    $(this).hover(function() {
    	var $outPos = this.outPos;
    	slidingPanel.stop()
    		.animate({ 'top' : $outPos + 'px' }, 260, 'easeOutQuad'); 
    }, 
    function() {
    	var $inPos = this.inPos;
    	slidingPanel.stop()
    		.animate({ 'top' : $inPos + 'px' }, 260, 'easeOutQuad'); 
    })

        // if a link exists, make the entire widget 'hot'
    var pointerLink = $this.find('a[href]:first');
    if (pointerLink.length > 0) {
      $this.click(function(){
        var target = pointerLink.attr('target');
        if(target){
            window.open(pointerLink.attr('href'), target);
        } else {
            window.location = pointerLink.attr('href');
        }        
      });
      $this.addClass('clickable');
    }
}
