////////////////////////////////////////////////////////////////////////////////
// 月齢ガジェット
//   Copyright (C) 2008 - 2009 AAOh inc.
////////////////////////////////////////////////////////////////////////////////

/**
 * @fileOverview 月齢
 * @author       $Author: fujishiro $
 */

(function () {
/**
 * Option。
 *
 * @constructor
 */
moonage.Option = aaoh.kaze.Gadget.extend(
	aaoh.sora.OptionEx, function() {
});
	/**
	 * 設定データの設定。
	 */
	moonage.Option.prototype.
	doOption = function() {
		// type
		for (var cnt = 1; cnt <= 3; cnt++) {
			var rdoType = aaoh.kaze.Gadget.$('rdoType' + cnt);
			var flgType = aaoh.kaze.Element.isChecked(rdoType);

			if (flgType) {
				aaoh.sora.App.model.data.type = String(cnt);
				break;
			}
		}
	}

	/**
	 * 表示データの初期化。
	 */
	moonage.Option.prototype.
	initData = function() {
		// デフォルト値の更新
		aaoh.sora.App.control.DEFAULT_ALERT_MSG
			= aaoh.sora.App.control.locale.getString('ALERT_MSG');

		this.initTitleData();
		this.initDefaultData();
	}

	/**
	 * 表示データの初期化(タイトル)。
	 */
	moonage.Option.prototype.
	initTitleData = function() {
		var lblType  = aaoh.kaze.Gadget.$('lblType');
		var lblType1 = aaoh.kaze.Gadget.$('lblType1');
		var lblType2 = aaoh.kaze.Gadget.$('lblType2');
		var lblType3 = aaoh.kaze.Gadget.$('lblType3');

		var ttlType  = aaoh.sora.App.control.locale.getString('TTL_TYPE');
		var ttlType1 = aaoh.sora.App.control.locale.getString('TTL_TYPE1');
		var ttlType2 = aaoh.sora.App.control.locale.getString('TTL_TYPE2');
		var ttlType3 = aaoh.sora.App.control.locale.getString('TTL_TYPE3');

		aaoh.kaze.Element.setValue(lblType,  ttlType);
		aaoh.kaze.Element.setValue(lblType1, ttlType1);
		aaoh.kaze.Element.setValue(lblType2, ttlType2);
		aaoh.kaze.Element.setValue(lblType3, ttlType3);
	}

	/**
	 * 表示データの初期化(デフォルト)。
	 */
	moonage.Option.prototype.
	initDefaultData = function() {
		// type
		var rdoType = aaoh.kaze.Gadget.$(
			'rdoType' + aaoh.sora.App.model.data.type
		);
		aaoh.kaze.Element.setChecked(rdoType, true);
	}

	/**
	 * 表示データの初期化(Yahoo)。
	 */
	moonage.Option.prototype.
	initDataForYahoo = function() {
		var ttlType  = aaoh.sora.App.control.locale.getString('TTL_TYPE');
		var ttlType1 = aaoh.sora.App.control.locale.getString('TTL_TYPE1');
		var ttlType2 = aaoh.sora.App.control.locale.getString('TTL_TYPE2');
		var ttlType3 = aaoh.sora.App.control.locale.getString('TTL_TYPE3');

		preferences.type.title     = ttlType;
		preferences.type.option[0] = ttlType1;
		preferences.type.option[1] = ttlType2;
		preferences.type.option[2] = ttlType3;
	}

	/**
	 * イベントの設定。
	 */
	moonage.Option.prototype.
	setEventListener = function() {
		// 特になし
	}

	/**
	 * 初期化処理(画面表示)。
	 */
	moonage.Option.prototype.
	initDisplay = function() {
		// 特になし
	}

	/**
	 * 初期化処理。
	 */
	moonage.Option.prototype.
	init = function() {
		this.setEventListener();
		this.initDisplay();
	}
})();
