/*GLOBAL DATABASE ABOUT PROGRAMS AND LOCATIONS*/
var programs = new Array();
				   
//Format of array       Name, URL, Description
programs[0] = new Array("", "", "");

programs[0] = new Array("Transitions Intensive Outpatient", "transitionsintoutpatient.htm", "The Transitions Intensive Outpatient Program (IOP) provides treatment for clients who are in need of more structured care than is provided in regular outpatient.  Clients of the Intensive Outpatient Program attend bundled outpatient services not to exceed three (3) hours of counseling three (3) days a week.  Services are individualized to the needs of the client.");

programs[1] = new Array("Eastern Region Service Center", "ersc.htm", "The Eastern Region Service Center is a regional case management project that assists clients who are medically indigent or eligible for or are currently receiving State Administered General Assistance.");

programs[2] = new Array("Milestone Intensive Residenial Treatment", "milestone.htm", "This program provides highly structured and rigorous residential treatment for chemically dependent persons who are in the early stages of recovery.  Milestone provides co-ed treatment with a variable length of stay based on treatment needs.  Two beds are reserved for clients referred by the Connecticut Court Support Services Division (CSSD).");

programs[3] = new Array("Thomas Murphy Center Intermediate Residential Treatment", "tmc.htm", "This program provides residential treatment for people who are in need of a structured environment to continue their recovery and who have developed the skills necessary to begin the process of reintegrating into the community. Clients of this program focus on employment and/or educational needs during the day and return to the facility in the evening for substance abuse treatment. The facility has 14 beds, is co-ed and provides a variable length of stay of up to 180 days.");

programs[4] = new Array("New Life Center", "newlifecenter.htm","This program provides residential substance abuse treatment for chemically dependent pregnant and postpartum women and their children. Women who enter this program need the structure of an intermediate program and support to help them with additional stressors of pregnancy and/or raising newborns/toddlers. The New Life Center offers six adult beds, six infant beds and two beds for toddlers with a variable length of stay up to 12 months.");

programs[5] = new Array("PAES: Pretrial Alcohol Education System", "paes.htm", "This program is a diversion program for first time offenders arrested for driving while intoxicated.  The program receives referrals from the Office of the Bail Commissioner and is designed to provide substance abusing drivers with intervention in a group format.");

programs[6] = new Array("PDEP: Pretrial Drug Education Program", "pdep.htm", "This program receives referrals from the Office of the Bail Commissioner and is designed to provide pretrial drug education services in a group format.  This program also receives participants that the court has sentenced to the Community Service Labor Program.");

programs[7] = new Array("Pathways Acute Care & Evaluation", "pathways.htm", "Pathways, Medically Monitored Detoxification Unit is a medical unit that provides medically monitored detoxification in order to prevent the serious side effects of withdrawal. The unit provides safe medical withdrawal from alcohol, heroin and benzodiazepines (low to moderate use) using the smallest amount of medication in the shortest time frame consistent with the safety and comfort of its patients.");

programs[8] = new Array("Prevention Programs", "prevention.htm", "C.P.A.S. continually responds to inquiries to address the educational needs of the community regarding substance abuse. These programs target all segments of the population, including all age groups and social classes with the special emphasis on targeted groups, settings and environments.");

programs[9] = new Array("Oak Street Recovery House", "oakrecovery.htm","The Oak Street Recovery House is a co-ed, 10 bed transitional living environment for people in the General Assistance Behavioral Health Program who are experiencing the most difficulty with recovery.");

programs[10] = new Array("Supportive Housing", "supportivehousing.htm", "Community Prevention and Addiction Services, Inc. provides supportive housing for chemically dependent men and women.  Supportive housing is an opportunity for individuals that have successfully completed substance abuse treatment programs to live with other individuals that are also in early recovery.  All tenants residing in the supportive housing have demonstrated a motivation to maintain their sobriety");

programs[11] = new Array("Transitions Outpatient", "transitionsoutpatient.htm", "Community Prevention and Addiction Services, Inc. Provides outpatient counseling for chemically dependent/substance abusing clients who are in need of treatment but who also have the skills and support to recover without the need of a residential setting.  Outpatient services provide weekly individual and/or group counseling.  Specialty groups are provided related to early recovery, anger management, relapse prevention, trauma and gender specific.");	

