var Models = function() {
	this.title = true;
	this.logo = true;
	this.languages = false;
	this.countries = false;
	this.footer = true;
	this.stepMenu = true;
	this.showSeparator = true;
	this.html = [];	
}

Models.prototype.ini = function() {
	//alert(1);
	var so = mGLOBALS.model_groups.length;	
	this.html = [];
	this.html.push('<table align="center" class="content"><tr><td class="content_cell">');
	this.html.push(Interface.showStepButtons());

	this.html.push('<table class="models_table">');
	this.html.push('<td class="small_separator"></td><td>&nbsp;</td><td class="small_separator"></td><td>&nbsp;</td><td class="small_separator"></td>');
	var separators = [];
	for (var n = 0; n < 5; n++) {
		this.html.push('<tr>');
		separators = [];
		for (var i = 0; i < so; i++) {
			if (!mGLOBALS.model_groups[i][n]) {
				this.html.push('<td>&nbsp;</td>');				
				separators.push('<td>&nbsp;</td>');				
				if ((i + 1) < so) {
					this.html.push('<td>&nbsp;</td>');
					separators.push('<td>&nbsp;</td>');
				}
				continue;
			}
			separators.push('<td class="small_separator"></td>');

			Pictures.add('/_/models/'+mGLOBALS.model_groups[i][n]+'.jpg');

			this.html.push('<td><img src="/_/models/'+mGLOBALS.model_groups[i][n]+'.jpg" alt="model" id="model_'+ mGLOBALS.model_groups[i][n] +'" class="pointer" onclick="');
				this.html.push('Car.modelID = '+mGLOBALS.model_groups[i][n]+';');
				this.html.push('Configurator.currentStep = \'matrix\';');
				this.html.push('Configurator.ini();');
			this.html.push('"/></td>');
			if ((i + 1) < so) {
				this.html.push('<td>&nbsp;</td>');
				separators.push('<td>&nbsp;</td>');
			}
		}
		this.html.push('</tr><tr>'+separators.join('')+'</tr>');
		
	}
	this.html.push('</table>');
	this.html.push('</td>');
	this.html.push(Interface.showRightMenu());
	this.html.push('</tr></table>');
	$('content').innerHTML = this.html.join('');	
	Pictures.preload();
	//alert(1);
}

Models.prototype.getModelById = function() {
	var so = mGLOBALS.models.length;
	for (var i = 0; i < so; i++) {
		if (mGLOBALS.models[i].car_id == Car.modelID) return mGLOBALS.models[i].text;
	}
}
