window.onunload = function(){}

if (self.location.href != window.location.href) {
	window.location.href = self.location.href;
}

//============================
// 背景画像読み込みキャッシュ
//============================
try { 
	document.execCommand('BackgroundImageCache', false, true); 
} catch(e) {}


//============================
// ロールオーバー
//============================
var smartRollover = {
	config: function(){
		smartRollover.init('img');
		smartRollover.init('input');
	},

	init: function(tag) {
		var images = document.getElementsByTagName(tag);
		if(!images) return;
		var preload = new Array();
		for(var i=0; i < images.length; i++) {
			if(images[i].className.indexOf('rollover') != -1){
				var path = images[i].src;
				var ext = path.slice(path.length-4, path.length);
				preload[i] = new Image();
				preload[i].src = images[i].src.replace(ext, '_on'+ext);
				images[i].onmouseover = function() {
					if(this.src.indexOf('_on') == -1){
						this.setAttribute("src", this.src.replace('.gif', '_on'+'.gif'));
						this.setAttribute("src", this.src.replace('.jpg', '_on'+'.jpg'));
						this.setAttribute("src", this.src.replace('.png', '_on'+'.png'));
					}
				};
				images[i].onmouseout = function() {
					if(this.src.indexOf('_on') != -1){
						this.setAttribute("src", this.src.replace('_on'+'.gif', '.gif'));
						this.setAttribute("src", this.src.replace('_on'+'.jpg', '.jpg'));
						this.setAttribute("src", this.src.replace('_on'+'.png', '.png'));
					}
				};
			}
		}
	},

	addEvent: function(){
		try {
			window.addEventListener('load', smartRollover.config, false);
		} catch (e) {
			window.attachEvent('onload', smartRollover.config);
		}
	}
}
smartRollover.addEvent();


//==============================================================================
// ブラウザ設定
//==============================================================================
var Mac = navigator.appVersion.indexOf('Mac',0) != -1;
var Win = navigator.appVersion.indexOf('Win',0) != -1;
var IE  = navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1;
var NN  = navigator.appName.indexOf("Netscape",0) != -1;
var Moz = navigator.userAgent.indexOf("Gecko") != -1;
var Vmajor = parseInt(navigator.appVersion); // ex. 3
var Vminor = parseFloat(navigator.appVersion); // ex. 3.01
var WinIE = (Win && IE);
var MacIE5 = ((Mac && navigator.appVersion.indexOf('MSIE 5',0) != -1) || (Mac && IE && VER > 4));
var MacIE4 = ((Mac && navigator.appVersion.indexOf('MSIE 4.',0) != -1));
var MacIE3 = ((Mac && navigator.appVersion.indexOf('MSIE 3.',0) != -1));

//==============================================================================
// ページスクロール
//==============================================================================
function scrollToPageTop () {
	if (window.scrollTo) {
		//window.scrollTo (0, 0);
		jumpToPageTop();
		return false;
	} else {
		return true;
	}
}

function setObj(id) {
 if (document.all) {
  return document.all(id);
 } else if (document.getElementById) {
  return document.getElementById(id);
 } else if (document.layers) {
  return document.layers[id];
 }
 return false;
}

function getScrollLeft() { // 020225
 if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {
  return document.body.scrollLeft;
 } else if (window.pageXOffset) {
  return window.pageXOffset;
 } else {
  return 0;
 }
}

function getScrollTop() { // 020225
 if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {
  return document.body.scrollTop;
 } else if (window.pageYOffset) {
  return window.pageYOffset;
 } else {
  return 0;
 }
}

function getScrollWidth() { // 010317
 if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {
  return document.body.scrollWidth;
 } else if (window.innerWidth) {
  return window.innerWidth;
 }
 return 0;
}

function getScrollHeight() { // 010317
 if ((navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1)) {
  return document.body.scrollHeight;
 } else if (window.innerHeight) {
  return window.innerHeight;
 }
 return 0;
}



function toHex(_int) {
 if (i < 0) {
  return '00';
 } else if (_int > 255) {
  return 'ff';
 } else {
  return '' + hexbox[Math.floor(_int/16)] + hexbox[_int%16];
 }
}

var pageScrollTimer;
function pageScroll(toX,toY,frms,cuX,cuY) { // 020314
 if (pageScrollTimer) clearTimeout(pageScrollTimer);
 if (!toX || toX < 0) toX = 0;
 if (!toY || toY < 0) toY = 0;
 if (!cuX) cuX = 0 + getScrollLeft();
 if (!cuY) cuY = 0 + getScrollTop();
 if (!frms) frms = 6;

 if (toY > cuY && toY > (getAnchorPosObj('end','enddiv').y) - getInnerSize().height) toY = (getAnchorPosObj('end','enddiv').y - getInnerSize().height) + 1;
 cuX += (toX - getScrollLeft()) / frms; if (cuX < 0) cuX = 0;
 cuY += (toY - getScrollTop()) / frms;  if (cuY < 0) cuY = 0;
 var posX = Math.floor(cuX);
 var posY = Math.floor(cuY);
 window.scrollTo(posX, posY);

 if (posX != toX || posY != toY) {
  pageScrollTimer = setTimeout("pageScroll("+toX+","+toY+","+frms+","+cuX+","+cuY+")",16);
 }
}



