

/* window open
----------------------------------------------- */
function subwindow(url) {
	var w = window.open(url,"infowindow","resizable=yes,toolbar=yes,scrollbars=yes,width=600,top=0,left=0");
	w.focus();
}


/* type check
----------------------------------------------- */
function typecheck() {
	var type = document.getElementById("type");
	var typeimage1 = document.getElementById("typeimage1");
	var typeimage2 = document.getElementById("typeimage2");
	var type1form = document.getElementById("type1form");
	var type2form = document.getElementById("type2form");
	
	if (eval(type.value) == 1) {
		typeimage1.src = "http://www.ortho-k.co.jp/contact/images/b_session_on.gif";
		typeimage2.src = "http://www.ortho-k.co.jp/contact/images/b_examination.gif";
		type1form.style.display = "block";
		type2form.style.display = "none";
	}
	else {
		typeimage1.src = "http://www.ortho-k.co.jp/contact/images/b_session.gif";
		typeimage2.src = "http://www.ortho-k.co.jp/contact/images/b_examination_on.gif";
		type1form.style.display = "none";
		type2form.style.display = "block";
	}
}


function typechanges(t) {
	var type = document.getElementById("type");
	type.value = t;
	typecheck();
}


/* css change
----------------------------------------------- */
function changeStyleseet(n) {
	var links = document.getElementsByTagName("link");
	for (i = 0; i <= 2; i++) {
		links.item(i).disabled = true;
		document.getElementById("fontSize" + i).src = "http://www.ortho-k.co.jp/common/b_font_" + i + ".gif";
	}
	links.item(eval(n)).disabled = false;
	document.getElementById("fontSize" + eval(n)).src = "http://www.ortho-k.co.jp/common/b_font_" + eval(n) + "_on.gif";
	setCookie("style",eval(n));
}

function styleCheck() {
	var style = getCookie("style");
	if (style == "") { style = 1; }
	document.getElementById("fontSize" + style).src = "http://www.ortho-k.co.jp/common/b_font_" + style + "_on.gif";
	changeStyleseet(style);
}


/* mouse over
----------------------------------------------- */
function fontSizeOver(n) {
	var style = getCookie("style");
	if (style != eval(n)) {
		document.getElementById("fontSize" + eval(n)).src = "http://www.ortho-k.co.jp/common/b_font_" + eval(n) + "_ov.gif";
	}
}
function fontSizeOut(n) {
	var style = getCookie("style");
	if (style != eval(n)) {
		document.getElementById("fontSize" + eval(n)).src = "http://www.ortho-k.co.jp/common/b_font_" + eval(n) + ".gif";
	}
}


/* page up
----------------------------------------------- */
function pageup() {
	if (document.all) { posi = document.body.scrollTop; }
	else { posi = window.pageYOffset; }
	moveObje(posi);
}
function moveObje(position) {
	move = position / 10;
	point = parseInt(position - move);
	scrollTo(0,point);
	if (point > 0) { setTimeout("moveObje(point)",1); }
}


/* Cookie
----------------------------------------------- */
function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
	tmp1 = " " + document.cookie + ";";
	xx1 = xx2 = 0;
	len = tmp1.length;
	while (xx1 < len) {
		xx2 = tmp1.indexOf(";", xx1);
		tmp2 = tmp1.substring(xx1 + 1, xx2);
		xx3 = tmp2.indexOf("=");
		if (tmp2.substring(0, xx3) == key) { return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1))); }
		xx1 = xx2 + 1;
	}
	return("");
}
function setCookie(key, val, tmp) {
	tmp = key + "=" + escape(val) + "; ";
	tmp += "domain=ortho-k.co.jp; ";
	tmp += "path=/; ";
	tmp += "expires=Fri, 31-Dec-2030 23:59:59; ";
	document.cookie = tmp;
}
function clearCookie(key) { document.cookie = key + "=" + "xx; expires=1-Jan-1997 00:00:00;"; }
