var tabs;
var d=document;
var DDLOrgState; 
var DDLOrgMaillingState ;

var DDLOrgCounty;
var DDLOrgMaillingCounty;

var DDLOrgCity ;
var DDLOrgMaillingCity;
 
Ext.onReady(function(){
//	Ext.form.Field.prototype.msgTarget = 'side'
    // basic tabs 1, built from existing content
    tabs = new Ext.TabPanel({
        renderTo: 'tabs1',
        width:660,
        activeTab: 0,
        enableTabScroll:true,
        frame:false,
        deferredRender : false,

        defaults:{autoHeight:true},
        items:[
            {id:'ContactPerson',contentEl:'DivContactPerson', title: 'CONTACT INFO'},
            {id:'OrgProfile1',contentEl:'DivOrgProfile1', title: 'ORGANIZATION PROFILE'},
            {id:'OrgProfile2',contentEl:'DivOrgProfile2', title: 'ADDRESS'},
            {id:'OrgProfile3',contentEl:'DivOrgProfile3', title: 'FUNDING AND SERVICE GOALS'},
            {id:'ServiceProfile',contentEl:'DivServiceProfile', title: 'SERVICE PROFILE'},
            {id:'Curriculum1',contentEl:'DivCurriculum1', title: 'CURRICULUM'},
            {id:'Curriculum2',contentEl:'DivCurriculum2', title: 'HOURS AND LOCATION'},            
            {id:'Curriculum3',contentEl:'DivCurriculum3', title: 'CLIENT AND FEES'},                        
            {id:'Registration',contentEl:'DivRegistration', title: 'REGISTRATION INFO'},
            {id:'Publish',contentEl:'DivPublish', title: 'PUBLISH INFO',listeners: {activate: handleActivate}}
        ]
    
    }); 
    
    
    
   var language= d.getElementById('together_togetherContent_lblTab');
   var spanish="SPANISH";  
   if(language.innerHTML==spanish)
   {
        tabs.getItem('ContactPerson').setTitle('Informacion de contacto');
        tabs.getItem('OrgProfile1').setTitle('Perfil de la organizacion');
        tabs.getItem('OrgProfile2').setTitle('Direccion');
        tabs.getItem('OrgProfile3').setTitle('Financiacion y metas de servicio');
        tabs.getItem('ServiceProfile').setTitle('Perfil del servicio');
        tabs.getItem('Curriculum1').setTitle('Plan de estudios');
        tabs.getItem('Curriculum2').setTitle('Horario y lugar');
        tabs.getItem('Curriculum3').setTitle('Cliente y tarifas');
        tabs.getItem('Registration').setTitle('Informacion sobre la inscripcion');
        tabs.getItem('Publish').setTitle('Permiso de publicacion');
        convertPopulationTarget(spanish);  
        convertHoursAndDayOperation(spanish); 
        convertProgramHours(spanish); 
        convertProgramSchedule(spanish); 
        convertMarriageEducation(spanish); 
        convertOrganizationFunding(spanish); 
        convertOrganizationType(spanish);
        convertCurriculumType(spanish);
        convertCurriculumLocation(spanish);
        d.getElementById('together_togetherContent_HdnOrgTypeOther').value="Otros";
        d.getElementById('together_togetherContent_HdnCurriculumTypeOther').value="Otro (explique)";
        d.getElementById('together_togetherContent_HdnLocationServedOther').value="Otro";
        

   }
   else
   {
        tabs.getItem('ContactPerson').setTitle('CONTACT INFO');
        tabs.getItem('OrgProfile1').setTitle('ORGANIZATION PROFILE');
        tabs.getItem('OrgProfile2').setTitle('ADDRESS');
        tabs.getItem('OrgProfile3').setTitle('FUNDING AND SERVICE GOALS');
        tabs.getItem('ServiceProfile').setTitle('SERVICE PROFILE');
        tabs.getItem('Curriculum1').setTitle('CURRICULUM');
        tabs.getItem('Curriculum2').setTitle('HOURS AND LOCATION');
        tabs.getItem('Curriculum3').setTitle('CLIENT AND FEES');
        tabs.getItem('Registration').setTitle('REGISTRATION INFO');
        tabs.getItem('Publish').setTitle('PUBLISH INFO');
       // convertPopulationTarget(''); 
   }
  



var TxtCPFName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtCPFName',
		//vtype:'alpha',
		visibilityType:'R'


});


var TxtCPMName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtCPMName',
		vtype:'alpha'
		

});

var TxtCPLName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtCPLName',
		//vtype:'alpha',
		visibilityType:'R'

});

var TxtCPPhone = new Genesis.MaskTextBox({
		applyTo: 'together_togetherContent_TxtCPPhone',
		mask:"(999)999-9999",
		visibilityType:'R'
		

});

var TxtCPExt = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_TxtCPExt'
		

});

var TxtCPEMailID = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtCPEMailID',
		visibilityType:'R'

});
var txtotherlanguage = new Genesis.TextBox({
		applyTo: 'together_togetherContent_txtotherlanguage'

});


var TxtCPEMailID = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtCPEMailID',
		visibilityType:'R'

});

var TxtFCFName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtFCFName',
		//vtype:'alpha',
		visibilityType:'R'

});

var TxtFCMName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtFCMName',
		vtype:'alpha'

});

