/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 Author : http://www.yomotsu.net
 created: 2008/06/06
 update : 2009/06/09
 Licensed under the GNU Lesser General Public License

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/

(function(){
//	alert(navigator.userAgent);
	
	var fontRule = {
		hiragino  : "font-family:'Hiragino Kaku Gothic Pro',\\30D2\\30E9\\30AE\\30CE\\89D2\\30B4\\20Pro\\20W3,sans-serif; font-size: 14px;",
		msPGothic : "font-family:'MS PGothic',\\FF2D\\FF33\\20\\FF30\\30B4\\30B7\\30C3\\30AF,sans-serif; font-size: 14px;",
		meiryo    : "font-family:Meiryo,\\30E1\\30A4\\30EA\\30AA,'Segoe UI',sans-serif; font-size: 14px;"
	}
	var CSSRule = '';
	
	//Macintosh
	if(navigator.userAgent.match(/Macintosh|Mac_PowerPC/)) {
		CSSRule = 'html body {' + fontRule.hiragino + '}';
//		alert("MAC");
	}
	//Server 2003, XP, 2000, NT 4.0, ME, 98, 95, CE
	else if(navigator.userAgent.match(/Windows NT (4|5)\.\d+|windows (98|95|CE)/)) {
		CSSRule = 'html body {' + fontRule.msPGothic + '}';
//		alert("XP以下");
	}
	//Vista and later
	else if(navigator.userAgent.match(/Windows NT (6)\.\d+/) || navigator.userAgent.match(/Windows/)) {
//		alert("VISTA以降");
		
		var ie = navigator.userAgent.match(/MSIE (\d\.\d+)/);
		var t = navigator.userAgent.match(/Trident\/([\d\.]+)/i);
		
		if(ie && ie[0]) {
//			alert("IEです");
			if (t && t[1] >= 5.0) {
				CSSRule = 'html body {' + fontRule.meiryo + '}';
//				alert("IE9以降　メイリオ");
			}else {
				CSSRule = 'html body {' + fontRule.msPGothic + '}';
//				alert("IE8以下　ゴシック");
			}
		}else {
			CSSRule = 'html body {' + fontRule.meiryo + '}';
//			alert("IE以外 メイリオ");
		}
		
	}else {
		CSSRule = 'html body {' + fontRule.msPGothic + '}';
//		alert("その他")
	}
	
	if (document.createStyleSheet)
		document.createStyleSheet().cssText = CSSRule;
	else {
		var element = document.createElement('style');
		document.getElementsByTagName('head')[0].appendChild(element);
		element.sheet.insertRule(CSSRule, 0 )
	}
})()
