//====================================================================//
//                                                                                                                       //
//      文字の大中小切替                                                                                       //
//                                  File Name  :  css_a.js                                                        //
//                                  Make Date  :  2006.11.24                                                  //
//                                  Copyright 2006 Octalserve Co,Ltd.                                    //
//                                                                                                                       //
//--------------------------------------------------------------------//
var i = 0;
var path = 'http://' + document.domain + '/';
var css = get_cookie.call(this);
if(css){change_css.call(this,path,css,i);}

function write_form()
{
	// CSSファイル名
	var css_a = new Array('common_fontb','common_fontm','common');

	// リンクテキスト
	var css_n = new Array('<img src="/commonimg/btn_m01.gif" alt="大" width="24" height="24" border="0">','<img src="/commonimg/btn_m01_over.gif" alt="大" width="24" height="24" border="0">','<img src="/commonimg/btn_m02.gif" alt="中" width="24" height="24" border="0">','<img src="/commonimg/btn_m02_over.gif" alt="中" width="24" height="24" border="0">','<img src="/commonimg/btn_m03.gif" alt="小" width="24" height="24" border="0">','<img src="/commonimg/btn_m03_over.gif" alt="小" width="24" height="24" border="0">');

	var css = get_cookie.call(this);

	if(!css){css = css_a[2];}

	if( css == css_a[0] )
	{
		document.write('<td width="24">' + css_n[1] + '</td>');
		document.write('<td width="24"><a href="javascript:set_cookie(\'' + css_a[1] + '\');">' + css_n[2] + '</a></td>');
		document.write('<td width="24"><a href="javascript:set_cookie(\'' + css_a[2] + '\');">' + css_n[4] + '</a></td>');
	}
	else if( css == css_a[1] )
	{
		document.write('<td width="24"><a href="javascript:set_cookie(\'' + css_a[0] + '\');">' + css_n[0] + '</a></td>');
		document.write('<td width="24">' + css_n[3] + '</td>');
		document.write('<td width="24"><a href="javascript:set_cookie(\'' + css_a[2] + '\');">' + css_n[4] + '</a></td>');
	}
	else
	{
		document.write('<td width="24"><a href="javascript:set_cookie(\'' + css_a[0] + '\');">' + css_n[0] + '</a></td>');
		document.write('<td width="24"><a href="javascript:set_cookie(\'' + css_a[1] + '\');">' + css_n[2] + '</a></td>');
		document.write('<td width="24">' + css_n[5] + '</td>');
	}
}


function change_css(path,css,i)
{
	if(document.all)
	{
		document.all.tags('link').item(i).href = path + css + '.css';
	}
	else if(document.getElementsByTagName)
	{
		document.getElementsByTagName('link').item(i).href = path + css + '.css'; 
	}
}


function get_cookie()
{
	if(!document.cookie){return;}

	var css = '';
	var cookie = unescape(document.cookie).split(';');

	for(j in cookie)
	{
		if(!cookie[j].match(/css_ss=/)){continue;}

		c = cookie[j].replace(/css_ss=/g,"");
		v = c.split('=');
		css = v[1];
	}

	return css;
}


function set_cookie(css)
{
	cookie  = 'css_ss=css=' + escape(css) + '; ';
	cookie += "expires=Fri, 31-Dec-2030 23:59:59 GMT; path=/; ";

	document.cookie = cookie;

	location.reload();
}
