/*/////////////////////////////////////////////////////////////////////////////////////////////////
	User's Guide
	Load JavaScript
	Modified : 2014-03-25
/////////////////////////////////////////////////////////////////////////////////////////////////*/


//目的から探すのアコーディオンコンテンツのディレクトリ Directory of accordion content of the "Search by Purpose"
var sh3AcDir = 'po/';


var _na = navigator, _ua = _na.userAgent, ua = [];

if(/MSIE [5678]/i.test(_ua)){
	/*@cc_on _d=document;eval('var document=_d')@*/
}

ua._isWin = /win/i.test(_na.platform);
if(ua._isWin){
	ua._isWin8_1 = /Win(dows )?NT 6\.3/i.test(_ua);
	ua._isWin8 = /Win(dows )?NT 6\.(2|3)/i.test(_ua);
	ua._isWin7 = /Win(dows )?NT 6\.1/i.test(_ua);
	ua._isWinVista = /Win(dows )?NT 6\.0/i.test(_ua);
	ua._isWinSv2003 = /Win(dows )?NT 5\.2/i.test(_ua);
	ua._isWinXP = /Win(dows )?(NT 5\.1|XP)/i.test(_ua);
	ua._isWin2000 = /Win(dows )?(NT 5\.0|2000)/i.test(_ua);
	ua._isWinMe = /Win(dows )? (9x 4\.90|ME)/i.test(_ua);
	ua._isWin98 = !ua._isWinMe && /Win(dows )?98/i.test(_ua);
}
ua._isMac = /mac/i.test(_na.platform);
if(ua._isMac){
	if(osver = _ua.match(/Mac OS X [0-9._]+/i)){
		osver = (osver+'').replace(/Mac OS X ([0-9._]+)/i, '$1');
		osver = (/\./.test(osver)) ? osver.split('.') : osver.split('_');
		ua['_isMacOSX' + osver[0]] = true;
		osver2 = (!osver[1]) ? osver[0]+'_0' : osver[0]+'_'+osver[1] ;
		ua['_isMacOSX' + osver2] = true;
		osverFull = osver.join('_');
		ua['_isMacOSX' + osverFull] = true;
	}
}
ua._isX11 = /X11/i.test(_ua);

ua._isWebKit = /WebKit/i.test(_ua);
ua._isChrome = /chrome/i.test(_ua);
ua._isSafari = ua._isWebKit && !ua._isChrome;
ua._isOpera = window.opera && opera.buildNumber;
ua._isIE = !ua._isWebKit && !ua._isOpera && ( /MSIE/i.test(_ua) || /Trident/i.test(_ua) )/* && (/Explorer/gi).test(_na.appName)*/;
ua._isGecko = !ua._isWebKit && /Gecko/.test(_ua);
ua._isFirefox = ua._isGecko && /Firefox/.test(_ua);
ua._isKMBuiltIn = /KMBuiltInBrowser/i.test(_ua);

ua._isiPhone = /iPhone/i.test(_ua);
ua._isiPod = /iPod/i.test(_ua);
ua._isiPad = /iPad/i.test(_ua);
ua._isAndroid = /Android/i.test(_ua);
ua._isMobile = ua._isiPhone || ua._isiPod || ua._isiPad || ua._isAndroid;
//ua._isMobile = true;

if(ua._isSafari){
	ua._isSafari1 = /WebKit\/(85|10[36]|12[45]|312)(|u|\.[0-9.]+) /i.test(_ua);
	ua._isSafari2 = /WebKit\/4[1-5][0-9.+]+ /i.test(_ua);
	if(bver = _ua.match(/Version\/[0-9.]+ /i)){
		bver = (bver+'').replace(/Version\/([0-9.]+?) /i, '$1').split('.');
		ua['_isSafari' + bver[0]] = true;
		bver2 = (!bver[1]) ? bver[0]+'_0' : bver[0]+'_'+bver[1] ;
		ua['_isSafari' + bver2] = true;
		bverFull = bver.join('_');
		ua['_isSafari' + bverFull] = true;
	}
	ua._isSafari3_0low = ua._isSafari1 || ua._isSafari2 || ua._isSafari3_0;
	ua._isSafari5low = ua._isSafari3_0low || ua._isSafari3 || ua._isSafari4 || ua._isSafari5;
	ua._isSafari6hi = !ua._isSafari5low;
}

