//マウスオーバー時、画像変更
function changeImage(imgName,imgURL){
	document.images[imgName].src = imgURL;
}
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_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_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 subWins(pages){
	w=window.open(pages,"gisu","toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=10,top=10");
	w.focus();
}
function subWins2(pages, title){
	w=window.open(pages, title,"toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=10,top=10");
	w.focus();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function JumpPage(TopURL,MainURL) { //v2.0
	newwin = window.open('', '_top');
	newwin.document.open();
	newwin.document.writeln('<HTML><HEAD><title>中央労働災害防止協会</title><','/HEAD>');
	newwin.document.write('<frameset rows="110,*" frameborder="NO" border="0" framespacing="0">');
	newwin.document.write('<frame src="',TopURL,'" name="topFrame" scrolling="NO" noresize >');
	newwin.document.write('<frame src="',MainURL,'" name="mainFrame">');
	newwin.document.writeln('</frameset>');
	newwin.document.writeln('<noframes><body>');
	newwin.document.write('<','/BODY><','/noframes><','/HTML>');
	newwin.document.close();
}

/*14日間Newを表示する
	HTMLに埋め込む部分　　<script type="text/javascript">newMark(2008,04,04)</script>　　HTMLに埋め込む部分*/
function newMark(y,m,d) {
	oldDay = new Date(y+"/"+m+"/"+d);
	newDay = new Date();
	n = (newDay - oldDay)/(1000*60*60*24);
	if (n <= 14) 
	document.write("<span class='red'>New</span>");
}

/*日付によって文字を変更する
	HTMLに埋め込む部分　　<script type="text/javascript">MessageDay(2008,3,14,'&nbsp;');</script>　　HTMLに埋め込む部分*/
function MessageDay(yy, mm, dd, msg1){
	var today = new Date();
    var xDay = new Date(yy, mm-1, dd);
    d = (xDay.getTime() - today.getTime()) / (24*60*60*1000);
    d = Math.ceil(d);
    if (d > -1){document.write(msg1);}
	else{document.write();}
}

function ImgEnd(yy, mm, dd,img1){
	var today = new Date();
    var xDay = new Date(yy, mm-1, dd);
    d = (xDay - today) / (24*60*60*1000);
    d = Math.ceil(d);
    if (0 <= d){document.write(img1);}
	else if(0 > d){document.write();}
}
/*締切り間近のセミナー・研修会一覧で使用　指定日表示し、指定日に非表示にする*/
function CountDay(y,m,d,msg1,yy,mm,dd){
    var today = new Date();
    var xDay = new Date(y,m-1,d);
	var iDay = new Date(yy,mm-1,dd);
	n = (xDay - today) / (24*60*60*1000);
    n = Math.ceil(n);
	d = (iDay - today) / (24*60*60*1000);
    d = Math.ceil(d);
	if (n > 0 || 0 > d){document.write();}
	else if(n <= 0 || 0 <= d){document.write(msg1);}
}
/*セミナー・研修会ページ「終了」を表示する際に使用
	HTMLに埋め込む部分　　<script type="text/javascript">Countend(年,月,日,'&nbsp;');</script>　　HTMLに埋め込む部分*/
function Countend(yy, mm, dd, msg1){
	var today = new Date();
    var xDay = new Date(yy, mm-1, dd);
    d = (xDay - today) / (24*60*60*1000);
    d = Math.ceil(d);
    if (d > 0){document.write(msg1);}
	else if(d <= 0){document.write("<span class='red'>終了</span>");}
}

/*日付によって文字を変更する リニューアル用
	HTMLに埋め込む部分　　<script type="text/javascript">Countdown1(2008, 3, 14, 0,'&nbsp;');</script>　　HTMLに埋め込む部分*/
function Countdown1(yy, mm, dd, days, msg1){
	var today = new Date();
    var xDay = new Date(yy, mm-1, dd);
    d = (xDay.getTime() - today.getTime()) / (24*60*60*1000);
    d = Math.ceil(d);
    if (d > 0){
      document.write(msg1);
    }else{
      if (d * -1 < days || days == 0){
        document.write("<span class='red'>終了</span>");
      }
    }
  }
 
/*タブ制御*/
function seltab(bpref, hpref, id_max,selected){
  if (! document.getElementById) return;
  for (i = 0; i <= id_max; i++) {
    if (! document.getElementById(bpref + i)) continue;
    if (i == selected) {
      document.getElementById(bpref + i).style.visibility = "visible";
      document.getElementById(bpref + i).style.position = "";
      document.getElementById(hpref + i).className = "open";
    } else {
      document.getElementById(bpref + i).style.visibility = "hidden";
      document.getElementById(bpref + i).style.position = "absolute";
      document.getElementById(hpref + i).className = "close";
}
  }
}

// 画像や文字をクリックしたら、表示する
function Display(id){
//location.reload();
if(document.all){
		if(document.all(id).style.display == "block"){document.all(id).style.display = "none";}
		else if(document.all(id).style.display == "none"){document.all(id).style.display = "block";}
	}else if(document.getElementById){
		if(document.getElementById(id).style.display == "block"){document.getElementById(id).style.display = "none";}
		else if(document.getElementById(id).style.display == "none"){document.getElementById(id).style.display = "block";}
	}
}

