function x(t){console.log(t);}

var colors = {
  'event':   '#000000',
  news:      '#ff003a',
  about:     '#ff00c0',
  work:      '#ffe800',
  chronology:'#ff9d00',
  artists:   '#52ffff',
  shop:      '#73ff00',
  member:    '#00a700',
  contact:   '#9200ff',
  blog:      '#000000',
  facebook:  '#000000',
  plurk:     '#000000',
  home:      '#000000'
};

jQuery(function($){
  $('#chinese').hide();
  new ppp($('#chinese'), $('#ppp_button'));
  
  var painter = $('#box');
  if ( $('#work_page').length ) {
    painter = $('#work_page');
  }
  else if ( $('body.by_year').length ) {
    painter = $('body.by_year');
  }
  else if ( $('body.by_director').length ) {
    painter = $('#list');
  }
  
  painter.originalColor = painter.css("backgroundColor");

  var navi = $('#navigator ul');
  navi.hide();
  
  $('#navigator').hover(
    function(){ navi.show(); },
    function(){ navi.hide(); });
  
  $('#navigator li').click( function (event) {
    var anchor = this.getElementsByTagName('a')[0],
        target = anchor.getAttribute('rel'),
        href   = anchor.href;
        
    if ( target == "external" ) {
      window.open(href, "_blank");
    }
    else {
      window.location.href = href;
    }
    event.preventDefault();
  } );
  $('#navigator li').hover(
    function(){
      var id = this.getAttribute('id');
      var color = colors[id];
      $(this).addClass("hover");
      painter.animate({ backgroundColor: color}, { queue:false, duration:500 } );
    },
    function(){
      $(this).removeClass("hover");
      painter.animate({ backgroundColor: painter.originalColor }, { queue:false, duration:500 } );
    });
    
    
    
  $('#producers a').click( function (event) {
    var target = this.getAttribute('rel'),
        href   = this.href;
        
    if ( target == "external" ) {
      window.open(href, "_blank");
      event.preventDefault();
    }
  } );


});
