/*
 * ToriSat リソースファイル
 * ごうだまりぽ
 */

// ja latitude:35.682552, longitude:139.75962	
// en longitude:-77.021841, latitude:38.889614
DEFAULT_LOCATION = {latitude:38.889614, longitude:-77.021841	};
var Message = {
	
	LOADING_SAT_LIST_START: 'Loading the satellite list...',
	LOADING_SAT_LIST_FINISH: 'Loaded the satellite list.',
	LOADING_SAT_LIST_FAIL: 'Failed to load satellite list.',
	LOADING_SAT_SCHEDULE_START: 'Loading the prediction data of {0}.',
	LOADING_SAT_SCHEDULE_FINISH: 'Loaded the prediction data of {0}.',
	LOADING_SAT_SCHEDULE_FAIL: 'Failed to load the predicition data of {0}.',
	SAT_SCHEDULE_EMPTY: "Sorry,{0} doesn't pass overhead in this 24 hours...( >_<)",
	SAT_SCHEDULE_FOUND: '{0} will pass overhead in this 24 hours!(*^-^)b',
	SAT_SCHEDULE_NEXT: 'Next approach is at {0}. {1} Click "play" button to simulate the path.',
	HOME_SET: 'Your home position was saved',
	HOME_EMPTY: 'You have not selected home position.',
	WELCOME: 'Welcome!Select your location in Google Map below.',
	EARTH_PLUGIN_NOT_FOUND: '<a href="http://code.google.com/intl/ja/apis/earth/">Google Earth plugin</a> is not installed. You can simulate the view from the satellite with Google Earth!',
	DEBUG: 'DEBUG:{0}',
	
	_messages: new Array(),
	_MAX_LINE: 3,
	
	showMessage : function (message, replacement) {
		if (replacement) {
			//replace
			for (var i=0, l=replacement.length; i<l; i++) {
				message = message.replace("{"+i+"}", replacement[i]);
			}
		}
		this._renderMessages(message);
	},
	_renderMessages: function (newMessage) {
		this._messages.push(newMessage);
		this._shift();
		$('headerConsole').innerHTML = this._messages.join('<br/>');
	},
	_shift: function () {
		if (this._messages.length > this._MAX_LINE)	this._messages.splice(0,1);
	},
	applyLocale: function () {
		for (var i=0, l=this.staticMessages.length; i<l; i++) {
			try {
				var message = this.staticMessages[i];
				if (message.message)
					$(message.id).innerHTML = message.message;
				if (message.value)
					$(message.id).value = message.value;
				if (message.title)
					$(message.id).title = message.title;
			} catch (e) {}		
		}
	}
};

	DICT = {
		N:'N',
		E:'E',
		W:'W',
		S:'S',
		NAKED_EYE_OK:'Easy to see with naked eyes!',
		NAKED_EYE_NG:'Difficult to see with naked eyes.',
		NAKED_EYE:'Condition',
		ELEVATION:'Elevation',
		PEAK:'Peak',
		SINCE:'Start',
		UNTIL:'End',
		SUN:'S',MON:'M',TUE:'T',
		WED:'W',THU:'T',
		FRI:'F',SAT:'S'
	};
	var Dict = DICT;
	