
/*-----------------------------------------------------------------------------

__  __ `__ \  _ \  ___/  __ `/_  __ \  __ \
_  / / / / /  __/ /__ / /_/ /_  / / / /_/ /
/_/ /_/ /_/\___/\___/ \__,_/ /_/ /_/\____/

Dictionnary.

version:   1.1
author:    Vincent Martin
email:     vincent@mecano.ca

------------------------------------------------------------------------------*/

dict = {
	
	/* Loads dictionnary content
	------------------------------------------- */
	loadDictContent: function(){
		this.add('name',{
				 		fr:"",
						en:"Your name"
				 		});
		this.add('email',{
				 		fr:"",
						en:"Your email"
				 		});
		this.add('message',{
				 		fr:"",
						en:"Your message..."
				 		});
		this.add('company',{
				 		fr:"",
						en:"Your company"
				 		});
		this.add('phone',{
				 		fr:"",
						en:"Your phone number"
				 		});
		this.add('si_email',{
				 		fr:"",
						en:""
				 		});
	},
	
	
	
	/* Add an entry.
	------------------------------------------- */
	add: function(msgId,msgData){
		this._dict.push({id:msgId,data:msgData});
	},
	
	
	
	/* Get an entry
	------------------------------------------- */
	get: function(msgId,msgLang){
		if(msgLang == null)msgLang = 'en';
		var ar = this._dict;
		var lg = ar.length;
		for(var i=0;i<lg;i++){
			if(ar[i].id == msgId) return ar[i].data[msgLang];
		}
	},
	
	
	
	
	init: function(){
		if (this._INIT == null){
			this._INIT = true;
			this._dict = [];
			this.startUp();
		}
	},
	
	
	
	
	startUp: function(){
		this.loadDictContent();
	},
	
	
	
	
	onWindowDomReady: function(){
		this.init();
	},
	
	
	
	
	onWindowLoad: function(){
		this.init();
	}
};

window.addEvent('domready', function() {
	dict.onWindowDomReady();
});

window.addEvent('load', function() {
	dict.onWindowLoad();
});