function KickerPages() { this.value = 0; } var mySlide = new Array( 'http://c.americanapparel.net/storefront/headers/women/stockings/10_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/13.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/15_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/18.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/19.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/20.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/21.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/23.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/26.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/30.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/410women_hosiery99.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/alanna_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/bodysuits2_410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/copy (2) of tights11.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/copy of hoisery5.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/copy of hoisery8.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/copy of tights.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/copy of tights2.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hoisery10.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hoisery12.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hoisery17.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hoisery18_410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hoisery410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hosiery2.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hosiery8.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/hosiery9.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/img_0436_1.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/img_0599_2.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/kali_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/long sleeves.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/stockingshosiery98.jpg' ,'http://c.americanapparel.net/storefront/headers/women/stockings/stockingshosiery99.jpg' ); var myInterval = 0; var myIntervalPause = 0; var myTimeout = 0; var myAPI; function ScrollThroughmyPages(){ myAPI.next(500); RestartmyInterval(); } function AutoScroll() { randArray(mySlide); for(var x = 0; x < mySlide.length; x++) if (x <=0) document.getElementById('myItems').innerHTML += ''; else document.getElementById('myItems').innerHTML += ''; $(function() { $("#myScrollable").myScrollable({horizontal:true}); }); if (document.getElementById('myScrollable') != null) { myAPI = $("#myScrollable").myScrollable(); myTotal = myAPI.getStatus().total; if (myTotal <= 1) { $('DIV.myNext').hide(); $('DIV.myPrev').hide(); } RestartmyInterval(); } } function RestartmyInterval() { LoadImgs(); myPause = 5000; CancelmyInterval(); myInterval = setInterval('ScrollThroughmyPages()',myPause); } function PausemyInterval(){ LoadImgs(); CancelmyInterval(); clearTimeout(myTimeout); myTimeout = setTimeout('RestartmyInterval()',5000); } function CancelmyInterval(){ LoadImgs(); clearInterval(myInterval); } function LoadImgs(){ myIndex = myAPI.getStatus().index; LoadImg(myIndex - 1); LoadImg(myIndex); LoadImg(myIndex + 1); } function LoadImg(index){ Item = document.getElementById('myItem' + index); if ( Item != null ){ if (mySlide[index] != null && Item.src != mySlide[index]) { Item.src = mySlide[index]; } } } function randArray(o){ for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o; } window.onload=AutoScroll;