// JavaScript Document

// iPhoneまたは、Androidの場合は振り分けを判断。リファラー機能で同じサーバからのアクセスはアラートを表示しない。
if (document.referrer.indexOf('http://www.va-f.ac.jp/') == -1 && document.referrer.indexOf('http://www.va-t.ac.jp/') == -1 && document.referrer.indexOf('http://www.fva.ac.jp/') == -1 && ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0)) {	
	
    if(confirm('このサイトにはスマートフォン用のサイトがあります。\n表示しますか？')) {
        location.href = 'http://www.fva.ac.jp/mobile/';
    }
}

//スマートフォンへの誘導
	
if (((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0)) {	

		$(document).ready(function() {
		$('#header').before('<p id="smartphone"><a href="http://www.fva.ac.jp/mobile/index.html">スマートフォン版はこちら</a></p>');	
		});

}
//http://ascii.jp/elem/000/000/557/557746/index-4.html
