/* 

Author: Yves Van Broekhoven
Date: 2010-01-10

Fueled by jQuery

*/

// Note: No conflict function

// This function must be called after including the jQuery javascript file, but before including any other conflicting library, 
// and also before actually that other conflicting library gets used, in case jQuery is included last. noConflict can be called at 
// the end of the jQuery.js file to globally disable the $() jQuery alias. jQuery.noConflict returns a reference to jQuery, so it 
// can be used to override the $() alias of the jQuery object.
// Use jQuery via jQuery(...)
//jQuery.noConflict();

jQuery(document).ready(function(){
    
    /* Projects
    -----------------------------------------------------*/
    try { projects(); } catch(e) {}
    
});

function projects() {
    
    /* Overlay
    -----------------------------------------------------*/
    image_containers    = $('.project .images');
    image_containers.css({ 'overflow-x' : 'hidden' });
    image_containers.each(function(){
        $(this).parent().append('<div></div>').children(':last').addClass('overlay');
    });
    $('.project .overlay').css({ 'height' : '150px' }); // Give overlay the full height

    
    /* Tags
    -----------------------------------------------------*/
    tags    = $('.tags li');
    tags.css({ 'opacity': 0.75 });
    tags.mouseover(function(){
        $(this).stop();
        $(this).animate( { opacity: 1 }, 200 );
    });
    tags.mouseout(function(){
        $(this).stop();
        $(this).animate( { opacity: 0.75 }, 200);
    });
    tags.find('a').click(function(){
        target_id       = $(this).attr('href');
        pane            = $(this).closest('.project').find('.images .inner');
        target          = pane.find('#' + target_id);
        target_index    = pane.children().index(target);
        target_pos_x    = 0 - (300 * target_index);
        pane.animate({ 'left' : target_pos_x + 'px' }, 700, 'easeInOutCirc');
        return false;
    });
    
}

