var ajaxManager = Jade.AjaxManager();
{//Ajax--------------------------------------------------------------------------------------------------------------------------------------------------------
	{//Ajax basic----------------------------------------------------------------------------------------------------------------------------------------------
		ajaxManager.Create('basic');
		{//DayTypes--------------------------------------------------------------------------------------------------------------------------------------------
			var aDayTypes=[];
			var ajaxDayTypes=Jade.AjaxDB("SELECT * FROM TIPO_DIA{c} ORDER BY Codigo");
			ajaxDayTypes.Add(ajaxManager,'basic');
			ajaxDayTypes.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						aDayTypes[item.Codigo] = {};
						aDayTypes[item.Codigo].Text = item.Codigo+" - "+item.Descripcion;
						aDayTypes[item.Codigo].Codigo = item.Codigo;
						aDayTypes[item.Codigo].Descripcion = item.Descripcion;
						aDayTypes[item.Codigo].Laborable = item.Laborable;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
		}
		{//Events----------------------------------------------------------------------------------------------------------------------------------------------
			var aEvents=[];
			var ajaxEvents=Jade.AjaxDB("SELECT * FROM INCIDENCIAS{c} ORDER BY Codigo");
			ajaxEvents.Add(ajaxManager,'basic');
			ajaxEvents.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						aEvents[item.Codigo]={};
						aEvents[item.Codigo].Text = item.Codigo+" - "+item.Descripcion;
						aEvents[item.Codigo].Codigo = item.Codigo;
						aEvents[item.Codigo].Descripcion = item.Descripcion;
						aEvents[item.Codigo].Valorada = item.Valorada;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
		}
		{//Accruals--------------------------------------------------------------------------------------------------------------------------------------------
			var aAccruals=[];
			var ajaxAccruals=Jade.AjaxDB("SELECT * FROM ACUMULADORES{c} ORDER BY Codigo");
			ajaxAccruals.Add(ajaxManager,'basic');
			ajaxAccruals.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						aAccruals[item.Codigo]={};
						aAccruals[item.Codigo].Text=item.Codigo+" - "+item.Descripcion;
						aAccruals[item.Codigo].Codigo=item.Codigo;
						aAccruals[item.Codigo].Descripcion=item.Descripcion;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
		}
		{//Breaks----------------------------------------------------------------------------------------------------------------------------------------------
			var aBreaks=[];
			var ajaxBreaks=Jade.AjaxDB("SELECT * FROM INTERRUPCIONES{c} ORDER BY Codigo");
			ajaxBreaks.Add(ajaxManager,'basic');
			ajaxBreaks.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						aBreaks[item.Codigo]={};
						aBreaks[item.Codigo].Text=item.Codigo+" - "+item.Descripcion;
						aBreaks[item.Codigo].Codigo=item.Codigo;
						aBreaks[item.Codigo].Descripcion=item.Descripcion;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
		}
		{//Payrolls--------------------------------------------------------------------------------------------------------------------------------------------
			var aPayrolls=[];
			var ajaxPayrolls=Jade.AjaxDB("SELECT * FROM COSTES{c} ORDER BY Codigo");
			ajaxPayrolls.Add(ajaxManager,'basic');
			ajaxPayrolls.oncomplete=function() {
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++)	{
						var item=this.json.row[i];
						aPayrolls[item.Codigo]={};
						aPayrolls[item.Codigo].Text=item.Codigo+" - "+item.Descripcion;
						aPayrolls[item.Codigo].Codigo=item.Codigo;
						aPayrolls[item.Codigo].Descripcion=item.Descripcion;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
		}
		{//PayrollItems----------------------------------------------------------------------------------------------------------------------------------------
			var aPayrollItems=[];
			var ajaxPayrollItems=Jade.AjaxDB("SELECT * FROM COSTES_CONCEPTOS{c} ORDER BY Codigo");
			ajaxPayrollItems.Add(ajaxManager,'basic');
			ajaxPayrollItems.oncomplete=function() {
				if(!this.json.error) {
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						aPayrollItems[item.Codigo]={};
						aPayrollItems[item.Codigo].Text=item.Codigo+" - "+item.Descripcion;
						aPayrollItems[item.Codigo].Codigo=item.Codigo;
						aPayrollItems[item.Codigo].Descripcion=item.Descripcion;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
			ajaxManager.group['basic'].Add(ajaxPayrollItems);
		}
		{//Profiles--------------------------------------------------------------------------------------------------------------------------------------------
			var aProfiles=[];
			var ajaxProfiles=Jade.AjaxDB("SELECT Codigo,Descripcion FROM PERFILES{c} ORDER BY Codigo");
			ajaxProfiles.Add(ajaxManager,'basic');
			ajaxProfiles.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						aProfiles[item.Codigo]={};
						aProfiles[item.Codigo].Text=item.Codigo+' - '+item.Descripcion;
						aProfiles[item.Codigo].Codigo=item.Codigo+' - '+item.Descripcion;
						aProfiles[item.Codigo].Descripcion=item.Codigo+' - '+item.Descripcion;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
			ajaxManager.group['basic'].Add(ajaxProfiles);
		}
		{//Terminals-------------------------------------------------------------------------------------------------------------------------------------------
			var aTerminals=[];
			var ajaxTerminals=Jade.AjaxDB("SELECT * FROM TERMINALES{c} ORDER BY Codigo");
			ajaxTerminals.Add(ajaxManager,'basic');
			ajaxTerminals.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						aTerminals[item.Codigo]={}
						aTerminals[item.Codigo].Text=item.Codigo+" - "+item.Descripcion;
						aTerminals[item.Codigo].Codigo=item.Codigo;
						aTerminals[item.Codigo].Descripcion=item.Descripcion;
						aTerminals[item.Codigo].Tipo=item.Tipo;
						if(typeof(aTerminalSlots[item.Codigo])=="undefined"){
							aTerminalSlots[item.Codigo]={};
							aTerminalSlots[item.Codigo].item=[];
						}
						if(typeof(aTerminalGroups[item.Codigo])=="undefined"){
							aTerminalGroups[item.Codigo]={};
							aTerminalGroups[item.Codigo].item=[];
						}
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
			ajaxManager.group['basic'].Add(ajaxTerminals);
		}
		{//TerminalSlots---------------------------------------------------------------------------------------------------------------------------------------
			var aTerminalSlots=[];
			var ajaxTerminalSlots=Jade.AjaxDB("SELECT * FROM TERMINALES_FRANJAS{c} ORDER BY Codigo");
			ajaxTerminalSlots.Add(ajaxManager,'basic');
			ajaxTerminalSlots.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						if(typeof(aTerminalSlots[item.IdTerminal])=="undefined"){
							aTerminalSlots[item.IdTerminal]={};
							aTerminalSlots[item.IdTerminal].item=[];
						}
						aTerminalSlots[item.IdTerminal].item[item.Codigo]={};
						aTerminalSlots[item.IdTerminal].item[item.Codigo].Text=item.Codigo+" - "+item.Descripcion;
						aTerminalSlots[item.IdTerminal].item[item.Codigo].Codigo=item.Codigo;
						aTerminalSlots[item.IdTerminal].item[item.Codigo].Descripcion=item.Descripcion;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
			ajaxManager.group['basic'].Add(ajaxTerminalSlots);
		}
		{//TerminalGroup---------------------------------------------------------------------------------------------------------------------------------------
			var aTerminalGroups=[];
			var ajaxTerminalGroups=Jade.AjaxDB("SELECT * FROM TERMINALES_GRUPOS{c} ORDER BY Codigo");
			ajaxTerminalGroups.Add(ajaxManager,'basic');
			ajaxTerminalGroups.oncomplete=function(){
				if(!this.json.error){
					for(var i=0,iLen=this.json.row.length;i<iLen;i++){
						var item=this.json.row[i];
						if(typeof(aTerminalGroups[item.IdTerminal])=="undefined"){
							aTerminalGroups[item.IdTerminal]={};
							aTerminalGroups[item.IdTerminal].item=[];
						}
						aTerminalGroups[item.IdTerminal].item[item.Codigo]={};
						aTerminalGroups[item.IdTerminal].item[item.Codigo].Text=item.Codigo+" - "+item.Descripcion;
						aTerminalGroups[item.IdTerminal].item[item.Codigo].Codigo=item.Codigo;
						aTerminalGroups[item.IdTerminal].item[item.Codigo].Descripcion=item.Descripcion;
					}
				}
				else{ Jade.Debug.Add(this.text); }
			}
			ajaxManager.group['basic'].Add(ajaxTerminalGroups);
		}
	}
	{//Ajax functions------------------------------------------------------------------------------------------------------------------------------------------
		function LoadProfile() {
			var profile=cmbProfile.selectedKey;
			{//Varios----------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxVarios=Jade.AjaxDB("SELECT * FROM PERFILES_VARIOS{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY Publico ASC",Ajax.Dontwait);
				ajaxVarios.oncomplete=function(){
					if(!this.json.error){
						if(this.json.row.length!=0){		
							var item=this.json.row[0];
							//---------------------------------------------------------
							if(item.AusenciaAsociar == '1'){ optAbsence2.SetCheck(); }
							else{ optAbsence1.SetCheck(); }
							for(var j in aEvents){
								if(!Jade.Utils.IsSystemIncidence(j)){ cmbAbsenceIncident.AddItem(aEvents[j].Text,j); }
							}
							cmbAbsenceIncident.SetSelectedKey(item.AusenciaIncidencia);
							//---------------------------------------------------------
							optProfile_Payroll2.SetCheck(item.AsignacionCostes);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//Rounding--------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxRounding=Jade.AjaxDB("SELECT * FROM PERFILES_E_S{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY IdTipoDia,Desde,Hasta,Redondeada,Tipo,Publico DESC",Ajax.Dontwait);
				grRoundings.ClearRows();
				ajaxRounding.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row = grRoundings.NewRow([item.IdTipoDia, item.Desde, item.Hasta, item.Redondeada, item.Tipo,[$.lng('erease'),'delete']],item.Indice);
							var combo = row.cells[0].references.object;
							for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
							combo.SetSelectedKey(item.IdTipoDia);
							combo = row.cells[4].references.object;
							combo.AddItem(Jade.Lang.Get('entry'),'0');
							combo.AddItem(Jade.Lang.Get('exit'),'1');
							combo.SetSelectedKey(item.Tipo);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//AutoEvents------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxAutoEvents=Jade.AjaxDB("SELECT * FROM PERFILES_INCIDENCIAS{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY IdTipoDia,Desde,Hasta,IdIncidencia,Publico DESC",Ajax.Dontwait);
				grAutoEvents.ClearRows();
				ajaxAutoEvents.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row = grAutoEvents.NewRow([item.IdTipoDia, item.Desde, item.Hasta, item.IdIncidencia,item.Tipo,[$.lng('erease'),'delete']], item.Indice);
							var combo = row.cells[0].references.object;
							for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
							combo.SetSelectedKey(item.IdTipoDia);
							combo = row.cells[3].references.object;
							for(var j in aEvents){ if(!Jade.Utils.IsSystemIncidence(j)){ combo.AddItem(aEvents[j].Text,j); } }
							combo.SetSelectedKey(item.IdIncidencia);
							combo = row.cells[4].references.object;
							combo.AddItem(Jade.Lang.Get('entry'),'0');
							combo.AddItem(Jade.Lang.Get('exit'),'1');
							combo.SetSelectedKey(item.Tipo);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//AccrualBalance--------------------------------------------------------------------------------------------------------------------------------------
				var ajaxAccrualBalance=Jade.AjaxDB("SELECT * FROM PERFILES_SALDOS{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY IdAcumulador,Periodo,Publico DESC",Ajax.Dontwait);
				grAccrualBalance.ClearRows();
				ajaxAccrualBalance.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row=grAccrualBalance.NewRow([item.IdAcumulador, item.VecesPermitidas, item.TiempoPermitido, item.Periodo,[$.lng('erease'),'delete']], item.Indice);
							var combo=row.cells[0].references.object;
							for(var j in aAccruals){ combo.AddItem(aAccruals[j].Text,j); }
							combo.SetSelectedKey(item.IdAcumulador);
							combo = row.cells[3].references.object;
							combo.AddItem(Jade.Lang.Get('term_week'),'0');
							combo.AddItem(Jade.Lang.Get('term_month'),'1');
							combo.AddItem(Jade.Lang.Get('term_year'),'2');
							combo.SetSelectedKey(item.Periodo);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//Breaks----------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxBreaks = Jade.Ajax();
				ajaxBreaks.AddParam('query',"SELECT * FROM PERFILES_INTERRUPCIONES{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY IdInterrupcion,IdTipoDia,Publico DESC",Ajax.Dontwait);
				grBreaks.ClearRows();
				ajaxBreaks.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row = grBreaks.NewRow([item.IdTipoDia, item.IdInterrupcion,[$.lng('erease'),'delete']], item.Indice);
							var combo = row.cells[0].references.object;
							for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
							combo.SetSelectedKey(item.IdTipoDia);
							combo = row.cells[1].references.object;
							for(var j in aBreaks){ combo.AddItem(aBreaks[j].Text,j); }
							combo.SetSelectedKey(item.IdInterrupcion);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}		
			}
			{//Payrolls--------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxPayrolls=Jade.AjaxDB("SELECT * FROM PERFILES_COSTES{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY IdCoste,IdTipoDia,Publico DESC",Ajax.Dontwait);
				grPayroll.ClearRows();
				ajaxPayrolls.oncomplete=function() {
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row = grPayroll.NewRow([item.IdCoste, item.IdTipoDia,[$.lng('erease'),'delete']], item.Indice);
							var combo = row.cells[0].references.object;
							for(var j in aPayrolls){ combo.AddItem(aPayrolls[j].Text,j); }
							combo.SetSelectedKey(item.IdCoste);
							combo = row.cells[1].references.object;
							for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
							combo.SetSelectedKey(item.IdTipoDia);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//Compensation----------------------------------------------------------------------------------------------------------------------------------------
				var ajaxCompensation=Jade.AjaxDB("SELECT * FROM PERFILES_COMP_EQ{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY Publico DESC",Ajax.Dontwait);
				ajaxCompensation.oncomplete=function(){
					if(!this.json.error){
						if(this.json.row.length!=0){		
							var item=this.json.row[0];
							switch(item.Periodo){
								case '4':
									opt_compo_term_0.SetCheck();
									break;
								case '3':
									opt_compo_term_1.SetCheck();
									break;
								case '0':
									opt_compo_term_2.SetCheck();
									break;
							}
							if(item.TipoCompensacion == '1') { opt_compo_must_0.SetCheck(); }
							else { opt_compo_must_1.SetCheck(); }
							txt_compo_must.SetValue(item.MinimoHoras);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//CompensationDutyTime--------------------------------------------------------------------------------------------------------------------------------
				var ajaxCompensationDutyTime=Jade.AjaxDB("SELECT * FROM PERFILES_COMP_H_NORM{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY Publico DESC,IdCosteConcepto ASC",Ajax.Dontwait);
				ajaxCompensationDutyTime.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length; i<iLen; i++) {
							var item=this.json.row[i];
							var row=gr_comp_payroll.NewRow(['']);
							var combo = row.cells[0].references.object;
							for(var j in aPayrollItems){ combo.AddItem(aPayrollItems[j].Text,j); }
							row.cells[0].references.object.SetSelectedKey(item.IdCosteConcepto);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//CompensationEquiv-----------------------------------------------------------------------------------------------------------------------------------
				var ajaxCompensationEquiv = Jade.AjaxDB("SELECT * FROM PERFILES_COMP_EQ{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY Publico DESC,IdCosteConceptoOrigen ASC",Ajax.Dontwait);
				ajaxCompensationEquiv.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row=gr_comp_comp.NewRow(['','',item.TiempoMinimo]);
							var combo = row.cells[0].references.object;
							for(var j in aPayrollItems){
								row.cells[0].references.object.AddItem(aPayrollItems[j].Text,j);
								row.cells[1].references.object.AddItem(aPayrollItems[j].Text,j);
							}
							row.cells[0].references.object.SetSelectedKey(item.IdCosteConceptoOrigen);
							row.cells[1].references.object.SetSelectedKey(item.IdCosteConceptoDestino);
							
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}                                                                                                                                                                                                                                                                
			{//AccessDays------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxAccessDays=Jade.AjaxDB("SELECT * FROM PERFILES_SIN_ACCESO{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY Desde,Hasta,Publico DESC",Ajax.Dontwait);
				grNoAccessDays.ClearRows();
				ajaxAccessDays.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row = grNoAccessDays.NewRow([item.Desde, item.Hasta,[$.lng('erease'),'delete']],item.Indice);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//Access----------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxAccess=Jade.AjaxDB("SELECT * FROM PERFILES_ACCESOS{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY IdTerminal,Publico DESC",Ajax.Dontwait);
				grAccess.ClearRows();
				ajaxAccess.oncomplete=function(){
					if(!this.json.error){
						for(i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var terminal=aTerminals[item.IdTerminal];
							var row=grAccess.NewRow([terminal.Text,'0','0','0','0',terminal.Codigo,terminal.Tipo]);
							row.cells[1].onchangekey=function(){
								var row=this.references.row;
								FillAccessCombo(row.cells[2]);
								FillAccessCombo(row.cells[3]);
								FillAccessCombo(row.cells[4]);
							}
							var combo = row.cells[1].references.object;
							if(terminal.Tipo=='2'){
								combo.AddItem(Jade.Lang.Get('no_access'),'0');
								combo.AddItem(Jade.Lang.Get('with_access'),'1');
								combo.SetSelectedKey(item.Acceso);
							}
							else{
								combo.AddItem(Jade.Lang.Get('no_access'),'3');
								combo.AddItem(Jade.Lang.Get('group'),'0');
								combo.AddItem(Jade.Lang.Get('slots'),'1');
								if(item.Acceso=='0'){ combo.SetSelectedKey('3'); }
								else{
									combo.SetSelectedKey(item.Tipo); 
									row.cells[2].references.object.SetSelectedKey(item.Opcion1); 
									row.cells[3].references.object.SetSelectedKey(item.Opcion2); 
									row.cells[4].references.object.SetSelectedKey(item.Opcion3);
								}
							}					
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
			{//AccessTime------------------------------------------------------------------------------------------------------------------------------------------
				var ajaxAccessTime=Jade.AjaxDB("SELECT * FROM PERFILES_FORZAR_ACCESO{c} WHERE IdPerfil='"+profile+"' AND Publico='1' ORDER BY IdTipoDia,Desde,Hasta,Publico DESC",Ajax.Dontwait);
				grOnlyAccessTime.ClearRows();
				ajaxAccessTime.oncomplete=function(){
					if(!this.json.error){
						for(var i=0,iLen=this.json.row.length;i<iLen;i++){
							var item=this.json.row[i];
							var row = grOnlyAccessTime.NewRow([item.IdTipoDia,item.Desde, item.Hasta,[$.lng('erease'),'delete']], item.Indice);
							row.cells[0].onbeginedit=function(){
								var combo = this.references.object;
								for(var j in aDayTypes){
									combo.AddItem(aDayTypes[j].Text,j);
								}
							}
							row.cells[0].onbeginedit();
							row.cells[0].references.object.SetSelectedKey(item.IdTipoDia);
						}
					}
					else{ Jade.Debug.Add(this.text); }
				}
			}
		}
	}
	{//Ajax Manager--------------------------------------------------------------------------------------------------------------------------------------------
		ajaxManager.group['basic'].Start();
		ajaxManager.group['basic'].oncomplete=function(){
			for(var i in aProfiles){ cmbProfile.AddItem(aProfiles[i].Text,i); }
			cmbProfile.onchangekey=function(){ LoadProfile(); }
			LoadProfile();
		}
	}
}

{//Buttons-----------------------------------------------------------------------------------------------------------------------------------------------------
/*
	var cmdOk = Jade.Objects.Button();
	cmdOk.Location(0, 573, 495, 24);
	cmdOk.SetText(Jade.Lang.Get('accept'));
	cmdOk.Add();

	var cmdCancel = Jade.Objects.Button();
	cmdCancel.Location(505, 573, 495, 24);
	cmdCancel.SetText(Jade.Lang.Get('cancel'));
	cmdCancel.Add();
*/
}
{//Perfil------------------------------------------------------------------------------------------------------------------------------------------------------
	var gpPublicProfile=Jade.Objects.Container();
	gpPublicProfile.Location(0,0,1000,40);
	gpPublicProfile.SetStyle('transparent');
	gpPublicProfile.Add();
	var lblPublicProfile = Jade.Objects.Text(Jade.Lang.Get('public_profile')+' :');
	lblPublicProfile.Location(15,15,200,20);
	lblPublicProfile.Add(gpPublicProfile);
	var cmbProfile=Jade.Objects.ComboBox();
	cmbProfile.Location(210,10,780,20);
	cmbProfile.Add(gpPublicProfile);
}	
{//Pestaņas----------------------------------------------------------------------------------------------------------------------------------------------------
	var tabsPerfil=Jade.Objects.Tabs();
	tabsPerfil.Location(0,50,1000,492);
	tabsPerfil.AddTab(Jade.Lang.Get('roundings'));
	tabsPerfil.AddTab(Jade.Lang.Get('auto_events'));
	tabsPerfil.AddTab(Jade.Lang.Get('absence'));
	tabsPerfil.AddTab(Jade.Lang.Get('accrual_balance'));
	tabsPerfil.AddTab(Jade.Lang.Get('breaks'));
	tabsPerfil.AddTab(Jade.Lang.Get('payrolls'));
	tabsPerfil.AddTab(Jade.Lang.Get('no_access_days'));
	tabsPerfil.AddTab(Jade.Lang.Get('access'));
	tabsPerfil.AddTab(Jade.Lang.Get('only_access_time'));
	tabsPerfil.Add();
}
{//Pestaņas: Redondeos-----------------------------------------------------------------------------------------------------------------------------------------
	var cmRoundings=Jade.Grids.ColumnModel();
	cmRoundings.Add(Jade.Grids.ComboColumn({key: 'day_type', text: Jade.Lang.Get('day_type'), width: '250'}));
	cmRoundings.Add(Jade.Grids.HourColumn({key: 'from', text: Jade.Lang.Get('from'), width: '100'}));
	cmRoundings.Add(Jade.Grids.HourColumn({key: 'to', text: Jade.Lang.Get('to'), width: '100'}));
	cmRoundings.Add(Jade.Grids.HourColumn({key: 'rounding', text: Jade.Lang.Get('rounding'), width: '100'}));
	cmRoundings.Add(Jade.Grids.ComboColumn({key: 'entry_exit', text: Jade.Lang.Get('entry_exit'), width: '200'}));
	cmRoundings.Add(Jade.Grids.ButtonColumn({key: 'button', text: '', width: '140', sortable: false}));
	var grRoundings=Jade.Grids.Grid(cmRoundings);
	grRoundings.Location(5,40,990,420);
	grRoundings.Add(tabsPerfil.tabpages[0]);
	var cmdNewRounding = Jade.Objects.Button();
	cmdNewRounding.Location(10,10,980,20);
	cmdNewRounding.SetText(Jade.Lang.Get('new_profile_rounding'));
	cmdNewRounding.Add(tabsPerfil.tabpages[0]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	cmdNewRounding.onclick=function(){
		var row=grRoundings.NewRow(['0','0000','00000','0000','0',[$.lng('erease'),'delete'],'2']);
		var combo=row.cells[0].references.object;
		for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
		combo = row.cells[4].references.object;
		combo.AddItem(Jade.Lang.Get('entry'),'0');
		combo.AddItem(Jade.Lang.Get('exit'),'1');
	}
	grRoundings.columnmodel.columns[5].oncellclick=function(cell){ cell.references.row.Delete(); }
}
{//Pestaņas: Incidencias automaticas---------------------------------------------------------------------------------------------------------------------------
	var cmAutoEvents = Jade.Grids.ColumnModel();
	cmAutoEvents.Add(Jade.Grids.ComboColumn({key: 'day_type', text: Jade.Lang.Get('day_type'), width: '250'}));
	cmAutoEvents.Add(Jade.Grids.HourColumn({key: 'from', text: Jade.Lang.Get('from'), width: '70'}));
	cmAutoEvents.Add(Jade.Grids.HourColumn({key: 'to', text: Jade.Lang.Get('to'), width: '70'}));
	cmAutoEvents.Add(Jade.Grids.ComboColumn({key: 'incidence', text: Jade.Lang.Get('incidence'), width: '300'}));
	cmAutoEvents.Add(Jade.Grids.ComboColumn({key: 'entry/exit', text: Jade.Lang.Get('entry_exit'), width: '110'}));	
	cmAutoEvents.Add(Jade.Grids.ButtonColumn({key: 'button', text: '', width: '140', sortable: false}));
	var grAutoEvents = Jade.Grids.Grid(cmAutoEvents);
	grAutoEvents.Location(5,40,990,420);
	grAutoEvents.Add(tabsPerfil.tabpages[1]);
	var cmdNewAutoEvent = Jade.Objects.Button();
	cmdNewAutoEvent.Location(10,10,980,20);
	cmdNewAutoEvent.SetText(Jade.Lang.Get('new_profile_autoevent'));
	cmdNewAutoEvent.Add(tabsPerfil.tabpages[1]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	cmdNewAutoEvent.onclick=function(){
		var row = grAutoEvents.NewRow(['0','0000','00000','0','0',[$.lng('erease'),'delete']]);
		var combo = row.cells[0].references.object;
		for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
		combo = row.cells[3].references.object;
		for(var j in aEvents){ if(j>'0009') { combo.AddItem(aEvents[j].Text,j); } }
		combo = row.cells[4].references.object;
		combo.AddItem(Jade.Lang.Get('entry'),'0');
		combo.AddItem(Jade.Lang.Get('exit'),'1');
	}
	grAutoEvents.columnmodel.columns[5].oncellclick = function(cell) {
		cell.references.row.Delete();
	}
}
{//Pestaņas: Ausencias-----------------------------------------------------------------------------------------------------------------------------------------
	var optAbsence1 = Jade.Objects.Option(Jade.Lang.Get('assign_absence'));
	optAbsence1.Location(15,15,200,20);
	optAbsence1.Add(tabsPerfil.tabpages[2]);
	var optAbsence2 = Jade.Objects.Option(Jade.Lang.Get('assign_incident'));
	optAbsence2.Location(200,15,200,20);
	optAbsence2.Add(tabsPerfil.tabpages[2]);
	var cmbAbsenceIncident = Jade.Objects.ComboBox();
	cmbAbsenceIncident.Location(400,15,300,20);
	cmbAbsenceIncident.Add(tabsPerfil.tabpages[2]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	optAbsence2.onchange=function(){
		if(this.GetCheck()){ Jade.FX.Show(cmbAbsenceIncident); }
		else{ Jade.FX.Hide(cmbAbsenceIncident); }
	}
	optAbsence1.SetCheck();
	Jade.FX.Hide(cmbAbsenceIncident);
}
{//Pestaņas: Saldos de bolsas----------------------------------------------------------------------------------------------------------------------------------
	var cmAccrualBalance = Jade.Grids.ColumnModel();
	cmAccrualBalance.Add(Jade.Grids.ComboColumn({key: 'accrual', text: Jade.Lang.Get('accrual'), width: '250'}));
	cmAccrualBalance.Add(Jade.Grids.TextColumn({key: 'ocurrence', text: Jade.Lang.Get('ocurrences_allowed'), width: '150'}));
	cmAccrualBalance.Add(Jade.Grids.TimeColumn({key: 'time_allowed', text: Jade.Lang.Get('time_allowed'), width: '150'}));
	cmAccrualBalance.Add(Jade.Grids.ComboColumn({key: 'term', text: Jade.Lang.Get('term'), width: '250'}));
	cmAccrualBalance.Add(Jade.Grids.ButtonColumn({key: 'button', text: '', width: '140', sortable: false}));
	var grAccrualBalance = Jade.Grids.Grid(cmAccrualBalance);
	grAccrualBalance.Location(5,40,990,420);
	grAccrualBalance.Add(tabsPerfil.tabpages[3]);
	var cmdNewAccrualBalance = Jade.Objects.Button();
	cmdNewAccrualBalance.Location(10,10,980,20);
	cmdNewAccrualBalance.SetText(Jade.Lang.Get('new_profile_accrualbalance'));
	cmdNewAccrualBalance.Add(tabsPerfil.tabpages[3]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	cmdNewAccrualBalance.onclick=function(){
		var row = grAccrualBalance.NewRow(['0','00','00000','0',[$.lng('erease'),'delete']]);
		var combo = row.cells[0].references.object;
		for(var j in aAccruals){ combo.AddItem(aAccruals[j].Text,j); }
		combo = row.cells[3].references.object;
		combo.AddItem(Jade.Lang.Get('term_week'),'0');
		combo.AddItem(Jade.Lang.Get('term_month'),'1');
		combo.AddItem(Jade.Lang.Get('term_year'),'2');
	}
	grAccrualBalance.columnmodel.columns[4].oncellclick=function(cell){	cell.references.row.Delete(); }	
}
{//Pestaņas: Interrupciones------------------------------------------------------------------------------------------------------------------------------------
	var cmBreaks = Jade.Grids.ColumnModel();
	cmBreaks.Add(Jade.Grids.ComboColumn({key: 'day_type', text: Jade.Lang.Get('day_type'), width: '250'}));
	cmBreaks.Add(Jade.Grids.ComboColumn({key: 'break_time', text: Jade.Lang.Get('break_time'), width: '250'}));
	cmBreaks.Add(Jade.Grids.ButtonColumn({key: 'button', text: '', width: '140', sortable: false}));
	var grBreaks = Jade.Grids.Grid(cmBreaks);
	grBreaks.Location(5,40,990,420);
	grBreaks.Add(tabsPerfil.tabpages[4]);
	var cmdNewBreak = Jade.Objects.Button();
	cmdNewBreak.Location(10,10,980,20);
	cmdNewBreak.SetText(Jade.Lang.Get('new_profile_break'));
	cmdNewBreak.Add(tabsPerfil.tabpages[4]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	cmdNewBreak.onclick=function(){
		var row=grBreaks.NewRow(['0','0',[$.lng('erease'),'delete']], '');
		var combo=row.cells[0].references.object;
		for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
		combo=row.cells[1].references.object;
		for(var j in aBreaks){ combo.AddItem(aBreaks[j].Text,j); }
	}
	grBreaks.columnmodel.columns[2].oncellclick=function(cell){ cell.references.row.Delete(); }
}
{//Pestaņas: Costes--------------------------------------------------------------------------------------------------------------------------------------------
	var lblProfile_PayrollMethod = Jade.Objects.Text(Jade.Lang.Get('profile_payroll_method')+' :');
	lblProfile_PayrollMethod.Location(15,14,200,20);
	lblProfile_PayrollMethod.Add(tabsPerfil.tabpages[5]);
	var optProfile_Payroll1 = Jade.Objects.Option(Jade.Lang.Get('profile_payroll_method_1'));
	optProfile_Payroll1.Location(230,15,200,20);
	optProfile_Payroll1.Add(tabsPerfil.tabpages[5]);
	optProfile_Payroll1.SetCheck(true);
	var optProfile_Payroll2 = Jade.Objects.Option(Jade.Lang.Get('profile_payroll_method_2'));
	optProfile_Payroll2.Location(400,15,200,20);
	optProfile_Payroll2.Add(tabsPerfil.tabpages[5]);
	var cmdProfile_Compensation = Jade.Objects.Button(Jade.Lang.Get('define_payroll_compensation'));
	cmdProfile_Compensation.Location(10,35,980,20);
	cmdProfile_Compensation.Add(tabsPerfil.tabpages[5]);
	var cmdNewPayroll = Jade.Objects.Button();
	cmdNewPayroll.Location(10,65,980,20);
	cmdNewPayroll.SetText(Jade.Lang.Get('new_profile_payroll'));
	cmdNewPayroll.Add(tabsPerfil.tabpages[5]);
	var cmPayroll = Jade.Grids.ColumnModel();
	cmPayroll.Add(Jade.Grids.ComboColumn({key: 'day_type', text: Jade.Lang.Get('day_type'), width: '250'}));
	cmPayroll.Add(Jade.Grids.ComboColumn({key: 'payroll', text: Jade.Lang.Get('payroll'), width: '250'}));
	cmPayroll.Add(Jade.Grids.ButtonColumn({key: 'button', text: '', width: '140', sortable: false}));
	var grPayroll = Jade.Grids.Grid(cmPayroll);
	grPayroll.Location(5,95,990,365);
	grPayroll.Add(tabsPerfil.tabpages[5]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	optProfile_Payroll2.onchange=function(){
		if(this.checked){
			Jade.FX.Hide(grPayroll); 
			Jade.FX.Hide(cmdNewPayroll); 
		}
		else{
			Jade.FX.Show(grPayroll); 
			Jade.FX.Show(cmdNewPayroll); 
		}
	}
	cmdProfile_Compensation.onclick=function(){ compensationWindow.Show(); }
	cmdNewPayroll.onclick=function(){
		var row = grPayroll.NewRow(['0','0',[$.lng('erease'),'delete']], '');
		var combo = row.cells[0].references.object;
		for(var j in aPayrolls){ combo.AddItem(aPayrolls[j].Text,j); }
		combo = row.cells[1].references.object;
		for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
	}
	grPayroll.columnmodel.columns[2].oncellclick=function(cell){ cell.references.row.Delete(); }	
}
{//Pestaņas: Dias sin acceso-----------------------------------------------------------------------------------------------------------------------------------
	var cmNoAccessDays = Jade.Grids.ColumnModel();
	cmNoAccessDays.Add(Jade.Grids.DateColumn({key: 'from', text: Jade.Lang.Get('from'), width: '250'}));
	cmNoAccessDays.Add(Jade.Grids.DateColumn({key: 'to', text: Jade.Lang.Get('to'), width: '250'}));
	cmNoAccessDays.Add(Jade.Grids.ButtonColumn({key: 'button', text: '', width: '140', sortable: false}));
	var grNoAccessDays = Jade.Grids.Grid(cmNoAccessDays);
	grNoAccessDays.Location(5,40,990,420);
	grNoAccessDays.Add(tabsPerfil.tabpages[6]);
	var cmdNewAccessDays = Jade.Objects.Button();
	cmdNewAccessDays.Location(10,10,980,20);
	cmdNewAccessDays.SetText(Jade.Lang.Get('new_profile_no_access'));
	cmdNewAccessDays.Add(tabsPerfil.tabpages[6]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	cmdNewAccessDays.onclick=function(){ var row=grNoAccessDays.NewRow(['20000101','20000101',[$.lng('erease'),'delete']], ''); }
	grNoAccessDays.columnmodel.columns[2].oncellclick=function(cell){ cell.references.row.Delete(); }	
}
{//Pestaņas: Acceso--------------------------------------------------------------------------------------------------------------------------------------------
	var cmAccess = Jade.Grids.ColumnModel();
	cmAccess.Add(Jade.Grids.SimpleColumn({key: 'terminal', text: Jade.Lang.Get('terminal'), width: '300'}));
	cmAccess.Add(Jade.Grids.ComboColumn({key: 'access', text: Jade.Lang.Get('access'), width: '110'}));
	cmAccess.Add(Jade.Grids.ComboColumn({key: 'slot1', text: Jade.Lang.Get('slot')+' 1', width: '170'}));
	cmAccess.Add(Jade.Grids.ComboColumn({key: 'slot2', text: Jade.Lang.Get('slot')+' 2', width: '170'}));
	cmAccess.Add(Jade.Grids.ComboColumn({key: 'slot3', text: Jade.Lang.Get('slot')+' 3', width: '170'}));
	cmAccess.Add(Jade.Grids.HideColumn({key: 'idTerminal'}));
	cmAccess.Add(Jade.Grids.HideColumn({key: 'tipo'}));
	var grAccess = Jade.Grids.Grid(cmAccess);
	grAccess.Location(5,5,990,455);
	grAccess.Add(tabsPerfil.tabpages[7]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	function FillAccessCombo(cell){
		var combo = cell.references.object;
		combo.Clear();
		var id = cell.references.row.cells[5].value;
		var tipo = cell.references.row.cells[6].value;
		var access = cell.references.row.cells[1].references.object.selectedKey;
		if(tipo=='2' || access=='3'){
			combo.AddItem(Jade.Lang.Get('none_m'),'0');
			combo.SetEnabled(false);
		}
		else{
			if(access=='0'){
				combo.AddItem(Jade.Lang.Get('none_m'),'0');
				for(var j in aTerminalGroups[id].item){ combo.AddItem(aTerminalGroups[id].item[j].Text,j); }
				if(cell.index==2){ combo.SetEnabled(true); }
				else{ combo.SetEnabled(false); }
			}
			else{
				combo.AddItem(Jade.Lang.Get('none_f'),'0');
				for(var j in aTerminalSlots[id].item){ combo.AddItem(aTerminalSlots[id].item[j].Text,j); }
				combo.SetEnabled(true);
			}
		}
		combo.SetSelectedIndex(0);
	}
}
{//Pestaņas: Horas de solo acceso------------------------------------------------------------------------------------------------------------------------------
	var cmOnlyAccessTime = Jade.Grids.ColumnModel();
	cmOnlyAccessTime.Add(Jade.Grids.ComboColumn({key: 'day_type', text: Jade.Lang.Get('day_type'), width: '250'}));
	cmOnlyAccessTime.Add(Jade.Grids.HourColumn({key: 'from', text: Jade.Lang.Get('from'), width: '100'}));
	cmOnlyAccessTime.Add(Jade.Grids.HourColumn({key: 'to', text: Jade.Lang.Get('to'), width: '100'}));
	cmOnlyAccessTime.Add(Jade.Grids.ButtonColumn({key: 'button', text: '', width: '120', sortable: false}));
	var grOnlyAccessTime = Jade.Grids.Grid(cmOnlyAccessTime);
	grOnlyAccessTime.Location(5,40,990,420);
	grOnlyAccessTime.Add(tabsPerfil.tabpages[8]);
	var cmdOnlyAccessTime = Jade.Objects.Button();
	cmdOnlyAccessTime.Location(10,10,980,20);
	cmdOnlyAccessTime.SetText(Jade.Lang.Get('new_profile_only_access_time'));
	cmdOnlyAccessTime.Add(tabsPerfil.tabpages[8]);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	cmdOnlyAccessTime.onclick=function(){
		var row=grOnlyAccessTime.NewRow(['0','0000','0000',[$.lng('erease'),'delete']], '');
		var combo=row.cells[0].references.object;
		for(var j in aDayTypes){ combo.AddItem(aDayTypes[j].Text,j); }
	}
	grOnlyAccessTime.columnmodel.columns[3].oncellclick=function(cell){ cell.references.row.Delete(); }
}
{//Ventana: Costes compensacion--------------------------------------------------------------------------------------------------------------------------------
	var compensationWindow = Jade.Objects.Window(600,510);
	var gp_comp_term = Jade.Objects.Container();
	gp_comp_term.Location(10,5,580,30);
	gp_comp_term.Add(compensationWindow);
	var lbl_comp_tem = Jade.Objects.Text(Jade.Lang.Get('payroll_compensation_period')+':');
	lbl_comp_tem.Location(10,10,150,20);
	lbl_comp_tem.Add(gp_comp_term);
	var opt_compo_term_0 = Jade.Objects.Option(Jade.Lang.Get('none_m'));
	opt_compo_term_0.Location(165,9,100,20);
	opt_compo_term_0.Add(gp_comp_term);
	var opt_compo_term_1 = Jade.Objects.Option(Jade.Lang.Get('term_day'));
	opt_compo_term_1.Location(265,9,100,20);
	opt_compo_term_1.Add(gp_comp_term);
	var opt_compo_term_2 = Jade.Objects.Option(Jade.Lang.Get('term_week'));
	opt_compo_term_2.Location(365,9,100,20);
	opt_compo_term_2.Add(gp_comp_term);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	var gp_comp_must_sum = Jade.Objects.Container();
	gp_comp_must_sum.Location(10,40,580,55);
	gp_comp_must_sum.Add(compensationWindow);
	var lbl_comp_tem = Jade.Objects.Text(Jade.Lang.Get('duty_time_must_sum')+':');
	lbl_comp_tem.Location(10,10,250,20);
	lbl_comp_tem.Add(gp_comp_must_sum);
	var opt_compo_must_0 = Jade.Objects.Option(Jade.Lang.Get('min_time_of')+':');
	opt_compo_must_0.Location(15,30,150,20);
	opt_compo_must_0.Add(gp_comp_must_sum);	
	var txt_compo_must = Jade.Objects.TimeBox(false,true);
	txt_compo_must.Location(165,25,60,20);
	txt_compo_must.Add(gp_comp_must_sum);
	var opt_compo_must_1 = Jade.Objects.Option(Jade.Lang.Get('employees_duty_time'));
	opt_compo_must_1.Location(250,30,250,20);
	opt_compo_must_1.Add(gp_comp_must_sum);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	var gp_comp_payroll = Jade.Objects.Container();
	gp_comp_payroll.Location(10,100,580,180);
	gp_comp_payroll.Add(compensationWindow);
	var lbl_comp_payroll = Jade.Objects.Text(Jade.Lang.Get('payroll_as_duty_time')+':');
	lbl_comp_payroll.Location(10,10,250,20);
	lbl_comp_payroll.Add(gp_comp_payroll);
	var cmd_comp_payroll = Jade.Objects.Button(Jade.Lang.Get('add'));
	cmd_comp_payroll.Location(5,25,570,20);
	cmd_comp_payroll.Add(gp_comp_payroll);
	var cm_comp_payroll = Jade.Grids.ColumnModel();
	cm_comp_payroll.Add(Jade.Grids.ComboColumn({key: 'day_type', text: Jade.Lang.Get('payroll_item'), width: '250'}));
	var gr_comp_payroll = Jade.Grids.Grid(cm_comp_payroll);
	gr_comp_payroll.Location(5,50,570,123);
	gr_comp_payroll.Add(gp_comp_payroll);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	var gp_comp_comp = Jade.Objects.Container();
	gp_comp_comp.Location(10,285,580,180);
	gp_comp_comp.Add(compensationWindow);
	var lbl_comp_comp = Jade.Objects.Text(Jade.Lang.Get('compensation_table')+':');
	lbl_comp_comp.Location(10,10,250,20);
	lbl_comp_comp.Add(gp_comp_comp);
	var cmd_comp_comp = Jade.Objects.Button(Jade.Lang.Get('add'));
	cmd_comp_comp.Location(5,25,570,20);
	cmd_comp_comp.Add(gp_comp_comp);
	var cm_comp_comp = Jade.Grids.ColumnModel();
	cm_comp_comp.Add(Jade.Grids.ComboColumn({key: 'with', text: Jade.Lang.Get('compensate_with'), width: '225'}));
	cm_comp_comp.Add(Jade.Grids.ComboColumn({key: 'from', text: Jade.Lang.Get('compensate_from'), width: '225'}));
	cm_comp_comp.Add(Jade.Grids.TimeColumn({key: 'time', text: Jade.Lang.Get('min_time'), width: '80'}));
	var gr_comp_comp = Jade.Grids.Grid(cm_comp_comp);
	gr_comp_comp.Location(5,50,570,123);
	gr_comp_comp.Add(gp_comp_comp);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	var cmd_comp_accept = Jade.Objects.Button(Jade.Lang.Get('accept'));
	cmd_comp_accept.Location(10,480,290,20);
	cmd_comp_accept.Add(compensationWindow);
	var cmd_comp_cancel = Jade.Objects.Button(Jade.Lang.Get('cancel'));
	cmd_comp_cancel.Location(310,480,280,20);
	cmd_comp_cancel.Add(compensationWindow);
	//---------------------------------------------------------------------------------------------------------------------------------------------------------
	cmd_comp_cancel.onclick=function(){ compensationWindow.Hide(); }
}