/* ----------------------------------------------------------------
 * FILE: core.js
 * ----------------------------------------------------------------
 * Created: 30-12-08 (dd-mm-yy)
 * Website: Elevate Web Design
 * ---------------------------------------------------------------
*/

$core = {

    context : false,
    
    getContext: function() {
        if(this.context === false) {
            this.context = $("#content");
        }
        return this.context;
    },
    
    init : function() {        
        $('body').addClass('js');
        
        this.prepareScrollTo();
        if($('#latest-work').length > 0) this.prepareLatestWork();
    },
    
    prepareLatestWork : function() {
        if($.browser.msie && $.browser.version < 7.0) {
            $('#latest-work li .details').remove();
        } else {    
            $('#latest-work li').hover(function() {
                $(this).children('div.details').stop(true, true).fadeIn().removeClass('hide');
            }, function() {
                $(this).children('div.details').stop(true, true).fadeOut().addClass('hide');
            });
        }
    },

    prepareScrollTo : function() {
        $('a[href^="#"]', this.getContext()).click(function(e) {  
            e.preventDefault();
            $('html, body').animate({ 
                scrollTop: $($(this).attr("href")).offset().top 
            }, 500);
        });        
    }    

}

$(function() {
    $core.init();
});