var TxtFCLName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtFCLName',
		//vtype:'alpha',
		visibilityType:'R'

});
var TxtFCPhone = new Genesis.MaskTextBox({
		applyTo: 'together_togetherContent_TxtFCPhone',
		mask:"(999)999-9999",
		visibilityType:'R'
});



var TxtFCExt = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_TxtFCExt'

});


var TxtFCEMailID = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtFCEMailID',
		visibilityType:'R'

});

var DDLCPtitle = new Genesis.TextBox({
		applyTo: 'together_togetherContent_DDLCPtitle'

});


var DDLFCtitle = new Genesis.TextBox({
		applyTo: 'together_togetherContent_DDLFCTitle'

});



//==============================================================

var TxtOrgName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgName',
		visibilityType:'R'
		

});


var TxtAKAName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtAKAName'

});
var TxtOtherName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOtherName'

});

var TxtOrgTypeOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgTypeOther'

});

////==============================================================================


var TxtOrgStreet = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgStreet',
			   visibilityType:'R'

});

var TxtOrgFaxNo = new Genesis.MaskTextBox({
		applyTo: 'together_togetherContent_TxtOrgFaxNo',
		mask:"(999)999-9999"
});
var TxtOrgEmailId = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgEmailId'

});

var TxtOrgMaillingStreet = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgMaillingStreet'

});

var TxtOrgEmailId = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgEmailId'

});


var TxtOrgGoals = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgGoals'

});


var TxtHourProgramOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtHourProgramOther'

});
var TxtOrgUrl = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgUrl'

});

var TxtOrgZip = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_TxtOrgZip',
			   visibilityType:'R'

});

var TxtOrgMaillingZip = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_TxtOrgMaillingZip'

});



////=========================================================================

var TxtOrgHistoryOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtOrgHistoryOther'

});


//=====================================================
var TxtEducationTypeOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtEducationTypeOther'

});
var TxtFormatOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtFormatOther'

});
var TxtPurpose = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtPurpose'

});
//==================================


var TxtCurriculumTypeOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtCurriculumTypeOther'

});

var TxtLocationServedOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_TxtLocationServedOther'

});

////=====================Curriculum------------

//==========================================================
var Curriculum_TxtTargetPopulationOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtTargetPopulationOther'

});


var Curriculum_TxtDescribeClassSize = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtFeeDescribe'

});


var Curriculum_TxtFeeFree = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtFeeFree'

});


////========================================================


var txtlocationservedcity1 = new Genesis.TextBox({
		applyTo: 'together_togetherContent_txtlocationservedcity1',
		visibilityType:'R'
		

});
var txtlocationservedcity2 = new Genesis.TextBox({
		applyTo: 'together_togetherContent_txtlocationservedcity2'

});
var txtlocationservedcity3 = new Genesis.TextBox({
		applyTo: 'together_togetherContent_txtlocationservedcity3'

});
var txtlocationservedcity4 = new Genesis.TextBox({
		applyTo: 'together_togetherContent_txtlocationservedcity4'

});
var txtlocationservedcity5 = new Genesis.TextBox({
		applyTo: 'together_togetherContent_txtlocationservedcity5'

});

var txtlocationservedzip1 = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_txtlocationservedzip1',
		visibilityType:'R'

});
var txtlocationservedzip2 = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_txtlocationservedzip2'

});
var txtlocationservedzip3 = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_txtlocationservedzip3'

});
var txtlocationservedzip4 = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_txtlocationservedzip4'

});
var txtlocationservedzip5 = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_txtlocationservedzip5'

});


var Curriculum_TxtSiteName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtSiteName'

});

var Curriculum_TxtAddress = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtAddress'

});

var Curriculum_TxtZip = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtZip'

});

var Curriculum_TxtDirections = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtDirections'

});

var Curriculum_TxtHourDayOperationOther = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Curriculum_TxtHourDayOperationOther'

});


//============================================================
var Registration_TxtFName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Registration_TxtFName'

});


var Registration_TxtMName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Registration_TxtMName'

});


var Registration_TxtLName = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Registration_TxtLName'

});
var Registration_DDLTitle = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Registration_DDLTitle'

});



var Registration_TxtPhone = new Genesis.MaskTextBox({
		applyTo: 'together_togetherContent_Registration_TxtPhone',
		mask:"(999)999-9999"
});



var Registration_TxtEMailID = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Registration_TxtEMailID'

});


var Registration_TxtExt = new Genesis.NumTextBox({
		applyTo: 'together_togetherContent_Registration_TxtExt'

});


var Registration_TxtWebSite = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Registration_TxtWebSite'

});

var Registration_TxtDescriptionOfProgram = new Genesis.TextBox({
		applyTo: 'together_togetherContent_Registration_TxtDescriptionOfProgram'

});
  

var Curriculum_DDLState = new Genesis.ComboBox({
  store: StateDS,
  displayField:'NAME',
  valueField: 'ID',
  dataIndex:'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:150,
  width:110,
  selectOnFocus:true,
  autocomplete:'off',
  editable: false,  
  applyTo: 'together_togetherContent_Curriculum_DDLState'//  onSelect:Curriculum_DDLState
 });
