
function SameAsAbove()
 {
    if(document.getElementById('together_togetherContent_ChkSameasAbove').checked)
    {
       document.getElementById('together_togetherContent_ChkSameasAbove').checked=false; 
    }
    else
    {
    document.getElementById('together_togetherContent_ChkSameasAbove').checked=true; 
    }
    if(document.getElementById('together_togetherContent_ChkSameasAbove').checked)
    {
            d.getElementById('together_togetherContent_TxtFCFName').value=d.getElementById('together_togetherContent_TxtCPFName').value;
            d.getElementById('together_togetherContent_TxtFCFName').disabled=true;
            d.getElementById('together_togetherContent_TxtFCMName').value = d.getElementById('together_togetherContent_TxtCPMName').value;
            d.getElementById('together_togetherContent_TxtFCMName').disabled=true;
            d.getElementById('together_togetherContent_TxtFCLName').value = d.getElementById('together_togetherContent_TxtCPLName').value;
            d.getElementById('together_togetherContent_TxtFCLName').disabled=true;
            d.getElementById('together_togetherContent_DDLFCTitle').value = d.getElementById('together_togetherContent_DDLCPtitle').value;
            d.getElementById('together_togetherContent_DDLFCTitle').disabled=true;
            d.getElementById('together_togetherContent_TxtFCPhone').value = d.getElementById('together_togetherContent_TxtCPPhone').value;
            d.getElementById('together_togetherContent_TxtFCPhone').disabled=true;
            d.getElementById('together_togetherContent_TxtFCExt').value = d.getElementById('together_togetherContent_TxtCPExt').value;
            d.getElementById('together_togetherContent_TxtFCExt').disabled=true;
            d.getElementById('together_togetherContent_TxtFCEMailID').value = d.getElementById('together_togetherContent_TxtCPEMailID').value;
            d.getElementById('together_togetherContent_TxtFCEMailID').disabled=true;
     }
     else
     {
            d.getElementById('together_togetherContent_TxtFCFName').value="";
            d.getElementById('together_togetherContent_TxtFCMName').value ="";
            d.getElementById('together_togetherContent_TxtFCLName').value ="";
            d.getElementById('together_togetherContent_DDLFCTitle').value ="";
            d.getElementById('together_togetherContent_TxtFCPhone').value ="";
            d.getElementById('together_togetherContent_TxtFCExt').value = "";
            d.getElementById('together_togetherContent_TxtFCEMailID').value="";
            d.getElementById('together_togetherContent_TxtFCFName').disabled=false;
            d.getElementById('together_togetherContent_TxtFCMName').disabled=false;
            d.getElementById('together_togetherContent_TxtFCLName').disabled=false;
            d.getElementById('together_togetherContent_DDLFCTitle').disabled=false;
            d.getElementById('together_togetherContent_TxtFCPhone').disabled=false;
            d.getElementById('together_togetherContent_TxtFCExt').disabled=false;
            d.getElementById('together_togetherContent_TxtFCEMailID').disabled=false;
     }
     
     return true;
 }
 
  
 function MailingSameAsAbove()
 {
    if(document.getElementById('together_togetherContent_ChkIsMaillingSame').checked)
    {
            d.getElementById('together_togetherContent_TxtOrgMaillingStreet').value=document.getElementById('together_togetherContent_TxtOrgStreet').value;
            d.getElementById('together_togetherContent_TxtOrgMaillingStreet').disabled=true;
            d.getElementById('together_togetherContent_TxtOrgMaillingZip').value = document.getElementById('together_togetherContent_TxtOrgZip').value;                
            d.getElementById('together_togetherContent_TxtOrgMaillingZip').disabled=true;
            
            d.getElementById('together_togetherContent_DDLOrgMaillingCounty').value= d.getElementById('together_togetherContent_DDLOrgCounty');
            d.getElementById('together_togetherContent_DDLOrgMaillingCounty').disabled=true;
        	
            d.getElementById('together_togetherContent_DDLOrgMaillingCity').value = d.getElementById('together_togetherContent_DDLOrgCity');
            d.getElementById('together_togetherContent_DDLOrgMaillingCity').disabled=true;
            
			DDLOrgMaillingState.setValue(DDLOrgState.getValue()) ;
			DDLOrgMaillingCounty.setValue(DDLOrgCounty.getValue()) ;
            DDLOrgMaillingCity.setValue(DDLOrgCity.getValue());
            d.getElementById('together_togetherContent_HdnOrgMaillingCounty').value =DDLOrgCounty.getValue();
            d.getElementById('together_togetherContent_HdnOrgMaillingCity').value =DDLOrgCity.getValue();
            
            
     }
     else
     {
           d.getElementById('together_togetherContent_TxtOrgMaillingStreet').value="";
           d.getElementById('together_togetherContent_TxtOrgMaillingStreet').disabled=false;
           
           d.getElementById('together_togetherContent_DDLOrgMaillingCounty').value="";
           d.getElementById('together_togetherContent_DDLOrgMaillingCounty').disabled=false;
           
           
           d.getElementById('together_togetherContent_DDLOrgMaillingCity').disabled=false;
           d.getElementById('together_togetherContent_DDLOrgMaillingCity').value="";
           
           d.getElementById('together_togetherContent_TxtOrgMaillingZip').value = "";
           d.getElementById('together_togetherContent_TxtOrgMaillingZip').disabled=false;
     }
     
     return true;
 }
 

  function SetAuthorizeValue(field)
  {
        if(field=='TxtCPFName' || field=='TxtCPLName' || field=='TxtCPMName')
        {
            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;
        }
        else if(field=='DDLCPtitle')
        {
            var DDLCPtitle=d.getElementById('together_togetherContent_DDLCPtitle');
            var lbltitle=d.getElementById('lbltitle');
            lbltitle.innerHTML=DDLCPtitle.value;
        }   
        else if(field=='TxtOrgName')
        {
            var TxtOrgName=d.getElementById('together_togetherContent_TxtOrgName');
            var lblorgname=d.getElementById('lblorgname');
            lblorgname.innerHTML=TxtOrgName.value;
        }
        return true;
}   

 function CheckForOtherSelection(chkboxid,othertextboxid)
 {
    var chkid,objchk,lastchkobj,objother;
    
    for (i = 0; i < 500; i++)
    {
        chkid=chkboxid + "_" + i;
        objchk=d.getElementById(chkid);
        if(objchk==null)
            break;
        else
            lastchkobj=objchk;
    }

    objother=d.getElementById(othertextboxid);
    if(lastchkobj.checked)
    {
       objother.disabled = false;

       if(chkboxid=='together_togetherContent_CBLOrgHistory')
            CBLOrgHistory=true;
       else if(chkboxid=='together_togetherContent_CBLEducationType')
            CBLEducationType=true;
       //else if(chkboxid=='together_togetherContent_RBLHourProgram')
       //     RBLHourProgram=true;
       else if(chkboxid=='together_togetherContent_RBLFormat')
            RBLFormat=true;
       //else if(chkboxid=='together_togetherContent_Curriculum_CBLHourDayOperation')
       //     CBLHourDayOperation=true;
       else if(chkboxid=='together_togetherContent_Curriculum_CBLTargetPopulation')
            CBLTargetPopulation=true;                         
    }
    else
    {
       objother.value='';
       objother.disabled = true;    

       if(chkboxid=='together_togetherContent_CBLOrgHistory')
            CBLOrgHistory=false;
       else if(chkboxid=='together_togetherContent_CBLEducationType')
            CBLEducationType=false;
       else if(chkboxid=='together_togetherContent_RBLHourProgram')
            RBLHourProgram=false;
       else if(chkboxid=='together_togetherContent_RBLFormat')
            RBLFormat=false;
       else if(chkboxid=='together_togetherContent_Curriculum_CBLHourDayOperation')
            CBLHourDayOperation=false;
       else if(chkboxid=='together_togetherContent_Curriculum_CBLTargetPopulation')
            CBLTargetPopulation=false;                         
    }
}

