/* Modified by Levente Kapitany, 2009-05-14 15:38:51 EST */
w = 128;
w2 = 83;
w3 = 143;

$(document).ready(function() { 

    var s = $("#boxes").find("li").size();
    $("#boxes > ul").width((s*w)+5);

    var s2 = $("#boxessmall").find("li").size();
    $("#boxessmall > ul").width((s2*w2)+5);

	var s3 = $(".wide").find("li").size();
    $(".wide > ul").width((s3*w3)+10);

    $("a.left").click(function(event){
      event.preventDefault();
      $(this).blur();
      $('#boxes').scrollTo('-='+w+'px',500,{offset:-50});
    });
  
    $("a.right").click(function(event){
      event.preventDefault();
      $(this).blur();
      $('#boxes').scrollTo('+='+w+'px',500,{offset:-50});
    });
    
    $("a.leftsmall").click(function(event){
      event.preventDefault();
      $(this).blur();
      $('#boxessmall').scrollTo('-='+w2+'px',500,{offset:-50});
    });
  
    $("a.rightsmall").click(function(event){
      event.preventDefault();
      $(this).blur();;
      $('#boxessmall').scrollTo('+='+w2+'px',500,{offset:-50});
    });
    
    $("a.leftlogic").click(function(event){
      event.preventDefault();
      $(this).blur();
      $('#boxeslogic').scrollTo('-='+w3+'px',500,{offset:-50});
    });
  
    $("a.rightlogic").click(function(event){
      event.preventDefault();
      $(this).blur();
      $('#boxeslogic').scrollTo('+='+w3+'px',500,{offset:-50});
    });
    
    //change image
    $("a[id^='thumb']").click(function(event){
      event.preventDefault();
      $(this).blur();
      z = new Number($(this).attr("rel"));        
      $("a[rel='zoom']").css("display","none");
      $("a[class='zoom"+z+"']").fadeIn("fast");
    });
    
    //zoom image
    $("a.leftbig").click(function(event){
      event.preventDefault();
      $(this).blur();
      z = z-1;
      if (z<1) z = zmax;
      $("a[rel='zoom']").css("display","none");
      $("a[class='zoom"+z+"']").fadeIn("fast");
    });

    $("a.rightbig").click(function(event){
      event.preventDefault();
      $(this).blur();
      z = z+1;
      if (z>zmax) z = 1;
      $("a[rel='zoom']").css("display","none");
      $("a[class='zoom"+z+"']").fadeIn("fast");
    });

    $("a[rel='zoom']").fancybox({
      'hideOnContentClick': true, 
      'overlayShow': true
    }); 
}); 
     