function KickerPages() { this.value = 0; } var mySlide = new Array( 'http://c.americanapparel.net/storefront/headers/women/Dresses/410women-dresses1.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/410women-dresses2.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/410women-dresses3.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/410_new.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/6.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/64.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/69.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/72.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/blackhat_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/coast_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dress410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses1.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses10.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses12.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses13.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses14.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses15.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses19.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses20_410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses21_410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses22_410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses5.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses50.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses50_410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses6.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses8.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses9.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses96.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses97.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses98.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/dresses99.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/megan_410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/miho-410x206.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/paris410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/rsa7309_410.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/women-dresses-6.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/women-dresses10.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/women-dresses11.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/women-dresses3.jpg' ,'http://c.americanapparel.net/storefront/headers/women/Dresses/women-dresses9.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;