var i;

var CBLOrgHistory,CBLEducationType,RBLHourProgram,RBLFormat,CBLHourDayOperation,CBLTargetPopulation;
var listboxOrgType,LstCurriculumTypeSelected,LBLocationServedSelected;
CBLOrgHistory=false;
CBLEducationType=false;
RBLHourProgram=false;
RBLFormat=false;
CBLHourDayOperation=false;
CBLTargetPopulation=false;
listboxOrgType=false;
LstCurriculumTypeSelected=false;
LBLocationServedSelected=false;

function ValidateServiceProviderForm()
{
    var i;
    var flag=true;
    isactivate=1;
    for(i=1;i<=9;i++)
    {
        if(i!=4 && i!=8 && i!=9)
        {
            flag=opentab(i);
            if(flag==false)
            {
                break;
            }
        }
        
    }    
    if(flag==false)
        return false;
    else
    {
        var issubmit=d.getElementById('together_togetherContent_IsSubmit');
        issubmit.value=1;
        
        d.getElementById('together_togetherContent_TxtFCFName').disabled=false;
        d.getElementById('together_togetherContent_TxtFCMName').disabled=false;
        d.getElementById('together_togetherContent_TxtFCLName').disabled=false;
        d.getElementById('together_togetherContent_DDLFCTitle').disabled=false;
        d.getElementById('together_togetherContent_TxtFCPhone').disabled=false;
        d.getElementById('together_togetherContent_TxtFCExt').disabled=false;
        d.getElementById('together_togetherContent_TxtFCEMailID').disabled=false;   

        d.getElementById('together_togetherContent_TxtOrgMaillingStreet').disabled=false;
        d.getElementById('together_togetherContent_DDLOrgMaillingCounty').disabled=false;
        d.getElementById('together_togetherContent_TxtOrgMaillingZip').disabled=false;
        d.getElementById('together_togetherContent_DDLOrgMaillingCity').disabled=false;
        this.tabs.activate(9);
    }    
    return true;
}
 
 var ctr;
 var strerror;
 function opentab(id)
 {
 
    var ctrlid,ctrlid1;
    ctr=0;
    strerror='';
    var header='Please correct the following error(s).<br \><br \><br \>';
    strerror='';
    var focusctrl=null;
   
    controlid=document.getElementById('together_togetherContent_Message');
    if(id==1)
    {
        ctrlid=d.getElementById('together_togetherContent_TxtCPFName');
        if(trim(ctrlid.value)=='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;         
           
            strerror+=++ctr + '.  Please provide the first name of the person completing this form.<br \>';    
        }
        
        if(trim(ctrlid.value)!='' && !IsValidOrganizationName(trim(ctrlid.value)) )
            {
			    if(focusctrl==null)
				    focusctrl=ctrlid;        
           
                strerror+=++ctr + '.  Please check the the first name of the person completing this form.<br \>';    
            }
        
        
        ctrlid=d.getElementById('together_togetherContent_TxtCPLName');
        if(trim(ctrlid.value)=='')
        {
           if(focusctrl==null)
				focusctrl=ctrlid;
                 
            strerror+=++ctr + '.  Please provide the last name of the person completing this form.<br \>';    
         }   

		if(trim(ctrlid.value)!='' && !IsValidOrganizationName(trim(ctrlid.value)) )
            {
			    if(focusctrl==null)
				    focusctrl=ctrlid;        
           
                strerror+=++ctr + '.  Please check the the last name of the person completing this form.<br \>';    
            }
        
        ctrlid=d.getElementById('together_togetherContent_TxtCPPhone');
        if(trim(ctrlid.value)=='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
            strerror+=++ctr + '.  Please provide the phone number of the person completing this form.<br \>';                
		}
					
        ctrlid=d.getElementById('together_togetherContent_TxtCPEMailID');
        if(trim(ctrlid.value)=='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please provide the E-mail ID of the person completing this form.<br \>';    
		}
		
		if(!IsEmailValid(ctrlid.value) && trim(ctrlid.value)!='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please check the E-mail ID of the person completing this form.<br \>';    
		}
		
        ctrlid=d.getElementById('together_togetherContent_TxtFCFName');
        if(trim(ctrlid.value)=='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
       
            strerror+=++ctr + '.  Please provide the first name of the contact person<br \>';    
		}       
		if(trim(ctrlid.value)!='' && !IsValidOrganizationName(trim(ctrlid.value)) )
            {
			    if(focusctrl==null)
				    focusctrl=ctrlid;        
           
                strerror+=++ctr + '.  Please check the the first name of the contact person.<br \>';    
            }
        
        ctrlid=d.getElementById('together_togetherContent_TxtFCLName');
        if(trim(ctrlid.value)=='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please provide the last name of the contact person.<br \>';    
		}
       
       if(trim(ctrlid.value)!='' && !IsValidOrganizationName(trim(ctrlid.value)) )
            {
			    if(focusctrl==null)
				    focusctrl=ctrlid;        
           
                strerror+=++ctr + '.  Please check the the last name of the contact person.<br \>';    
            }
        
        ctrlid=d.getElementById('together_togetherContent_TxtFCPhone');
        if(trim(ctrlid.value)=='' )
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please provide the phone number of the contact person.<br \>';                
		}
		
        ctrlid=d.getElementById('together_togetherContent_TxtFCEMailID');
        if(trim(ctrlid.value)=='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please provide the E-mail ID of the contact person.<br \>';    
		}
		
		if(!IsEmailValid(ctrlid.value) && trim(ctrlid.value)!='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please check the E-Mail ID of the contact person.<br \>';    
		}
		
		        
        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);           
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)
            {
                focusctrl.focus();         
                Ext.get(focusctrl.id).focus();
                }
            return false;
        }
        else
        {
            controlid.innerHTML='';
            focusctrl=d.getElementById('together_togetherContent_TxtOrgName'); 
            this.tabs.activate(id);
            focusctrl.focus();
            return true;
        }
    }
    else if(id==2)
    {
        focusctrl=null;
        
        ctrlid=d.getElementById('together_togetherContent_TxtOrgName');        
        if(ctrlid.readOnly==false)
        {
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
				    strerror+=++ctr +'. Please provide the Organization Name.<br \>';    
            }
        
            if(trim(ctrlid.value)!='' && !IsValidOrganizationName(trim(ctrlid.value)) )
            {
			    if(focusctrl==null)
				    focusctrl=ctrlid;        
           
                strerror+=++ctr + '.  Please check the Organization name.<br \>';    
            }
        
        
             var DivOrgnameExists=d.getElementById('DivOrgnameExists');
             if(DivOrgnameExists.innerHTML.trim()!='')
                 strerror+=++ctr +'. The organization name entered already exists in the Twogether database.<br\>Please ensure the name you\'ve entered is the full legal name of your organization.<br \>';  
        }
        
        ctrlid=d.getElementById('together_togetherContent_TxtOrgTypeSelect');
        
        if(trim(ctrlid.value)=='')
			strerror+=++ctr +'. Please select the Organization Type.<br \>';    
		
		if(listboxOrgType==true)
        {
            ctrlid=d.getElementById('together_togetherContent_TxtOrgTypeOther');
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
		
                strerror+=++ctr +'. Please provide the other value of your Organization type.<br \>';    
            }  
        }
        

        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror); 
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)
                focusctrl.focus();    
            return false;
        }
        else
        {
            controlid.innerHTML='';
            focusctrl=d.getElementById('together_togetherContent_TxtOrgStreet');
            this.tabs.activate(id);
            focusctrl.focus(); 
            return true;
        }
    }
    else if(id==3)
    {
		ctr=0;
		focusctrl=null;
        ctrlid=d.getElementById('together_togetherContent_TxtOrgStreet');
        if(trim(ctrlid.value)=='')
          {
			 if(focusctrl==null)
				focusctrl=ctrlid;
		
            strerror+=++ctr +'. Please provide the street address of your Organization.<br \>';    
        }
        ctrlid=d.getElementById('together_togetherContent_DDLOrgCounty');
        if(ctrlid.selectedIndex<=0)
        {
			/*if(focusctrl==null)
				focusctrl=ctrlid;*/
            strerror+=++ctr +'. Please provide the County of your Organization.<br \>';    
            
        }
        ctrlid=d.getElementById('together_togetherContent_DDLOrgCity');
        if(ctrlid.selectedIndex<=0)
         {
			/*if(focusctrl==null)
				focusctrl=ctrlid;  */      
            strerror+=++ctr +'. Please provide the City of your Organization.<br \>';    
		}
        ctrlid=d.getElementById('together_togetherContent_TxtOrgZip');
        
        if(trim(ctrlid.value)=='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '. Please provide the ZipCode of your Organization.<br \>';                
		}
				
		ctrlid=d.getElementById('together_togetherContent_TxtOrgUrl');
		if(!IsUrlValid(ctrlid.value) && trim(ctrlid.value)!='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please check the URL of your Organization.<br \>';    
		}
		
		ctrlid=d.getElementById('together_togetherContent_TxtOrgEmailId');
		if(!IsEmailValid(ctrlid.value) && trim(ctrlid.value)!='')
        {
			if(focusctrl==null)
				focusctrl=ctrlid;
        
            strerror+=++ctr + '.  Please check the E-Mail ID of your Organization.<br \>';    
		}
		
		 var DivOrgnameExists=d.getElementById('DivOrgnameExists');
         if(DivOrgnameExists.innerHTML.trim()!='')
		 {		
                 strerror+=++ctr +'. The organization name entered already exists in the Twogether database.<br\>Please ensure the name you\'ve entered is the full legal name of your organization.<br \>'; 
                 ctrlid=d.getElementById('together_togetherContent_TxtOrgName'); 
                 if(focusctrl==null)
				    focusctrl=ctrlid;
				  id=2;    
		 }
		 
        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)            
                focusctrl.focus();    
            return false;
        }
        else
        {
            controlid.innerHTML='';
            focusctrl=d.getElementById('together_togetherContent_CBLOrgHistory');
            this.tabs.activate(id);
			focusctrl.focus(); 
            return true;
        }
    }
    else if(id==4)
    {
        ctr=0;
		focusctrl=null;
	
        
        if(CBLOrgHistory==true)
        {
            ctrlid=d.getElementById('together_togetherContent_TxtOrgHistoryOther');
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
		
                strerror+=++ctr +'. Please provide the other value of your Organization History.<br \>';    
            }  
        }
        
        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)            
                focusctrl.focus();    
            return false;
        }
        else
        {
            this.tabs.activate(id);
            focusctrl=d.getElementById('together_togetherContent_CBLEducationType'); 
            focusctrl.focus(); 
            return true;   
        }
    }
    else if(id==5)
    {
        ctr=0;
		focusctrl=null;
		strerror='';
		ctrlid='together_togetherContent_CBLEducationType';
		var chkid,objchk;
		var isselectanyitem=false;
		chkboxid=""
        for (i = 0; i < 500; i++)
        {
            chkid=ctrlid + "_" + i;
            objchk=d.getElementById(chkid);
            if(objchk==null)
                break;
            else
            {
                if(objchk.checked)
                    isselectanyitem=true;
            }   
        }
        
        
        if(isselectanyitem==false)
        {    
            chkid=ctrlid + '_0';
            objchk=d.getElementById(chkid);
            if(objchk!=null)
			    focusctrl=objchk;
			strerror+=++ctr +'. Please select the type of Marriage Education your Organization provides.<br \>';    
        }
		
		
		
		if(CBLEducationType==true)
        {
            ctrlid=d.getElementById('together_togetherContent_TxtEducationTypeOther');
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
		
                strerror+=++ctr +'. Please provide the other value Marriage Education your Organization provides.<br \>';    
            }  
        }
        

		ctrlid='together_togetherContent_RBLHourProgram';
	
		isselectanyitem=false;
		chkboxid=""
        for (i = 0; i < 500; i++)
        {
            chkid=ctrlid + "_" + i;
            objchk=d.getElementById(chkid);
            if(objchk==null)
                break;
            else
            {
                if(objchk.checked)
                    isselectanyitem=true;
            }   
        }
        
        
        if(isselectanyitem==false)
        {    
            chkid=ctrlid + '_0';
            objchk=d.getElementById(chkid);
            if(objchk!=null)
			    focusctrl=objchk;
			strerror+=++ctr +'. Please select the program hours your Organization provides.<br \>';    
        }
		
		
