(function() { var files = ["https://lh6.googleusercontent.com/-8oLJ46kDTwY/T3V6FdALvyI/AAAAAAAAABw/jGI5yvDsr3A/DJ073_L.jpg", "https://lh5.googleusercontent.com/-jWnroeBz6MA/T5ZWnsvEJ7I/AAAAAAAAADA/-PyQWCwyh5A/IMG_2435.jpeg", "https://lh6.googleusercontent.com/-NvoFOuZ9cdo/T3V6GNnoNWI/AAAAAAAAAB4/cDJJkQ1bqPc/dot4.jpg", "https://lh3.googleusercontent.com/-dEld8gcvHdA/T5ZWooqeEtI/AAAAAAAAADQ/--qcgm0ef0o/2011210-06.jpeg", "https://lh6.googleusercontent.com/-JOKm9H3bnkE/T3V6FbW7WqI/AAAAAAAAABs/aWNwiqPU1js/DJ055_L.jpg", "https://lh3.googleusercontent.com/-Rar-m3uP5O0/T5ZWoAL8C6I/AAAAAAAAADI/NL6_w30Bn3U/IMG_2464.jpeg", "https://lh6.googleusercontent.com/-dD8dkPfj35o/T5ZWnJZj-eI/AAAAAAAAAC8/1SCqk4axvzo/IMG_0007.jpeg", "https://lh6.googleusercontent.com/-0GGetG0Ngao/T5ZT3hm5ldI/AAAAAAAAACQ/cHAcN_6LDec/20120320-12.JPG", "https://lh6.googleusercontent.com/-PeBaZ7UzqGs/T5ZWcTP-i5I/AAAAAAAAACs/aLiDlw2QZb0/PICT0138.jpeg", "https://lh6.googleusercontent.com/-3_-0jdDDcmM/T3V6FayXvXI/AAAAAAAAAB0/xn3tBMMYP9o/b20u60000.jpg", "https://lh3.googleusercontent.com/-UOUPSLKYd0s/T-1_eWaQVkI/AAAAAAAAAGY/PTw7rM5nFTs/obog.jpg", "https://lh4.googleusercontent.com/-Z8_wXJVweQk/UUKaQrnTw0I/AAAAAAAAAHs/td0bTAQiawo/201301School-Canon24-105-30.jpg", "https://lh4.googleusercontent.com/-WiI2z_OI3cI/UUKbmA-tM1I/AAAAAAAAAIQ/6arv17C1Mr4/2012_4_4shinkan.png", "https://lh3.googleusercontent.com/-mTNa894ChfU/UUKbmKecUYI/AAAAAAAAAIM/4-qe5CvDSCQ/2013sotu.jpg", "https://lh5.googleusercontent.com/-OFXfWLF42tc/UUKbmOn-kzI/AAAAAAAAAIU/S1_mskCR_Ys/news1.png", "https://lh4.googleusercontent.com/-OCJ-nBGdhqI/UUKbnX3sD0I/AAAAAAAAAIc/jWRrYjYdvmc/ssh2013_0129.png"], currentObj = null, currentIndex = Math.floor(Math.random() * files.length), frame = document.getElementById("slideshow"), frameW = parseInt("0"), frameH = parseInt("0"), scale = parseInt("1"), raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback, element) {setTimeout(callback, 16)}, alpha if (~navigator.userAgent.indexOf("MSIE")) { alpha = function(o, n) { o.style.filter = "alpha(opacity=" + Math.floor(n * 100) + ")"; } } else { alpha = function(o, n) { o.style.opacity = n; } } if (!frameW) { frameW = parseInt(frame.offsetWidth); } else { frame.style.width = frameW + "px"; } if (!frameH) { frameH = parseInt(frame.offsetHeight); } else { frame.style.height = frameH + "px"; } frame.style.overflow = "hidden"; frame.style.position = "relative"; frame.style.background = "#fff"; show(); function show() { var img = document.createElement("img"); img.onload = function () { if (img.width / img.height * scale > frameW / frameH * scale) { img.height *= (frameW / img.width); img.width = frameW; } else { img.width *= (frameH / img.height); img.height = frameH; } img.style.position = "absolute"; img.style.borderStyle = "solid"; img.style.borderWidth = Math.ceil(frameH - img.height) / 2 + "px " + Math.ceil(frameW - img.width) / 2 + "px"; img.style.borderColor = "#fff"; if (!currentObj) { frame.appendChild(img); currentObj = img; setTimeout(show, 3500); } else { frame.insertBefore(img, currentObj); var start = getTimer(); function fade() { var n = (getTimer() - start) / 1000; if (n > 1) { frame.removeChild(currentObj); currentObj = img; setTimeout(show, 2500); } else { alpha(currentObj, 1 - n); raf(fade); } } fade(); } }; img.onerror = function() { setTimeout(show, 500); }; img.src = files[(currentIndex ++) % files.length]; } function getTimer() { return new Date().getTime(); } })();