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); var s =function () { /* slide(i); i = getnexti(1);*/ }; 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].onclick = 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); }; };