//        if(RBLHourProgram==true)
//        {
//            ctrlid=d.getElementById('together_togetherContent_TxtHourProgramOther');
//            if(trim(ctrlid.value)=='')
//            {
//			     if(focusctrl==null)
//				    focusctrl=ctrlid;
//		
//                strerror+=++ctr +'. Please provide the other value of Hour Program your Organization provides.<br \>';    
//            }  
//        }
         
        if(RBLFormat==true)
        {
            ctrlid=d.getElementById('together_togetherContent_TxtFormatOther');
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
		
                strerror+=++ctr +'. Please provide the other value of Format your Organization services.<br \>';    
            }  
        }
        
		if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);  
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)            
                focusctrl.focus();    
            return false;
        }
        else
        {
            controlid.innerHTML='';
            focusctrl=d.getElementById('together_togetherContent_Curriculum_LstCurriculumType');
            this.tabs.activate(id);
            focusctrl.focus();
            return 'true';
        }
    }
    else if(id==6)
    {
        ctr=0;
		focusctrl=null;
		
		ctrlid=d.getElementById('together_togetherContent_TxtCurriculumTypeSelected');
        if(trim(ctrlid.value)=='')
        {
			/*if(focusctrl==null)
				focusctrl=d.getElementById('together_togetherContent_Curriculum_LstCurriculumType');*/
			strerror+=++ctr +'. Please select the Curriculum that your Organization offers.';    
		}
		
		if(LstCurriculumTypeSelected==true)
        {
            ctrlid=d.getElementById('together_togetherContent_TxtCurriculumTypeOther');
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
		
                strerror+=++ctr +'. Please provide the other value of Curriculum that your Organization offers.<br \>';    
            }  
        }
        
        if(LBLocationServedSelected==true)
        {
            ctrlid=d.getElementById('together_togetherContent_TxtLocationServedOther');
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
		
                strerror+=++ctr +'. Please provide the other value of Location Server your Organization.<br \>';    
            }  
        }
        
        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)            
                focusctrl.focus();
            return false;
        }
        else
        {
            controlid.innerHTML='';
            focusctrl=d.getElementById('together_togetherContent_txtlocationservedcity1');
            this.tabs.activate(id);
            focusctrl.focus(); 
            return true;
        }

    }
    else if(id==7)
    {
        focusctrl=null;
        strerror='';
        ctr=0;
		var ctrlid1=d.getElementById('together_togetherContent_txtlocationservedcity1');
		var ctrlid2=d.getElementById('together_togetherContent_txtlocationservedzip1');
		
        if(trim(ctrlid1.value)=='')
            focusctrl=ctrlid1;
        if(trim(ctrlid2.value)=='')
        {
		   if(focusctrl==null)
			    focusctrl=ctrlid2;
		}        
		if(trim(ctrlid2.value)=='' || trim(ctrlid1.value)=='')
            strerror+=++ctr + '.  Please provide the list of city/zip where service(s) is/are offered.<br \>';
        
//        if(CBLHourDayOperation==true)
//        {
//            ctrlid=d.getElementById('together_togetherContent_Curriculum_TxtHourDayOperationOther');
//            if(trim(ctrlid.value)=='')
//            {
//			     if(focusctrl==null)
//				    focusctrl=ctrlid;
//		
//                strerror+=++ctr +'. Please provide the other value of HOURS and DAYS of OPERATION.<br \>';    
//            }  
//        }
        
        
        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);   
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)            
                focusctrl.focus(); 
            return false;
        }
        else
        {
		    this.tabs.activate(id);
    	    focusctrl=null;
            focusctrl=d.getElementById('together_togetherContent_Curriculum_CBLTargetPopulation');
            focusctrl.focus(); 
            return true;
        }
    }
    else if(id==8)
    {
        ctr=0;
        strerror='';
		focusctrl=null;
        if(CBLTargetPopulation==true)
        {
            ctrlid=d.getElementById('together_togetherContent_Curriculum_TxtTargetPopulationOther');
            if(trim(ctrlid.value)=='')
            {
			     if(focusctrl==null)
				    focusctrl=ctrlid;
		
                strerror+=++ctr +'. Please provide the other value of Target Population.<br \>';    
            }  
        }
        
        ctrlid=d.getElementById('together_togetherContent_Curriculum_RBOtherLanguageYes');
        if(ctrlid.checked)
        {
            ctrlid=d.getElementById('together_togetherContent_txtotherlanguage');
            if(trim(ctrlid.value)=='')
            {
		        if(focusctrl==null)
    		        focusctrl=ctrlid;
                strerror+=++ctr +'. Please provide the value of Other Language.<br \>';    
            }
       } 
            
        
        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)
                focusctrl.focus();    
            return false;
        }
        else
        {
		    this.tabs.activate(id);
    	    focusctrl=null;
            focusctrl=d.getElementById('together_togetherContent_Registration_TxtFName');    
            focusctrl.focus(); 
            return true;
        }
    }
    else if(id==9)
    {
        focusctrl=null;
        strerror='';
        ctr=0;
        
        var regext,regph,regemail;
        regext=d.getElementById('together_togetherContent_Registration_TxtExt');    
        regph=d.getElementById('together_togetherContent_Registration_TxtPhone');    
        regemail=d.getElementById('together_togetherContent_Registration_TxtEMailID'); 
          
        
        if(trim(regemail.value)!='' && !IsEmailValid(trim(regemail.value)))
        {
            if(focusctrl==null)
				    focusctrl=regemail;
                strerror+=++ctr + '.  Register provider E-mail must be valid.<br \>';
        }
        
        if(strerror!='')
        {
            strerror=header + strerror;
            ShowError(strerror);
            this.tabs.activate(parseInt(id)-1);
            if(focusctrl!=null)            
                focusctrl.focus(); 
            return false;
        }
        else
        {
            this.tabs.activate(id);
            return true;
        }
    }
    else
    {
        this.tabs.activate(id);
        return false;
    }
 }   

