/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 Dream Weaver Function

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  subWin = window.open(theURL,winName,features);
		subWin.focus();
}

function CS_openBrWindow(theURL,winName,features) { //v2.0
  subWin = window.open(theURL,winName,features);
		subWin.focus();
}

function MM_reloadPage(init) {	//reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
  	if (obj.parentNode && obj.parentNode.className == "posRelative"){
		obj.parentNode.style.zIndex = (obj.parentNode.style.zIndex==10)?0:10;
	}
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}

function gaPassthru(category, action) {
	pageTracker._trackEvent(category, action);
}



var metaphase_stripedTable = {
	main : function(){
		var table = document.getElementsByTagName("table"),
		tr, i, j, k, oddRow, headRow, group, currentNum, totalNum;

		for(var i=0; i<table.length; i++){
			tr = table[i].getElementsByTagName("tr");
			oddRow	= true; //true = odd, false = even

			for(var j=0; j< tr.length; j++){
				headRow = true;
				if(tr[j].parentNode.nodeName.toLowerCase() == "thead"){
					headRow = true;
				}
				else{
					for(var k=0; k < tr[j].childNodes.length; k++){
						if(tr[j].childNodes[k].nodeName.toLowerCase() == "td"){
							headRow = false;
						}
					}
				}

				if(!headRow&&(tr[j].parentNode.parentNode==table[i]||tr[j].parentNode==table[i])){
					tr[j].className += oddRow ? " odd" : " even";

					if(tr[j].className.match(/\brow[0-9]+-[0-9]+\b/)){
						group = String(tr[j].className.match(/\brow[0-9]+-[0-9]+\b/));
						currentNum = group.slice(group.indexOf("row")+3,group.indexOf("-"));
						totalNum   = group.slice(group.indexOf("-")+1,group.length);
						if(currentNum == totalNum){
							oddRow = oddRow ? false : true;
						}
					}
					else{
						oddRow = oddRow ? false : true;
					}
				}
				else{	oddRow = true;	}

			}
		}
	},
	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}
metaphase_stripedTable.addEvent();


function isearch(obj){
	//alert(obj.innerHTML);
	var actionHost = (("https:" == document.location.protocol) ? "https://" : "http://");
	var query;
	var action_ = actionHost + "cilabo.dga.jp";
	var form_	= document.forms[0];
	query =  (obj.innerHTML) ? (obj.innerHTML) : "";
	form_.method="post";
	form_.action = action_;
	form_.kw.value = query;
	form_.ie.value = "s";

	if (checkexist()) {
		document.forms[0].submit();
		return mysearch();
		//location.href = action_+"?ie=s&kw="+escape(query);
		//return;
	}
	else {
		return false;
	}
//alert(query);

}

function checkexist() {
	//alert(document.forms[0]);
	if (document.forms[0] == "undefined") {
		return false;
	}
	else {
		form_ = document.forms[0];
		//alert(form_.kw);alert(form_.ie);
		if (form_.kw == "undefined") {
			return false;
		}
		if (form_.ie == "undefined") {
			return false;
		}
	}
	return true;
}
//URL Encode (UTF-8)
function encoder(str) {
  var character = '';
  var unicode	= '';
  var string	= '';
  var i 		= 0;

  for (i = 0; i < str.length; i++) {
	character = str.charAt(i);
	unicode   = str.charCodeAt(i);

	if (character == ' ') {
	  string += '+';
	} else {
	  if (unicode == 0x2a || unicode == 0x2d || unicode == 0x2e || unicode == 0x5f || ((unicode >= 0x30) && (unicode <= 0x39)) || ((unicode >= 0x41) && (unicode <= 0x5a)) || ((unicode >= 0x61) && (unicode <= 0x7a))) {
		string = string + character;
	  } else {
		if ((unicode >= 0x0) && (unicode <= 0x7f)) {
		  character   = '0' + unicode.toString(16);
		  string += '%' + character.substr(character.length - 2);
		} else if (unicode > 0x1fffff) {
		  string += '%' + (oxf0 + ((unicode & 0x1c0000) >> 18)).toString(16);
		  string += '%' + (0x80 + ((unicode & 0x3f000) >> 12)).toString(16);
		  string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
		  string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
		} else if (unicode > 0x7ff) {
		  string += '%' + (0xe0 + ((unicode & 0xf000) >> 12)).toString(16);
		  string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
		  string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
		} else {
		  string += '%' + (0xc0 + ((unicode & 0x7c0) >> 6)).toString(16);
		  string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
		}
	  }
	}
  }

  return string;
}

