var RANGE=6;var OFFSET=450;var ALL=1;var START=1;var NOW=1;var current=0;var loaded=0;function change()
{$('#s_'+START).parent().css({background:'none'});$('#s_'+(START+RANGE)).parent().css({background:'none'});}
function clear()
{$('#s_'+NOW).next().remove();$('#s_'+NOW).css({opacity:1});}
$(document).ready
(function()
{var tmp,i,j,dest,count;$('#gallery_left').click
(function()
{if(START>1)
{tmp=parseInt($('.gallery_preview ul').css('left'));dest=tmp+OFFSET;$('.gallery_preview ul').animate({left:'+='+OFFSET});START-=RANGE;change();}});$('#gallery_right').click
(function()
{if(START+RANGE<ALL-1)
{tmp=parseInt($('.gallery_preview ul').css('left'));dest=tmp-OFFSET;$('.gallery_preview ul').animate({left:'-='+OFFSET});START+=RANGE;change();}});$('#big2').bind("load",function(){newh=$('#big2').height();tmp=$('#big2').attr('src');$('.big').animate({height:newh},function(){$('#big1').fadeOut(function(){$('#big2').fadeIn('fast',function(){$('#big1').attr('src',tmp).show();$('#big2').attr('src','');$('#big2').hide();});});});});$('.gallery_preview ul a').each
(function(i)
{$(this).attr('id','s_'+(i+1));if(loaded==0){$('#big2').attr('src',$(this).attr('href'));$('#text').html($(this).attr('title'));};loaded++;$(this).click
(function()
{clear();NOW=$(this).attr('id').split('_').pop();tmp=$(this).attr('href');tmp2=this;$('#s_'+NOW).css({opacity:0.33});$('#big2').attr('src',tmp);$('#text').html($(tmp2).attr('title'));tmp=this;$(tmp).parent().append('<span class="current fix"></span>');return false;});++ALL;});change();})
