function works(fetchAttrName)
{
if (fetchAttrName == undefined) {
  //fetchAttrName = '#main > .works > .page > ul.list > li > a[rel*=lightbox]';
  fetchAttrName = 'a[rel*=lightbox]';
}
$(function(){

  $(fetchAttrName).lightpop({overlayBgColor:'#FFF',contentFrameType:'box',iframeEnabled:false});

  if ( ! $('ul.index')){ return; }

  $('.page').each(function(){ $(this).css('display','none'); });
  $('.works').attr('title','page1');
  $('#page1').css('display','block')
  $('#page1').css('zIndex',101);
  $('a[title="page1"]').addClass('select');
  $('.works > ul.index > li > a').click(function()
  {
    var current = $('.works').attr('title');
    var next = $(this).attr('title');

    if (current == next){
      return false;
    }

    // Remove current .select
    var span_text = $("a[title='" + current  + "']").text();
    var spanParent = $("a[title='" + current  + "']").parent();
    $("a[title='" + current + "']").removeClass('select');

    // Add next .select
    var a_text  = $("a[title='" + next  + "']").text();
    var aParent = $("a[title='" + next + "']").parent();
    $("a[title='" + next + "']").addClass('select');

    $('.works').attr('title', next);
    $('#'+current).css('zIndex',100);
    $('#'+current).css('display','none');
    $('#'+next).css('zIndex',101);
    $('#'+next).css('display','block');
    return false;
  });
});
}
