/* $Id: case_studies.js,v 1.6 2009/12/09 19:27:09 sap Exp $ */

$(document).ready(function () {
    
    // subnav click open popup
    $('a.ss_link').click(function(e){
        
        var target_img = $(this).attr('title');
        var target_height = parseInt($(this).attr('xheight'));
        //var height = $('div#pop_ss').css('height');
        var height = 600;
        
            if (target_height > 0)
            {    
            height = parseInt(target_height) + 22;
            $('div#pop_ss').css('height', height + 'px');
            }

        $('div#pop_ss #ss_img').attr('src', '/img/portfolio/' + target_img);
        
        var top_val = e.pageY - (height / 2) + "px";
        $('div#pop_bg').show();
        
        $('div#pop_ss').centerInClient();        
        $('div#pop_ss').show('slow');
        return false;
    });

    // click popup close [x]
    $('div#pop_ss div#close_ss a').click(function(){
        $('div#pop_ss #ss_img').attr('src', ''); // remove old image
        $('div#pop_bg').hide();
        $('div#pop_ss').hide();
        return false;
    });
    
    // click out of popup to close
    $('div#pop_bg').click(function(){
        $('div#pop_ss #ss_img').attr('src', ''); // remove old image
        $('div#pop_bg').hide();
        $('div#pop_ss').hide();
        return false;
    });
});
