//フォントサイズの拡大・縮小
var typenum = "";
typenum = eval(getCookie('style'));
if(!typenum){typenum=2;}
var typeList=new Array('small','medium','large');
var value_style=typeList[typenum-1];

//SitePath
var i,a;
for(i=0; (a = document.getElementsByTagName("script")[i]); i++) {
	if(a.getAttribute("src").indexOf("js/fontsize.js") != -1 ) {
		var SitePath=a.getAttribute("src").replace("js/fontsize.js", "");
	}
}


//ボタンの表示
function size_btn(){
document.write('<div id="sizeSwitch">');
document.write('<p>文字サイズ');
if(value_style=="small"){
document.write('<a href="#" onclick="setStyle(1);return false;"><img src="'+SitePath+'common/size_small_on.gif" width="16" height="16" class="borderImg" alt="文字を小さくします"></a>');
document.write('<a href="#" onclick="setStyle(2);return false;"><img src="'+SitePath+'common/size_medium.gif" width="16" height="16" class="borderImg" alt="文字を標準サイズにします"></a>');
document.write('<a href="#" onclick="setStyle(3);return false;" ><img src="'+SitePath+'common/size_large.gif" width="16" height="16" class="borderImg" alt="文字を大きくします"></a></p>');
}else if(value_style=="medium"){
	document.write('<a href="#" onclick="setStyle(1);return false;"><img src="'+SitePath+'common/size_small.gif" width="16" height="16" class="borderImg" alt="文字を小さくします"></a>');
document.write('<a href="#" onclick="setStyle(2);return false;"><img src="'+SitePath+'common/size_medium_on.gif" width="16" height="16" class="borderImg" alt="文字を標準サイズにします"></a>');
document.write('<a href="#" onclick="setStyle(3);return false;" ><img src="'+SitePath+'common/size_large.gif" width="16" height="16" class="borderImg" alt="文字を大きくします"></a></p>');
}else{
	document.write('<a href="#" onclick="setStyle(1);return false;"><img src="'+SitePath+'common/size_small.gif" width="16" height="16" class="borderImg" alt="文字を小さくします"></a>');
document.write('<a href="#" onclick="setStyle(2);return false;"><img src="'+SitePath+'common/size_medium.gif" width="16" height="16" class="borderImg" alt="文字を標準サイズにします"></a>');
document.write('<a href="#" onclick="setStyle(3);return false;" ><img src="'+SitePath+'common/size_large_on.gif" width="16" height="16" class="borderImg" alt="文字を大きくします"></a></p>');
}
document.write('</p></div>');
}

//読み込んだときにCookieからstyleを読み込んでcssを書き出す
function setCss(){
document.write( '<link href="'+SitePath+'css/size_'+value_style+'.css" rel="stylesheet" type="text/css" media="screen,tv,print">');
}

//Cookieの取り出し（慣用的）
function getCookie(name){
var cookieStr = document.cookie
var existNum = cookieStr.indexOf(name)
if(existNum != -1){
start = existNum + name.length + 1
end = cookieStr.indexOf(";" , start)
if(end == -1){
end = cookieStr.length
}
var cookieValue = cookieStr.substring(start,end)
return cookieValue
} else {
return ""
}
}

//Cookieに選択したタイプ（sss,ss,s,m,l,ll,lll）を書き込む
function setStyle(num){
styletype=num;
sizeString='style=' ;
sizeString+=escape(styletype);
//sizeString+= "; domain=bc-6.com";
sizeString+= "; path=/";
document.cookie =sizeString ;
window.location.reload();
}
//document.write(cssName);
setCss();

function sav_cook() {
coknam = "jssample";
coktxt = document.frm1.txt1.value;
day0 = new Date();
day0.setTime(day0.getTime()+60*60*24*1000);
endday = day0.toGMTString();
document.cookie = coknam+"="+escape(coktxt)+";expires="+endday;
}

function print_btn() {
document.write( '<div id="print"><a href="javascript:window.print();">印刷 <img src="'+SitePath+'common/ico_print.gif" alt="印刷ダイアログを開きます" width="18" height="18" class="borderImg"></a></div>');
}