
var LP_Machine = function (serie, jMachine) {
	this.serie 			= serie;
	this.model 			= jMachine.find('td.LP_model').html();
	this.comment 		= jMachine.find('td.LP_comment_text').html();
	this.commentAlign 	= jMachine.find('td.LP_comment_align').html();
	this.chart 			= new LP_Chart(this, jMachine.find('td.LP_data table'));
};

LP_Machine.prototype.getOutput = function (i, totalMachines) {
	var data = {
		arrow: '<img src="image/machine_serie_arrow.gif" alt="" />',
		serie: this.serie.name,
		model: this.model,
		chart: this.chart.getOutput()
	};
	
	if (i == 0) {
		data.totalMachines = this.serie.totalMachines;
		var tpl = new Template(LP_Machine_firstTemplate);
		return tpl.evaluate(data);
	}
	else {
		var tpl = new Template(LP_Machine_Template);
		return tpl.evaluate(data);
	}
};

var LP_Machine_firstTemplate 	 = tab+'<tr class="LP_serie_row">'+newline;
//LP_Machine_firstTemplate 		+= tab+tab+'<td class="LP_serie" rowspan="{[totalMachines]}">{[arrow]}<div class="title_serie">{[serie]}</div></td>'+newline;
LP_Machine_firstTemplate 		+= tab+tab+'<td class="LP_serie" rowspan="{[totalMachines]}">{[arrow]}<span class="title_serie">{[serie]}</span></td>'+newline;
LP_Machine_firstTemplate 		+= tab+tab+'<td class="LP_model">{[model]}</td>'+newline;
LP_Machine_firstTemplate 		+= tab+tab+'<td class="LP_chart">{[chart]}</td>'+newline;
LP_Machine_firstTemplate 		+= tab+'</tr>'+newline;

var LP_Machine_Template  = tab+'<tr class="LP_serie_row">'+newline;
LP_Machine_Template 	+= tab+tab+'<td class="LP_model">{[model]}</td>'+newline;
LP_Machine_Template 	+= tab+tab+'<td class="LP_chart">{[chart]}</td>'+newline;
LP_Machine_Template 	+= tab+'</tr>'+newline;
