function PopulateApps() {

   var AppsList = document.frmMain.States;
   
   // Clear out the list of apps
   ClearOptions(document.frmMain.Apps);
   
	//Look at state Value
   if (AppsList[AppsList.selectedIndex].value == "Alabama") {
	AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }
   
   if (AppsList[AppsList.selectedIndex].value == "Alaska") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "Arizona") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

   if (AppsList[AppsList.selectedIndex].value == "Arkansas") {
	AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }
   
   if (AppsList[AppsList.selectedIndex].value == "California") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "Colorado") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "Connecticut") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "Delaware") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "District of Columbia") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

   if (AppsList[AppsList.selectedIndex].value == "Florida") {
    
	AddToOptionList(document.frmMain.Apps, "false", "FLDIC - Florida Doctors Insurance Company")
    AddToOptionList(document.frmMain.Apps, "pdfs/FLDIC AlliedApp.pdf", "- Allied Application");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLDIC Locum Tenens Acknowledgement - LTA 9.05.doc", "- Locum Tenens Acknowledgment");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLDIC PartTime Supplement.pdf", "- Part Time Supplement");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLDIC Physician Application.pdf", "- Physician Application");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLHPIX Entity app.pdf", "- Entity Application");
	AddToOptionList(document.frmMain.Apps, "false", "FLHPIX - Florida Healthcare Physician Insurance Exchange")
	AddToOptionList(document.frmMain.Apps, "pdfs/FLHPIX individual app.pdf", "- Individual Application");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLHPIX Office practice risk questionaire.pdf", "- Office Practice Risk Questionnaire");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLHPIX Submission Checklist.pdf", "- Submission Checklist");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLHPIX Subscribers Agreement.pdf", "- Subscribers Agreement");
    AddToOptionList(document.frmMain.Apps, "pdfs/FLHPIX Surplus AgreemenT.pdf", "- Surplus Agreement");
	AddToOptionList(document.frmMain.Apps, "false", "Hudson")
	AddToOptionList(document.frmMain.Apps, "pdfs/Hudson Application Small Group and Individual Physician.pdf", "- Small Group & Individual Physician");
	AddToOptionList(document.frmMain.Apps, "false", "GenStar")
	AddToOptionList(document.frmMain.Apps, "pdfs/GSN-Application 06-PS-02 (11-2006).pdf", "- Main Application");
	AddToOptionList(document.frmMain.Apps, "false", "Centurion Medical Liability Protective")
	AddToOptionList(document.frmMain.Apps, "pdfs/Centurion application.pdf", "- Main Application");
	AddToOptionList(document.frmMain.Apps, "false", "Rockbridge Underwriting Agency")
	AddToOptionList(document.frmMain.Apps, "pdfs/Rockbridge Underwriting Agency Ind app.pdf", "- Individual Application");  
	AddToOptionList(document.frmMain.Apps, "false", "AIG - American International")
	AddToOptionList(document.frmMain.Apps, "pdfs/AIG Healthcare Med Group Physicians Application 2007.doc", "- Main Application");  

    
   }

	if (AppsList[AppsList.selectedIndex].value == "Georgia") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }
	
	if (AppsList[AppsList.selectedIndex].value == "Hawaii") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Idaho") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

   if (AppsList[AppsList.selectedIndex].value == "Illinois") {
     AddToOptionList(document.frmMain.Apps, "false", "Medicus")
	 AddToOptionList(document.frmMain.Apps, "pdfs/Medicus.pdf", "- Main Application");
	 AddToOptionList(document.frmMain.Apps, "false", "PLICA - Professional Liability Insurance Company of America")
	 AddToOptionList(document.frmMain.Apps, "pdfs/PLICA IL.pdf", "- Main Application");
	 AddToOptionList(document.frmMain.Apps, "pdfs/PLICA no known claims.pdf", "- No Known Claims");
	 AddToOptionList(document.frmMain.Apps, "false", "TDC - The Doctors Company")
	 AddToOptionList(document.frmMain.Apps, "pdfs/TDC AlliedPersonnel.pdf", "- Allied Personnel");
	 AddToOptionList(document.frmMain.Apps, "pdfs/TDC PhysiciansSurgeons.pdf", "- Physicians & Surgeons");
	 AddToOptionList(document.frmMain.Apps, "false", "ISMIE")
	 AddToOptionList(document.frmMain.Apps, "pdfs/ismieAlliedHealth.pdf", "- Allied Health");
	 AddToOptionList(document.frmMain.Apps, "pdfs/ismieCorporate.pdf", "- Corporate");
	 AddToOptionList(document.frmMain.Apps, "pdfs/ismieLocumTenens.pdf", "- Locum Tenens");
	 AddToOptionList(document.frmMain.Apps, "false", "Hudson")
	 AddToOptionList(document.frmMain.Apps, "pdfs/Hudson Application Small Group and Individual Physician.pdf", "- Small Group & Individual Physician");
	 AddToOptionList(document.frmMain.Apps, "false", "GenStar")
	 AddToOptionList(document.frmMain.Apps, "pdfs/GSN-Application 06-PS-02 (11-2006).pdf", "- Main Application");
	 AddToOptionList(document.frmMain.Apps, "false", "Rockbridge Underwriting Agency")
	 AddToOptionList(document.frmMain.Apps, "pdfs/Rockbridge Underwriting Agency Ind app.pdf", "- Individual Application");
	 AddToOptionList(document.frmMain.Apps, "false", "AIG - American International")
	 AddToOptionList(document.frmMain.Apps, "pdfs/AIG Healthcare Med Group Physicians Application 2007.doc", "- Main Application");

   }

   if (AppsList[AppsList.selectedIndex].value == "Indiana") {
	AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }

	if (AppsList[AppsList.selectedIndex].value == "Iowa") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }

   if (AppsList[AppsList.selectedIndex].value == "Kansas") {
       AddToOptionList(document.frmMain.Apps, "false", "TDC - The Doctors Company")
	   AddToOptionList(document.frmMain.Apps, "pdfs/TDC AlliedPersonnel.pdf", "- Allied Personnel");
       AddToOptionList(document.frmMain.Apps, "pdfs/TDC PhysiciansSurgeons.pdf", "- Physicians & Surgeons");
	   AddToOptionList(document.frmMain.Apps, "false", "Kansas Health Care Availability Plan")
	   AddToOptionList(document.frmMain.Apps, "pdfs/PLAN APPLICATION.pdf", "- Main Application");
	   AddToOptionList(document.frmMain.Apps, "false", "Medicus")
	   AddToOptionList(document.frmMain.Apps, "pdfs/Medicus.pdf", "- Main Application");
   }

   if (AppsList[AppsList.selectedIndex].value == "Kentucky") {
	AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }

	if (AppsList[AppsList.selectedIndex].value == "Louisiana") {
    AddToOptionList(document.frmMain.Apps, "false", "LAMMICO")
	AddToOptionList(document.frmMain.Apps, "pdfs/LAMMICO Phys App.pdf", "- Physicians Application");
    AddToOptionList(document.frmMain.Apps, "false", "Hudson")
    AddToOptionList(document.frmMain.Apps, "pdfs/Hudson Application Small Group and Individual Physician.pdf", "- Small Group & Individual Physician");
	AddToOptionList(document.frmMain.Apps, "false", "Rockbridge Underwriting Agency")
	AddToOptionList(document.frmMain.Apps, "pdfs/Rockbridge Underwriting Agency Ind app.pdf", "- Individual Application");
	AddToOptionList(document.frmMain.Apps, "false", "AIG - American International Group")
	AddToOptionList(document.frmMain.Apps, "pdfs/AIG Healthcare Med Group Physicians Application 2007.doc", "- Main Application");
   }
	
	if (AppsList[AppsList.selectedIndex].value == "Maine") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Maryland") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Massachusetts") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Michigan") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Minnesota") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

   if (AppsList[AppsList.selectedIndex].value == "Mississippi") {
	AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }

   if (AppsList[AppsList.selectedIndex].value == "Missouri") {
    AddToOptionList(document.frmMain.Apps, "false", "MPM - Missouri Professionals Mutual")  
	AddToOptionList(document.frmMain.Apps, "pdfs/Full03_01_08.pdf", "- Main Application");
    AddToOptionList(document.frmMain.Apps, "pdfs/Ancillary03_01_08.pdf", "- Ancillary Application");
	AddToOptionList(document.frmMain.Apps, "pdfs/Locums03_01_08.pdf", "- Locum Tenens Application");
	AddToOptionList(document.frmMain.Apps, "pdfs/Renewal03_01_08.pdf", "- Renewal Application");
	AddToOptionList(document.frmMain.Apps, "pdfs/Clinics03_01_08.pdf", "- Clinics Application");
	AddToOptionList(document.frmMain.Apps, "pdfs/MPM_form_a.pdf", "- Claim Incident Report - Form A");
	AddToOptionList(document.frmMain.Apps, "pdfs/MPM_form_b.pdf", "- OB GYN Supplement - Form B");
	AddToOptionList(document.frmMain.Apps, "pdfs/MPM_form_c.pdf", "- Dental Related Fields - Form C");
	AddToOptionList(document.frmMain.Apps, "pdfs/MPM_form_d.pdf", "- Ophthamology - Form D");
	AddToOptionList(document.frmMain.Apps, "pdfs/MPM_form_e.pdf", "- Family Practice - Form E");
	AddToOptionList(document.frmMain.Apps, "pdfs/MPM_form_f.pdf", "- Supplement to Application - Form F");
	AddToOptionList(document.frmMain.Apps, "pdfs/MPM_form_g.pdf", "- Educational Information - Form G");
	AddToOptionList(document.frmMain.Apps, "false", "Medicus") 
	AddToOptionList(document.frmMain.Apps, "pdfs/Medicus.pdf", "- Main Application");
	AddToOptionList(document.frmMain.Apps, "false", "TDC - The Doctors Company") 
	AddToOptionList(document.frmMain.Apps, "pdfs/TDC AlliedPersonnel.pdf", "- Allied Personnel");
	AddToOptionList(document.frmMain.Apps, "pdfs/TDC PhysiciansSurgeons.pdf", "- Physicians & Surgeons");
	AddToOptionList(document.frmMain.Apps, "false", "PLICA - Professional Liability Insurance Company of America") 
	AddToOptionList(document.frmMain.Apps, "pdfs/PLICA IL.pdf", "- Main Application");
	AddToOptionList(document.frmMain.Apps, "pdfs/PLICA no known claims.pdf", "- No Known Claims");
	AddToOptionList(document.frmMain.Apps, "false", "Intermed") 
	AddToOptionList(document.frmMain.Apps, "pdfs/Intermed.pdf", "- Main Application");
	AddToOptionList(document.frmMain.Apps, "false", "Rockbridge Underwriting Agency") 
	AddToOptionList(document.frmMain.Apps, "pdfs/Rockbridge Underwriting Agency Ind app.pdf", "- Individual Application");
	AddToOptionList(document.frmMain.Apps, "false", "AIG - American International Group") 
	AddToOptionList(document.frmMain.Apps, "pdfs/AIG Healthcare Med Group Physicians Application 2007.doc", "- Main Application");
   }
   
   if (AppsList[AppsList.selectedIndex].value == "Montana") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "Nevada") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "New Hampshire") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "New Jersey") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "New Mexico") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "New York") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "North Carolina") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "North Dokata") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

	if (AppsList[AppsList.selectedIndex].value == "Ohio") {
      AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");

   }

   if (AppsList[AppsList.selectedIndex].value == "Oklahoma") {
    AddToOptionList(document.frmMain.Apps, "false", "APIC - American Physicians Insurance Company")
	AddToOptionList(document.frmMain.Apps, "pdfs/APIC Physician Application TX-OK 8-1-07.pdf", "- Main Application");
	AddToOptionList(document.frmMain.Apps, "false", "TDC - The Doctors Company") 
    AddToOptionList(document.frmMain.Apps, "pdfs/TDC AlliedPersonnel.pdf", "- Allied Personnel");
	AddToOptionList(document.frmMain.Apps, "pdfs/TDC PhysiciansSurgeons.pdf", "- Physicians & Surgeons");
	AddToOptionList(document.frmMain.Apps, "false", "Hudson")
	AddToOptionList(document.frmMain.Apps, "pdfs/Hudson Application Small Group and Individual Physician.pdf", "- Small Group & Individual Physician");
	AddToOptionList(document.frmMain.Apps, "false", "GenStar")
	AddToOptionList(document.frmMain.Apps, "pdfs/GSN-Application 06-PS-02 (11-2006).pdf", "- Main Application");
	AddToOptionList(document.frmMain.Apps, "false", "Rockbridge Underwriting Agency")
	AddToOptionList(document.frmMain.Apps, "pdfs/Rockbridge Underwriting Agency Ind app.pdf", "- Individual Application");
	AddToOptionList(document.frmMain.Apps, "false", "AIG - American International")
	AddToOptionList(document.frmMain.Apps, "pdfs/AIG Healthcare Med Group Physicians Application 2007.doc", "- Main Application");
   }
   
   if (AppsList[AppsList.selectedIndex].value == "Oregon") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "Pennsylvania") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "Rhode Island") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "South Carolina") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
   
   if (AppsList[AppsList.selectedIndex].value == "South Dakota") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

   if (AppsList[AppsList.selectedIndex].value == "Tennessee") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
   }

	if (AppsList[AppsList.selectedIndex].value == "Texas") {
        AddToOptionList(document.frmMain.Apps, "false", "APIC -American Physicians Insurance Company") 
		AddToOptionList(document.frmMain.Apps, "pdfs/APIC Physician Application TX-OK 8-1-07.pdf", "- Main Application");
		AddToOptionList(document.frmMain.Apps, "false", "Centurion Medical Liability Protective") 
		AddToOptionList(document.frmMain.Apps, "pdfs/Centurion application.pdf", "- Main Application");
		AddToOptionList(document.frmMain.Apps, "false", "TMLT - Texas Medical Liability Trust")
		AddToOptionList(document.frmMain.Apps, "pdfs/TMLT application kit.pdf", "- Main Application"); 
		AddToOptionList(document.frmMain.Apps, "false", "TDC - The Doctors Company") 
		AddToOptionList(document.frmMain.Apps, "pdfs/TDC AlliedPersonnel.pdf", "- Allied Personnel");
		AddToOptionList(document.frmMain.Apps, "pdfs/TDC PhysiciansSurgeons.pdf", "- Physicians & Surgeons");
		AddToOptionList(document.frmMain.Apps, "false", "Medicus") 
		AddToOptionList(document.frmMain.Apps, "pdfs/Medicus.pdf", "- Main Application");
		AddToOptionList(document.frmMain.Apps, "false", "PLICA - Professional Liability Insurance Company of America")
		AddToOptionList(document.frmMain.Apps, "pdfs/PLICA TX (2) (2).pdf", "- Main Application");
		AddToOptionList(document.frmMain.Apps, "pdfs/PLICA no known claims.pdf", "- No Known Claims");
		AddToOptionList(document.frmMain.Apps, "pdfs/false", "Rockbridge Underwriting Agency") 
		AddToOptionList(document.frmMain.Apps, "pdfs/Rockbridge Underwriting Agency Ind app.pdf", "- Individual Application");
		AddToOptionList(document.frmMain.Apps, "false", "AIG - American International Group") 
		AddToOptionList(document.frmMain.Apps, "pdfs/AIG Healthcare Med Group Physicians Application 2007.doc", "- Main Application");
	}
	
	if (AppsList[AppsList.selectedIndex].value == "Utah") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Vermont") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Virginia") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "Washington") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }
	
	if (AppsList[AppsList.selectedIndex].value == "West Virginia") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

   if (AppsList[AppsList.selectedIndex].value == "Wisconsin") {
      AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");

   }
   
   if (AppsList[AppsList.selectedIndex].value == "Wyoming") {
		AddToOptionList(document.frmMain.Apps, "false", "Please Contact Us For Application(s) At 800.966.7731");
	   }

}