Curriculum_DDLState.setValue('999000045');
Curriculum_DDLState.on('blur',function()
	{  
		Curriculum_DDLState.setValue('999000045');
	});

 var Curriculum_DDLCounty = new Genesis.ComboBox({
  store: CountyDS,
  displayField:'NAME',
  valueField: 'ID',
  dataIndex:'COUNTYID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:150,
  width:110,
  selectOnFocus:true,
  autocomplete:'off',
  applyTo: 'together_togetherContent_Curriculum_DDLCounty',
  listeners:{select:{fn:function(combo, value) {
	var comboCity = Ext.getCmp('Curriculum_DDLCityID');
	comboCity.clearValue();	comboCity.setValue('');
	if(combo.getValue()=="")
		comboCity.setDisabled(true);
	else
		comboCity.setDisabled(false);	
	comboCity.store.filter('COUNTYID', combo.view.selected.el.dom.innerHTML);
	d.getElementById('together_togetherContent_HdnCurriculumCounty').value=combo.getValue();
	}}
	}
 });

 var Curriculum_DDLCity = new Genesis.ComboBox({
  store: CityDS,
  id:'Curriculum_DDLCityID',
  disabled: true,
  displayField:'NAME',
  valueField: 'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',	   
  listWidth:150,
  width:110,   
  lazyRender:true,
  selectOnFocus:true,
  autocomplete:'off',
  applyTo: 'together_togetherContent_Curriculum_DDLCity',
  lastQuery:'',
  editable: false,
  listeners:{select:{fn:function(combo, value) {
			d.getElementById('together_togetherContent_HdnCurriculumCity').value=combo.getValue();
			}
		}
	}
 });

 DDLOrgMaillingState = new Genesis.ComboBox({
  store: StateDS,
  displayField:'NAME',
  valueField: 'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:150,
  width:110,
  editable: false,  
  selectOnFocus:true,
  autocomplete:'off',
  applyTo: 'together_togetherContent_DDLOrgMaillingState'//  onSelect:OrgMaillingState
 });

DDLOrgMaillingState.setValue('999000045');
DDLOrgMaillingState.on('blur',function()
	{  
		DDLOrgMaillingState.setValue('999000045');
	});

  DDLOrgMaillingCounty = new Genesis.ComboBox({
  store: CountyDS,
  displayField:'NAME',
  valueField: 'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:150,
  width:110,

  selectOnFocus:true,
  autocomplete:'off',
  applyTo: 'together_togetherContent_DDLOrgMaillingCounty',
  
  listeners:{select:{fn:function(combo, value) {
	var comboCity = Ext.getCmp('DDLOrgMaillingCityID');
	comboCity.clearValue();	comboCity.setValue('');
	if(combo.getValue()=="")
		comboCity.setDisabled(true);
	else
		comboCity.setDisabled(false);	
	comboCity.store.filter('COUNTYID', combo.view.selected.el.dom.innerHTML);
	d.getElementById('together_togetherContent_HdnOrgMaillingCounty').value=combo.getValue();
	}}
	}	    
  
 });


  DDLOrgMaillingCity= new Genesis.ComboBox({
  store: CityDS,
  id:'DDLOrgMaillingCityID',
  displayField:'NAME',
  valueField: 'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:150,
  width:110,     
  lazyRender:true,
  disabled:true,
  selectOnFocus:true,
  autocomplete:'off',
  applyTo: 'together_togetherContent_DDLOrgMaillingCity',
  lastQuery:'',
  editable: false,  
  listeners:{select:{fn:function(combo, value) {
			d.getElementById('together_togetherContent_HdnOrgMaillingCity').value=combo.getValue();
			}
		}
	}

 });

  DDLOrgState = new Genesis.ComboBox({
  store: StateDS,
  displayField:'NAME',
  valueField: 'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:200,
  width:110,
  selectOnFocus:true,
  autocomplete:'off',
  editable: false,
  applyTo: 'together_togetherContent_DDLOrgState'//  onSelect:OrgState
 });
 DDLOrgState.setValue('999000045');
 DDLOrgState.on('blur',function()
	{  
		DDLOrgState.setValue('999000045');
	});

  DDLOrgCounty = new Genesis.ComboBox({
  store: CountyDS,
  displayField:'NAME',
  valueField: 'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:150,
  width:110,
  selectOnFocus:true,
  autocomplete:'off',
  visibilityType:'R',
  applyTo: 'together_togetherContent_DDLOrgCounty',
  lastQuery: '',
  listeners:{select:{fn:function(combo, value) {
	var comboCity = Ext.getCmp('DDLOrgCityID');
	comboCity.clearValue();	comboCity.setValue('');
	if(combo.getValue()=="")
		comboCity.setDisabled(true);
	else
		comboCity.setDisabled(false);	
		comboCity.store.filter('COUNTYID',combo.view.selected.el.dom.innerHTML );
		d.getElementById('together_togetherContent_HdnOrgCounty').value=combo.getValue();
	}}
	}	  
 
 });


 DDLOrgCity = new Genesis.ComboBox({
  store: CityDS,
  id:'DDLOrgCityID',
  displayField:'NAME',
  valueField: 'ID',
  typeAhead: true,
  mode: 'local',
  triggerAction: 'all',
  listWidth:150,
  width:110,  
  lazyRender:true,
  disabled:true,
  selectOnFocus:true,
  autocomplete:'off',
  applyTo: 'together_togetherContent_DDLOrgCity',
  visibilityType:'R',
  lastQuery:'',
  editable: false,
  listeners:{select:{fn:function(combo, value) {
			d.getElementById('together_togetherContent_HdnOrgCity').value=combo.getValue();
			}
		}
	}
 });

