//var getClassString = function() {
//	// IE7以前はsetAttributeでclass属性を扱う場合、第一引数に"className"と指定する必要があるため、これを取得する関数を作成。
//	var appVer = window.navigator.appVersion.toLowerCase();
//	var classstring = "class";
//	if (appVer.indexOf("msie 6.") != -1) {
//			classstring = "className";
//	} else if (appVer.indexOf("msie 7.") != -1) {
//			classstring = "className";
//	}
//	return classstring;
//}

// ボタンにカーソルを合わせたとき、ボタン自身にフォーカスを当てる
var setFocus_MO1 = function() {
	document.getElementById("doc1file").focus();
}
var setFocus_MO8 = function() {
	document.getElementById("doc8file").focus();
}
var setFocus_MO2 = function() {
	document.getElementById("doc2file").focus();
}
var setFocus_MO4 = function() {
	document.getElementById("doc4file").focus();
}
var setFocus_MO5 = function() {
	document.getElementById("doc5file").focus();
}
var setFocus_MO6 = function() {
	document.getElementById("doc6file").focus();
}
var setFocus_MO7 = function() {
	document.getElementById("doc7file").focus();
}
var setFocus_MO3 = function() {
	document.getElementById("doc3file").focus();
}
var setFocus_MO10 = function() {
	document.getElementById("doc10file").focus();
}
var setFocus_MO9 = function() {
	document.getElementById("doc9file").focus();
}
var setFocus_MO11 = function() {
	document.getElementById("doc11file").focus();
}
// IE6の場合のみ
var setFocus_MO11IE6 = function() {
	document.getElementById("doc11fileIE6").focus();
}
var setFocus_MOurl = function() {
	document.getElementById("doc12link").focus();
}

// ダミー要素 IE6 の場合 onKeyDownイベント Tab, Shift+Tab, F5
var setFocus_dummy = function(e) {
	
	var ie6 = false;
	ie6 = getBoolIE6();
	
	var shift;
	var keycode;
	
	if(ie6){
		//IE6の場合
		
		keycode = event.keyCode;
		shift   = event.shiftKey;
		// イベントの上位伝播を防止
		event.returnValue = false;
		event.cancelBubble = true;
		
		// Shift  Key
		if (shift) { 
			// Tab  Key
			if (keycode == 9) { 
				document.getElementById("doc11fileIE6").focus();
			}
		// Tab Key
		} else if (keycode == 9) { 
			document.getElementById("selectlang").focus();
		// F5 Key
		} else if (keycode == 116) {
			window.location.reload();
		}
		
	}else{
		//IE6以外の場合
		
		var userAgent = window.navigator.userAgent.toLowerCase();
		
		// Mozilla(Firefox, NN) and Opera
		if (userAgent.indexOf('gecko/') != -1) {
			keycode = e.which;
			shift   = typeof e.modifiers == 'undefined' ? e.shiftKey : e.modifiers & Event.SHIFT_MASK;
			// イベントの上位伝播を防止
			e.preventDefault();
			e.stopPropagation();
		// Internet Explorer
		} else {
			keycode = event.keyCode;
			shift   = event.shiftKey;
			// イベントの上位伝播を防止
			event.returnValue = false;
			event.cancelBubble = true;
		}
		
		// Shift  Key
		if (shift) { 
			// Tab  Key
			if (keycode == 9) { 
				document.getElementById("doc12link").focus();
			}
		// Tab Key
		} else if (keycode == 9) { 
			document.getElementById("selectlang").focus();
		// F5 Key
		} else if (keycode == 116) {
			window.location.reload();
		}
	}
}

// 応用機能ボタン IE6の場合 onKeyDownイベント Tab, Shift+Tab, F5
var setFocus_KD11IE6 = function(e) {
	var shift;
	var keycode;
	var userAgent = window.navigator.userAgent.toLowerCase();
	
	keycode = event.keyCode;
	shift   = event.shiftKey;
	// イベントの上位伝播を防止
	event.returnValue = false;
	event.cancelBubble = true;
	
	// Shift  Key
	if (shift) { 
		// Tab  Key
		if (keycode == 9) { 
			document.getElementById("doc9file").focus();
		}
	// Tab Key
	} else if (keycode == 9) { 
		document.getElementById("tabdummy").focus();
	// F5 Key
	} else if (keycode == 116) {
		window.location.reload();
	}
}