function ResetForm()
{
    document.forms[0].reset();
    this.tabs.activate(0);
}
var flag;
function IsOrgAlreadyExists(ctrlid,ctrCityid)
{
   flag=false;
   var objctrl,xmlDoc;

   var objctrl=d.getElementById(ctrlid);
   var objCityID=d.getElementById(ctrCityid);
   var DivOrgnameExists=d.getElementById('DivOrgnameExists');
   DivOrgnameExists.innerHTML='';
   orgname=encodeURIComponent(trim(objctrl.value));
   var cityid=trim(objCityID.value);
   var oldProviderName=encodeURIComponent(trim(d.getElementById('together_togetherContent_HdnIsOldProviderNameEdit').value));
   var oldCityID=d.getElementById('together_togetherContent_HdnIsOldProviderCityIDEdit').value;
   var IsProviderEdit=d.getElementById('together_togetherContent_HdnIsProviderEdit').value;
  
   if(orgname!='' && cityid!='' && cityid!='0' && ( oldProviderName !=orgname || oldCityID!= cityid) )
   {
        Ext.Ajax.request({
        url: '../Handlers/OrganigationName.ashx?OrgName='+orgname +'&cityid=' +cityid,
        success: function(o)
        {
            xmlDoc=o.responseText;
             if(xmlDoc=="1")
             {
                    //flag=true;
                    DivOrgnameExists.innerHTML='The organization name entered already exists in the Twogether database.Please ensure the name you\'ve entered is the full legal name of your organization.';
                    //objctrl.focus();
                    //objctrl.select();
                    
             } 
        },
        failure: function(){       
           return false;
        }
       });
   }
   return false;
}

