

/**********************************************************
* form redirect */

if (location.href == "http://www.tokyo-shiki.co.jp/form/guide_support.php")
{
	location.replace('https://www.tokyo-shiki.co.jp/form/guide_support.php');
}
else if (location.href == "http://www.tokyo-shiki.co.jp/form/estimate.html")
{
	location.replace('https://www.tokyo-shiki.co.jp/form/form/estimate.html');
}
else if (location.href == "http://www.tokyo-shiki.co.jp/form/contact.php")
{
	location.replace('https://www.tokyo-shiki.co.jp/form/contact.php');
}
else if (location.href == "http://www.tokyo-shiki.co.jp/service_d/presentation.html")
{
	location.replace('https://www.tokyo-shiki.co.jp/service_d/presentation.html');
}



/**********************************************************
* onload */

function addEvent(elm,listener,fn){
	try{
		elm.addEventListener(listener,fn,false);
	}catch(e){
		elm.attachEvent("on"+listener,fn);
	}
}




/**********************************************************
* rollover */

function initOvers() {
	initRollovers('container');
}

function initRollovers(idName) {
	if(document.getElementsByTagName) {
	
		var aPreLoad = new Array();
		var sTempSrc;
		var aImages = document.getElementById(idName).getElementsByTagName('img');

		for (var i = 0; i < aImages.length; i++) {
			if (aImages[i].className == 'rollover') {
				var src = aImages[i].getAttribute('src');
				if (src.indexOf('_over') == -1) {
					var ftype = src.substring(src.lastIndexOf('.'), src.length);
					var hsrc = src.replace(ftype, '_over'+ftype);

					aImages[i].setAttribute('hsrc', hsrc);
					
					aPreLoad[i] = new Image();
					aPreLoad[i].src = hsrc;
					
					aImages[i].onmouseover = function() {
						sTempSrc = this.getAttribute('src');
						this.setAttribute('src', this.getAttribute('hsrc'));
					}	
					
					aImages[i].onmouseout = function() {
						if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_over'+ftype, ftype);
						this.setAttribute('src', sTempSrc);
					}
				}
			}
		}

	}
}
addEvent(window,"load",function(){initOvers()});




/**********************************************************
* objHeight */

function objHeight(id,tag,c) {
	var obj = document.getElementById(id).getElementsByTagName(tag);
	var h = 0;
	for (var i = 0; i < obj.length; i++) {
		if (obj[i].className == c || !c) {
			if (h < obj[i].offsetHeight) h = obj[i].offsetHeight;
		}
	}
	for (var i = 0; i < obj.length; i++) {
		if (obj[i].className == c || !c) {
			if (h != 0) obj[i].style.height = h + 'px';
		}
	}
}




/**********************************************************
* openWindow */

function openWindow(winURL,winName,winW,winH) {
	var winFeatures = 'toolbar=no,resizable=no,menubar=no,directories=no,scrollbars=yes,status=no,location=no,width=' + winW + ',height=' + winH + '';
	window.subwin = window.open(winURL,winName,winFeatures);
	window.subwin.focus();
}