if(d.getElementById('together_togetherContent_HdnIsProviderEdit').value>0)
{
    Curriculum_DDLCounty.setValue(d.getElementById('together_togetherContent_HdnCurriculumCounty').value);
    Curriculum_DDLCity.setValue(d.getElementById('together_togetherContent_HdnCurriculumCity').value);
    DDLOrgMaillingCounty.setValue(d.getElementById('together_togetherContent_HdnOrgMaillingCounty').value);
    DDLOrgMaillingCity.setValue(d.getElementById('together_togetherContent_HdnOrgMaillingCity').value);
    DDLOrgCounty.setValue(d.getElementById('together_togetherContent_HdnOrgCounty').value);
    DDLOrgCity.setValue(d.getElementById('together_togetherContent_HdnOrgCity').value);

}
 
 
}); 

handleActivate=function(tab)
{
    if(tab.contentEl=='DivPublish')
    {
        var TxtCPFName=d.getElementById('together_togetherContent_TxtCPFName');
        var TxtCPMName=d.getElementById('together_togetherContent_TxtCPMName');
        var TxtCPLName=d.getElementById('together_togetherContent_TxtCPLName');
            
        var lblname=d.getElementById('lblname');

        lblname.innerHTML=TxtCPFName.value+' '+TxtCPMName.value + ' '+TxtCPLName.value;
        var DDLCPtitle=d.getElementById('together_togetherContent_DDLCPtitle');
        var lbltitle=d.getElementById('lbltitle');
        lbltitle.innerHTML=DDLCPtitle.value;
        var TxtOrgName=d.getElementById('together_togetherContent_TxtOrgName');
        var lblorgname=d.getElementById('lblorgname');
        lblorgname.innerHTML=TxtOrgName.value;
    }
    return false;
 }   



function convertPopulationTarget(lang)
{

    var ctrlid='together_togetherContent_Curriculum_CBLTargetPopulation';
	var control=d.getElementById(ctrlid)
	
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.childNodes.length; i++)
        {
           if(control.childNodes[i].nodeName=="LABEL")
           {
                if(control.childNodes[i].innerHTML=="Married")     
                    control.childNodes[i].innerHTML='Casados';  
                else if(control.childNodes[i].innerHTML=="Engaged")     
                    control.childNodes[i].innerHTML='Comprometidos';  
                else if(control.childNodes[i].innerHTML=="Seriously Dating")     
                    control.childNodes[i].innerHTML='Novios serios';  
                else if(control.childNodes[i].innerHTML=="Other")     
                    control.childNodes[i].innerHTML='Otro';  
                
           }
        }
    }
}


function convertHoursAndDayOperation(lang)
{

    var ctrlid='together_togetherContent_Curriculum_CBLHourDayOperation';
	var control=d.getElementById(ctrlid)
	
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.childNodes.length; i++)
        {
           if(control.childNodes[i].nodeName=="LABEL")
           {
                if(control.childNodes[i].innerHTML=="Weekday Evenings (5pm-10pm)")     
                    control.childNodes[i].innerHTML='Dias entre semana por la tarde (5 p.m. - 10 p.m.)';  
                else if(control.childNodes[i].innerHTML=="Weekends")     
                    control.childNodes[i].innerHTML='Los fines de semana';  
                else if(control.childNodes[i].innerHTML=="Weekdays (Mon. - Fri. 8am - 5pm)")     
                    control.childNodes[i].innerHTML='Dias entre semana (de lunes a viernes, 8 a.m. - 5 p.m.)';  
                else if(control.childNodes[i].innerHTML=="Saturday Only")     
                    control.childNodes[i].innerHTML='Solo los sábados';                  
                else if(control.childNodes[i].innerHTML=="Sunday Only")     
                    control.childNodes[i].innerHTML='Solo los domingos';                  
                else if(control.childNodes[i].innerHTML=="By Appointment")     
                    control.childNodes[i].innerHTML='Se hace por cita';  
                
           }
        }
    }
}

function convertProgramHours(lang)
{
    var ctrlid='together_togetherContent_RBLHourProgram';
	var control=d.getElementById(ctrlid)
	
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.childNodes.length; i++)
        {
           if(control.childNodes[i].nodeName=="TBODY")
           {
                for (j = 0; j < control.childNodes[i].rows.length; j++)
                {
                    for (k = 0; k < control.childNodes[i].rows[j].cells.length; k++)
                    {
                        for (l = 0; l < control.childNodes[i].rows[j].cells[k].childNodes.length; l++)
                        {
                           
                           if(control.childNodes[i].rows[j].cells[k].childNodes[l].nodeName=="LABEL")
                           {
                                if(control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML=="&lt;8 hours")     
                                    control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML='&lt;8 horas';  
                                else if(control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML=="8 hours")     
                                    control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML='8 horas';  
                                else if(control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML=="9-12 hours")     
                                    control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML='9-12 horas';  
                                else if(control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML=="13-16 hours")     
                                    control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML='13-16 horas';  
                                else if(control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML=="17-20 hours")     
                                    control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML='17-20 horas';  
                                else if(control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML=="20+ hours")     
                                    control.childNodes[i].rows[j].cells[k].childNodes[l].innerHTML='20+ horas';  
                           }
                        }
                    }
                }
             }
        }
    }
}

