	
	function cst_i18n( ) {
		this.i18n = {
			months: ['januar','februar','mrz','april','mai','juni','juli','august','sept','okt','nov','dezember'],
			weekdays: ['sonntag','montag','dienstag','mittwoch','donnerstag','freitag','samstag'],
			weekdays_short: ['so','mo','di','mi','do','fr','sa']
		};
	}
	
	cst_i18n.prototype.i18n_set = function( type, strings ) {
		this.i18n[type] = {};
		
		jQuery.each(
			strings,
			function( key, value ) {
				var span = document.createElement( 'span' );
				span.innerHTML = value;
				this.i18n[type][key] = unescape( span.innerHTML );
			}.bind( this )
		);
	}
	
	cst_i18n.prototype.i18n_string_set = function( type, key, value ) {
		if( typeof this.i18n[type] == 'undefined' ) this.i18n[type] = {};
		
		var span = document.createElement( 'span' );
		span.innerHTML = value;
		this.i18n[type][key] = span.innerHTML;
	}
	
	cst_i18n.prototype.i18n_string_entities_decode_span = function( value ) {
		var span = document.createElement( 'span' );
		span.innerHTML = value;
		if( typeof span.innerText == 'undefined') {
			return value;
		};
		return span.innerText;
		// return span.innerHTML;
	}
	
	// from http://snipplr.com/view/13634/htmlentitydecode/
	cst_i18n.prototype.i18n_string_entities_decode = function( value ) {
	    try {
			var tarea = document.createElement( 'textarea' );
			tarea.innerHTML = value;
			return tarea.value;
			tarea.parentNode.removeChild( tarea );
		} catch(e) {
			return cst_i18n.prototype.i18n_string_entities_decode_span( value );
		}
	}
	
	cst_i18n.prototype.i18n_get = function( type, index ) {
		if( typeof this.i18n[type] == 'undefined' ) alert( 'i18n_get(): type not found: ' + type );
		if( typeof this.i18n[type][index] == 'undefined' ) alert( 'i18n_get(): string (type: '+type+') not found: ' + index );
		if( typeof this.i18n[type] == 'undefined' || typeof this.i18n[type][index] == 'undefined' && ( typeof _ch != 'undefined' && typeof _ch.error_handler != 'undefined' ) ) {
			 _ch.error_handler( { msg: '' + type + ' ' + index, url: '', line: 0 }, 'lng' );	
		}
		return this.i18n[type][index];
	}
	
	cst_i18n.prototype.i18n_check = function( type, index ) {
		if( typeof this.i18n[type] == 'undefined' || typeof this.i18n[type][index] == 'undefined' && ( typeof _ch != 'undefined' && typeof _ch.error_handler != 'undefined' ) ) {
			return false
		}
		return true;
	}

