
function errorCheck() {
	if (document.sForm.sText.value == "") {
		alert("キーワードを入力してください。");
		document.sForm.sText.focus();
		return false;
	} else {
		return true;
	}
}
function toolsHide(name) {
	if (name == "1" || name == "") {
		document.getElementById("tools").style.display = "none";
	} else {
		document.getElementById("tools").style.display = "inline";
	}
	setCookieTools(name);
}

function radioDefault(name) {
	if (name == "1" || name == "") {
		document.sForm.sRadio[0].checked = true;
	} else {
		document.sForm.sRadio[1].checked = true;
	}
}
function selectDefault(name) {
	for (n=0; document.sForm.sSelect.options.length > n; n++) {
		if (document.sForm.sSelect.options[n].value == name) {
			document.sForm.sSelect.options[n].selected = true;
		}
	}
}

function setCookieTools(key) {
	document.cookie = "tools=" + key + "; path=/; expires=" + calcTime() + ";";
	//alert("クッキー格納：tools=" + key + "; path=/; expires=" + calcTime() + ";");
}
function setCookieTool(key) {
	document.cookie = "tool=" + key + "; path=/; expires=" + calcTime() + ";";
	//alert("クッキー格納：tool=" + key + "; path=/; expires=" + calcTime() + ";");

}
function calcTime() {
	time = new Date;
	time.setMonth(time.getMonth() + 1);
	time_char = time.toGMTString();
	time_char = time_char.replace('UTC','GMT');
	return time_char;
}
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("");
}
