; (function ($) { $.extend({ 'foucs': function (con) { var $container = $('#index_b_hero') , $imgs = $container.find('li.hero') , $leftbtn = $container.find('a.prev') , $rightbtn = $container.find('a.next') , config = { interval: con && con.interval || 3500, animatetime: con && con.animatetime || 500, direction: con && (con.direction === 'right'), _imglen: $imgs.length } , i = 0 , getnextindex = function (y) { return i + y >= config._imglen ? i + y - config._imglen : i + y; } , getprevindex = function (y) { return i - y < 0 ? config._imglen + i - y : i - y; } , silde = function (d) { $imgs.eq((d ? getprevindex(2) : getnextindex(2))).css('left', (d ? '-2000px' : '2000px')) $imgs.animate({ 'left': (d ? '+' : '-') + '=1000px' }, config.animatetime); i = d ? getprevindex(1) : getnextindex(1); } , s = setinterval(function () { silde(config.direction); }, config.interval); $imgs.eq(i).css('left', 0).end().eq(i + 1).css('left', '1000px').end().eq(i - 1).css('left', '-1000px'); $container.find('.hero-wrap').add($leftbtn).add($rightbtn).hover(function () { clearinterval(s); }, function () { s = setinterval(function () { silde(config.direction); }, config.interval); }); $leftbtn.click(function () { if ($(':animated').length === 0) { silde(false); } }); $rightbtn.click(function () { if ($(':animated').length === 0) { silde(true); } }); } }); }(jquery)); var foucsbox = function (time) { var time = time || 3500 , $ = function (id) { return document.getelementbyid(id); } , topcon = $('divimgplay') , big = $('divimginfog_imgplayer') , samll = $('divpageinfog_imgplayer') , tip = $('ptitleg_imgplayer') , bigimgs = big.getelementsbytagname('li') , samllimgs = samll.getelementsbytagname('li') , imglink = tip.getelementsbytagname('a')[0] , slide = function (z) { samllimgs[lastindex].classname = ''; samllimgs[z].classname = 'current'; bigimgs[lastindex].style.display = 'none'; bigimgs[z].style.display = 'block'; try { imglink.innerhtml = samllimgs[z].getelementsbytagname('img')[0].alt; } catch (e) { imglink.innertext = samllimgs[z].firstchild.firstchild.alt; } lastindex = i = z; } , helper = function (z) { return function (e) { var na; if (!e) { e = window.event; na = e.srcelement.nodename; } else { na = e.target.nodename; } if (na === 'img') { slide(z); } } } , lastindex = i = 0, x, y = bigimgs.length , getprevi = function (q) { return i - q < 0 ? y - q : i - 1; } , getnexti = function (q) { return i + q >= y ? i + q - y : i + 1; } var s = setinterval(function () { slide(i); i = getnexti(1); }, time); try { imglink.innertext = samllimgs[0].getelementsbytagname('img')[0].alt; } catch (e) { imglink.innertext = samllimgs[0].firstchild.firstchild.alt; } for (x = 1; x < y; x += 1) { bigimgs[x].style.display = 'none'; } for (x = 0; x < y; x += 1) { samllimgs[x].onmouseover = helper(x); } topcon.children[2].onclick = function (e) { i = lastindex; var t; if (!e) { e = window.event; t = e.srcelement; } else { t = e.target; } switch (t.classname) { case 'icon_prev': slide(getprevi(1)); break; case 'icon_next': slide(getnexti(1)); break; } }; topcon.onmouseover = function () { clearinterval(s); }; topcon.onmouseout = function () { s = setinterval(function () { slide(i); i = getnexti(1); }, time); }; };