﻿/*-------------------------------------------------------------
　　 JavaScript Document
-------------------------------------------------------------*/

// Debug Site's Hostname
debug_host_list = new Array(
"e-2j.com"
);

// initialize debug flag
debug_flag = false;

// default image path
image_path = "サイトドメイン（フルパス）/";

// debug site image path
debug_image_path = "/05/テストサイト上のディレクトリ名/";

// this hostname
this_hostname = location.hostname;

// checking debug site
for(i = 0; i < debug_host_list.length ; i++){
	if (this_hostname.match(debug_host_list[i])) {
		debug_flag = true;
		image_path = debug_image_path;
	}
}

// swaping image list(filename only)
data = new Array(
"img/○○.jpg",
"img/○○.jpg",
"img/○○.jpg",
"img/○○.jpg",
"img/○○.jpg"
);

preload= new Array();
for (i=0; i<data.length; i++)
{
	preload[i] = new Image();
	preload[i].src = image_path + data[i];
}


// pop up window
function html(w,h,html,target) {
	var w1;
	w1 = window.open("", target,"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width="+w+",height="+h);
	w1.location.href=html
	w1.focus();
}


//SmartRollover
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_ov."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_ov.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}