// ヘッダ用JavaScript
document.write('<script type="text/javascript" src="/script/import.js"></script>');
document.write('<script type="text/javascript" src="/script/jquery.js"></script>');
document.write("<link rel='stylesheet' href='/css/g_import.css' type='text/css'>");

document.write('<script type="text/javascript" src="/script/header.js"></script>');

// スタイルシート
if(navigator.appVersion.indexOf('Mac')!=-1)
	document.write("<link rel='stylesheet' href='/css/mac.css?date=' + (new Date()).getTime() + ' type='text/css'>");
else if(navigator.appName.charAt(0) == 'M')
	document.write("<link rel='stylesheet' href='/css/winie.css?date=' + (new Date()).getTime() + ' type='text/css'>");
else
	document.write("<link rel='stylesheet' href='/css/winnn.css?date=' + (new Date()).getTime() + ' type='text/css'>");
document.write("<link rel='stylesheet' href='/css/header.css?date=' + (new Date()).getTime() + ' type='text/css'>");

// カートを開く
function OpenCart(Url){

//	Url = Url.replace("seikyu/cart.asp?","sclbase/sclbase.asp?Mode=Seikyu&")
	Url = Url.replace("cart.asp?","nocart.asp?")
	top.location.href=Url;

//カート用
//	newwin=window.open(Url,"cart","width=600,height=350,alwaysRaised=yes,dependent=yes,titlebar=no,directories=no,location=no,scrollbars=yes,menubar=no,status=no,resizable=yes");
//	newwin.focus();
}

// 検索結果→カート
function SearchIntoCart(tp, id){
	location.href = "/success/seikyu/9p_cart.asp?scl_id=" + id + "&seikyu_tp=" + tp + "&mode=List";
}

// 画像先読み（引数は配列）
function preload_image(locList){
	if(document.images){
		for(var ii = 0; ii < locList.length; ii++){
			var locImg = new Image();
			locImg.src = locList[ii];
		}
	}
}

function logwrite(locType){
	if(document.images){
		var locImg = new Image();
		locImg.src = '/common/click_log.asp?click_tp=' + locType + '&url=' + escape(top.document.URL);
	}
}

