$(function(){
  $('.phperror').each(function() {
    $("#menu").after('<div class="notify-error">'+$(this).html()+'</div>');
    $(this).remove();
  });
  $('#main a[rel^="light"]').colorbox({opacity:0.6, current: "Изображение {current} из {total}"});
  
  $("#main a[title]").mousemove(function(e){
    var hintW = $("#hint").width();
    var hintH = $("#hint").height();
    $("#hint").css("left", (e.pageX-hintW/2)).css("top", (e.pageY-hintH-10));
  });
  
  $("#main div.work-tools a").css("opacity", 0).css("display", "block");
  $("#hint div div").css("opacity", 0.8);
  $("#main a[title]").mouseover(function(){
    var txt = $(this).attr("title");
    $(this).attr("title","");
    $("#hint").css("display", "block");
    $("#hint div div").text(txt);
  }).mouseout(function(){
    $("#hint").css("display", "none");
    $(this).attr("title", $("#hint div div").text());
  });
  $("#main div.work-tools").bind("mouseenter",function(){
    $(this).siblings(".work-canvas").stop().animate({width:70}, 300);
    $(this).children("a").stop().animate({opacity:1}, 300);
  }).bind("mouseleave",function(){
    $(this).siblings(".work-canvas").stop().animate({width:1}, 300);
    $(this).children("a").stop().animate({opacity:0}, 300);
  });
  $("#main a[href^='http://'],#main a[href^='/works/']").each(function(e){ 
    $(this).attr("target", "_blank"); 
  });
});
