//Rollover
function smartOver() {
	smartRollover('HEADER');
	if( !document.URL.match(/\/member\//) && !document.URL.match(/\/search\//) && !document.URL.match(/\/regist\//) && !document.URL.match(/\/download\//) && !document.URL.match(/\/sitemap\//) && !document.URL.match(/\/condition\//) && !document.URL.match(/\/privacy\//) && !document.URL.match(/\/application\//) ){
		smartRollover('MAINCONTENTS');
	}
	smartRollover('FOOTER');
}
function smartRollover(idName) {
	if(document.URL.match(/\/scripts\/member\/index\.asp/) || ( !document.URL.match(/\/scripts\/member\//) && !document.URL.match(/\/scripts\/inspect\//) && !document.URL.match(/\/scripts\/insurance\//)) ) {
		if(document.getElementsByTagName) {
			var images = document.getElementById(idName).getElementsByTagName("img");
			for(var i=0; i < images.length; i++) {
				if(images[i].getAttribute("src").match(/_off\./)) {
					fileName = new Array(images[i].getAttribute("src").replace("_off.", "_on."));
					preImages = new Array();
					for (j=0; j<fileName.length; j++) {
						preImages[j] = new Image();
						preImages[j].src = fileName[j];
					}
					images[i].onmouseover = function() {
						this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
						/*
						var t_src = this.src;
						if(t_src.match(/lm_cmn_insurance_02_[0-9][0-9]_on\.gif$/)){
							images[4].setAttribute("src", images[4].getAttribute("src").replace("_off.", "_on."));
						}
						var t_src = this.src;
						if(t_src.match(/lm_cmn_insurance_04_[0-9][0-9]_on\.gif$/)){
							images[8].setAttribute("src", images[8].getAttribute("src").replace("_off.", "_on."));
						}
						*/
						var t_src = this.src;
						if(t_src.match(/lm_cmn_flat35_09_[0-9][0-9]_on\.gif$/)){
							images[21].setAttribute("src", images[21].getAttribute("src").replace("_off.", "_on."));
						}
						var t_src = this.src;
						if(t_src.match(/lm_cmn_flat35_11_[0-9][0-9]_on\.gif$/)){
							images[28].setAttribute("src", images[28].getAttribute("src").replace("_off.", "_on."));
						}
					}
					images[i].onmouseout = function() {
						this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
						/*
						var t_src = this.src;
						if(t_src.match(/lm_cmn_insurance_02_[0-9][0-9]_off\.gif$/)){
							images[4].setAttribute("src", images[4].getAttribute("src").replace("_on.", "_off."));
						}
						var t_src = this.src;
						if(t_src.match(/lm_cmn_insurance_04_[0-9][0-9]_off\.gif$/)){
							images[8].setAttribute("src", images[8].getAttribute("src").replace("_on.", "_off."));
						}
						*/
						var t_src = this.src;
						if(t_src.match(/lm_cmn_flat35_09_[0-9][0-9]_off\.gif$/)){
							images[21].setAttribute("src", images[21].getAttribute("src").replace("_on.", "_off."));
						}
						var t_src = this.src;
						if(t_src.match(/lm_cmn_flat35_11_[0-9][0-9]_off\.gif$/)){
							images[28].setAttribute("src", images[28].getAttribute("src").replace("_on.", "_off."));
						}
					}
				}
			}
		}
	}
}
if(window.addEventListener) {
	window.addEventListener("load", smartOver, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartOver);
}
else{
	window.onload = smartOver;
}


//PopUP
function WinOpen(url,width,height){
	var win = window.open(url,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + "\"");
	win.focus();
}



function ChangeImage(myID,type){
	var images = document.getElementById(myID);
	switch (type) {
		case "on":
			images.setAttribute("src", images.getAttribute("src").replace("_off.", "_on."));
			break;
		case "off":
			images.setAttribute("src", images.getAttribute("src").replace("_on.", "_off."));
			break;
		default:
	}
	
}

function WriteSerch(){
	var Tags = '<form action="http://' + location.host + '/search/" id="cse-search-box"><div id="SEARCH"><input type="hidden" name="cx" value="011035530901277458899:1bqqoreoqvo" /><input type="hidden" name="cof" value="FORID:9" /><input type="hidden" name="ie" value="Shift_JIS" /><div class="text"><input type="text" name="q" size="31" /></div><input type="image" name="sa" alt="ŒŸõ" src="/shared/images/btn_cmn_search.gif" /></div></form>';
	if(!location.href.match(/^https:/)) {
		Tags = Tags + '<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=ja"></script>';
	}
	document.write(Tags);
};