/* $Id: portfolio.js,v 1.5 2011/04/18 21:21:01 sap Exp $ */

$(document).ready(function () {
    
    // fake case study link
    $('.cs_link').click(function(e){
        e.stopPropagation();
        //alert('case study!');
        var target = $(this).attr('xurl');
        location.href = target;
        return false;


    });

    // screenshot popup
    $('.ss_link').click(function(e){
        //alert('screen shot!');
        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;
            height = parseInt(target_height) + 32;
            $('div#pop_ss').css('height', height + 'px');
            }

        //$('div#pop_ss #ss_img').attr('src', '/img/portfolio/' + target_img);
        $('div#pop_ss #ss_img').attr('src', 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;
    });
});