function jumpToPageTop() { // 020301
// if (!MacIE3 && !MacIE4 && !NN && window.scrollTo || NN && (Vminor >= 4.75) && window.scrollTo) {
  pageScroll(0,0,5);
// } else {
//  location.hash = "top";
// }
}

function getInnerSize() {
 var obj = new Object();

 if (document.all || (document.getElementById && IE)) {
  obj.width = document.body.clientWidth;
  obj.height = document.body.clientHeight;
 } else if (document.layers || (document.getElementById && Moz)) {
  obj.width = window.innerWidth;
  obj.height = window.innerHeight;
 }

 return obj;
}

function getAnchorPosObj(elementname, elementid) {
 var obj = setObj(elementname);
 var objnew = new Object();
 var objtmp;

 if (document.getElementById && IE) {
  objtmp = obj;
   objnew.x = objtmp.offsetLeft;
  objnew.y = objtmp.offsetTop;
 while ((objtmp = objtmp.offsetParent) != null) {
   objnew.x += objtmp.offsetLeft;
   objnew.y += objtmp.offsetTop;
  }
 } else if (document.getElementById && Moz) {
//  objnew.x = document.getElementsByTagName("A").namedItem(elementname).offsetLeft;
//  objnew.y = document.getElementsByTagName("A").namedItem(elementname).offsetTop;
  objnew.x = document.getElementsByTagName("DIV").namedItem(elementid).offsetLeft;
  objnew.y = document.getElementsByTagName("DIV").namedItem(elementid).offsetTop;
 } else if (document.all) {
  objtmp = obj;
  objnew.x = objtmp.offsetLeft;
  objnew.y = objtmp.offsetTop;
  while ((objtmp = objtmp.offsetParent) != null) {
   objnew.x += objtmp.offsetLeft;
   objnew.y += objtmp.offsetTop;
  }
 } else if (document.layers) {
  objnew.x = document.anchors[elementname].x;
  objnew.y = document.anchors[elementname].y;
 } else {
  objnew.x = 0;
  objnew.y = 0;
 }
 return objnew;
}

function jumpToAnchor(elementname, elementid) {
 if (getAnchorPosObj(elementname, elementid).x != 0 || getAnchorPosObj(elementname, elementid).y != 0) {
  pageScroll(0,getAnchorPosObj(elementname, elementid).y,5);
 } else {
  location.hash = elementname;
 }
}


//==============================================================================
//ポップアップウィンドウを開く（MUFG）
//==============================================================================
function Popup1(Link,breite,hoehe){
var iMyWidth = (window.screen.width) - (breite + 80);
var iMyHeight = (window.screen.height) - (hoehe + 150);
var win_MUFGpop = window.open(Link ,"MUFGpop","toolbar=yes,location=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=" + breite + ",height=" + hoehe + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
win_MUFGpop.focus();
}

function Popup_qa(Link){
breite=800;
hoehe=600;
var iMyWidth = (window.screen.width) - (breite + 80);
var iMyHeight = (window.screen.height) - (hoehe + 150);
var win_MUFGpop_qa = window.open(Link ,"MUFGpop_qa","toolbar=yes,location=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=" + breite + ",height=" + hoehe + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
win_MUFGpop_qa.focus();
}

function Popup_syokai(Link){
breite=980;
hoehe=600;
var iMyWidth = (window.screen.width) - (breite + 80);
var iMyHeight = (window.screen.height) - (hoehe + 150);
var win_MUFGpop_syokai = window.open(Link ,"MUFGpop_syokai","toolbar=no,scrollbars=yes,status=yes,resizable=yes,menubar=yes,location=yes,width=" + breite + ",height=" + hoehe + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
win_MUFGpop_syokai.focus();
}

//------------------------------------------------------------------------------
//ポップアップウィンドウからさらにポップアップウィンドウを開くためのもの

function Popup2(Link,breite,hoehe){
var iMyWidth = (window.screen.width) - (breite + 80);
var iMyHeight = (window.screen.height) - (hoehe + 150);
var win_MUFGpop2 = window.open(Link ,"MUFGpop2","toolbar=yes,location=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=" + breite + ",height=" + hoehe + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
win_MUFGpop2.focus();
}

function Popup3(Link,breite,hoehe){
var iMyWidth = (window.screen.width) - (breite + 80);
var iMyHeight = (window.screen.height) - (hoehe + 150);
var win_MUFGpop3 = window.open(Link ,"MUFGpop3","toolbar=yes,location=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes,width=" + breite + ",height=" + hoehe + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight);
win_MUFGpop3.focus();
}
//------------------------------------------------------------------------------

//==============================================================================
//ポップアップウィンドウを開く（旧UFJ）
//==============================================================================
function open_popup(wURL,wName,wOption){
	newwin = window.open(wURL,wName,wOption);
	newwin.focus();
}

// ポップアップで開かれた子ウィンドウから親を呼び出す関数

function oya_change(url){
	ua = getnavi();
	
	if (ua[0] != 'safari'){
		oya = window.open( url, 'OYA', 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes' );
	}
	else {
		oya = window.opener;
		if (oya == NULL){
			oya = window.open( url, 'OYA', 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes' );
		}
		else {
			oya.location.href = url;
		}
	}
	if ((ua[0] == 'IE') && (ua[3].indexOf("5") > -1)) {
		self.blur();
	} else {
		oya.focus();
	}
}


