var isNav, isIE;
var coll = "";
var styleObj = "";
if (parseInt(navigator.appVersion) >= 4) {
	if (navigator.appName == "Netscape") {
		isNav = true;
	} else {
		isIE = true;
		coll = "all.";
		styleObj = ".style";
	}
}

//function handleResize() {
//	location.reload();
//	return false;
//}
//if (isNav) {
//	window.captureEvents(Event.RESIZE);
//	window.onresize = handleResize;
//}

function getObject() {
	var theObj;
	var str = "";
	var arglen = getObject.arguments.length;
	var element = getObject.arguments[arglen - 1];
	if (typeof element == "string") {
		if (arglen > 1 && isNav) {
			for (var k = 0; k < arglen - 1; k++)
				str += "document." + getObject.arguments[k] + ".";
			str += "document." + element;
			theObj = eval(str);
		} else {
			theObj = eval("document." + coll + element + styleObj);
		}
	} else {
		theObj = element;
	}
	return theObj;
}

function shiftTo(obj, x, y) {
	var theObj = getObject(obj);
	if (isNav) {
		theObj.moveTo(x,y);
	} else {
		theObj.pixelLeft = x;
		theObj.pixelTop = y;
	}
}
function shiftBy(obj, deltaX, deltaY) {
	var theObj = getObject(obj);
	if (isNav) {
		theObj.moveBy(deltaX, deltaY);
	} else {
		theObj.pixelLeft += deltaX;
		theObj.pixelTop += deltaY;
	}
}
function setZIndex(obj, zOrder) {
	var theObj = getObject(obj);
	theObj.zIndex = zOrder;
}
function setBGColor(obj, color) {
	var theObj = getObject(obj);
	if (isNav) {
		theObj.bgColor = color;
	} else {
		theObj.backgroundColor = color;
	}
}
function show() {
	var c = 0;
	var obj = "getObject(";
	while (c < show.arguments.length) {
		obj += "\'" + show.arguments[c] + "\'";
		if (c != show.arguments.length - 1) obj += ",";
		c++;
	}
	obj += ")";
	var theObj = eval(obj);
	theObj.zIndex = 1;
	theObj.visibility = "visible";
}
function hide(){
	var c = 0;
	var obj = "getObject(";
	while (c < hide.arguments.length) {
		obj += "\'" + hide.arguments[c] + "\'";
		if (c != hide.arguments.length - 1) obj += ",";
		c++;
	}
	obj += ")";
	var theObj = eval(obj);
	theObj.visibility = "hidden";
	theObj.zIndex = 0;
}
function getObjLeft(obj) {
	var theObj = getObject(obj);
	if (isNav) {
		return theObj.left;
	} else {
		return theObj.pixelLeft;
	}
}
function getObjTop(obj) {
	var theObj = getObject(obj);
	if (isNav) {
		return theObj.top;
	} else {
		return theObj.pixelTop;
	}
}
function getObjHeight(obj) {
	if (isNav) {
		return obj.clip.height;
	} else {
		return obj.clientHeight;
	}
}
function getObjWidth(obj) {
	if (isNav) {
		return obj.clip.width;
	} else {
		return obj.clientWidth;
	}
}
function getInsideWindowWidth() {
	if (isNav) {
		return window.innerWidth;
	} else {
		return document.body.clientWidth;
	}
}
function getInsideWindowHeight() {
	if (isNav) {
		return window.innerHeight;
	} else {
		return document.body.clientHeight;
	}
}
function centerIt(name) {
	var obj = eval("document." + coll + name + styleObj);
	var contentObj = eval("document." + coll + name);
	var x = Math.round((getInsideWindowWidth()/2) - (getObjWidth(contentObj)/2));
	var y = getObjTop(obj);
	shiftTo(obj, x, y);
	obj.visibility = "visible";
}

function fullCenter(name) {
	var obj = eval("document." + coll + name + styleObj);
	var contentObj = eval("document." + coll + name);
	var x = Math.round((getInsideWindowWidth()/2) - (getObjWidth(contentObj)/2));
	var y = Math.round((getInsideWindowHeight()/2) - (getObjHeight(contentObj)/2));
	shiftTo(obj, x, y);
	obj.visibility = "visible";
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

var image_lib = new Array();
var image_count = 0;
function preload(name, src1, src2) {
image_lib[image_count] = new Array(3);
image_lib[image_count][0] = new Image();
image_lib[image_count][0].src = src1;
image_lib[image_count][1] = new Image();
image_lib[image_count][1].src = src2;
image_lib[image_count][2] = name;
image_count++
}
function changeit() {
	var str = "";
	var arglen = changeit.arguments.length;
	var elementName = changeit.arguments[arglen - 1];
	if(arglen > 1 && isNav) {
		var c = 0;
		var obj = "getObject(";
		while (c < arglen) {
			obj += "\'" + changeit.arguments[c] + "\'";
			if (c != arglen - 1) obj += ",";
			c++;
		}
		obj += ")";
		var the_image = eval(obj);
	} else {
		var the_image = document.images[elementName];
	}
	var c = 0;
	while (c < image_count) {
		if (elementName == image_lib[c][2])
			the_image.src = image_lib[c][1].src;
		c++;
	}
}
function changeitback() {
	var str = "";
	var arglen = changeitback.arguments.length;
	var elementName = changeitback.arguments[arglen - 1];
	if(arglen > 1 && isNav) {
		var c = 0;
		var obj = "getObject(";
		while (c < arglen) {
			obj += "\'" + changeitback.arguments[c] + "\'";
			if (c != arglen - 1) obj += ",";
			c++;
		}
		obj += ")";
		var the_image = eval(obj);
	} else {
		var the_image = document.images[elementName];
	}
	var c = 0;
	while (c < image_count) {
		if (elementName == image_lib[c][2])
			the_image.src = image_lib[c][0].src;
		c++;
	}
}

function getFullYear(d) {
var y = d.getYear();
if (y < 1000) y += 1900;
return y;
}
function today() {
var now = new Date();
var base = new Date(0);
var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    now.setTime (now.getTime() - skew);
var year = getFullYear(now);
document.write("平成" + (10 + (year - 1998)) + "年" + " ");
var month = now.getMonth();
document.write((month + 1) + "月" + " ");
var date = now.getDate();
document.write(date + "日" + " ");
var day = now.getDay();
week = new Array(7);
week[0] = "日";
week[1] = "月";
week[2] = "火";
week[3] = "水";
week[4] = "木";
week[5] = "金";
week[6] = "土";
document.write("(" + week[day] + ")");
}