function IsValidOrganizationName(sText)
{
   var ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. -'&";
   var IsChar=true;
   var Char;

 
	 for (i = 0; i < sText.length && IsChar == true ; i++) 
     { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsChar = false;
         }
      }
   return IsChar;
   
}
function SetReadOnly(ctrl1,ctrl2,ctrl3,ctrl4,ctrl5,ctrl6,ctrl7,ctrl8,ctrl9,ctrl10,ctrl11,ctrl12)
{
   var objctrl;
   objctrl=d.getElementById(ctrl1);
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
   
   objctrl=d.getElementById(ctrl2);        
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
        
   objctrl=d.getElementById(ctrl3);        
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
        
   objctrl=d.getElementById(ctrl4);        
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
        
   objctrl=d.getElementById(ctrl5);        
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
   
   objctrl=d.getElementById(ctrl6);
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
        
   objctrl=d.getElementById(ctrl7);        
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
   
   objctrl=d.getElementById(ctrl8);        
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
   
   objctrl=d.getElementById(ctrl9);        
   if(trim(objctrl.value)=='')
        objctrl.disabled = true; 
   
   objctrl=d.getElementById(ctrl10);        
   if(trim(objctrl.value)=='0')
        objctrl.disabled = true; 
   
   objctrl=d.getElementById(ctrl11);        
   if(trim(objctrl.value)=='0')
        objctrl.disabled = true; 
        
   objctrl=d.getElementById(ctrl12);        
   if(trim(objctrl.value)=='0')
        objctrl.disabled = true;         
}
function SetListWidth(obj1,obj2,obj3,obj4,obj5,obj6)
{
    var flag,i;
    obj1=document.getElementById(obj1);
    obj2=document.getElementById(obj2);
    obj3=document.getElementById(obj3);
    obj4=document.getElementById(obj4);
    obj5=document.getElementById(obj5);
    obj6=document.getElementById(obj6);
    
    objdv1=document.getElementById('dv1');
    objdv2=document.getElementById('dv2');
    objdv3=document.getElementById('dv3');
    objdv4=document.getElementById('dv4');
    objdv5=document.getElementById('dv5');
    objdv6=document.getElementById('dv6');
    
    hght=objdv1.style.height;
	hght=parseInt(hght.substring(0,3));
	if(((parseInt(obj1.length)+1)*17)>hght)	
		hght=(parseInt(obj1.length)+1)*17;
	obj1.style.height=hght+'px';
	
	hght=objdv2.style.height;
	hght=parseInt(hght.substring(0,3));
	if(((parseInt(obj2.length)+1)*17)>hght)	
		hght=(parseInt(obj2.length)+1)*17;
	obj2.style.height=hght+'px';
	
	hght=objdv3.style.height;
	hght=parseInt(hght.substring(0,3));
	if(((parseInt(obj3.length)+1)*17)>hght)	
		hght=(parseInt(obj3.length)+1)*17;
	obj3.style.height=hght+'px';
	
	hght=objdv4.style.height;
	hght=parseInt(hght.substring(0,3));
	if(((parseInt(obj4.length)+1)*17)>hght)	
		hght=(parseInt(obj4.length)+1)*17;
	obj4.style.height=hght+'px';
	
	hght=objdv5.style.height;
	hght=parseInt(hght.substring(0,3));
	if(((parseInt(obj5.length)+1)*17)>hght)	
		hght=(parseInt(obj5.length)+1)*17;
	obj5.style.height=hght+'px';
	
	hght=objdv6.style.height;
	hght=parseInt(hght.substring(0,3));
	if(((parseInt(obj6.length)+1)*17)>hght)	
		hght=(parseInt(obj6.length)+1)*17;
	obj6.style.height=hght+'px';
	        
    if(obj1.length<=0)
        obj1.style.width='234px';
    else
    {
        flag=1;
	    for (i=0; i<obj1.length; i++)
	    {
		    if(obj1.options[i].text.length>=35)
	        {
		        flag=0;
			    break;
		    }
	    }
	    if(flag==1)
	        obj1.style.width='234px';
	    else
		    obj1.style.width=null;	                            
    }    
    
    if(obj2.length<=0)
        obj2.style.width='234px';
    else
    {
        flag=1;
	    for (i=0; i<obj2.length; i++)
	    {
		    if(obj2.options[i].text.length>=35)
	        {
		        flag=0;
			    break;
		    }
	    }
	    if(flag==1)
	        obj2.style.width='234px';
	    else
		    obj2.style.width=null;	                            
    }    
        
    if(obj3.length<=0)
        obj3.style.width='234px';
    else
    {
        flag=1;
	    for (i=0; i<obj3.length; i++)
	    {
		    if(obj3.options[i].text.length>=35)
	        {
		        flag=0;
			    break;
		    }
	    }
	    if(flag==1)
	        obj3.style.width='234px';
	    else
		    obj3.style.width=null;	                            
    }    
        
    if(obj4.length<=0)
        obj4.style.width='234px';
    else
    {
        flag=1;
	    for (i=0; i<obj4.length; i++)
	    {
		    if(obj4.options[i].text.length>=35)
	        {
		        flag=0;
			    break;
		    }
	    }
	    if(flag==1)
	        obj4.style.width='234px';
	    else
		    obj4.style.width=null;	                            
    }    
        
    if(obj5.length<=0)
        obj5.style.width='234px';
    else
    {
        flag=1;
	    for (i=0; i<obj5.length; i++)
	    {
		    if(obj5.options[i].text.length>=35)
	        {
		        flag=0;
			    break;
		    }
	    }
	    if(flag==1)
	        obj5.style.width='234px';
	    else
		    obj5.style.width=null;	                            
    }    
        
    if(obj6.length<=0)
        obj6.style.width='234px';
    else
    {
        flag=1;
	    for (i=0; i<obj6.length; i++)
	    {
		    if(obj6.options[i].text.length>=35)
	        {
		        flag=0;
			    break;
		    }
	    }
	    if(flag==1)
	        obj6.style.width='234px';
	    else
		    obj6.style.width=null;	                            
    }    
		
}
