$(document).ready(function(){

 jQuery('#mycarousel').jcarousel({scroll: 1});

 $('.preview').prepend("<div id='ss_loader'></div>");

 var tools={
 intval: function(v){
 v = parseInt(v);
 return isNaN(v) ? 0 : v;
 }
 };

 var sirina=tools.intval($('.preview img').css('width'));

           
 $('.preview img').hide();
 $(window).load(function(){
 $('#ss_loader').hide();
 $('.preview img').fadeIn();
 //$('.jcarousel-list li').show();
 });

 $('#lazy').lazyslider({btnsHeight:21,slowcontrols:false});
 $('#lazy a').lazybox({footer:'<a href="http://adamantus.com/dev/vedra">Vedra</a> &copy; All Rights Reserved'});

 $('.preview img').attr('src',$('.list ul li:first a').attr('href'));
 $('.list ul li a').click(function(){
 var element=this;
 
 $('.preview').animate({width:"40px",height:"40px",paddingBottom:0},{duration:800,complete:function(){
         $('.preview img').hide();
         $('#ss_loader').show();

         img = new Image();
         img.onload=function()
            {

                     var img_width=this.width;
                     var img_height=this.height;
                     $('#ss_loader').hide();

                     $('.preview img').attr({'src':$(element).attr('href'),'alt':$(element).attr('title')});
                     $('.preview img').show();
                     var quant=img_width/sirina;

                     $('.preview').animate({width:sirina,height:img_height/quant,paddingBottom:"50px"},800).children('p').text($('.preview img').attr('alt'));
         $('.preview p').text($('.preview img').attr('alt'));
            }

         img.src=$(element).attr('href');
 }
 });
 return false;
 });

 



});
