//<![CDATA[
var FSC = function( argId ) {
	if ( window == this || !this.initialize ) {
		return new FSC( argId );
	}
	return this.initialize( argId );
};
FSC.c = {
	TARGETNAME		: ''				,
	STYLENAME		: 'font-size'		,
	REPLACEID		: '#fontSizeChange'	,
	FONTINDEX		: 1					,
	FONTSIZE		: new Array(
					'x-small'			,
					'small'				,
					'large'		)		,
	DUMMY_END		: 2					
};
FSC.p = {
	gWindow			: null				,
	DUMMY_END		: 2					
};
FSC.prototype.initialize = function( argId ) {
	FSC.c.TARGETNAME	= argId;
	this.gElement		= document.getElementById( argId );
	return this;
};
FSC.prototype.clickFontSizeS = function() {
	$.cookie( FSC.c.STYLENAME , FSC.c.FONTINDEX-1 , { expires: 90 , path: '/' } );
	$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ FSC.c.FONTINDEX-1 ] );
	this.renderButton();
/*
	var fontIndex = FSC.c.FONTINDEX;
	if( $.cookie( FSC.c.STYLENAME ) != null ) {
		fontIndex = parseInt( $.cookie( FSC.c.STYLENAME ) ) - 1;
		if ( fontIndex >= 0 ) {
			$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ fontIndex ] );
			$.cookie( FSC.c.STYLENAME , fontIndex , { expires: 90 } );
		} else {
		}
	} else {
		var fontIndex = FSC.c.FONTINDEX;
		$.cookie( FSC.c.STYLENAME , fontIndex , { expires: 90 } );
		$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ fontIndex ] );
	}
	this.renderButton();
*/
};
FSC.prototype.clickFontSizeD = function() {
	$.cookie( FSC.c.STYLENAME , FSC.c.FONTINDEX+0 , { expires: 90 , path: '/' } );
	$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ FSC.c.FONTINDEX+0 ] );
	this.renderButton();
};
FSC.prototype.clickFontSizeL = function() {
	$.cookie( FSC.c.STYLENAME , FSC.c.FONTINDEX+1 , { expires: 90 , path: '/' } );
	$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ FSC.c.FONTINDEX+1 ] );
	this.renderButton();
/*
	var fontIndex = FSC.c.FONTINDEX;
	if( $.cookie( FSC.c.STYLENAME ) != null ) {
		fontIndex = parseInt( $.cookie( FSC.c.STYLENAME ) ) + 1;
		if ( fontIndex < FSC.c.FONTSIZE.length ) {
			$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ fontIndex ] );
			$.cookie( FSC.c.STYLENAME , fontIndex , { expires: 90 } );
		} else {
		}
	} else {
		var fontIndex = FSC.c.FONTINDEX;
		$.cookie( FSC.c.STYLENAME , fontIndex , { expires: 90 } );
		$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ fontIndex ] );
	}
	this.renderButton();
*/
};
FSC.prototype.openWindow = function( argUrl , argWidth , argHeight ) {
	if ( window.gWindow ) {
		FSC.p.gWindow.close();
	}
	FSC.p.gWindow = window.open( argUrl , 'win' , 'width=' + argWidth + ',height=' + argHeight + ',status=no,scrollbars=yes,directories=no,menubar=no,resizable=yes,toolbar=no' );
};
FSC.prototype.renderButton = function() {
	var html = '';
	switch ( parseInt( $.cookie( FSC.c.STYLENAME ) ) ) {
		case 0:
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeL();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/L.gif" alt="大" title="大" width="22" height="22" class="imgover" /></a></li>';
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeD();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/M.gif" alt="中" title="中" width="22" height="22" class="imgover" /></a></li>';
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeS();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/S_ov.gif" alt="小" title="小" width="22" height="22" /></a></li>';
			break;
		case 1:
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeL();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/L.gif" alt="大" title="大" width="22" height="22" class="imgover" /></a></li>';
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeD();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/M_ov.gif" alt="中" title="中" width="22" height="22" /></a></li>';
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeS();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/S.gif" alt="小" title="小" width="22" height="22" class="imgover" /></a></li>';
			break;
		case 2:
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeL();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/L_ov.gif" alt="大" title="大" width="22" height="22" /></a></li>';
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeD();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/M.gif" alt="中" title="中" width="22" height="22" class="imgover" /></a></li>';
			html+= '<li><a href="javascript:void(0)" onclick="FSC.prototype.clickFontSizeS();return false;"><img src="http://www.junsei.ac.jp/edu/common/images/S.gif" alt="小" title="小" width="22" height="22" class="imgover" /></a></li>';
			break;
		default:
	}
	$( FSC.c.REPLACEID ).html( html );
	initRollovers();
};
FSC.prototype.start = function() {
	var fontIndex = FSC.c.FONTINDEX;
	if( $.cookie( FSC.c.STYLENAME ) == null ) {
		$.cookie( FSC.c.STYLENAME , fontIndex , { expires: 90 , path: '/' } );
	} else {
	}
	fontIndex = parseInt( $.cookie( FSC.c.STYLENAME ) );
	$( FSC.c.TARGETNAME ).css( FSC.c.STYLENAME , FSC.c.FONTSIZE[ fontIndex ] );
	this.renderButton();
};
//]]>