var metaphase_rollover = {
	preLoad : {},
	main : function() {
		var img = document.images, i, preLoadImg;
			for (i = 0; i <img.length; i++) {
			if ((img[i].src.match(/.*_n\./))||(img[i].style.filter)){
				var preLoadImg = new Image;
				preLoadImg.src = img[i].src.replace('_n.', '_r.');
				metaphase_rollover.preLoad[img[i].src] = preLoadImg.src;
				img[i].onmouseover = metaphase_rollover.over;
				img[i].onmouseout  = metaphase_rollover.out;
			}
		}
	},
	over : function() {
		var imgSrc, preLoadImgSrc;
		if((this.style.filter)&&(this.style.filter.match(/_n\.png/))){//(IE5.5-6 && png)
			imgSrc = (this.style.filter.match(/src=.*\)/)+"").slice(5,-2);
			preLoadImgSrc = metaphase_rollover.preLoad[imgSrc];
			this.style.filter = this.style.filter.replace(imgSrc, preLoadImgSrc);
		}
		else{
			this.src = metaphase_rollover.preLoad[this.src];
		}
	},
	out : function(){
		if((this.style.filter)&&(this.style.filter.match(/_r\.png/))){//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_r.png', '_n.png');
		}
		else{
			this.src = this.src.replace('_r.', '_n.');
		}
	},
	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}
metaphase_rollover.addEvent();


