document.write('<script type="text/javascript" src="http://www.takarabox.net/flash_js/images.js"></script>\n');
var FLASH_IMAGES_URI = "http://www.takarabox.net/flash_js/img/";
var PRODUCT_DETAIL_URI = "http://www.takarabox.net/products/detail.php?product_id="
var flashIndex, flashJs, a, img, href, div;
window.onload = function() {
    flashJs = document.getElementById("flash_js");
    a = document.createElement("a");
    img = document.createElement("img");
    div = document.createElement("div");
    flashIndex = Math.floor(Math.random() * flashImages.length);
    flashJs.appendChild(a);
    flashJs.appendChild(div);
    flashJs.style.marginBottom = "4px";
    a.appendChild(img);
    flashInit();
}
function flashInit() {
    href = flashImages[flashIndex].jump || PRODUCT_DETAIL_URI + flashImages[flashIndex].id;
    a.setAttribute("href", href);
    img.setAttribute("src", FLASH_IMAGES_URI + flashImages[flashIndex].file);
    img.setAttribute("alt", flashImages[flashIndex].alt);
    img.setAttribute("title", flashImages[flashIndex].title);
    div.innerHTML = flashIndex + 1 + "/" + flashImages.length;
    div.innerHTML += "&nbsp;(" + flashImages[flashIndex].name + ")";
}
function flashChange(arg) {
    if ( arg == "prev" ) {
        flashIndex--;
    } else if ( arg == "next" ) {
        flashIndex++;
    } else if ( arg == "start" ) {
        flashIndex = 0;
    } else if ( arg == "end" ) {
        flashIndex = flashImages.length;
    } else {
        flashIndex--;
    }
    if ( flashIndex < 0 ) flashIndex = 0;
    if ( flashImages.length < flashIndex + 1 ) flashIndex = flashImages.length - 1;
    flashInit();
}