if(ua._isIE){
	if(bver = _ua.match(/((MSIE |rv:)[0-9]+)/i)){
		bver = (bver[0]+'').replace(/(MSIE |rv:)([0-9]+)/i, '$2');
		if(bver == '5') bver = '6';
		ua['_isIE' + bver] = true;
	}
	if(bver >= 9) ua._isIE9hi = true;
	if(bver >= 10) ua._isIE10hi = true;
	if(bver >= 11) ua._isIE11hi = true;
}

if(ua._isFirefox){
	if(bver = _ua.match(/Firefox\/[0-9.]+/i)){
		bver = (bver+'').replace(/Firefox\/([0-9.]+)/i, '$1').split('.');
		ua['_isFirefox' + bver[0]] = true;
		bver2 = (!bver[1]) ? bver[0]+'_0' : bver[0]+'_'+bver[1] ;
		ua['_isFirefox' + bver2] = true;
		bverFull = bver.join('_');
		ua['_isFirefox' + bverFull] = true;
	}
	ua._isFirefox7low = ua._isFirefox1||ua._isFirefox2||ua._isFirefox3||ua._isFirefox4||ua._isFirefox5||ua._isFirefox6||ua._isFirefox7;
}

if(ua._isChrome){
	if(bver = _ua.match(/Chrome\/[0-9.]+/i)){
		bver = (bver+'').replace(/Chrome\/([0-9.]+)/i, '$1').split('.');
		ua['_isChrome' + bver[0]] = true;
		bver2 = (!bver[1]) ? bver[0]+'_0' : bver[0]+'_'+bver[1] ;
		ua['_isChrome' + bver2] = true;
		bverFull = bver.join('_');
		ua['_isChrome' + bverFull] = true;
	}
}

osver = osver2 = osverFull = bver = bver2 = bverFull = null;
delete osver; delete osver2; delete osverFull; delete bver; delete bver2; delete bverFull;



var thisFile = document.location.pathname.replace(/file:\/\/+/i, "").replace(/\\/g, "/").split('/').slice(-1).join('');
var thisId = thisFile.split("-",1).join('');
var thisHash = location.hash;
var getdata = location.search.replace(/^\?/,'').split('&');
var get = [];
for(var i=0,len=getdata.length; i<len; i++){
	temp = decodeURIComponent(getdata[i]).split('=');
	ak = temp[0];
	temp.shift();
	get[ak] = temp.join('=');
}
var NotHTTP = !/https?:/.test(document.location.protocol);

var HttpReqSecure = ( (ua._isChrome || ua._isIE11hi) && NotHTTP) ? true : false;

var isTop = (thisFile=='index.html'||thisFile=='') ? true : false ; 
var sharedPath = (isTop) ? 'contents/shared' : 'shared' ;
var jsCPath = (isTop) ? 'contents/' : '' ; 

var lang = settings.lang;
var _lang = (lang) ? '_'+lang : '';

var srCountType = 0;
if(lang=='zh-tw') srCountType = 1;

var loadFile = [];

loadFile.push('<link href="'+sharedPath+'/css/'+_lang+'.css" rel="stylesheet" type="text/css" media="screen,print" />');

// Vista以降
if( ua._isWin && !(/Win(dows )?NT [345]/.test(_ua)) ) {
	loadFile.push('<link href="'+sharedPath+'/css/win_v7'+_lang+'.css" rel="stylesheet" type="text/css" media="screen,print" />');
}
if(ua._isIE8){
	loadFile.push('<link href="'+sharedPath+'/css/print_ie8.css" rel="stylesheet" type="text/css" media="print" />');
}