(function() {
	try {
		window.addEventListener("load", arguments[0], false);
	} catch(e) {
		window.attachEvent("onload", arguments[0]);
	}
})(function() {
	var input = document.getElementsByTagName('input');
	for(var i=0;i<input.length;i++){
		if(input[i].getAttribute('type').match(/text|password/) && input[i].getAttribute('id') != "txtKeyword" && input[i].getAttribute('id') != "txtKeywordHeader"){
			input[i].onfocus = function(){
				var div = this.parentNode.getElementsByTagName('div');
				for(var i = 0; i < div.length; i++)
				if(div[i].className.match(/^helpLayer02$/)){
					div[i].style.display = 'block';
					div[i].style.zIndex = 5;
					div[i].style.top	 = this.offsetTop - div[i].offsetHeight + 'px';
					div[i].style.left	 = this.offsetLeft + 'px';
					if (/*@cc_on!@*/false && location.href.match(/^http:\/\//)) {
						var iframe = document.createElement('iframe');
						iframe.style.height  = div[i].offsetHeight - 10 + 'px';
						iframe.style.width	 = div[i].offsetWidth + 'px';
						iframe.style.position= 'absolute'
						iframe.style.top	 = getElementPosition(div[i]).posTop + 'px';
						iframe.style.left	 = getElementPosition(div[i]).posLeft - 8 + 'px';
						iframe.style.zIndex  = 1;
						iframe.id='helpLayer02-bg';
						document.getElementById('document').appendChild(iframe);
					}
				}
			}
			input[i].onblur = function(){
				var div = this.parentNode.getElementsByTagName('div');
				for(var i = 0; i < div.length; i++)
				if(div[i].className.match(/^helpLayer02$/)){
					if (document.getElementById('helpLayer02-bg'))
						document.getElementById('document').removeChild(document.getElementById('helpLayer02-bg'))
					div[i].style.display = 'none';
				}
			}
		}
	}
	var getElementPosition = function(element) {
		var posTop = posLeft = 0;
		do {
			posTop	+= element.offsetTop  || 0;
			posLeft += element.offsetLeft || 0;
			element =  element.offsetParent;
		}
		while (element);
		return {posTop: posTop, posLeft: posLeft};
	}
});

var metaphase_openWin = {
	conf : {
		className : "external",
		fileTypes : ["pdf","doc","xls","ppt"]
	},
	main : function(){
		var fileTypesReg = "/";
		for(i = 0; i <metaphase_openWin.conf.fileTypes.length; i++){
			fileTypesReg += "\\."+metaphase_openWin.conf.fileTypes[i]+"$|";
		}
		fileTypesReg=fileTypesReg.slice(0, -1)+"/";
		var a = document.links;
		for (i = 0; i < a.length; i++) {
			if (new RegExp("\\b" + metaphase_openWin.conf.className + "\\b").exec(a[i].className)||
				(new RegExp(fileTypesReg).exec(a[i].getAttribute("href")))){
				a[i].onclick = metaphase_openWin.openWin;
				a[i].onkeypress = metaphase_openWin.openWin;
			}
		}
	},
	openWin : function(){
		window.open(this.href, "", "toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, close=yes");
		return false;
	},
	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}
var openSubWin = function(path, w, h){
	var newWindow = window.open(path, 'syosai', 'width = ' + w + ', height = ' + h + ', scrollbars = 1, resizable = 1');
	newWindow.focus();
}
metaphase_openWin.addEvent();

var backToTop = {
	conf : {
		topFlag : "#document" //"ページの先頭へ戻る"のhrefの値
	},
	main : function () {
		var x1 = x2 = x3 = 0;
		var y1 = y2 = y3 = 0;
		if (document.documentElement) {
			x1 = document.documentElement.scrollLeft || 0;
			y1 = document.documentElement.scrollTop || 0;
		}
		if (document.body) {
			x2 = document.body.scrollLeft || 0;
			y2 = document.body.scrollTop || 0;
		}
		x3 = window.scrollX || 0;
		y3 = window.scrollY || 0;
		var x = Math.max(x1, Math.max(x2, x3));
		var y = Math.max(y1, Math.max(y2, y3));
		window.scrollTo(Math.floor(x / 1.3), Math.floor(y / 1.3));
		if (x > 0 || y > 0) {
			window.setTimeout("backToTop.main()", 15);
		}
		//else if (navigator.userAgent.indexOf("AppleWebKit") == -1){
		//location.href = backToTopBootConf.topFlag;
		//}
	},
	set : function () {
		var a = document.links;
		for(i=0;i<a .length;i++){
			if(new RegExp(backToTop.conf.topFlag + "\\b").exec(a[i].href)) {
				a[i].onclick = function(){
					this.removeAttribute("href")
					backToTop.main();
					this.setAttribute("href",backToTop.conf.topFlag);
					return false;
				}
			}
		}
	},
	addEvent : function(){
		try {
			window.addEventListener('load', backToTop.set, false);
		} catch (e) {
			window.attachEvent('onload', backToTop.set);
		}
	}
}
backToTop.addEvent();

var yomotsuModalWindow = {
		conf : {
			triggerClassName	   : "show-detail",
			//displayBasePositionTop : 150, // ( px )
			displayBaseMaxWidth    : 936, // ( px )
			backgroundMaxOpacity   : 0.70 // [ 0.00 ~ 1.00 ]
		},
		start : function(){
			try {
				window.addEventListener('load', this.trigger, false);
			} catch (e) {
				window.attachEvent('onload', this.trigger);
			}
		},
		trigger : function(){
			var a = document.links;
			for(var i=0; i<a.length; i++){
				if(new RegExp("\\b" + yomotsuModalWindow.conf.triggerClassName + "\\b").exec(a[i].className)){
					a[i].onclick = function(){
						if(this.href.match(/\..*html?|\.xml|\.php|\.asp/)){
							yomotsuModalWindow.set(this.href);
							return false;
						}
					}
				}
			}
		},
		set : function(URI){
			if(document.getElementById("display-base")) return;
			var displayBase = document.createElement("div");
			displayBase.id = "display-base";
			displayBase.style.position = "absolute";
			displayBase.style.zIndex   = "100";
			displayBase.style.top	   = '-9999px';
			displayBase.style.left	   = '-9999px';
			displayBase.style.width    = yomotsuModalWindow.conf.displayBaseMaxWidth + "px";
			document.body.appendChild(displayBase);
			background.set();
			this.getHTMLSrc(URI);
		},
		replace : function(URI){
			this.getHTMLSrc(URI);
		},
		getHTMLSrc : function(URI){
			var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {
			try 	 { return new ActiveXObject("Msxml2.XMLHTTP");	  }
			catch(e) { return new ActiveXObject("Microsoft.XMLHTTP"); }
			})();
			req.onreadystatechange = function(){
			if (req.readyState != 4 ) return ;
			if (req.status == 200 || req.status==0) {
							var resText = req.responseText;
							if ( navigator.appVersion.indexOf( "KHTML" ) > -1 ) {
								var esc = escape( resText );
								if ( esc.indexOf("%u") < 0 && esc.indexOf("%") > -1 ) {
									resText = decodeURIComponent( esc );
								}
							}

							if(resText.match(/<body.*>/)){
								var htmlBodyStart = resText.indexOf("<body")+(resText.match(/<body.*>/)+"").length;
								var htmlBodyEnd   = resText.indexOf("</body>");
								resText = resText.slice(htmlBodyStart,htmlBodyEnd);
							}
							document.getElementById("display-base").innerHTML = resText;
							yomotsuModalWindow.alignment();
							background.fix()
						}
						else{
							if(document.getElementById("display-base").childNodes){
								var displayBase = document.getElementById("display-base");
								displayBase.innerHTML = "<p style='background:#fff;'>loading...</p>";
								yomotsuModalWindow.alignment();
							}
						}
					}
					req.open('GET', URI, true);
					req.send(null);
				},

		alignment : function(){
		var i, childWidth, contentMaxWidth = 0, displayBase = document.getElementById("display-base");
		for( i=0 ; i<displayBase.childNodes.length ; i++){
			childWidth = displayBase.childNodes[i].offsetWidth;
			contentMaxWidth = contentMaxWidth < childWidth ? childWidth : contentMaxWidth ;
		}
		var displayBaseWidth	= Math.min(yomotsuModalWindow.conf.displayBaseMaxWidth, contentMaxWidth) ;
		var displayBaseTop		= Math.max(getPageOffset().yOffset + Math.floor(getClientSize().height / 2 - displayBase.offsetHeight / 2),getPageOffset().yOffset);
		displayBase.style.width = displayBaseWidth + "px";
		displayBase.style.top	= displayBaseTop + 'px';
		displayBase.style.left	= getPageSize().width / 2 - ( displayBaseWidth / 2) + "px";
	},
	remove : function(){
		var displayBase = document.getElementById("display-base");
		if(displayBase)
		document.body.removeChild(displayBase);
		background.remove();
	}

}
yomotsuModalWindow.start();


			//-----------------------------------------------------
			//	get page size
			//-----------------------------------------------------

			var getPageSize = function(){
				var w1=w2=h1=h2=0, width, height;

				if (document.documentElement) {
					w1 = document.documentElement.scrollWidth;
					h1 = document.documentElement.scrollHeight;
				}

				if (document.body) {
					w2 = document.body.scrollWidth;
					h2 = document.body.scrollHeight;
				}

				var width  = Math.max(w1, w2);
				var height = Math.max(h1, h2);

				return {width: width, height: height};
			}

			//---------------------------

			var getPageOffset = function(){
				return {
					xOffset: document.body.scrollLeft || document.documentElement.scrollLeft,
					yOffset: document.body.scrollTop  || document.documentElement.scrollTop
				};

			}

			var getClientSize = function(){
				return {
					width : window.innerWidth ? window.innerWidth : ( document.documentElement && document.documentElement.clientWidth != 0 ) ? document.documentElement.clientWidth : document.body.clientWidth,
					height : window.innerHeight ? window.innerHeight : ( document.documentElement && document.documentElement.clientHeight != 0 ) ? document.documentElement.clientHeight : document.body.clientHeight
					};
			}

			//-----------------------------------------------------
			//	background
			//-----------------------------------------------------


			var background = {
				conf : {
					id : "back-screen"
				},

				alpha : 0,

				set : function(){
					this.hideSelectElements(); // for IE 6 select-zIndex BUG
					var bg = document.createElement("div");

					bg.id = this.conf.id;
					bg.style.position = "absolute";
					bg.style.left	  = 0;
					bg.style.top	  = 0;
					bg.style.zIndex   = 99;
					//bg.style.width	= Math.max(getPageSize().width, yomotsuModalWindow.conf.displayBaseMaxWidth) +"px";
					bg.style.width	  = "100%";
					bg.style.height   = getPageSize().height +"px";
					bg.style.filter 	="alpha(opacity="+this.alpha*100+")";
					bg.style.MozOpacity =this.alpha;
					bg.style.opacity	=this.alpha;

					document.body.appendChild(bg);

					this.alpha = 0;
					this.fadeIn();
				},

				fadeIn : function(){
					var bg = document.getElementById(this.conf.id);
					this.alpha += 0.10;
					if(bg.style.opacity)			bg.style.opacity	= this.alpha;
					else if(bg.style.filter)		bg.style.filter 	= "alpha(opacity="+this.alpha*100+")";
					if (this.alpha < yomotsuModalWindow.conf.backgroundMaxOpacity ) {
						bg.onclick = function(){return};
						window.setTimeout("background.fadeIn()", 25);
					}
					else {
						bg.onclick = yomotsuModalWindow.remove;
					}
				},

				fadeOut : function(){
					var bg = document.getElementById(this.conf.id);
					bg.onclick = function(){return};
					this.alpha -= 0.10;
					if(bg.style.opacity)			bg.style.opacity	= this.alpha;
					else if(bg.style.filter)		bg.style.filter 	= "alpha(opacity="+this.alpha*100+")";
					if (this.alpha > 0.05) {
						window.setTimeout("background.fadeOut()", 20);
					}
					else{
						document.body.removeChild(bg);
						this.alpha = 0;
					}
				},

				remove : function(){
					var bg = document.getElementById(background.conf.id);
					if(bg)
						this.fadeOut();
					this.showSelectElements(); // for IE 6 select-zIndex BUG
				},

				fix : function(){
					var bg = document.getElementById(background.conf.id);
					if(bg){
						//bg.style.width  = getPageSize().width  +"px";
						bg.style.width	= "100%";
						bg.style.height = getPageSize().height +"px";
					}
				},

				//-----------------------------------------------------
				//	select elements z-index BUG ( IE 6 )
				//-----------------------------------------------------

				hideSelectElements : function(){
					if ((typeof document.documentElement.style.zoom != "undefined")&&(typeof document.documentElement.style.msInterpolationMode == "undefined")){
						var selectEle = document.getElementsByTagName("select");
						for(i=0;i<selectEle.length;i++){
							selectEle[i].style.visibility = "hidden";
						}

						var selectEle2 = document.getElementById("display-base").getElementsByTagName("select")
						for(i=0;i<selectEle2.length;i++){
							selectEle[i].selectEle2.visibility = "visible";
						}
					}
				},

				showSelectElements : function (){
					if ((typeof document.documentElement.style.zoom != "undefined")&&(typeof document.documentElement.style.msInterpolationMode == "undefined")){
						var selectEle = document.getElementsByTagName("select");
						for(i=0;i<selectEle.length;i++){
							selectEle[i].style.visibility = "visible";
						}
					}
				}

			}

			try {
				window.addEventListener('resize', background.fix, false);
			} catch (e) {
				window.attachEvent('onresize', background.fix);
			}