function convertProgramSchedule(lang)
{
    var ctrlid='together_togetherContent_RBLFormat';
	var control=d.getElementById(ctrlid)
	
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.childNodes.length; i++)
        {
           if(control.childNodes[i].nodeName=="LABEL")
           {
                if(control.childNodes[i].innerHTML=="Single, One-Day Session")     
                    control.childNodes[i].innerHTML="Una sola sesion de un dia ";  
                else if(control.childNodes[i].innerHTML=="Weekend Retreat")     
                    control.childNodes[i].innerHTML='Retiro de fin de semana';  
                else if(control.childNodes[i].innerHTML=="Weekly Sessions")     
                    control.childNodes[i].innerHTML='Sesiones semanales';  
                else if(control.childNodes[i].innerHTML=="Other")     
                    control.childNodes[i].innerHTML='Otro';  
                
           }
        }
    }
}

function convertMarriageEducation(lang)
{
    var ctrlid='together_togetherContent_CBLEducationType';
	var control=d.getElementById(ctrlid)
	
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.childNodes.length; i++)
        {
           if(control.childNodes[i].nodeName=="LABEL")
           { 
                if(control.childNodes[i].innerHTML=="Counseling/Therapy")     
                    control.childNodes[i].innerHTML='Orientacion/terapia';  
                else if(control.childNodes[i].innerHTML=="Divorce Prevention")     
                    control.childNodes[i].innerHTML='Prevencion del divorcio';  
                else if(control.childNodes[i].innerHTML=="Expectant Parent")     
                    control.childNodes[i].innerHTML="Padre que espera un bebe ";  
                else if(control.childNodes[i].innerHTML=="Mentoring")     
                    control.childNodes[i].innerHTML='Servicios de mentor';  
                else if(control.childNodes[i].innerHTML=="Premarital Preparation")     
                    control.childNodes[i].innerHTML='Preparacion antes del matrimonio';  
                else if(control.childNodes[i].innerHTML=="Relationship Education")     
                    control.childNodes[i].innerHTML='Educacion sobre las relaciones';  
                else if(control.childNodes[i].innerHTML=="Youth")     
                    control.childNodes[i].innerHTML='Jovenes';  
                else if(control.childNodes[i].innerHTML=="Others")     
                    control.childNodes[i].innerHTML='Otros';  
                
           }
        }
    }
}

function convertOrganizationFunding(lang)
{
    var ctrlid='together_togetherContent_CBLOrgHistory';
	var control=d.getElementById(ctrlid)
	
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.childNodes.length; i++)
        {
           if(control.childNodes[i].nodeName=="LABEL")
           { 
                if(control.childNodes[i].innerHTML=="Contributions/Donations")     
                    control.childNodes[i].innerHTML='Contribuciones/Donativos';  
                else if(control.childNodes[i].innerHTML=="Fee For Service")     
                    control.childNodes[i].innerHTML='Pago por servicios';  
                else if(control.childNodes[i].innerHTML=="Government")     
                    control.childNodes[i].innerHTML='Gobierno';  
                else if(control.childNodes[i].innerHTML=="Grant - Community Fund")     
                    control.childNodes[i].innerHTML='Concesion: fondos comunitarios';  
                else if(control.childNodes[i].innerHTML=="Grant - Foundation")     
                    control.childNodes[i].innerHTML="Concesion: fundacion ";  
                else if(control.childNodes[i].innerHTML=="Grant - Government (Local, State Or Federal)")     
                    control.childNodes[i].innerHTML='Concesion: gobierno (local, estatal o federal)';  
                else if(control.childNodes[i].innerHTML=="I Am An Individual Providing Volunteer/Free Marriage Education Services")     
                    control.childNodes[i].innerHTML='Soy una persona que ofrece servicios voluntarios/gratis de educacion matrimonial';  
                else if(control.childNodes[i].innerHTML=="Organization Only Receives In-Kind Support (Volunteers, Material Goods, Space, Etc.)")     
                    control.childNodes[i].innerHTML='La organizacion solo recibe apoyo no monetario (voluntarios, articulos materiales, espacio, etc.)';  
                else if(control.childNodes[i].innerHTML=="Others")     
                    control.childNodes[i].innerHTML='Otros';  
                
           }
        }
    }
}


