﻿
var Fixing ; Fixing = 1;		//フォントサイズ固定：0 = no, 1 = yes
var intMainSize = 12;		//フォントサイズ：pt換算
var intMainLine = 160;		//行間：%換算

var ph = navigator.platform.charAt(0);

var ua = navigator.userAgent;
//alert (ua);
var av = navigator.appVersion;

function getOSType()
{
	var uAgent  = navigator.userAgent.toUpperCase();
	if		(uAgent.indexOf("MAC") >= 0) 			{ return "MacOS";	}
	else if	(uAgent.indexOf("WINDOWS NT 5.0") >= 0)			{ return "Windows2k";	}
	else if	(uAgent.indexOf("WINDOWS NT 5.1") >= 0)			{ return "WindowsXP";	}
	else if	(uAgent.indexOf("WIN") >= 0)				{ return "Windows";	}
	else if	(uAgent.indexOf("X11") >= 0)				{ return "UNIX";	}
	else								{ return "unknown";	}
}
function getBrowserName()
{

	if	(navigator.userAgent.indexOf("Gecko/") != -1)		{
		if	(navigator.userAgent.indexOf("7.0") != -1)	{ return "Gecko7";		}
		else if	(navigator.userAgent.indexOf("6.2") != -1)	{ return "Gecko7";		}
		else { return "Gecko";		}
	}
	else if	(navigator.userAgent.indexOf("Gecko") != -1)		{ return "Safari";		}
	else if	(navigator.userAgent.indexOf("MSIE") != -1)		{ return "Explorer";		}
	else if	(navigator.userAgent.indexOf("Mozilla") != -1)		{ return "Mozilla";		}
	else								{ return "unknown";		}
}

cssType = getOSType() + getBrowserName();


var intTextSize = intMainSize;
var intTextLine = intMainLine;

document.writeln("<style type='text/css'><!--");

