﻿//受験生サイトのグローバルメニューでのロールオーバー処理に使用します。
//Yuuki
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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.01
  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 && d.getElementById) x=d.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];}
}




/*スパム対策*/
<!--
function vspam(im,domain) {
  maddress = "mailto:" + im + "@" + domain;
  window.location.href = maddress;
}
// -->


/*ページスクロール*/
function SmoothScroll(targetID){
  if( !document.getElementById ) {return true;}
  var step=1;  //初速度
  var max=200;  //最高速度
  var accel=1;  //加速度
  var interval=1;  //加速インターバル
  var current_y = document.body.scrollTop  || document.documentElement.scrollTop;
  var element=document.getElementById(targetID);
  if (!element){return true;}
  var target_y = 0;
  for (i = element;i.offsetParent;i=i.offsetParent ){
    target_y += i.offsetTop;
  }
  var count=0;
  if ( current_y > target_y ){ step = -(step); accel = -(accel);}
  var timerid = setInterval( function(){
    if (step<max) step += (count*accel);
    if ( Math.abs(current_y-target_y) < Math.abs(step) ){
      window.scrollTo((document.body.scrollTop  || document.documentElement.scrollTop),target_y);
      clearInterval(timerid);
      return false;
    }else{
      window.scrollBy(0,step);
      current_y += step;
      count++;
    }
  },interval);
  return false;
}



/*ポップアップスクリプト
---------------------------------*/

/*ホスト名によるパスの設定*/
hostname_w = window.location.hostname;
if (hostname_w == "demo.colletomo.com"){ //プレビューサーバー
	from_rootpath = "/yamano-ac_prev564022148";
}else if (hostname_w == ""){//ローカル環境時
	from_rootpath = "/制作データ/yamano.ac.jp（山野美容芸術短期大学）/【2009】public_html";
}else{ //本番サーバー
	from_rootpath = "";
}


/*オープンキャンパス*/
function ocWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 1000;//windowの横幅
	var wy = 650;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/opencampus/index.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*オープンキャンパス*/
function ocFes() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 1000;//windowの横幅
	var wy = 650;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/opencampus/fes.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*オープンキャンパス トワイライト*/
function ocEveningWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 1000;//windowの横幅
	var wy = 650;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/opencampus/index.html#evening","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*オープンキャンパス フェス*/
function ocFesWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 1000;//windowの横幅
	var wy = 650;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/opencampus/index.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*キャリア支援*/
function careerWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 1000;//windowの横幅
	var wy = 650;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/career.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*新設*/
function newcWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 1040;//windowの横幅
	var wy = 768;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/new.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*講師紹介*/
function instructorWin() { 
	var st = "scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 900;//windowの横幅
	var wy = 640;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/faculty/instructor/sp.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*茶室*/
function aizianWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 920;//windowの横幅
	var wy = 650;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/about/facilities/aizian_sp.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*ギャラリー*/
function galWin() { 
	var st = "scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 900;//windowの横幅
	var wy = 600;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open(from_rootpath+"/juken/gallery/index.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*例*/
function exWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 620;//windowの横幅
	var wy = 720;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open("../exsample.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*単位互換制度*/
function unitWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 620;//windowの横幅
	var wy = 720;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open("unit03_02.html","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*資料請求*/
function requireWin() { 
	var st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 750;//windowの横幅
	var wy = 650;//windowの高さ
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open("http://www.postin-net.com/yamano/","reqWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*体入フォーム*/
function openWin(){
	var st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 650;
	var wy = 680;
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open("https://www.yamano.jp/cgi-bin/yca/cgi-bin/opencampus/index.cgi","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}

/*AOフォーム*/
function aoWin(){
	var st = "scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no";
	var wx = 750;
	var wy = 680;
	var x = (screen.width  - wx) / 2;
	var y = ((screen.height - wy) / 2) - 30;
	var newwin = window.open("https://www.yamano.jp/cgi-bin/yca/cgi-bin/ao_entry/index.cgi","newWin","left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}


/*Indexフラッシュ用
---------------------------------------*/
// クッキーの書き込み
function saveCookie(n) {
  cName = "yamanoac_cscount="; // クッキー名
  cDays = 1; // データの保存日数
  setPre = new Date();
  setPre.setTime(setPre.getTime() + (cDays*1000*24*3600));
  prd = setPre.toGMTString();
  document.cookie = cName + n + ";expires=" + prd;
}


//初回訪問の場合はカミングスーンのPOPUPを強制表示
function first_commingsoon() {
	cName = "yamanoac_cscount="; // クッキー名
	cCookie = document.cookie+";";
	str = cCookie.indexOf(cName);
	if(str != -1) { //2回目以降の訪問の場合
		document.getElementById("flash_area-second").style.display = "block";
		return true;
		} else { //初めての訪問の場合
		saveCookie(2); //クッキーの書き込み
		document.getElementById("flash_area").style.display = "block";
		return false;
	}
}



/*教師紹介用のリンク*/
function Link_art(){//芸術
	window.opener.location.href = from_rootpath+"/faculty/instructor/art.html";
	window.close();
}

function Link_hel(){//保健
	window.opener.location.href = from_rootpath+"/faculty/instructor/health.html";
	window.close();
}

function Link_wel(){//福祉
	window.opener.location.href = from_rootpath+"/faculty/instructor/welfare.html";
	window.close();
}



/*アクセスマップ・ポップアップ*/
function openExpGuide(code){
	var newwin = window.open("http://welcomenavi.jp/route/mrnavi.cgi?content=w1f8mkqfpl&landmp=35/37/04.602,139/20/44.053&style=cmj&landmk="+code, "keirowindow","width=500,height=400,toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes");
	newwin.focus();
}