function convertOrganizationType(lang)
{
    var ctrlid='together_togetherContent_listboxOrgType';
	var control=d.getElementById(ctrlid)
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.options.length; i++)
        {
                if(control.options[i].text=="For-Profit Organization (Llc, Corporation, Etc.)")     
                    control.options[i].text='Organizacion con fines de lucro (S. A., corporacion, etc.)';  
                else if(control.options[i].text=="Government - County")     
                    control.options[i].text='Gubernamental: del condado';  
                else if(control.options[i].text=="Government - Federal")     
                    control.options[i].text='Gubernamental: federal';  
                else if(control.options[i].text=="Government - Municipal")     
                    control.options[i].text='Gubernamental: municipal';  
                else if(control.options[i].text=="Government - Public School District / Board Of Education")     
                    control.options[i].text="Gubernamental: distrito escolar publico / Junta de Educacion ";  
                else if(control.options[i].text=="Government - Special District/Regional")     
                    control.options[i].text='Gubernamental: distrito especial/regional';  
                else if(control.options[i].text=="Government - State")     
                    control.options[i].text='Gubernamental: estatal';  
                else if(control.options[i].text=="Healthcare Organization")     
                    control.options[i].text='Organizacion de atencion medica';
                else if(control.options[i].text=="Healthy Marriage Coalition (Not Tax Exempt, Not Incorporated)")     
                    control.options[i].text='Coalicion de Matrimonios Felices (no exenta de impuestos, no incorporada)';                    
                else if(control.options[i].text=="Individual - Clergy/Faith Leader")     
                    control.options[i].text='Persona: clero/lider religioso '; 
                else if(control.options[i].text=="Individual - Licensed Mental Health Professional")     
                    control.options[i].text='Persona: profesional con licencia en salud mental';  
                else if(control.options[i].text=="Individual - Trained Marriage Educator")     
                    control.options[i].text='Persona: educador matrimonial capacitado';  
                else if(control.options[i].text=="Military")     
                    control.options[i].text='Militar';  
                else if(control.options[i].text=="Non-Profit Organization  - Community-Based (Tax Exempt)")     
                    control.options[i].text='Organizacion sin fines de lucro, basada en la comunidad (exenta de impuestos)';  
                else if(control.options[i].text=="Non-Profit Organization (Other Tax Exempt)")                         
                    control.options[i].text='Otro organizacion sin fines de lucro (exenta de impuestos)'; 
                else if(control.options[i].text=="Non-Profit Organization - Faith-Based (Tax Exempt)")     
                    control.options[i].text='Organizacion sin fines de lucro religiosa (exenta de impuestos)';
                else if(control.options[i].text=="Other Group (Not Tax Exempt, Not Incorporated)")     
                    control.options[i].text='Otro grupo (no exento de impuestos, no incorporado)';
                else if(control.options[i].text=="Regional Intermediary Or Its Subcontractor")     
                    control.options[i].text='Intermediario regional o su subcontratista';
                else if(control.options[i].text=="University / College")     
                    control.options[i].text='Universidad ';
                else if(control.options[i].text=="Unknown")     
                    control.options[i].text='Se desconoce';
                else if(control.options[i].text=="Non-Profit Organization (Other Tax Exempt)")     
                    control.options[i].text='Otro organizacion sin fines de lucro (exenta de impuestos)'; 
                else if(control.options[i].text=="Others")     
                    control.options[i].text='Otros';  
 
        }
    }
}

