$(function(){
function rotate(){
$('#blockprods')
 .addClass("block-widget block-prods main-form")
 .html('<div id="new_designs" class="main-form block-big-title-font block-big-title-color">'+caption+'</div><ul id="carousel_items"></ul>');
function cIn(c,el,i,st,evt){
 var j=c.index(i,prodsL);try{
 prods[j].el = c.add(i, prods[j].el===undefined? cItem(prods[j]):prods[j].el)[0].firstElementChild;
 }catch(e){}
}
function cOut(c,el,i,st,evt){c.remove(i);}
function cItem(el){
 return '<a href="?lang='+lang+'&search='+el.n+'"><img src="'+img_uri+el.n+'.jpg'+'" width="150" height="150" alt="'+el.t+'" title="'+el.t+'" alt="" title=""/><p>'+el.t+'</p></a>';
}
var prodsL=prods.length;
prodsL--;
jc = $('#carousel_items').jcarousel({
 auto:4,
 scroll:1,
 wrap:prodsL>6?'circular':'',
 size:prodsL>6?null:prodsL,
 itemVisibleInCallback: {onBeforeAnimation: cIn},
 itemVisibleOutCallback: {onAfterAnimation: cOut}
});
if(prodsL<7){
 $('.jcarousel-prev').hide();$('.jcarousel-next').hide();
 $('#blockprods').css("left",(150*(6-prodsL)/2)).width(156*(prodsL)+42);
 $('.jcarousel-container-horizontal').width(156*(prodsL));
}
$('.block-prods .jcarousel-clip-horizontal').width(156*(prodsL<7?prodsL:6));
$('#block-big-img-prod .item').click(function(){window.top.location.href=$(this).attr('href');});
}
if(prods !== undefined)rotate();
});
