/*****************************
*listpayors.js			 *
*version 5.3			 *
*Author: Eric Trimble		 *
*date: 06/29/2010			 *
******************************
*V5				 *
******************************
*Veritcal formatting.
*Had an an awsome idea while stumbling
*through v4
*Rather than write tables I'll simply write
*3 columns, thus eliminating an entire
*block of code, so much simpler.
******************************
*V5.1				 *
******************************
*Implemented a sort() function that now
*properly sorts the list alphabetically, you
*no longer need to order the list manually.
******************************
*V5.2
******************************
*sort() has a bug in it, it will improperly
*sort the list if it begins with multiple
*capitol letters.  Added in cOrder function
*to allow the sort to ignore case.
*REVERTED
******************************
*V5.3
******************************
*problems enocunted with 5.2 were fixed.
*The biggest error was a display problem
*with special char's.  this was corrected
*by changing it from a variable to a 
*string to allow it to pass special char's
*with ease.
*/


function cOrder(elementA,elementB)
{
	a = elementA.toLowerCase();
	b = elementB.toLowerCase();
	if(a > b) return 1;
	if(a < b) return -1;
	return 0;
}

function displaytable(who)
{

var x; //blank varable
var insco; //insurance company array value holder

/****Inc Co Array Groups****/

var blues = ["Anthem Blue Cross","Blue Cross Life and Health California","Blue Shield of California","BCBS Alabama","BC Colorado","BC Connecticut","CareFirst BlueChoice DC","The Dental Network (TDN) DC","BCBS Georgia","BCBS Georgia - Federal","BC Idaho","BCBS Illinois","BC Indiana","Anthem BCBS Kentucky","BCBS Massachusetts","BCBS CareFirst","BCBS Michigan","Anthem BCBS Missouri","Anthem BCBS Nevada","BCBS New Mexico","BCBS North Carolina- Dental Blue","BCBS North Carolina- Dental Blue Select","BCBS Ohio","BCBS Oklahoma","BCBS Tennesee","BCBS Texas","Premera BC of WA and Alaska","Anthem BCBS Wisconsin","BCBS WV Mountain States","BC Life and Health (CA)","Highmark BC ","Pennsylvania Blue Shield","Anthem BCBS Virginia","Regence BCBS of Utah ","Regence BlueShield of Idaho","Regence BCBS of Oregon","Regence BlueShield","Regence FEP - Washington","Regence FEP - Oregon","Horizon New Jersey","Horizon NJ Health","Horizon Dental Choice","Horizon Traditional","Wellmark Blue Dental of Iowa"];

var dentalhmo = ["Aetna DMO","American Dental Plan, Inc.","American Dental Plan of GA, Inc","American Dental Plan of NC, Inc.","American Dental Prov. of AR, Inc.","American Prepaid Dental Plan of OH","American Prepaid Professional Services","Cigna Health Plan - HMO","CompBenefits Dental and Vision Co.","CompBenefits Direct, Inc.","CompBenefits of AL, Inc.","CompBenefits of GA, Inc.","CompDent","CompDent of AL, Inc.","CompDent of GA, Inc.","CompDent of IL, Inc.","CompDent Preferred Networks, Inc.","Concordia Plus","Dental Care Plus Management Corp.","Dental Health Management, Inc.","Dental Network of America","DentiCare, Inc.","DentLease, Inc.","Diamond Dental of Arkansas, Inc.","Diversified Administrators, Inc.","Health Care Systems, Inc.","HealthStream Services, Inc.","Managed Dental Care (CA) - Guardian","Managed DentalGuard FL, NJ, NY, TX","National Dental Plans, Inc.","OHS of Alabama, Inc.","OHS of Georgia, Inc.","Oral Health Services","Unicare of Texas - HMO","Texas Dental Plan, Inc.","Lincoln Financial Group FL DHMO (Solstice)","HealthPlan of San Mateo Care Advantage (HMO)"];

var deltadental = ["AARP Dental Insurance","Alabama","Alaska","Arizona","Arkansas","California - Federal Services","California","California - TriCare Ret.","Colorado","Connecticut","Delaware","DeltaCare USA","District of Columbia","Georgia","Florida","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Missouri in SC","Montana","Nevada","New Jersey","New Mexico","New York","North Carolina","Ohio","Oklahoma","Oregon Dental Service - ODS","Pennsylvania","PMI DeltaCare USA","Puerto Rico","South Carolina (MO)","South Dakota","Tennessee","Texas","Utah","Virginia","Washington Dental - WDS","West Virginia","Wisconsin","Wyoming","Nebraska"];

var commercial = ["Aetna","ADI - Choice PPO","ADI - JMH Select Discount","ADI - Select","ADI - Series","ADI - Signature","Aetna Life and Casualty","Aetna Select","Alan Sturm & Associates","Allied Administrators - Pilot","Americhoice","Ameritas","Anthem Health & Life Insurance Company","Ascent Benefits Company","ASO/SIDS","Assurant Employee Benefits","Assurant Health","Assurant, Inc.","Atlantic Dental, Inc.(ADI)","Bell Atlantic","Brokers National Life Assurance Co.","Business Men's Assurance","Caterpillar Company","CSEA Employee Benefit Fund","Choice Care","Choice Plus","CIGNA HealthCare","CompBenefits Corporation","Concordia Preferred","Connecticut General","Continental Dental","CustomCare (Southwestern Bell - Exec)","Decare Dental","Denex Dental","Dental Benefit Providers","Dental Care Plus Group - Ohio","Dental Guard Preferred Network","Dental Select","DentaQuest","Doral Dental USA","Eastern Life and Health","Educators Mutual Life","Emphesys","Employee Benefit (EBMC)","Employee Benefit Services","Employer Plan Services","Employers Health Insurance","Employers Health Insurance of WI","Equicor","Equitable Life","First Ameritas Life Ins. Corp.","First Commonwealth","First Dental Health","First Reliance Standard","Fiserv Health- Harrington","FlexCare","Florida Power and Light","Fort Dearborn Life","Fortis Benefits","Fortis Insurance Company","Fortis Self Funded Administrative Services","GE Group Life Assurance","GEHA - Government Employees Health Assoc.","GEHA Connection Dental Federal","GEHA Connection Dental Plus","GEHA Employee Benefit Plan","Genworth Group Dental Benefits","GIC","Golden West Dental & Vision Plan","Group Dental Service","Group Health (GHI)","Guardian","Harrington Benefit Services","HealthCare Insight (HCI)","HealthPlex","Health Care Systems, Inc.","Health Services Group","HealthSource Provident","Health Resources Inc.","Hershey Health Smiles","Humana Choice Care","Humana Dental","Humana Gold Choice","Humana Military Healthcare","J.C. Penney","John Alden","Kaiser Permanente Dental Choice","John Hancock","LifeWise Health Plan of Oregon","Managed Health Services","Marriott","MCNA Dental Plans","Medica MN Commercial Program","Medica MN Public Program","MetLife","Minnesota Power","Motorola","Mutual of Omaha","National Rural Letter Carriers Association","Nippon Life Insurance of America","Oxford Health Plans","Paul Revere","Pacific Union","Phoenix Home Life","Phoenix American","Physicians Mutual","Preferred Dental Organization","Premier Access Insurance","Premier Dental Group","Primary Delivery Systems","Principal Financial Group","Principal Life Insurance","Protective Life","R.E. Harrington","Reliance Standard","ReliaStar","Renaissance Life & Health Ins.","SelectCare (Coca Cola)","Serentas Dental Solutions","Solstice Benefits, Inc.","Southwest Benefits Administers","Southwestern Bell","Standard Insurance","Standard of NY","Sun Life Financial Employee Benefits Grp","Superior Dental Care","Surency Life and Health","Transamerica Life","The Dental Companies","The Dental Concern","Three Rivers Health Plans","Time Insurance","Travelers","Tricare Active Reservists","Tricare Dental","Tricare Family Dental Plan-TFMDP","Tricare Retiree Dental Program","Trustmark ACEC","Trustmark NY ACEC","TRW","TSRDP Dental Claims","UFT Welfare Fund","UNICARE","Unicare Health Ins Co of the Midwest","Unicare Life and Health","Unicare Special Accounts","Uniform Dental Plan","Union Security Insurance Company","Unison Health Plan","Unistar","United Concordia","United Concordia - Dental Plus - PA Blue Shield","United Healthcare","United of Omaha","United Parcel Service","VA Project Hero","Varian Health Care Plan","Vencor/Kindred Healthcare","Vistica Administrators","WellPoint Dental Services","WellPoint Health Network","Xantus Health Plan","Regence MedAdvantage","Asuris TruAdvantage","Asuris Northwest Health","HealthPartners Dental Plan","Scion Dental of Nevada","Scion Dental of Ohio","Scion Dental of West Virginia","Scion IPA of New York","Scion, Inc.","Scion Dental of Georgia","Empire Dental","Securian Dental","Patriot Dental","Philadelphia Carpenters","Carpenters Health and Welfare Fund - Philadelphia","Sele-Dent","Healthplex - Florida DHMO (Solstice)","Coventry Dental","Prudential Dental of Group Dental SVC","California State Government Programs","Scion Dental of Florida","Liberty Dental Plan","Security Life Insurance Company of America","Advantica Benefits","Bay Area Delivery Drivers","Bay Area Automotive Group","Operating Engineers Health & Welfare Fund","Sentry Employee Dental Plan","Sentry Life Insurance Company of NY","Sentry Life Insurance Company","Sentry Insurance A Mutual Company"];

var medicaid = ["AZ - Mericopa Health","AZ - ALTCS Program-Avesis TPA","CA - BC Life","CA - Dentical","CA - CMSP","CT - Health Net","DC - Amerigroup","DC - Chartered Medicaid-EPSDT (Under 21)","DC - DC Healthcare Alliance - Chartered","DC - DC Healthcare Alliance - HealthRight","DC - DC Healthy Smiles Administrered by QPA","DC - DC Healthy Smiles Adult (21&up) Administrered by Doral","DC - DC Healthy Smiles Child (upto21)Administrered by Doral","DC - HealthRight - EPSDT (Under 21)","DC - Mid - Atlantic Access/EPPO","DC - Mid - Atlantic Choice","DC - Mid - Atlantic DHMO","DC - Health Services for Children with Special Needs","DC - Unison Capital Alliance Adult","DC - Unison Capital Alliance Child","DC - Unison Capitol Area Child","FL - Atlantic Dental, Inc.(ADI)","FL - Better Health - Adults","FL - Better Health-Children","FL - Childrens - Charlee","FL - Childrens - Miami-Dade 0-5","FL - Childrens - Miami-Dade 6-20","FL - Healthy Kids","FL - Humana - Children 0-5","FL - Humana - Children 6-20","FL - Humana - PW/H/A","FL - Humana - Non-Reform - Adult","FL - Humana - SSI - Adult","FL - Humana - TANF - Adult","FL - Independent Living - Adult","FL - JMH - Health & Wellness","FL - Prestige Health Choice Adult","FL - Molina HealthCare of FL","FL - SFCCN-PSN Adult","FL - THC - Alternate ID Product-no bnfit","FL - THC - Children","FL - THC - Non-Reform - Adult","FL - THC - Reform - Adult","FL - WC HealthEaseNon-Reform-Adult","FL - WC-Staywell Non-Reform-Adult","GA - Amerigroup","GA - Peach State Health Plan","GA - WellCare","IL - Amerigroup - Illinois","IL - Medicaid","IL - Medical Assistance Program","KS - Kansas Medical Assistance","KS - Medicaid","KY - Medicaid (Region 3)","KY - Passport FFS - KY","KY - Passport Health Plan","MA - MassHealth Dental","MA - Network Health Forward","MA - NHP Commonwealth Care","MD - Amerigroup","MD - Coventry Diamond Plan","MD - Healthy Smiles Confirm Pregnancy","MD - Healthy Smiles REM 21 and Over","MD - Healthy Smiles Under 21","MD - Helix","MD - History Load","MD - Mid - Atlantic Access/EPPO","MD - Mid - Atlantic Choice","MD - Mid - Atlantic DHMO","MD - Physician Care - MCO","MD - Priority Partners","MD - United Healthcare HealthChoice","MD - United Healthcare PAC","MN - Blue Plus","MN - Care SCHA Basic Plus One(M3)","MN - Care SCHA Basic Plus Two(M4)","MN - Care SCHA Care Basic (M2)","MN - Care SCHA Care Basic Plus(M5)","MN - Care SCHA Expanded (M1)","MN - CivicSmiles","MN - First Plan Blue","MN - MHP(Metropolitan Health Plan)","MN - SCHA - Ability Care","MN - SCHA (GA) - over 21","MN - SCHA (MA) - over 21","MN - SCHA (MA) - under 21","MN - SCHA - MSHO","MN - SCHA - Senior Care Plus","MN - UCare of Minnesota","MO - BCBS Kansas City","MO - Care Adult","MO - Care Children City","MO - Care Eligibility History","MO - Care Pregnant Woman","MO - FirstGuard Health Plan","MO - HealthCare USA","MO - HealthNet","NJ - Aetna Medicare Advantage","NJ - Amerigroup","NJ - Healthfirst ABD","NJ - Healthfirst DDD","NJ - Healthfirst DDD - copay","NJ - Healthfirst DYFS","NJ - Healthfirst Family Care A","NJ - Healthfirst Family Care B","NJ - Healthfirst Family Care C-Copay","NJ - Healthfirst Family Care C","NJ - Healthfirst Family Care D","NJ - Healthfirst Family Care D-Copay","NJ - Health Net","NJ - University Health Plan","NM - Amerigroup","NM - BlueSalud Adult","NM - BlueSalud Child","NM - Lovelace Community Health","NM - Molina HealthCare of NM","NM - Presbyterian Salud","NV - Amerigroup Community Care Adult","NV - Amerigroup Community Care Check-up","NV - Amerigroup Community Care Child","NV - Amerigroup Community Care Pregnant","NY - CenterCare","NY - Empire BCBS","NY - Fidelis 1199 - Adult","NY - Fidelis 1199 - Child","NY - Fidelis 1199 CHP Subsidized","NY - Fidelis 1199 CHP Non-Subsidized","NY - Fidelis 1199 FHP Non-Subsidized Co-pay","NY - Fidelis 1199 FHP Non Subsidized No Co-pay","NY - Fidelis 1199 FHP Subsidized Co-pay","NY - Fidelis 1199 FHP Subsidized No Co-pay","NY - Fidelis Care","NY - GHI","NY - Healthfirst","NY - Managed Health Inc.","NY - Metro Plus","NY - NHP CHP (no co-pay)","NY - NHP FHP (co-pay)","NY - NHP FHP (no co-pay)","NY - NHP Adult","NY - NHP Child","NY - Presbyterian Community","NY - Suffolk County","OH - Amerigroup","OH - Anthem BCBS Partnership","OH - Buckeye Health Plan","OH - Molina HealthCare of OH","OH - QualChoice","OH - Wellcare of Ohio, Inc-Adults","OH - Wellcare of Ohio, Inc-Children","OH - Unison Health Plan","OK - Heartland Health","OK - Unicare Health Plan","PA - Amerihealth Mercy","PA - Health Partners Philadelphia","PA - Ion","PA - Keystone Mercy","PA - KidzPartners CHIP","PA - Three Rivers Health Plans","PA - UPMC Health Plan - Dental","PA - UPMC Health Plan Pittsburgh","SD - Medicaid","TN - TennCare (DD-TN)","TN - TennDent (DD-TN)","VA - Mid - Atlantic Access/EPPO","VA - Mid - Atlantic Choice","VA - Mid - Atlantic DHMO","VA - Medicaid","VA - Smiles for Children","WA - Medicaid","WA - WA Dept. Social Health Services","WI - BadgerCare","WI - Doral Health Plan","WI - Prime Care of Wisconsin","WI - UHC of Wisconsin","WI - Wisconsin (2001)","WI - WI State Employees","Medicaid WA - WDSHS","MO - Bridgeport Dental Services"];

/*actual display code*/
/*This chunk of code simply determines what you selected to display and
defines the value of the insco to the value of the associated array*/

if(who == 'blues')
  {
	insco = blues;
  }
else if(who == 'dentalhmo')
  {
	insco = dentalhmo;
  }
else if(who == 'deltadental')
  {
	insco = deltadental;
  }
else if(who == 'commercial')
  {
	insco = commercial;
  }
else if(who == 'medicaid')
  {
	insco = medicaid;
  }
else
  {
	document.write("Invalid selection")
  }

/*Nothing changed between versions above this line*/

/*
Ok, so like in version 4, version 5 needs to get a total count of ins co's
but rather than display entire able columns, I'll write them into a single 
vertically aligned table definition.
-------------------------			-------------------------
| ins co | ins co | ins co |			| ins co | ins co | ins co |
| ins co | ins co | ins co |			-------------------------
| ins co | ins co | ins co |  rather than	| ins co | ins co | ins co |
| ins co | ins co | ins co |			-------------------------
| ins co | ins co | ins co |			| ins co | ins co | ins co |
-------------------------			-------------------------
removes an entire loop from the script and should actually be much simpler
since there's no longer a need to embed tables inside one another.
*/

/*--Count Variables--*/
var iCnt = 0;	//lenght of array value
var bCnt = 0;	//lenght of array value divided by 3
var fCnt = 0;	//final count of column size
var tCnt = 0;	//Number of ins co's printed count.
var tCol = 0;	//Total Column's complete count.
/*--Get count values--*/
iCnt = insco.length; 	//total array lenght
bCnt = (iCnt / 3);		//total lenght divided by 3
fCnt = Math.round(bCnt);	//round the divided lenght, prevents uneven columns
/*--This is a trouble shooting printout, prints the values for certain variables
--leave this commented out unless trouble shooting.
document.write("iCnt: " + iCnt + "<br />");
document.write("fCnt: " + fCnt + "<br />");
document.write("tCnt: " + tCnt + "<br />");
document.write("tCol: " + tCol + "<br />");
*/

/*Added 5.1, alphabetical sort*/
var inscos = insco.sort(cOrder);

document.write("<td valign=\"top\" width=\"250\">"); //open the table column


for(x in inscos) //loop through the selected array
{
	tCnt++; //add one to count value
	document.write("&bull\;" + insco[x] + "<br />"); //add the name into the column
	if(tCnt == fCnt) //if our count equals our control number
		{
		tCnt = 0; //reset the count to zero
		if(tCol < 2) //check to see how many colums have been completed and if its less than 2, close the column
			{
			document.write("</td><td valign=\"top\" width=\"250\">"); //close the table column
			}
		tCol++; //add one to the table column count
		}
}

document.write("</td>"); //close the final table column.


}