function convertCurriculumType(lang)
{
    var ctrlid='together_togetherContent_Curriculum_LstCurriculumType';
	var control=d.getElementById(ctrlid)
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.options.length; i++)
        {
                if(control.options[i].text=="10 Great Dates")     
                    control.options[i].text='10 Citas Extraordinarias';  
               else if(control.options[i].text=="5 Love Languages")     
                    control.options[i].text='5 Love Languages';  
               else if(control.options[i].text=="8 Habits Of A Successful Marriage")     
                    control.options[i].text='8 Habits Of A Successful Marriage';  
               else if(control.options[i].text=="Active Choices")     
                    control.options[i].text='Active Choices';  
               else if(control.options[i].text=="Active Commitment")     
                    control.options[i].text='Active Commitment';  
               else if(control.options[i].text=="Active Relationships (Ar)")     
                    control.options[i].text='Active Relationships (Ar)';  
               else if(control.options[i].text=="Ar For Military Families")     
                    control.options[i].text='Ar For Military Families';  
               else if(control.options[i].text=="Ar For Young Adults")     
                    control.options[i].text='Ar For Young Adults';  
               else if(control.options[i].text=="Basic Training For Couples")     
                    control.options[i].text='Basic Training For Couples';  
               else if(control.options[i].text=="Before We Say, \"I Do\"")     
                    control.options[i].text='Before We Say, \"I Do\"';  

               else if(control.options[i].text=="Before You Say, \"I Do\"")     
                    control.options[i].text='Before You Say, \"I Do\"';  
               else if(control.options[i].text=="Better Together For Couples")     
                    control.options[i].text='Better Together For Couples';  
               else if(control.options[i].text=="Black Marriage Education")     
                    control.options[i].text='Black Marriage Education';  
               else if(control.options[i].text=="Caring For My Family")     
                    control.options[i].text='Caring For My Family';  
               else if(control.options[i].text=="Catholic Engaged Encounter")     
                    control.options[i].text='Catholic Engaged Encounter';  
               else if(control.options[i].text=="Christian Married Life")     
                    control.options[i].text='Christian Married Life';  
               else if(control.options[i].text=="Commit")     
                    control.options[i].text='Commit';  
               else if(control.options[i].text=="Connections")     
                    control.options[i].text='Connections';  
               else if(control.options[i].text=="Countdown")     
                    control.options[i].text='Countdown';  
               else if(control.options[i].text=="Couple Checkup Workshop")     
                    control.options[i].text='Couple Checkup Workshop';  
               else if(control.options[i].text=="Divorce Busting")     
                    control.options[i].text='Su Matrimonio Siempre Puede Ser Mejor: Salve su matrimonio sin necesidad de separarse';  
               else if(control.options[i].text=="En Las Buenas Y Para Siempre")     
                    control.options[i].text='En Las Buenas Y Para Siempre';  
               else if(control.options[i].text=="Engaged - The 8 Fundamental Truths To Lasting Love!")     
                    control.options[i].text='Engaged - The 8 Fundamental Truths To Lasting Love!';  
               else if(control.options[i].text=="Engaged Encounter")     
                    control.options[i].text='Engaged Encounter';  
               else if(control.options[i].text=="Engaged Encounter Umc")     
                    control.options[i].text='Engaged Encounter Umc';  

               else if(control.options[i].text=="Family Wellness")     
                    control.options[i].text='Family Wellness';  
               else if(control.options[i].text=="Feeding The Starved Marriage")     
                    control.options[i].text='Feeding The Starved Marriage';  
               else if(control.options[i].text=="Foccus (Facilitating Open Couple Communication, Understanding & Study (Foccus) / Refoccus)")     
                    control.options[i].text='Foccus (Facilitating Open Couple Communication, Understanding & Study (Foccus) / Refoccus)';  
               else if(control.options[i].text=="For Better And Forever")     
                    control.options[i].text='En Las Buenas Y Para Siempre';  
               else if(control.options[i].text=="Fragile Families")     
                    control.options[i].text='Fragile Families';  
               else if(control.options[i].text=="Great Start")     
                    control.options[i].text='Great Start';  
               else if(control.options[i].text=="Growing Love In Christian Marriage (Glcm)")     
                    control.options[i].text='Growing Love In Christian Marriage (Glcm)';  
               else if(control.options[i].text=="Growing Love In Your Marriage")     
                    control.options[i].text='Growing Love In Your Marriage';  
               else if(control.options[i].text=="His Needs Her Needs")     
                    control.options[i].text='Lo que el Necesita, Lo que ella Necesita';  
               else if(control.options[i].text=="Intimate Encounters")     
                    control.options[i].text='Intimate Encounters';  
               else if(control.options[i].text=="Keys To A Healthy Marriage")     
                    control.options[i].text='Keys To A Healthy Marriage';  
               else if(control.options[i].text=="Lasting Love: Skills For Better Relationships Saving Your Marriage ")     
                    control.options[i].text='Lasting Love: Skills For Better Relationships Saving Your Marriage ';  
               else if(control.options[i].text=="Lasting Promise")     
                    control.options[i].text='Lasting Promise';  
               else if(control.options[i].text=="Love And Respect")     
                    control.options[i].text='Love And Respect';  
               else if(control.options[i].text=="Loving Couples Loving Children")     
                    control.options[i].text='Loving Couples Loving Children';  
               else if(control.options[i].text=="Make Your Good Thing Better")     
                    control.options[i].text='Make Your Good Thing Better';  
               else if(control.options[i].text=="Making Love Last A Lifetime")     
                    control.options[i].text='Making Love Last A Lifetime';  
               else if(control.options[i].text=="Marriage Encounter")     
                    control.options[i].text='Encuentro Matrimonial Mundial';  
               else if(control.options[i].text=="Marriage Garden")     
                    control.options[i].text='Marriage Garden';  
               else if(control.options[i].text=="Marriage L.I.N.K.S.")     
                    control.options[i].text='Marriage L.I.N.K.S.';  
               else if(control.options[i].text=="Marriage Mentoring - 12 Conversations")     
                    control.options[i].text='Marriage Mentoring - 12 Conversations';  
               else if(control.options[i].text=="Marriage On The Rock")     
                    control.options[i].text='Marriage On The Rock';  
               else if(control.options[i].text=="Marriage Prep")     
                    control.options[i].text='Marriage Prep';  
               else if(control.options[i].text=="Marriage Savers")     
                    control.options[i].text='Marriage Savers';  
               else if(control.options[i].text=="Married And Loving It")     
                    control.options[i].text='Married And Loving It';  
               else if(control.options[i].text=="Married In The Catholic Church: What Difference Does It Make?")     
                    control.options[i].text='Married In The Catholic Church: What Difference Does It Make?';  
               else if(control.options[i].text=="New Life")     
                    control.options[i].text='New Life';  
               else if(control.options[i].text=="New Love New Life")     
                    control.options[i].text='New Love New Life';  
               else if(control.options[i].text=="P.I.C.K A Partner Relationship Education Program")     
                    control.options[i].text='P.I.C.K A Partner Relationship Education Program';  
               else if(control.options[i].text=="Pairs (Practical Application Of Intimate Relationship Skills)")     
                    control.options[i].text='Pairs (Practical Application Of Intimate Relationship Skills)';  
               else if(control.options[i].text=="Parejas Unidas (United Couples)")     
                    control.options[i].text='Parejas Unidas';  
               else if(control.options[i].text=="Pick (Premarital Interpersonal Choices & Knowledge) A Partner - How To Avoid Marrying A Jerk/Jerkette")     
                    control.options[i].text='Pick (Premarital Interpersonal Choices & Knowledge) A Partner - How To Avoid Marrying A Jerk/Jerkette';  
               else if(control.options[i].text=="Picture Of Love")     
                    control.options[i].text='Picture Of Love';  
               else if(control.options[i].text=="Power Of Two")     
                    control.options[i].text='Power Of Two';  
               else if(control.options[i].text=="Pre P A I R S For A Catholic Marriage")     
                    control.options[i].text='Pre P A I R S For A Catholic Marriage';  
               else if(control.options[i].text=="Prep (Prevention & Relationship Enhancement Program)")     
                    control.options[i].text='Prep (Prevention & Relationship Enhancement Program)';  
               else if(control.options[i].text=="Prep - Within My Reach")     
                    control.options[i].text='Prep - Within My Reach';  
               else if(control.options[i].text=="Prep - Within Our Reach")     
                    control.options[i].text='Prep - Within Our Reach';  
               else if(control.options[i].text=="Prep For Strong Bonds")     
                    control.options[i].text='Prep For Strong Bonds';  
               else if(control.options[i].text=="Prepairs")     
                    control.options[i].text='Prepairs';  
               else if(control.options[i].text=="Prepare To Last")     
                    control.options[i].text='Prepare To Last';  
               else if(control.options[i].text=="Prepare/Enrich Empowering Couples")     
                    control.options[i].text='Fortaleciendo Parejas';  
               else if(control.options[i].text=="Preparing For Marriage")     
                    control.options[i].text='preparando el matrimonio';  
               else if(control.options[i].text=="Preparing For Marriage God's Way")     
                    control.options[i].text='Preparando El Matrimonio En El Camino de Dios';  
               else if(control.options[i].text=="Re (Relationship Enhancement)")     
                    control.options[i].text='Programma para la Renovacion y el Enriquecimiento de las Relaciones Interpersonales';  
               else if(control.options[i].text=="Re - Love's Cradle")     
                    control.options[i].text='Re - Love\'s Cradle';  
               else if(control.options[i].text=="Re - Mastering The Mystery Of Love")     
                    control.options[i].text='Programa para la Renovacion y el Enriquecimiento de las Relaciones Interpersonales (not sure about this one)';  
               else if(control.options[i].text=="Reconciling God's Way")     
                    control.options[i].text='Reconciling God\'s Way';  
               else if(control.options[i].text=="Relationship Smart")     
                    control.options[i].text='Relationship Smart';  
               else if(control.options[i].text=="Retrouvaille")     
                    control.options[i].text='Retrouvaille';  
               else if(control.options[i].text=="Saving Your Marriage Before It Starts")     
                    control.options[i].text='Asegure el exito de su matrimonio antes de casarse';  
               else if(control.options[i].text=="Saying I Do")     
                    control.options[i].text='Saying I Do';  
               else if(control.options[i].text=="Six Building Blocks Of A Healthy Marriage")     
                    control.options[i].text='Six Building Blocks Of A Healthy Marriage';  
               else if(control.options[i].text=="So, You're Getting Married")     
                    control.options[i].text='So, You\'re Getting Married';  
               else if(control.options[i].text=="Third Option")     
                    control.options[i].text='Third Option';  
               else if(control.options[i].text=="Today And All The Days Of Your Life")     
                    control.options[i].text='Today And All The Days Of Your Life';  
               else if(control.options[i].text=="Together In God's Image")     
                    control.options[i].text='Together In God\'s Image';  
               else if(control.options[i].text=="U N I T A S")     
                    control.options[i].text='Unitas';  
               else if(control.options[i].text=="Why Am I Tempted? (Wait) Training")     
                    control.options[i].text='Why Am I Tempted? (Wait) Training';  
               else if(control.options[i].text=="World Class Marriage")     
                    control.options[i].text='Matrimonio de clase mundial';  
               
               else if(control.options[i].text=="Y Serán Los Dos Uno Solo (Programa De Preparacion Matrimonial)")     
                    control.options[i].text='Y Serán Los Dos Uno Solo (Programa De Preparacion Matrimonial)';                 
               
                else if(control.options[i].text=="Other (Explain)")     
                    control.options[i].text='Otro (explique)';  
 
        }
    }
}


