function KickerPages() { this.value = 0; } var mySlide = new Array( 'http://c.americanapparel.net/storefront/headers/accessories/headwear/1.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/11.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/11_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/13_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/15.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/18.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/19.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/410accessories-headwear1.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/5.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories-headwear1.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories-headwear4.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories-headwear7.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories-headwear8.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories2_410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories3.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/accessories5_410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/beret.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/bow410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/bow_410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/copy of belts-1.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/copy of headwear.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/hair1.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/hairaccessories1.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/hairaccessories2.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/hairaccessories3.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/hairaccessories40.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/hats.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/hats3.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear-2.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear-410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear1.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear2.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear3.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear50.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear7_410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear8_410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/headwear_410 2.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/lawntee_410.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/rsa0513.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/tbow-410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/untitled.jpg' ,'http://c.americanapparel.net/storefront/headers/accessories/headwear/untitled1.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;