﻿/*-------------------------------------------------------------
　　 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 = "http://www.e-2.co.jp/";

// debug site image path
debug_image_path = "/05/E2RENEWAL2009/";

// 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/e2_logo_ov.jpg",
"img/global/global01_ov.jpg",
"img/global/global02_ov.jpg",
"img/global/global03_ov.jpg",
"img/global/global04_ov.jpg",
"img/global/global05_ov.jpg",
"img/global/global06_ov.jpg",
"img/global/global07_ov.jpg",
"img/top/column_release/newrelease_ov.jpg",
"img/top/column_release/mserv_ov.jpg",
"img/top/column_release/mform_ov.jpg",
"img/top/column_release/binpara_ov.jpg",
"img/top/column_introduce/banner/bn_sp_contents_ov.jpg",
"img/top/column_introduce/banner/bn_website_ov.jpg",
"img/top/column_introduce/banner/bn_mobilesite_ov.jpg"
);

preload= new Array();
for (i=0; i<data.length; i++)
{
	preload[i] = new Image();
	preload[i].src = image_path + data[i];
}

// change image
function swapimg(imgname,chg){
	document.images[imgname].src = chg;
}


// 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);
}