function convertCurriculumLocation(lang)
{
    var ctrlid='together_togetherContent_Curriculum_LBLocationServed';
	var control=d.getElementById(ctrlid)
	if(	lang=='SPANISH')
	{	
        for (i = 0; i < control.options.length; i++)
        {
              if(control.options[i].text=="Community Center")     
                    control.options[i].text='Centro comunitario';  
               else if(control.options[i].text=="Healthcare Setting")     
                    control.options[i].text='Centro de atencion medica';  
               else if(control.options[i].text=="House Of Worship (Church, Synagogue, Mosque, Etc.)")     
                    control.options[i].text='Centro religioso (iglesia, sinagoga, mezquita, etc.)';  
               else if(control.options[i].text=="In People's Homes")     
                    control.options[i].text='Casa particular';  
               else if(control.options[i].text=="Library")     
                    control.options[i].text='Biblioteca';  
               else if(control.options[i].text=="Mental Health Facility (Private Practice, Hospital, Office, Etc.)")     
                    control.options[i].text='Centro de salud mental (consultorio particular, hospital, oficina, etc.)';  
               else if(control.options[i].text=="Military Base")     
                    control.options[i].text='Base militar';  
               else if(control.options[i].text=="Retreat Setting")     
                    control.options[i].text='Centro de retiros';  
               else if(control.options[i].text=="Schools (Elementary, Middle, High School, Private School, Etc.)")     
                    control.options[i].text='Escuelas (primaria, secundaria, preparatoria, escuela particular, etc.)';  
               else if(control.options[i].text=="Social Service Agency (I.E. Catholic Charities, Head Start Center)")     
                    control.options[i].text='Agencia de servicios sociales (por ejemplo, Catholic Charities, Centro del programa Head Start)';  
               else if(control.options[i].text=="University / College")     
                    control.options[i].text='Universidad';  
               else if(control.options[i].text=="Workplace")     
                    control.options[i].text='Lugar de trabajo';  
               else if(control.options[i].text=="Other")     
                    control.options[i].text='Otro';  
 
        }
    }
}

function VisbleControl(controlid)
{
    var objctrl;
    objctrl=document.getElementById(controlid);
    document.getElementById('tdotherlanguage').style.display='block';
    objctrl.focus();
    return true;
}

function HiddenControl(controlid)
{
    var objctrl;
    objctrl=document.getElementById(controlid);
    document.getElementById('tdotherlanguage').style.display='none';
    objctrl.value='';
    return true;
}
