$(function(){ /** formatted digit here >>> **/ function numFormat(n, d, s) { if (arguments.length == 2) { s = " "; } if (arguments.length == 1) { s = " "; d = "."; } n = n.toString(); a = n.split(d); x = a[0]; y = a[1]; z = ""; if (typeof(x) != "undefined") { for (i=x.length-1;i>=0;i--) z += x.charAt(i); z = z.replace(/(\d{3})/g, "$1" + s); if (z.slice(-s.length) == s) z = z.slice(0, -s.length); x = ""; for (i=z.length-1;i>=0;i--) x += z.charAt(i); if (typeof(y) != "undefined" && y.length > 0) x += d + y; } return x; } /** end **/ /** menu scroll here >>> if($('div.jCarousel ul li').length <= 6){ $('.jCarousel').css({'width':'381px','float':'left'}); $('div.menu a.down, div.menu a.up').hide(); } else { $('.jCarousel').css({'width':'381px','float':'left'}); $('div.menu a.down, div.menu a.up').show(); } end **/ /** various quantity of menu item here >>> **/ lisS = $('div.jCarousel li').height(); elem = $(window); numEl = $('div.jCarousel li a').parent().index(); if($('div.jCarousel li:last').prev().find('a').hasClass('selected')){ numEl = $('div.jCarousel li a.selected').parent().index() - 1; } if($('div.jCarousel li a.selected').attr('rel')){ numEl = $('div.jCarousel li a.selected').parent().index() - 2; } sp = numEl * lisS; if (elem.height() < 800){ $('div.menu a.down, div.menu a.up').show(); $('div.jCarousel').jMyCarousel({ visible:4, circular:false, start:sp }); $('.jCarousel').css({'width':'381px','float':'left'}); } else{ $('div.jCarousel').jMyCarousel({ visible:6, circular:false, start:0 }); if($('div.jCarousel ul li').length <= 6){ $('.jCarousel').css({'width':'381px','float':'left'}); $('div.menu a.down, div.menu a.up').hide(); } if($('div.jCarousel ul li').length > 6){ $('.jCarousel').css({'width':'381px','float':'left'}); $('div.menu a.down, div.menu a.up').show(); } } /** end **/ /** catalog scripts >>> **/ var Tot = $('table.subscr-tab span.digiter').text(); $('table.subscr-tab span.digiter').text(numFormat(Tot)); var ishop=new fConnector('ishop'); $('a.img').click(function(event){ event.preventDefault(); $(this).next().next().fadeIn("slow").fadeOut(1000); if($(this).attr('title')) { ishop.execute({add_product:{id:$(this).attr('id'),count:1,ext:{outer_price:$(this).attr('rel'),id:$(this).attr('id'),generate_id_from:'id,color',color:$(this).attr('title')}}}); $(this).next().show(); } }); $('a.second_order').click(function(event){ event.preventDefault(); super_val = $(this).parent().parent().prev().find('input.ite').val(); ishop.execute({add_product:{id:$(this).attr('id'),count:super_val,ext:{outer_price:$(this).attr('rel'),id:$(this).attr('id')}}}); $(this).next().fadeIn(700).fadeOut(2000); }); $('ul.colors li a').click(function(){ $('div.splashed').hide(); $(this).parents('li').find('li a').removeClass('marked'); $(this).addClass('marked'); $(this).parents('li').find('a.img').removeClass('img').addClass('active'); color = $(this).attr('title'); $(this).parents('li').find('a.active').attr('title',color); }); $('ul.cat-table > li').each(function(i){ var NumC = $(this).find('span.numeric').text(); var NumCo = $(this).find('span.cost').text(); $(this).find('span.numeric').text(numFormat(NumC)); $(this).find('span.cost').text(numFormat(NumCo)); cost = $(this).find('span.cost').text(); $(this).find('span.no').text(cost); coss = $(this).find('span.costhide').text(); calc = function(){ cc = $(this).val(); total_norm = coss * cc; $(this).parents('table').next().find('span.no').text(numFormat(total_norm)); } $(this).find("input.itemz").each(calc).change(calc).keypress(calc).keyup(calc).keydown(calc); }); inv = $('div.pages').find('span.invisible_count').text(); $('div.cat-search').find('span.invv').text(inv); $('div.cat-menu-top a.arrow, div.cat-menu-top input.iarrow').click(function(){ $(this).siblings('ul.drop').toggle(); }); $('ul.drop li a').click(function(event){ event.preventDefault(); var color_name = $(this).attr('id'); $(this).parent().parent().hide(); $(this).parent().parent().prev().prev().val(color_name); $(this).parent().parent().prev().prev().prev().val(color_name); }); $('ul.drop li a.all').click(function(event){ event.preventDefault(); var ce = $(this).text(); $(this).parent().parent().prev().prev().val(ce); }); /** end **/ /** backet script here **/ $('table.subscr-tab tr.gg').each(function(){ sbb = $(this).find('span.ff').text(); $(this).find('span.ff').text(numFormat(sbb)); }); /** end **/ /** Search scripts here >>> **/ $('#butt_s').click(function(evn){ evn.preventDefault(); $('#catsearch_main').submit(); }); /*end*/ /** enlarge cat image here >>> **/ gr=document.getElementById('enlarge'); $("a#enlarge").fancybox({ 'titleShow' : false, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic' }); /** end **/ });