// JavaScript Document
<!--
function onSearch(val) {
	document.form1.head.value = val;
	document.form1.mode.value = 'h';
    document.form1.submit(); 
}
function onSearchP(val) {
	document.form1.p.value = val;
	document.form1.mode.value = 'p';
    document.form1.submit(); 
}
function onSearchR(val1,val2) {
	document.form1.line.value = val1;
	document.form1.rail.value = val2;
    document.form1.submit(); 
}
function onSearchS(val) {
	document.form1.station.value = val;
	document.form1.mode.value = 's';
    document.form1.submit(); 
}
function onSort(val) {
	document.form1.order.value = val;
	document.form1.mode.value = 'sort';
    document.form1.submit(); 
}

function check2postADD() {
	f = document.getElementById("form1");
	flg = 0;
	for (i = 0; i < f.length; i++) {
    	c = f[i];
		if (c.name == 'scs[]' && c.checked == true) {
			flg++;
		}
	}
	if (!flg) {
		alert("マイページに登録したい学校にチェックしてください");
		return false;
	} else {
		document.form1.mode.value = 'add';	
    	document.form1.submit(); 
	}
}
function check2postD() {
	var hs1 = document.getElementById("HensachiMin").value;
	var hs2 = document.getElementById("HensachiMax").value;
	// 全角数字→半角数字へ
	hs1 = hs1.replace(/[０-９]/g, function(hs1){return String.fromCharCode(hs1.charCodeAt(0)-65248);});
	hs2 = hs2.replace(/[０-９]/g, function(hs2){return String.fromCharCode(hs2.charCodeAt(0)-65248);});
	if ((hs1 != '' && (hs1 < 10 || hs1.match(/[^0-9]/))) || (hs2 != '' && (hs2 < 10 || hs2.match(/[^0-9]/)))) {
		alert("偏差値は、2桁の数字を入力してください");
		return false;
	} else {
		document.form1.mode.value = 'd';	
    	document.form1.submit(); 
	}
}
function onMonth(val) {
	document.form1.m.value = val;
    document.form1.submit(); 
}
function switchSelectG(n) {
	g = document.getElementById("selectG");
	gt = document.getElementById("selectGtext");
	s = document.getElementById("selectS");
	st = document.getElementById("selectStext");
	if ( n == 1 || n == 2) {
		g.style.visibility = 'visible';
		gt.style.visibility = 'hidden';
		s.style.visibility = 'visible';
		st.style.visibility = 'hidden';
	} else {
		g.style.visibility = 'hidden';
		gt.style.visibility = 'visible';
		s.style.visibility = 'hidden';
		st.style.visibility = 'visible';
	}
}
function OpenWin(theURL,winName,features){
	win=window.open(theURL,winName,features);
	win.moveTo(0,0);
}
function MM_goToURL() {
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function print_shinfo(url) {
	setTimeout("print_shinfo2('"+url+"')",1000);	
//	if(document.getElementById || document.layers){
//		setTimeout("window.print();",1000);		//印刷をします
//	}
//	location.href = url;
}
function print_shinfo2(url) {
	window.print();
	location.href = url;
}
function check2postPrint() {
	f = document.getElementById("form1");
	flg = 0;
	for (i = 0; i < f.length; i++) {
    	c = f[i];
		if (c.name == 'scs[]' && c.checked == true) {
			flg++;
		}
	}
	if (!flg) {
		alert("印刷したい学校にチェックしてください");
		return false;
	} else {	
    	document.form1.submit(); 
	}
}
function check2postImg() {
	f = document.getElementById("form1");
	flg = 0;
	for (i = 0; i < f.length; i++) {
    	c = f[i];
		if (c.name == 'scc[]' && c.checked == true) {
			flg++;
		}
	}
	if (!flg) {
		alert("印刷したい学校にチェックしてください");
		return false;
	} else {	
    	document.form1.submit(); 
	}
}
function addFavorite(TL) {
 var brw_v = navigator.appVersion.charAt(0);
 var brw_n = navigator.appName.charAt(0);
 if((brw_v >= 4)&&(brw_n == "M")){
  window.external.AddFavorite("http://www.school-data.com/index.php?fav", TL);
 } else {
  window.alert("Internet Explorer 4以上のみの対応です");
 }
}

function countMoji(id,num){
	o=document.getElementById('slen'+id);
	t=document.getElementById('textarea'+id);
	m=document.getElementById('mes'+id);
	m2=document.getElementById('mes2'+id);
	n=t.value.replace(/\s|　/gm,'').length;
	o.value=n;
	o.innerHTML=n;
//	o.style.color=(n>50)?'red':'MediumBlue';
//	m.innerHTML=(n>50)?'文字　文字制限を越えました　※入力は50字以内':'文字';
//	m2.innerHTML=(n>50)?'':'　あと'+(50-n)+'文字です。※入力は<font color="red">50字以内</font>';
//	m.style.color=(n>50)?'red':'black';
	o.style.color=(n>num)?'red':'MediumBlue';
	m.innerHTML=(n>num)?'文字　文字制限を越えました　※入力は'+num+'字以内':'文字';
	m2.innerHTML=(n>num)?'':'　あと'+(num-n)+'文字です。※入力は<font color="red">'+num+'字以内</font>';
	m.style.color=(n>num)?'red':'black';

	
}
function printAlert() {
	alert('プリンターの用紙設定をA4・横向きにして印刷してください。');
}


//-->
