var desc0HTML = '';

$(document).ready(function(){

    desc0HTML = $('#desc0').html();

    $('#boxes div').each(function() {
        if(this.id && (this.id == 'box1' || this.id == 'box2' || this.id == 'box3' || this.id == 'box4' || this.id == 'box5')) {
            $(this).css('cursor','pointer');
            $(this).click(function() {

                //document.location = $(this,'a:first').href;
                var firstA = $('#'+this.id+' a');
                if(firstA && firstA.length && firstA.get(0).href) {
                    document.location = firstA.get(0).href;
                    return false;
                } 
                return true;
            });
            $(this).mouseover(function() {
                tooglecontent(this.id.substr(3,1));
            });
        }
    });
    
    $('#bigpicture,#footer').mouseover(function(){
            tooglecontent(0);
    });

});

function tooglecontent(curIDX) {
    if(curIDX == 0) {
        $('#desc0').css('backgroundPosition','-50px 10px');
        $('#desc0').html(desc0HTML);
    } else {
        var newHtml   = $('#box'+curIDX).html();
        var newPos = curIDX*165-95;
        $('#desc0').css('backgroundPosition',newPos+'px 10px').html(newHtml);
    }
}

