$(function(){


    
    $('a.project-item-link').click(function(event) {
        
        if($(this).attr('itemtype').length>0 && $(this).attr('itemid').length>0)
        {
            event.preventDefault(); //prevent hyperlink loading

            $('#overlay-container').load('/ajax/overlay?type='+$(this).attr('itemtype')+'&id='+$(this).attr('itemid'), function() {


//                $('div#project-view').hide().slideToggle(400);//200
                $('div#overlay').hide().fadeToggle(300); //800

                $('a#close-overlay').click(function(){
                    $('div#project-view').remove();//.slideToggle(400,function(){});
                    $('div#overlay').fadeToggle(600,function(){
                        $(this).remove()
                    });
                })

                $('.makelink[href]').click(function(){
                                        window.location = $(this).attr('href')
                                    })
                                    .css('cursor','pointer')


            })
        }
    })


    $('a.ajax-dialog').click(function(){
        href=$(this).attr('ajaxhref');
        title = $(this).attr('title')
        $('<div />')
            .load('/terms/index/plaintext/show')
            .css('z-index','1000')
            .dialog({title: title, width: 750, height: 400, modal: 'true'})
        return false;
    })
});
