var baseurl = "http://mysimplyperfect.com/inc/splash/"; var images = ["1a4a42.jpg","ebefd6.jpg","99480c.jpg","da9416.jpg","4c94ac.jpg","d3c724.jpg","774f94.jpg","7d4aa0.jpg","fd9a2d.jpg","922942.jpg","97f272.jpg","00c30e.jpg","d6791f.jpg","74e9ac.jpg","a35191.jpg","dac116.jpg","5f7641.jpg","f82444.jpg","44c3ef.jpg","8bcdbd.jpg","e74224.jpg","817e3b.jpg","df9905.jpg","60620f.jpg","4ffdd7.jpg","fe7d35.jpg","d38452.jpg","56a020.jpg","5fca82.jpg","777135.jpg","21e299.jpg","e01aac.jpg","8ea25b.jpg","2e9531.jpg","7950c4.jpg","50f49d.jpg","706d01.jpg","c3fa64.jpg","d285cf.jpg","09f053.jpg","80705b.jpg","ed9991.jpg","790876.jpg","94c5a3.jpg","ce486b.jpg","90f5bc.jpg","189f2e.jpg","4097b9.jpg","0f24d1.jpg","89a115.jpg","7b295d.jpg","e0a26e.jpg","a062e3.jpg","5d1708.jpg","b98d99.jpg","c5065b.jpg","586238.jpg","5f0e7a.jpg","9a15d9.jpg","b454f4.jpg","77d5c8.jpg","e381b8.jpg","f23d36.jpg","3f76f6.jpg","91ee4c.jpg","eb5694.jpg","0e0850.jpg","7ac7a7.jpg","4ec086.jpg","a84106.jpg","49f5ec.jpg","e0d2b2.jpg","60d271.jpg","263dfe.jpg","a5714f.jpg","5f0e6b.jpg","fd72d7.jpg","4ec030.jpg","4ca346.jpg","cab439.jpg","d45dff.jpg","223e94.jpg","4f08d0.jpg","1540e7.jpg","07672e.jpg","aea92a.jpg","3a7692.jpg","cfdab5.jpg","8bf90e.jpg","de3717.jpg","52cc32.jpg","b99ae1.jpg","c7d55e.jpg","51127d.jpg","4345d9.jpg","6f60d0.jpg","02e0f9.jpg","581d49.jpg","57c1f9.jpg","08b54c.jpg","a381d1.jpg","cda6a0.jpg","456dfe.jpg","10c498.jpg","06aa30.jpg","8e829e.jpg","281f09.jpg","18ab24.jpg","3d0b2c.jpg","36b668.jpg","846ab6.jpg","18d6bf.jpg","257e5a.jpg","d9ab35.jpg","eb0aef.jpg","9ea94d.jpg","beb650.jpg","1c4da1.jpg","bee34e.jpg","32a1e6.jpg","c201a2.jpg","0691c8.jpg","4dfd89.jpg","b7f661.jpg","6a4a1a.jpg","cd975b.jpg","1f44c2.jpg","e3319d.jpg","91ba10.jpg","4996a8.jpg","ba1674.jpg","cc641f.jpg","2feddc.jpg","97cf91.jpg","e01155.jpg","e58ee0.jpg"]; // preload first 20 images for (var i=0; i < images.length; i++) { $('')[0].src = baseurl + images[i]; if (i === 20) { break; } } function prependBaseUrl(a) { for(var i=0; i < a.length; i++) { a[i] = baseurl + a[i]; } return a; } function getImage() { var image = images.shift(); return baseurl + image; } function getImages() { var image = images.shift(); images.push(image); return prependBaseUrl(images.slice(0)); } function initSplash() { $("#field1 p").backstretch(getImages()); $("#field2 p").backstretch(getImages()); $("#field3 p").backstretch(getImages()); $("#field4 p").backstretch(getImages()); $("#field5 p").backstretch(getImages()); $("#field6 p").backstretch(getImages()); $("#field7 p").backstretch(getImages()); $("#field8 p").backstretch(getImages()); $("#field9 p").backstretch(getImages()); $("#field10 p").backstretch(getImages()); } function initSplashTop() { $("#field4 p").backstretch(getImage()); $("#field5 p").backstretch(getImage()); $("#field7 p").backstretch(getImage()); $("#field8 p").backstretch(getImage()); $("#field9 p").backstretch(getImage()); $("#field10 p").backstretch(getImage()); }