window.addEvent('domready', function(){
	var el = $$('.post'),
        color = el.getStyle('backgroundColor');

    $$('.post').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-image': 'url(images/smallwhiteback.png)', //Background image
                'background-position': [0, 520] //image will move from left to right - Values are in pixels.
            });
		},
        mouseleave: function(){
            // Morphes back to the original style
            this.morph({
                'background-image': 'none',
                backgroundColor: color
            });
        }
    });


    //We retrieve the link location (href) and assign it to LI to make the whole region clickable
    var link = $$('.post 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': 'url(images/smallwhiteback.png)'
            });
        });
    });
    
    
    	var el = $$('.smlnews'),
        color = el.getStyle('backgroundColor');

    $$('.smlnews').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-image': 'url(images/smallwhiteback.png)', //Background image
                'background-position': [0, 520] //image will move from left to right - Values are in pixels.
            });
		},
        mouseleave: function(){
            // Morphes back to the original style
            this.morph({
                'background-image': 'none'
                });
        }
    });


    //We retrieve the link location (href) and assign it to LI to make the whole region clickable
    var link = $$('.smlnews 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': 'url(images/smallwhiteback.png)'
            });
        });
    });
    
    
	var el = $$('.presswrapper'),
        color = el.getStyle('backgroundColor');

    $$('.presswrapper').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-image': 'url(images/PostBackground.png)', //Background image
                'background-position': [0, 520] //image will move from left to right - Values are in pixels.
            });
		},
        mouseleave: function(){
            // Morphes back to the original style
            this.morph({
                'background-image': 'none'
            });
        }
    });


    //We retrieve the link location (href) and assign it to LI to make the whole region clickable
    var link = $$('.presswrapper 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': 'url(images/PostBackground.png)'
            });
        });
    });
    
    
    
});
