// JavaScript Document $(function () { if ($('#justProductTabs').length == 1) { var _fpage = 1; var _ftype = 1; var updateThumbs = function (_type,_page) { var _el = false; $('#proTabsInfo a.tn').find('img:first').attr('src','/images/thumbs_loader.gif').parent().attr('href','#').css('visibility','visible').find('span:first').html(''); $.ajax({type:'GET',url:'/justajax.php?do=homeThumbs&type='+_type+'&page='+_fpage,dataType:'json',success:function(_data) { var _count = 0; if (_data.ok == 1 && _data.thumbs) { _fpage = _data.page; $.each(_data.thumbs, function(_i, _t) { _el = $('#proTabsInfo a.tn:eq('+_count+')'); $('img',_el).attr('src',_t.img); _el.attr({'href':_t.url,'title':_t.title}); if (!_t.reviews) { _t.reviews = ''; } if (!_t.stars) { _t.stars = ''; } $('span:eq(0)',_el).html(_t.desc); $('span:eq(1)',_el).html(_t.stars); _count++; }); } while (_count < 7) { _el = $('#proTabsInfo a.tn:eq('+_count+')').css('visibility','hidden'); _count++; } }}); }; $('#proTabsInfo .arrowRight, #proTabsInfo .arrowLeft').click(function() { if ($(this).hasClass('arrowRight')) { _fpage = (_fpage > 2) ? 1 : _fpage+1; } else { _fpage = (_fpage > 1) ? _fpage-1 : 3; } updateThumbs(_ftype,_fpage); return false; }); $('#proTabs').delegate('a','click', function() { $(this).parent().addClass('on').siblings().removeClass('on'); _ftype = $('#proTabs a').index(this)+1; _fpage = 1; updateThumbs(_ftype,_fpage); return false; }); updateThumbs(_ftype,_fpage); } });