JorE = "ja"

function mySetCookie(myCookie,myValue,myDay){
   myExp = new Date();
   myExp.setTime(myExp.getTime()+(myDay*24*60*60*1000));
   myItem = "@" + myCookie + "=" + escape(myValue) + ";";
   myExpires = "expires="+myExp.toGMTString();
   top.document.cookie =  myItem + myExpires;
}

function myGetCookie(myCookie){
   myCookie = "@" + myCookie + "=";
   myValue = null;
   myStr = top.document.cookie + ";" ;
   myOfst = myStr.indexOf(myCookie);
   if (myOfst != -1){
      myStart = myOfst + myCookie.length;
      myEnd   = myStr.indexOf(";" , myStart);
      myValue = unescape(myStr.substring(myStart,myEnd));
   }
   return myValue;
}

function openWin(file_path,name){
	myWin = window.open( file_path,name,
	"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,height=650,width=600");
}

function closeWin(){
	window.close();
}

function changeHTML(frame_name,file_path){
	f = window.open(file_path,frame_name);
}


function changeBorder(id,color){
	width = document.getElementById(id).style.width;
	height = document.getElementById(id).style.height;
	
	document.getElementById(id).style.borderColor = color;

}

function clearBorder(id,color){
	document.getElementById(id).style.borderColor = color;

}


function changeColor(id,color){
	document.getElementById(id).style.color = color;
	if((old_id != "")&(old_id != id)){//処理が追いつかない場合クリアされないため、回避用。
		document.getElementById(clear_id).style.color = clear_color;
	}
}
function changeColorClear(id,color){
	clear_id = id;
	clear_color = color;
	document.getElementById(id).style.color = color;
}

function changePic(name,file_path){
	//document.name.src = file_path;
	document.getElementById("name").name.src = "./img/nenpou/nenpou2.jpg"
}

function changeDisplay(id,option){
	document.getElementById(id).style.display = option;
}

function changeDisplayS(id,option){

	if (self.findDivId(id) == true) {
		parent.rbottom.document.getElementById(id).style.display = option;
	}
}

function findDivId(parents) {
	objDiv=parent.rbottom.document.getElementsByTagName('div');

	objRegex = new RegExp(parents);

	for(i=0; i < objDiv.length; i++){
		if(objDiv[i].id.match(objRegex)){
			return true;
		}
	}
}

function changeBcolor(id,color){
	document.getElementById(id).style.backgroundColor = color;
}

function selectTab(id,columnId){
	color = "#DDDDFF";
	option = "block";
	borderStyle = "solid";
	borderNone = "none";
	fontSize = "100%";
	fontColor = "#000000";

	self.mySetCookie(id,"yes",1);


	changeBcolor(id,color);
	changeDisplay(columnId,option);
	document.getElementById(id).style.borderWidth = "1px";
	document.getElementById(id).style.borderBottomStyle = borderNone;
	document.getElementById(id).style.borderTopStyle = borderStyle;
	document.getElementById(id).style.borderLeftStyle = borderStyle;
	document.getElementById(id).style.borderRightStyle = borderStyle;
	document.getElementById(id).style.fontSize = fontSize;
	document.getElementById(id).style.color = fontColor;


}

function selectTabS(id,columnId){
	color = "#DDDDFF";
	option = "block";
	fontSize = "100%";
	fontColor = "#000000";

	self.mySetCookie(id,"yes",1);

	changeBcolor(id,color);
	changeDisplayS(columnId,option);
	document.getElementById(id).style.fontSize = fontSize;
	document.getElementById(id).style.color = fontColor;

}

function clearTab(id,columnId){
	color = "#EEEEFF";
	option = "none";
	borderStyle = "solid";
	borderNone = "none";
	fontSize = "95%";
	fontColor = "#AAAAAA";

	self.mySetCookie(id,"no",1);

	changeDisplay(columnId,option);
	changeBcolor(id,color);
	document.getElementById(id).style.borderWidth = "1px";
	document.getElementById(id).style.borderBottomStyle = borderStyle;
	document.getElementById(id).style.borderTopStyle = borderNone;
	document.getElementById(id).style.borderLeftStyle = borderNone;
	document.getElementById(id).style.borderRightStyle = borderNone;
	document.getElementById(id).style.fontSize = fontSize;
	document.getElementById(id).style.color = fontColor;


}

function clearTabS(id,columnId){
	color = "#EEEEFF";
	option = "none";
	fontSize = "95%";
	fontColor = "#AAAAAA";

	self.mySetCookie(id,"no",1);

	changeDisplayS(columnId,option);
	changeBcolor(id,color);
	document.getElementById(id).style.fontSize = fontSize;
	document.getElementById(id).style.color = fontColor;


}

function selectedE(jId,jColumnId,eId,eColumnId){
	id = self.myGetCookie(eId)
	if(id == "yes"){
		self.clearTab(jId,jColumnId);
		self.selectTab(eId,eColumnId);	
	}
}

function selectedES(jId,jColumnId,eId,eColumnId){
	id = self.myGetCookie(eId)
	if(id == "yes"){
		self.changeDisplayS(jColumnId,"none");
		self.changeDisplayS(eColumnId,"block");
	}
}
function selectedEC(jId,jColumnId,eId,eColumnId){
	sFontSize ="100%"; 
	sFontColor = "#000000";
	sColor = "#DDDDFF";
	cFontSize ="95%"; 
	cFontColor = "#AAAAAA";
	cColor = "#EEEEFF";
	
	id = self.myGetCookie(eId)
	if(id == "yes"){
		changeBcolor(jId,cColor);
		document.getElementById(jId).style.fontSize = cFontSize;
		document.getElementById(jId).style.color = cFontColor;

		changeBcolor(eId,sColor);
		document.getElementById(eId).style.fontSize = sFontSize;
		document.getElementById(eId).style.color = sFontColor;	}
}