///*if(ua._isMobile)*/
//{
//	loadFile.push(
//		'<meta name="viewport" content="width=1000px">'
//		,'<script src="'+sharedPath+'/js/jquery-1.10.2.min.js" type="text/javascript"></script>'
//		,'<link href="'+sharedPath+'/css/mobile.css" rel="stylesheet" type="text/css" media="screen,print" />'
//		,'<script src="'+sharedPath+'/js/mobile.js" type="text/javascript"></script>'
//	);
//}

if(ua._isSafari1){
	loadFile.push(
		'<script src="'+sharedPath+'/js/jquery-1.2.3.min.js" type="text/javascript"></script>'
		,'<script src="'+sharedPath+'/js/jquery-ui-1.5.0.min.js" type="text/javascript"></script>'
		,'<script src="'+jsCPath+'jsContents/jsMenu.js" type="text/javascript"></script>'
	);
}else if((ua._isSafari2)||(ua._isSafari3_0)){
	loadFile.push(
		'<script src="'+sharedPath+'/js/jquery-1.2.6.min.js" type="text/javascript"></script>'
		,'<script src="'+sharedPath+'/js/jquery-ui-1.6.min.js" type="text/javascript"></script>'
		,'<script src="'+jsCPath+'jsContents/jsMenu.js" type="text/javascript"></script>'
	);
}else if(ua._isMobile)
{
	loadFile.push(
		'<meta name="viewport" content="width=1000px">'
		, '<script src="' + sharedPath + '/js/jquery-1.8.2.min.js" type="text/javascript"></script>'
		, '<script src="' + sharedPath + '/js/jquery-ui-1.8.24.min.js" type="text/javascript"></script>'
		, '<script src="' + sharedPath + '/js/jquery.dropshadow.js" type="text/javascript"></script>'
		, '<link href="' + sharedPath + '/css/mobile.css" rel="stylesheet" type="text/css" media="screen,print" />'
		, '<script src="' + sharedPath + '/js/mobile.js" type="text/javascript"></script>'
	);
	if(/^opkey_/.test(thisFile)){
		loadFile.push(
			'<script src="'+sharedPath+'/js/opkey.js" type="text/javascript"></script>'
			,'<script src="jsContents/jsMenu.js" type="text/javascript"></script>'
		);
	}
}else{
	loadFile.push(
		'<script src="'+sharedPath+'/js/jquery-1.8.2.min.js" type="text/javascript"></script>'
		,'<script src="'+sharedPath+'/js/jquery.bgiframe.min.js" type="text/javascript"></script>'
		,'<script src="'+sharedPath+'/js/jquery-ui-1.8.24.min.js" type="text/javascript"></script>'
		,'<script src="'+sharedPath+'/js/jquery.dropshadow.js" type="text/javascript"></script>'
	);
	if(/^opkey_/.test(thisFile)){
		loadFile.push(
			'<script src="'+sharedPath+'/js/opkey.js" type="text/javascript"></script>'
			,'<script src="jsContents/jsMenu.js" type="text/javascript"></script>'
		);
	}
}
if(get['k'] && /^(id|sh|opkey)/.test(thisFile)){
	loadFile.push(
		'<script src="'+sharedPath+'/js/jquery.keyHighlight.min.js" type="text/javascript"></script>'
	);
}
if( HttpReqSecure ){
	loadFile.push('<script src="'+jsCPath+'jsContents/jsContents.js" type="text/javascript"></script>');
}

loadFile.push(
	'<script src="'+sharedPath+'/js/textData'+_lang+'.js" type="text/javascript"></script>'
	,'<script src="'+sharedPath+'/js/view.js" type="text/javascript"></script>'
);


document.write(loadFile.join(''));




