
function Table()
{ 
	this.base = GUIBasic;
	this.id;
	this.PRETPERSOANATIPOFERTA="";
    this.tdHeaderArray;
	this.columnsInput;
	
	this.createTableHotel = function(id, nume)
	{
		this.id = id;
		var div = document.createElement('div');
	        div.setAttribute("id","hotel"+id);
        var hi = this.createInput("hidden","idhotel"+id,id);
		div.appendChild(hi);

		var table = this.createTable("0","100%","1px solid #AAAAAA");
		var tbody = this.createTableBody();
		
		var tr = this.createRow();
		var td = this.createColumn("left", "top", "r_text", "50%");
		    td.appendChild(this.createBold(nume));
			td.appendChild(document.createTextNode(" | "));
			td.appendChild(this.createA("hotel.php?id="+id, "_blank", "vezi detalii hotel"));
		    tr.appendChild(td);
		var td = this.createColumn("right", "top", "r_text", "50%");
		    td.appendChild(this.createA("javascript:stergeHotel('"+id+"');", '_self', STERGEHOTEL));
		    tr.appendChild(td);
			tbody.appendChild(tr);

		var tr = this.createRow();
		var td = this.createColumn("left", "top", "r_text", "50%");
		    td.appendChild(this.createMasa());
			tr.appendChild(td);
		var td = this.createColumn("right", "top", "r_text", "50%");
		    td.style.borderBottom = "1px dotted CCCCCC";
		    td.appendChild(document.createTextNode(ADAUGAPERIOADAPRET));
			tr.appendChild(td);
			tbody.appendChild(tr);
        
		var tr = this.createRow();
		var td = this.createColumn("left", "top", "r_text", "50%");
		    td.colSpan = 2;
		    td.appendChild(this.createPreturi());
			tr.appendChild(td);
		    tbody.appendChild(tr);
            
			table.appendChild(tbody);
			div.appendChild(table);
			var lastRow = this.createInput("hidden","lastrow"+this.id,"1");
			    lastRow.setAttribute("id","lastrow"+this.id);
			div.appendChild(lastRow);
		var holder = document.getElementById('hotelsholder');
        holder.appendChild(div);
		holder.appendChild(document.createElement("br"));
        }
	this.createMasa = function()
					  {
		                var values = new Array(6,4,1,2,5,3,7,8);
						var text = new Array(ALLINCLUSIVE,DEMIPENSIUNE,FARAMASA,MICDEJUN,PENSIUNECOMPLETA,PRANZ,"ultra all inclusive","nespecificat");
						var masa = this.createSelect("masaChoice"+this.id, "comm_t", values, text, TIPMASA);
						var span = document.createElement('span');
                     	span.appendChild(document.createTextNode(TIPMASA+" :"));
					    span.appendChild(masa);
						return span;
							}
	this.createPreturi = function()
						 {
							var table = this.createTable("0","100%","");
							var tbody = this.createTableBody();
		
							var tr = this.createRow();
							var td = this.createColumn("center", "top", "comm_t", "");
							    td.colSpan = 2;
							    td.appendChild(document.createTextNode(PERIOADA));
							    tr.appendChild(td);
							var td = this.createColumn("center", "top", "comm_t", "");
							    td.colSpan = 4;
							    td.appendChild(document.createTextNode(this.PRETPERSOANATIPOFERTA));
							    tr.appendChild(td);
								tbody.appendChild(tr);
                             
								tbody.appendChild(this.createTdHeader(this.tdHeaderArray));
                            var tr = this.createRow();
								var thishotid = this.id;
							    tr.appendChild(this.createTdTextFieldDate("dela"+thishotid));
								tr.appendChild(this.createTdTextFieldDate("panala"+thishotid));
								for(i=0;i<this.columnsInput.length;i++)
							    {
									tr.appendChild(this.createTdTextField(this.columnsInput[i]));
									}
								tr.appendChild(this.createButton("","+",function(){adaugaLiniePerioadaPret(thishotid);}));
                                tbody.appendChild(tr);

								table.appendChild(tbody);
							return table;
							}
}

Table.prototype = new GUIBasic;