programs[12] = new Array("Opiate Treatment Program", "otp.htm", "Pathways is an accredited Opiate Treatment Program and is licensed to provide chemical maintenance treatment.");

programs[13] = new Array("", "", "");


//Array of locations holding indices to the programs they offer
var locations = new Array();
locations["DANIELSON"] = new Array(11, 5, 6);
locations["WILLIMANTIC"] = new Array(3, 11, 8, 10, 1, 9,0);
locations["MANCHESTER"] = new Array(11,13);
locations["PUTNAM"] = new Array(7, 2, 4, 12);
/*GLOBAL DATABASE ABOUT PROGRAMS AND LOCATIONS END HERE*/

function PageTitleNav()
{
	document.write("<div id='masthead'>");
	document.write("	<img align='left' src='images/cpas-logo.png'/>");
	document.write("	<h1 id='siteName'>Community Prevention &amp; Addiction Services, Inc.");	
	document.write("	<br/><font color='#006699' size='1px'>|----- A Continuum of Care for Chemically Dependent, Abusing, and At Risk Populations -----|</font></h1>");
	document.write("	<div id='globalNav'><a href='index.htm'>Main Page</a> | Locations >>> ");
	document.write("		<a href='danielson.htm'>Danielson </a> |  ");
	document.write("		<a href='manchester.htm'>Manchester</a> |  ");
	document.write("		<a href='putnam.htm'>Putnam </a> | ");
	document.write("		<a href='willimantic.htm'>Willimantic</a>");
	document.write("	</div>");
	document.write("	<div id='topaddress'>");
	document.write("		1491 West Main Street<br/>");
	document.write("		Willimantic, CT	 06226</br>");
	document.write("		Phone:(860)-456-3215");
	document.write("	</div>");
	document.write("</div>");
}

function PageLeftNavigation()
{
	document.write("<div id='navBar'>");
	document.write("	<div id='search'>");
	document.write(GooogleSearchForm());
	document.write("  	</div>");
	document.write("  	<div id='sectionLinks'>");
	document.write("		<h5>Programs at C.P.A.S.</h5>");
	document.write("		<ul>");
	document.write("      		<li><a href='ersc.htm'>ERSC <font size='1px'>[Eastern Region Service Center]</font></a></li>");
	//document.write("      		<li><a href='outreach.htm'>Manchester Outreach Project</a></li>");	
	document.write("	  		<li><a href='milestone.htm'>Milestone Intensive Residential Treatment</a></li>");
	document.write("      		<li><a href='newlifecenter.htm'>New Life Center</a></li>	  ");
	document.write("      		<li><a href='oakrecovery.htm'>Oak Street Recovery House</a></li>");	
	document.write("      		<li><a href='otp.htm'>Opiate Treatment Program</a></li> ");
	document.write("      		<li><a href='paes.htm'>PAES <font size='1px'>[Pretrial Alcohol Education Program]</font></a></li>");
	document.write("      		<li><a href='pathways.htm'>Pathways Acute Care &amp; Evaluation </a></li>");	
	document.write("      		<li><a href='pdep.htm'>PDEP <font size='1px'>[Pretrial Drug Education Program]</font></a></li>");
	document.write("      		<li><a href='prevention.htm'>Prevention Programs</a></li>");	
	document.write("      		<li><a href='supportivehousing.htm'>Supportive Housing</a></li>");
	document.write("      		<li><a href='tmc.htm'>Thomas Murphy Center Intermediate Residential Treatment</a></li>");
	document.write("      		<li><a href='transitionsoutpatient.htm'>Transitions Outpatient</a></li> ");		
	document.write("      		<li><a href='transitionsintoutpatient.htm'>Transitions Intensive Outpatient Services</a></li> ");		
	document.write("    	</ul>");
	document.write("  	</div>");
	document.write("	<div id='seperator'></div>"); //just add a seperaor div	
	document.write("  	<div class='relatedLinks'>");		
	document.write("    	<ul>");
	document.write("      		<li><a href='board.htm'>Board of Directors</a></li>");
	document.write("      		<li><a href='administrators.htm'>Administrators</a></li>");
	document.write("    	</ul>");
	document.write("  	</div>");
	document.write("	<div id='seperator'></div>"); //just add a seperaor div	
	document.write("  	<div class='relatedLinks'>");		
	document.write("    	<ul>");
	document.write("      		<li><a href='privpol.htm'>Privacy Protection Policy</a></li>");
	document.write("    	</ul>");
	document.write("  	</div>");
	document.write("	<div id='seperator'></div>"); //just add a seperaor div
	document.write("  	<div class='relatedLinks'>");
	document.write("    	<h3>Locate us</h3>");
	document.write("    	<ul>");
	document.write("      		<li><a href='contactus.htm'>Contact us</a></li>");
	document.write("      		<li><a href='hoursofoperation.htm'>Hours of operation</a></li>");
	document.write("    	</ul>");
	document.write("  	</div>");
	document.write("	<div id='seperator'></div>"); //just add a seperaor div	
	document.write("  	<div class='relatedLinks'>");	
	document.write("    	<h3>Career at C.P.A.S.</h3>");
	document.write("    	<ul>");
	document.write("      		<li><a href='jobs.php'>Find a job</a></li>");
	document.write("      		<li><a href='benefits.htm'>Benefits</a></li>");	
	document.write("    	</ul>");
	document.write("  	</div>");
	document.write("  	</div>");
}

