window.addEvent('domready', function(){
	var el = $$('#posts li'),
        color = el.getStyle('backgroundColor');

    $$('#posts .link').addEvents({
        mouseenter: function(){
            // We set the cursor to pointer so users know they can click this region
            this.setStyle('cursor','pointer');

            // Change background color on mouseover
            this.morph({
    	        'background-color': '#71abde',
				'height': '50px',
				'line-height' : '80px'
				
            });
		},
        mouseleave: function(){
            // Morphes back to the original style
            this.morph({
				'height': '20px',
				'background-color': '#6f7a84',
				'line-height' : '20px'
            });
        }
    });

    //We retrieve the link location (href) and assign it to LI to make the whole region clickable
    var link = $$('#posts .link a');
    link.each(function(element) {
        element.getParent().addEvent('click', function(){
            window.location = element.get('href');
            // on click, background color and border will turn to a different color
            this.morph({
                'background-image': 'none',
				'background-color': '#6f7a84'
            });
        });
    });
});

