
SAILClass.prototype.tpl = {
	/**
	 * @private
	 * @return  {Object}
	 */
	init: function () {
		this._super = SBM;
		var f       = this._super.func;
		var hub     = this._super.hub;
		
		this.version = '2.02';
		this.url     = window.tpl_url || location.href;
		this.lang    = hub.getLang(this.url);
		this.id_xml  = '';
		this.ss      = null;
		
		return this;
	},
	
	/**
	 * @private
	 */
	createBreadcrumbs: function () {
		if (this.isClosed()) {
			var header = this._super.dom.get('header');
			header.getTag('ul')[0].style.display = 'none';
			if (this.ss.logo) {
				header.get('frm-H-logo').getTag('a')[0].onclick = function () {
					SBM.win.opener(this.href);
					return false;
				};
			}
			else {
				header.get('frm-H-logo').getTag('a')[0].removeAttribute('href');
			}
			var input = header.getTag('form')[0].getTag('input');
			for (var i = 0, ix = input.length; i < ix; i++)
				input[i].style.display = 'none';
			
			return;
		}
		
		var id = this.getTemplateID();
		if (id && (id != '1')) {
			var d   = this._super.dom;
			var hub = this._super.hub;
			
			var bc = [];
			    bc.push('<div id="frm-H-bcs">');
			    bc.push('<ol>');
			    bc.push('<li id="frm-H-home">');
			    bc.push('<a href="/mb/' + ((this.lang == 'en') ? 'en/' : '') + '">');
			    bc.push('Home');
			    bc.push('</a>');
			    bc.push('</li>');
			    bc.push('</ol>');
			    bc.push('</div>');
			
			document.write(bc.join(''));
			
			var createList = function (list) {
				var li = [];
				if (list.length >= 2) {
					for (var i = 1, ix = list.length - 1; i < ix; i++) {
						li.push('<li>');
						li.push('<a href="' + list[i].url + '">');
						li.push(list[i].name);
						li.push('</a>');
						li.push('</li>');
					}
					
					li.push('<li>');
					li.push(list[list.length - 1].name);
					li.push('</li>');
					
					d.get('header').getTag('ol')[0].push(li.join(''));
					if (list.length >= 5) {
						d.get('header').getTag('ol')[0].id = 'frm-H-small';
					}
				}
			};
			
			this.id_xml = hub.tree.getTree(createList, this.url);
		}
	},	
	/**
	 * @private
	 * @return  {boolean}
	 */
	isClosed: function () {
		if (!this.ss) {
			var e   = this._super.env;
			var ss  = e.loadCookie('closed_ss') || '';
			this.ss = { logo: /logo/.test(ss) };
		}
		return (window.name == 'closed');
	}
}.init();