/*
	Prints the footer note on each page
*/
function PageFooter()
{
	document.write("<br />");
	document.write("<div id='siteInfo'>");	
	document.write("	<a href='#'>Site Map</a> | ");
    document.write("	<a href='#'>Privacy Policy</a> | ");
	document.write("   &copy;2006 Community Prevention &amp; Addiction Services, Inc. 1491 West Main Street. Willimantic, CT 06226");
	document.write("</div><br />");
}

function GooogleSearchForm()
{
	var str = 	"<FORM method=GET action='http://www.google.com/search'>" +
			  	"<input type=hidden name=ie value=UTF-8>" +
				"<input type=hidden name=oe value=UTF-8>" +
				"<INPUT TYPE=text name=q size=20 maxlength=255 value=''><br/>" +
				"<INPUT type=submit name=btnG VALUE='Search'> Powered by Google, Inc." +
				"<font size=-1>" +
				"<input type=hidden name=domains value='www.cpas-inc.org'><br><input type=radio name=sitesearch value='www.cpas-inc.org' checked>C.P.A.S.<br>" +
				"</font>" +
				"</FORM>";
	return str;
}

/*
* Writes programs offered at the given location
* location must be in capital letters
*/
function GetProgramsByLocation(location)
{	
	//GET THE PROGRAMS FOR THE LOCATION
	var progs = locations[location];
	if(progs == null)
	{
		document.write("This location doesn't provide any programs");
		return;
	}
	
	document.write("<table width='100%' cellpadding='0' cellspacing='0' summary=''>");
	for(prog in progs)
	{
		var cur_prog_index = progs[prog];
		var cur_program = programs[cur_prog_index][0];
		var cur_program_href = programs[cur_prog_index][1];
		var cur_program_desc = programs[cur_prog_index][2];
		
		document.write("        <tr valign='top'>");
		document.write("          <td width='100%' class='storyLeft'>");
		document.write("            <p> ");
		document.write("            <h1 class='capsule'>");
		document.write(cur_program);
		document.write(" <a href='");
		document.write(cur_program_href);
		document.write("'>More ...</a>");
		document.write("</h1>");
		
		if(cur_program_desc != "")
		{
			document.write(cur_program_desc);
		}
		
		document.write("          <br/><br/></td>");
		document.write("        </tr>");		
	}
	
	document.write("      </table>");
	
	/* SAMPLE TABLE SHOULD LOOK LIKE THIS
	document.write("        <tr valign='top'>");
	document.write("          <td width='48%' class='storyLeft'>");
	document.write("            <p> ");
	document.write("            <h1 class='capsule'>Transition Outpatient Services</h1>");
	document.write("          </td>");
	document.write("        </tr>");
	document.write("      </table>");
	*/
}

//Function to Check emails
//Parameter ctrl: control that is to be validated. In other words control that
//                has the email value.
//Returns       : true - if valid else returns false
function checkemail(ctrl)
{
	var result = false
	var str= ctrl.value
	var filter=/^.+@.+\..{2,3}$/

	if(str.length == 0)
 		result = true	
	else if (filter.test(str))
    	result=true
	return result
}
