
var $j=jQuery.noConflict();var current=0;var tempH=0;var tempW=0;var hiddenPic,parent;var interval=0;var currentView;var galleryWidth=634;function GalleryChangePic(element){parent=$j(element).parent();if(!$j(element).hasClass('active'))
{$j('.active',parent).removeClass('active');$j(element).addClass('active');}
if($j(element).length!=0){$j('#gallery .pic img').attr('src',$j(element).attr('src').replace("thumb/",""));}
gname=$j('#gallery .pic img').attr('src');gname=gname.replace('_r','').replace('_','');gname=gname.substring(gname.lastIndexOf('/')+1,gname.lastIndexOf('.')<0?gname.length:gname.lastIndexOf('.'));$j('#gpname').html(gname);ilp=$j(element).parent();ilg=$j(element).parent().parent();y=$j('li',ilg).index(ilp);x=$j('img',ilp).index(element)+1;$j('#gpc').html(12*y+x);}
function GallerySearchNext()
{var next=0;$j('#gallery .thumbs li.view img').each(function(index){if($j(this).hasClass('active'))
next=index+1;});if(next==$j('#gallery .thumbs li.view img').size()){if($j('#gallery .thumbs li:last').hasClass('view')){for(var i=0;i<$j('#gallery .thumbs li').size();i++)
$j('#gallery a.goleft:not(.off)').click();next=0;}
else{$j('#gallery a.goright:not(.off)').click();next=0;}}
return next;}
function GalleryInitThumbs(){$j('#thumbs-wrap ul').css('width',$j('#thumbs-wrap ul li').size()*galleryWidth+'px');}
function GalleryInit(element){if($j('#gallery').width()>0)interval=setInterval(function(){GalleryChangePic($j(element).eq(GallerySearchNext()))},2000);$j(element).bind('mouseover',function(){GalleryChangePic(this);clearInterval(interval);});$j(element).parent().bind('mouseover',function(){clearInterval(interval);});$j(element).parent().bind('mouseout',function(){interval=setInterval(function(){GalleryChangePic($j(element).eq(GallerySearchNext()))},2000);});}
function GalleryUnbind(element){$j(element).unbind('mouseover');$j(element).parent().unbind('mouseover');$j(element).parent().unbind('mouseout');}
function GalleryScroll(direction){size=$j('#thumbs-wrap .thumbs li').size();$j('#thumbs-wrap .thumbs li').each(function(index){if($j(this).hasClass('view'))
current=index;});clearInterval(interval);GalleryUnbind($j('#gallery .thumbs li.view img'));currentMargin=$j('#thumbs-wrap ul').css('margin-left');currentView=$j('#thumbs-wrap ul li.view');$j('img.active',currentView).removeClass('active');$j(currentView).removeClass('view');if(direction==='left'){$j('#thumbs-wrap ul').stop().animate({marginLeft:'-'+634*(current-1)+'px'},300);$j(currentView).prev().addClass('view');if(current==1)
$j('a.goleft').addClass('off');$j('a.goright').removeClass('off');}
else{$j('#thumbs-wrap ul').stop().animate({marginLeft:'-'+634*(current+1)+'px'},300);$j(currentView).next().addClass('view');$j('a.goleft').removeClass('off');if(current==size-2)
$j('a.goright').addClass('off');}
$j('#thumbs-wrap ul li.view img').eq(0).addClass('active');GalleryInit($j('#gallery .thumbs li.view img'));GalleryChangePic($j('#thumbs-wrap ul li.view img.active'));}