if (Fixing == 0){
	//文字サイズ固定
document.writeln("body,td,th {");

	if(ph == "M"){
		if(av.indexOf("[",0) > -1){
			//alert("文字サイズ固定：Macintosh NetscapeCommunicator4 , NetscapeNavigator4用 CSS");
			intTextSize = Math.round(intMainSize * 1.25);
			intTextLine = Math.round(intMainLine * intMainSize * 0.01);
		}else{
			if(ua.indexOf("Netscape6",0) > -1){
				//alert("文字サイズ固定：Macintosh Netscape6用 CSS");
				intTextSize = Math.round(intMainSize * 1.1);
				intTextLine = Math.round(intMainLine * intMainSize * 0.008);
			}else{
				if(ua.indexOf("Safari",0) > -1){
					//alert("文字サイズ固定：Macintosh Safari用 CSS");
					intTextSize = Math.round(intMainSize * 1.0909);
					intTextLine = Math.round(intMainLine * intMainSize * 0.01);
				}else if(ua.indexOf("Opera",0) > -1){
					//alert("文字サイズ固定：Macintosh Opera 用 CSS");
					intTextSize = Math.round(intMainSize * 1.1);
					intTextLine = Math.round(intMainLine * intMainSize * 0.009);
				}else if(ua.indexOf("MSIE",0) > -1){
					//alert("文字サイズ固定：Macintosh InternetExplorer 用 CSS");
					intTextSize = Math.round(intMainSize * 1.1);
					intTextLine = Math.round(intMainLine * intMainSize * 0.01);
				}else{
					//alert("文字サイズ固定：Macintosh InternetExplorer , Netscape7 , Opera , iCab , etc...用 CSS");
					intTextSize = Math.round(intMainSize * 1.1);
					intTextLine = Math.round(intMainLine * intMainSize * 0.01);
				}
			}
		}
	}else{
		if(ph == "W"){
			//alert("文字サイズ固定：Windows");
			if(av.indexOf("[",0) > -1){
				//alert("文字サイズ固定：Windows NetscapeCommunicator4 , NetscapeNavigator4用 CSS");
				intTextSize = Math.round(intMainSize * 0.8);
				intTextLine = Math.round(intMainLine * intMainSize * 0.009299);
			}else{
				if(ua.indexOf("Gecko",0) > -1){
					//alert("文字サイズ固定：Windows Netscape6 , 7用 CSS");
					intTextSize = Math.round(intMainSize * 1);
					intTextLine = Math.round(intMainLine * intMainSize * 0.009);
				}else{
					if(ua.indexOf("Opera",0) > -1){
						//alert("文字サイズ固定：Windows Opera6, 7,9用 CSS");
						intTextSize = Math.round(intMainSize * 1.136);
						intTextLine = Math.round(intMainLine * intMainSize * 0.0105);
					}else{
						//alert("文字サイズ固定：Windows InternetExplorer , etc...用 CSS");
						intTextSize = Math.round(intMainSize * 1.12);
						intTextLine = Math.round(intMainLine * intMainSize * 0.0105);
					}
				}
			}
		}else {
			intTextSize = Math.round(intMainSize * 1);
			intTextLine = Math.round(intMainLine * 0.009);
			//alert("?");
		}
	}
	
	document.writeln("font-size:" + intTextSize + "px;line-height:" + intTextLine +"px");
	document.writeln("}");
	
}else{
	//文字サイズ可変
	document.writeln("body {");

	if(ph == "M"){
		if(av.indexOf("[",0) > -1){
			//alert("文字サイズ可変：Macintosh NetscapeCommunicator4 , NetscapeNavigator4用 CSS");
			intTextSize = Math.round(intMainSize * 10.25);
			intTextLine = Math.round(intMainLine * 0.8399);
		}else{
			if(ua.indexOf("Netscape6",0) > -1){
				//alert("文字サイズ可変：Macintosh NetscapeNavigator6用 CSS");
				intTextSize = Math.round(intMainSize * 8.2);
				intTextLine = Math.round(intMainLine * 0.72);
			}else{
				if(ua.indexOf("Safari",0) > -1){
					//alert("文字サイズ可変：Macintosh Safari用 CSS");
					intTextSize = Math.round(intMainSize * 6.666);
					intTextLine = Math.round(intMainLine * 0.9529);
				}else if(ua.indexOf("Opera",0) > -1){
					//alert("文字サイズ可変：Macintosh Opera 用 CSS");
					intTextSize = Math.round(intMainSize * 8.2);
					intTextLine = Math.round(intMainLine * 0.9);
				}else if(ua.indexOf("MSIE",0) > -1){
					//alert("文字サイズ可変：Macintosh InternetExplorer 用 CSS");
					intTextSize = Math.round(intMainSize * 7.083);
					intTextLine = Math.round(intMainLine * 0.9);
				}else{
					//alert("文字サイズ可変：Macintosh  Netscape7 , iCab , etc...用 CSS");
					intTextSize = Math.round(intMainSize * 8.2);
					intTextLine = Math.round(intMainLine * 0.9);
				}
			}
		}
	}else{
		if(ph == "W"){
			if(av.indexOf("[",0) > -1){
				//alert("文字サイズ可変：Windows NetscapeCommunicator4 , NetscapeNavigator4用 CSS");
				intTextSize = Math.round(intMainSize * 6.356);
				intTextLine = Math.round(intMainLine * 0.9193);
			}else{
				if(ua.indexOf("Gecko",0) > -1){
					//alert("文字サイズ可変：Windows Netscape6 , 7用 CSS");
					intTextSize = Math.round(intMainSize * 6.78);
					intTextLine = Math.round(intMainLine * 0.95);
				}else{
					if(ua.indexOf("Opera",0) > -1){
						//alert("文字サイズ可変：Windows Opera 6, 7用 CSS");
						intTextSize = Math.round(intMainSize * 6.7);
						intTextLine = Math.round(intMainLine * 0.95);
					}else{
						// 文字サイズ可変：Windows InternetExplorer , etc...用 CSS
						intTextSize = Math.round(intMainSize * 7);
						intTextLine = Math.round(intMainLine * 0.92);
						//alert("文字サイズ可変：Windows InternetExplorer , etc...用 CSS");
						if (cssType.indexOf("WindowsXPExplorer") >= 0)	{
							//alert("");
						}else{
							//alert("");
						}
					}
				}
			}
		}else {
			intTextSize = Math.round(intMainSize * 6.5);
			intTextLine = Math.round(intMainLine * 1);
			//alert("");
		}
	}
	
	document.writeln("font-size:" + intTextSize + "%;line-height:" + intTextLine +"%");
	document.writeln("}");
	document.writeln("h1,h2,h3,h4,h5,h6 {font-size:medium}");

}

document.writeln("--></style>");