// AdobeURLボタン onKeyDownイベント Tab, Shift+Tab, F5, Enter
var setFocus_url = function(e) {
	var shift;
	var keycode;
	var userAgent = window.navigator.userAgent.toLowerCase();
	
	// Mozilla(Firefox, NN) and Opera
	if (userAgent.indexOf('gecko/') != -1) {
		keycode = e.which;
		shift   = typeof e.modifiers == 'undefined' ? e.shiftKey : e.modifiers & Event.SHIFT_MASK;
		// イベントの上位伝播を防止
		e.preventDefault();
		e.stopPropagation();
	// Internet Explorer
	} else {
		keycode = event.keyCode;
		shift   = event.shiftKey;
		// イベントの上位伝播を防止
		event.returnValue = false;
		event.cancelBubble = true;
	}
	
	// Shift  Key
	if (shift) { 
		// Tab  Key
		if (keycode == 9) { 
			document.getElementById("doc11file").focus();
		}
	// Tab Key
	} else if (keycode == 9) { 
		document.getElementById("tabdummy").focus();
	// F5 Key
	} else if (keycode == 116) {
		window.location.reload();
	// Enter Key
	} else if (keycode == 13) {
		window.location.href = __i18n_url;
	}
}

var changelang = function() {
	var objsl = document.getElementById("selectlang");
	setuilanguage(objsl.options[objsl.selectedIndex].value);
}

// IE6ならtrueを返す
var getBoolIE6 = function() {

	var ieVersion = 0;
	
	// IEのバージョンを取得
	var versionInfo = navigator.appVersion.split(";");
	for(var i=0; i<versionInfo.length; i++) {
		if(versionInfo[i].indexOf("MSIE") != -1) {
			ieVersion = versionInfo[i].replace(/[MSIE ]/g,"")-0;
			break;
		}
	}
	if(ieVersion == 6){
		return true;
	}else{
		return false;
	}
}

var setuilanguage = function(lang) {
	// ドキュメントタイトル （User's Guide CDに固定）
	//document.title = __i18n_documents[lang]["doctitle"];
	// タイトルイメージ
//	var imgurl = 'url("./contents/img/top/top_header_title_' + lang + '.png") no-repeat';
//	document.getElementById("title").style.background = imgurl;
	
	var ie6 = false;
	ie6 = getBoolIE6();
	
	// generic / own版で内容の異なる表示のセット
	// －models:		モデル名
	// －version:		バージョン表記
	// －commsg:		キャッチコピー
	for (var key in __i18n_corporate) {
		if (__i18n_corporate[key] == "1") {
			switch (key) {
			case "generic":
				document.getElementById("models").style.background = __i18n_documents[lang]["models_background_generic"];
				document.getElementById("version").innerHTML = __i18n_documents[lang]["version_text_generic"];
				document.getElementById("commsg").style.background = __i18n_documents[lang]["commsg_background_generic"];
				break;
			case "own":
				document.getElementById("models").style.background = __i18n_documents[lang]["models_background"];
				document.getElementById("version").innerHTML = __i18n_documents[lang]["version_text"];
				document.getElementById("commsg").style.background = __i18n_documents[lang]["commsg_background"];
				break;
			default:
				break;
			}
			break;
		}
	}
	document.getElementById("title").innerHTML = __i18n_documents[lang]["doctitle"];
	
	if(ie6) {
		document.getElementById("doc11tipsIE6").style.visibility = "visible";
		document.getElementById("doc11fileIE6").setAttribute("href", __i18n_documents[lang]["doc11file"]);
		document.getElementById("doc11tipsIE6").setAttribute("title", __i18n_documents[lang]["doc11tips"]);
		document.getElementById("doc11textIE6").innerHTML = "";
		document.getElementById("doc11textIE6").innerHTML = __i18n_documents[lang]["doc11text"];
		document.getElementById("doc11text_2IE6").innerHTML = __i18n_documents[lang]["doc11text_2"];
		
		document.getElementById("dlinfo").innerHTML = __i18n_documents[lang]["dlinfoie6"];
	}else{
		document.getElementById("doc11tips").style.visibility = "visible";
		document.getElementById("doc11file").setAttribute("href", __i18n_documents[lang]["doc11file"]);
		document.getElementById("doc11tips").setAttribute("title", __i18n_documents[lang]["doc11tips"]);
		document.getElementById("doc11text").innerHTML = "";
		document.getElementById("doc11text").innerHTML = __i18n_documents[lang]["doc11text"];
		document.getElementById("doc11text_2").innerHTML = __i18n_documents[lang]["doc11text_2"];
		
		document.getElementById("doc12text").innerHTML = __i18n_url;
		document.getElementById("dlinfo").innerHTML = __i18n_documents[lang]["dlinfo"];
	}
	// ボタンテキスト
	for(var i=1; i<=10; i++) {
		var id_file = "doc" + i + "file";
		var id_tips = "doc" + i + "tips";
		var id_text = "doc" + i + "text";
		if(__i18n_documents[lang][id_file] != "") {
			document.getElementById(id_tips).style.visibility = "visible";
			document.getElementById(id_file).setAttribute("href", __i18n_documents[lang][id_file]);
			document.getElementById(id_tips).setAttribute("title", __i18n_documents[lang][id_tips]);
			document.getElementById(id_text).innerHTML = "";
			document.getElementById(id_text).innerHTML = __i18n_documents[lang][id_text];
		} else {
			document.getElementById(id_tips).style.visibility = "hidden";
		}
	}
}