function logwrite2(locType, locURL){
	if(document.images){
		var locImg = new Image();
		locImg.src = '/common/click_log.asp?click_tp=' + locType + '&url=' + locURL;
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// iframeの高さを取得する
function getIFrameHeight(locdiffHeight){
	var iHeight;

	if(window.innerHeight)
		iHeight = window.innerHeight-locdiffHeight;
	else if(document.body.clientHeight)
		iHeight = document.body.clientHeight-locdiffHeight;
	else
		iHeight = 450;
	if(iHeight < 200)
		iHeight = 200;
	return iHeight;
}

// チェックリストPOPUP用
var clist_win;
function OpenPopupWindowCheckList()
{
	//window.nameが未設定の場合、資料請求時にpost先のtargetが指定できないので自動設定する
	if(window.name==null||window.name=='')window.name=(new Date()).getTime();
	if(window.location.hostname == 'www.js88.com')window.location.href='http://school.js88.com/';
	if(clist_win!=null)clist_win.close();
	clist_win = window.open('/success/checklist/jsc_checklist.html','CheckListWindow',
		'width=640,height=800,top=0,menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes');
	clist_win.focus();
}

// 動画再生用
function movie_start(url, wndName){
	var oWin = window.open(url,wndName);
	setTimeout("oWin.close();",3000);
}

// マウスオーバー時のフィルター適用
function img_alpha_filter(obj,tp1,tp2){
	obj.style.filter = 'alpha(opacity=' + tp1 + ')';
	obj.style.opacity = tp2;
}

//-----------------------------------------------------------------------------
// 地図を表示 要jsapi.cgi
//-----------------------------------------------------------------------------
function JS_loadMap(map_id, ido, keido, shakudo) {
	if(ido=="" || keido==""){
		return;
	}
	var map = new ZdcMap(document.getElementById(map_id));
	map.setMapType(4);
	map.setMapLocation(new ZdcPoint(keido, ido, 2), shakudo);
	map.addMapControl(new ZdcControl(3, "large"));
	map.addMapCenter(new ZdcMapCenter());
	map.reflashMap();

	/* ユーザレイヤを作成する */
	var userlay = new ZdcUserLayer();
	userlay.setLayerScale(1, 18); // レイヤを1/5万から1/1500で動作させる

	/* アイコンを生成する */
	var icon = new ZdcIcon(); // デフォルトのアイコンを利用する

	/* マーカで緯度経度とアイコンを紐付ける */
	var mark = new ZdcMarker(new ZdcPoint(keido, ido, 2), icon);

	/* ユーザレイヤにマーカを追加する */
	userlay.addMarker(mark);

	/* 地図にユーザレイヤを追加する */
	map.addUserLayer(userlay);
}

//-----------------------------------------------------------------------------
// QRコード表示
//-----------------------------------------------------------------------------
function JS_QRCreate(QR, UBoundQR, SqrUBoundQR, dotPSel, id_name) {
	var locHTML = '', ii;

	locHTML = locHTML + '<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td align="center" valign="center" width="100%" height="100%">';
	locHTML = locHTML + '<table border="0" cellspacing="0" cellpadding="0" style="margin:4px;">';

	for(ii = 0; ii < UBoundQR; ii++){
		if(ii % SqrUBoundQR == 0)
			locHTML = locHTML + '<tr>';
		if(QR.charAt(ii) == '0')
			locHTML = locHTML + '<td bgcolor="#ffffff"><img src="/common_img/spacer.gif" style="vertical-align:baseline;" width="' + dotPSel + '" height="' + dotPSel + '" border="0"></td>';
		else
			locHTML = locHTML + '<td bgcolor="#000000"><img src="/common_img/spacer.gif" style="vertical-align:baseline;" width="' + dotPSel + '" height="' + dotPSel + '" border="0"></td>';
		if(ii % SqrUBoundQR == SqrUBoundQR-1)
			locHTML = locHTML + '</tr>';
	}
	locHTML = locHTML + '</table>';
	locHTML = locHTML + '</td></tr></table>';

	document.getElementById(id_name).innerHTML = locHTML;
}

//-----------------------------------------------------------------------------
// 説明会ページ
//-----------------------------------------------------------------------------
function OnOffDiv(ch) {
	var obj=document.all && document.all(ch) || document.getElementById && document.getElementById(ch);
	if(obj && obj.style) obj.style.display= "none" == obj.style.display ?"" : "none"
	var objtxt=document.all && document.all(ch + "_txt") || document.getElementById && document.getElementById(ch + "_txt");
	if(objtxt.innerHTML == "もとに戻す"){
		objtxt.innerHTML = "もっと見る";
	}else{
		objtxt.innerHTML = "もとに戻す";
	}
}

//-----------------------------------------------------------------------------
// 学部・学科・コース
//-----------------------------------------------------------------------------
function checkExpand(ch) {
	var obj=document.all && document.all(ch) || document.getElementById && document.getElementById(ch);
	if(obj && obj.style) obj.style.display= "none" == obj.style.display ?"" : "none"
	var objtxt=document.all && document.all(ch + "_txt") || document.getElementById && document.getElementById(ch + "_txt");
	if(objtxt.innerHTML == "もとに戻す"){
		objtxt.innerHTML = "もっと見る";
	}else{
		objtxt.innerHTML = "もとに戻す";
	}
}

//-----------------------------------------------------------------------------
// 動画で学校紹介
//-----------------------------------------------------------------------------
function movie_start(URL, file_nm){
	var oWin = window.open('/success/fe/movie_HPlink_log.asp?url=' + URL + '&mid=' + file_nm,'movie_win');
	setTimeout("oWin.close();",3000);
}

//-----------------------------------------------------------------------------
// 入試情報
//-----------------------------------------------------------------------------
function ExpandBlock(id){
	var div    = document.getElementById(id);
	var tuzuki = document.getElementById(id+'_tuzuki');
	var moto   = document.getElementById(id+'_moto');
	if(div.style.display=='none')
	{
		div.style.display='';
		tuzuki.style.display='none';
		moto.style.display='';
	}
	else
	{
		div.style.display='none';
		tuzuki.style.display='';
		moto.style.display='none';
	}
}
function ExpandBlock2(id){
	var div = document.getElementById(id);
	if(div.style.display=='none')
		div.style.display='';
	else
	div.style.display='none';
}

//-----------------------------------------------------------------------------
// キーワード検索
//-----------------------------------------------------------------------------
	function KeyWordSearcher(site, defmes){
		var tp, defmes;
		if(document.kWSearch.wd.value == defmes)
			document.kWSearch.wd.value = '';
			document.kWSearch.target = '_top';
			document.kWSearch.action = site;
			document.kWSearch.submit();
	}

function common_KeyWordForm(form_nm, site, defmes){
	var tp;
	var fm = document.getElementById(form_nm);
	if(fm.wd.value == defmes)
		fm.wd.value = '';
	fm.target = '_top';
	fm.action = site;
	fm.submit();
}

//-----------------------------------------------------------------------------
// ガイドブック検索
//-----------------------------------------------------------------------------
	function go88topBookSearch(site, defmes){
		var tp, defmes;
		if(document.search_88booktop.no.value == defmes)
			document.search_88booktop.no.value = '';
		document.search_88booktop.target = '_top';
		document.search_88booktop.action = site;
		document.search_88booktop.submit();
	}

//-----------------------------------------------------------------------------
// 資料請求データ受け渡し
//-----------------------------------------------------------------------------
	function SeikyuDataAdd(form_name){
		var forms = document.getElementById(form_name);
		var array = [];
		for (var i = 0; i < forms.length; i++) {
			var elem = forms.elements[i];
			if (elem.name != 'tp' && elem.name != '' && elem.value != '' && (elem.type != 'checkbox' || elem.checked == true))
				array.push(elem.name + '=' + elem.value);
		}
		var param = 'tp=6&' + array.join('&');
		if(document.images){
			var locImg = new Image();
			locImg.src = '/success/seikyu/ikkatu_send.asp?' + param;
		}
	}

