﻿function ChangeBgColor(obj1, obj2, bg){
	document.getElementById(obj1).style.backgroundColor = bg;
	document.getElementById(obj2).style.backgroundColor = "#FFE57B";
}

function ChangeBgColor2(obj, bg){
		document.getElementById(obj).style.backgroundColor = bg;
}

function ChangeBgColor30(bg){
	document.getElementById("tr0-2").style.backgroundColor = bg;
	document.getElementById("tr0-3").style.backgroundColor = bg;
	document.getElementById("tr0-4").style.backgroundColor = bg;
	document.getElementById("tr0-5").style.backgroundColor = bg;
	document.getElementById("tr0-6").style.backgroundColor = bg;
	document.getElementById("tr0-7").style.backgroundColor = bg;
	document.getElementById("tr0-8").style.backgroundColor = bg;
	document.getElementById("tr0-9").style.backgroundColor = bg;
	document.getElementById("tr0-10").style.backgroundColor = bg;
}
function ChangeBgColor31(bg){
	document.getElementById("tr1-2").style.backgroundColor = bg;
	document.getElementById("tr1-3").style.backgroundColor = bg;
	document.getElementById("tr1-4").style.backgroundColor = bg;
	document.getElementById("tr1-5").style.backgroundColor = bg;
	document.getElementById("tr1-6").style.backgroundColor = bg;
	document.getElementById("tr1-7").style.backgroundColor = bg;
	document.getElementById("tr1-8").style.backgroundColor = bg;
	document.getElementById("tr1-9").style.backgroundColor = bg;
	document.getElementById("tr1-10").style.backgroundColor = bg;
}
function ChangeBgColor32(bg){
	document.getElementById("tr2-2").style.backgroundColor = bg;
	document.getElementById("tr2-3").style.backgroundColor = bg;
	document.getElementById("tr2-4").style.backgroundColor = bg;
	document.getElementById("tr2-5").style.backgroundColor = bg;
	document.getElementById("tr2-6").style.backgroundColor = bg;
	document.getElementById("tr2-7").style.backgroundColor = bg;
	document.getElementById("tr2-8").style.backgroundColor = bg;
	document.getElementById("tr2-9").style.backgroundColor = bg;
	document.getElementById("tr2-10").style.backgroundColor = bg;
}
function ChangeBgColor33(bg){
	document.getElementById("tr3-2").style.backgroundColor = bg;
	document.getElementById("tr3-3").style.backgroundColor = bg;
	document.getElementById("tr3-4").style.backgroundColor = bg;
	document.getElementById("tr3-5").style.backgroundColor = bg;
	document.getElementById("tr3-6").style.backgroundColor = bg;
	document.getElementById("tr3-7").style.backgroundColor = bg;
	document.getElementById("tr3-8").style.backgroundColor = bg;
	document.getElementById("tr3-9").style.backgroundColor = bg;
	document.getElementById("tr3-10").style.backgroundColor = bg;
}




function cText(obj){
if(obj.value==obj.defaultValue){
obj.value="";
obj.style.color="#000";
}
}

function sText(obj){
if(obj.value==""){
obj.value=obj.defaultValue;
obj.style.color="#999";
}
}




function chkCkbox(o,type){
e = document.getElementById(o.name);
e.checked =! e.checked;
if(!e.checked){
	return;
}
var cnt=0;
if (type=='stn') {
var fname = 'station';
var chc=20;
var msg="駅が21駅以上選択されています。選択できる駅の数は20駅までです。";
}else if(type=='ln') {
var fname='transit';
var chc=5;
var msg="路線が6つ以上選択されています。選択できる路線の数は5つまでです。";
}else if(type=='geo') {
var fname='geo';
var chc=5;
var msg="地域が6つ以上選択されています。選択できる地域の数は5つまでです。";
}else {
	return;
}
var elementleng=document.forms[fname].elements[type].length;
for(i=0; i<elementleng; i++){
	if(document.forms[fname].elements[type][i].checked){
		cnt++;
		if(cnt>chc){e.checked=false;
			alert(msg);
			break;
		}
	}
}
}



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];}
}