//function selectAll(OptionList) {

//alert(OptionList.length);   
//for (x = OptionList.length - 1; x >= 1; x--) 
//	{
   // alert(x)  
//	if (ob.options[ob.selectedIndex].value != "false")
//	{
//		OptionList[x].selected = true;
//	}
  // }
//}


function ClearOptions(OptionList) {

   // Always clear an option list from the last entry to the first
   for (x = OptionList.length - 1; x >= 1; x--) {
      OptionList[x] = null;
   }
}


function AddToOptionList(OptionList, OptionValue, OptionText) {
   // Add option to the bottom of the list
   	var option = new Option(OptionText, OptionValue);
	if(OptionValue == "false")
	{
		option.disabled = true;
		option.style.fontWeight = "bold";
	}
	OptionList[OptionList.length] = option;


}


function download() {
	//need to get the values of the selected items in the third populated box 
	//then need to download those applications
	var ob = document.forms[0].Apps;
	//var arSelected = new Array();
	while (ob.selectedIndex != -1) 
	{ 
		if (ob.selectedIndex != 0) {
			if (ob.options[ob.selectedIndex].value != "false")
			{
				window.open(ob.options[ob.selectedIndex].value);
			}
	
		ob.options[ob.selectedIndex].selected = false; 
			}
	}
	//alert(arSelected.length);
}