var career_images = 5;var filename = "";var fast_facts_array = ["In-prison treatment is good public policy. It can deliver a 103% to 376% return on investment.", "Leading national provider of TC treatment in correctional settings.", "Most effective treatment available for correctional substance abusing clients.", "Unique substance abuse treatment programs for special needs clients.", "Prisoners who spend 90-150 days in treatment have much lower recidivism rates.", "Lower recidivism saved the state of Texas an estimated<br />$60.5 million.", "Former National Program of the Year Winner.", "Last year Gateway treated over 18,000 corrections clients.", "For a 500 bed facility, the annual savings to taxpayers could be $1.5 million -$3.4 million.", "Providing offenders the services to successfully re-enter life."];var fast_facts__link_array = ["Learn More About Our Research", "TC Treatment Model", "TC Treatment Model", "Specialized Institutional Programs", "More on Outcome Evaluations", "More on Outcome Evaluations", "Learn More About Gateway", "Learn More About Our Services", "Learn More About Our Research", "Learn More About Our Services"];var fast_facts__link_destination_array = ["research/default.aspx", "services/model.aspx", "services/model.aspx", "services/programs.aspx", "research/evaluations.aspx?faqOpen=1", "research/evaluations.aspx?faqOpen=3", "about/default.aspx", "services/default.aspx", "research/default.aspx", "services/default.aspx"];startList = function() {			var ua = navigator.userAgent.toLowerCase(); 			var is_pc_ie = ( (ua.indexOf('msie') != -1 ) && ( ua.indexOf('win') != -1 ) && ( ua.indexOf('opera') == -1 ) && ( ua.indexOf('webtv') == -1 ) );			var is_mac_ie = ( (ua.indexOf('msie') != -1 ) && ( ua.indexOf('mac') != -1 )); 			if(is_pc_ie){				navRoot = document.getElementById("nav_list");				for (i=0; i<navRoot.childNodes.length; i++) {					node = navRoot.childNodes[i];												if (node.nodeName=="LI") {						node.onmouseover=function() {							this.className+=" over";						}						node.onmouseout=function() {							this.className=this.className.replace(" over", "");						}																		   																			if (node.childNodes[2]) {														for (n=0; n<node.childNodes[2].childNodes.length; n++) {								node2 = node.childNodes[2].childNodes[n];								if (node2.nodeName=="LI") {									node2.onmouseover=function() {										this.className+=" over";									}									node2.onmouseout=function() {										this.className=this.className.replace(" over", "");									}															}									}															if (node.childNodes[2].childNodes[0].childNodes[2]) {																								for (n=0; n<node.childNodes[2].childNodes[0].childNodes[2].childNodes.length; n++) {									node3 = node.childNodes[2].childNodes[0].childNodes[2].childNodes[n];																	if (node3.nodeName=="LI") {										node3.onmouseover=function() {											this.className+=" over";										}										node3.onmouseout=function() {											this.className=this.className.replace(" over", "");										}																	}										}									}						}																												 																							}				}			}		}function MM_preloadImages() { //v3.0    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function init() {	    filename = unescape(location.pathname);    //filename = filename.substring(21, filename.lastIndexOf('/'));    	if(filename.substring(1,20).toLowerCase() == "gateway_corrections") filename = filename.substring(21, filename.lastIndexOf('/'));	else filename = filename.substring(1, location.pathname.lastIndexOf('/'));		//alert(filename);		if(filename != "/") {		var navHighlight = document.getElementById("nav_"+filename);				for (i=0; i<navHighlight.childNodes.length; i++) {					node = navHighlight.childNodes[i];												if(node.nodeName.toLowerCase() == 'a'){ 								node.className = node.className.replace(/main_link/g, 'selectedTopNav2'); 						} 			break;		}						}		if(document.getElementById('careers_ad')) setCareerAdImage();	if(document.getElementById('fast_fact_quote')) setFastFactQuote();		if(document.getElementById('faq_1')) loadFAQ();		/*if(filename != "/") {		document.getElementById("nav_" + filename).className = "selectedTopNav";		alert("nav_" + filename);    }*/			/*//uncomment the line above and comment out line 8 for the nav to work on staging    if(filename != "/") {	    document.getElementById(filename).style.display = "block";	    document.getElementById("pushNav").style.display = "none";    }		var urlPath = location.pathname;		var splitPathName_array = urlPath.split("/");			var str = splitPathName_array[2];	str = str.slice(0, str.indexOf('.'));	if(str == "SIK_teenNeedsHelp") {		document.getElementById('SIK_teenChecklist').className = "subNavItemSelected";			}	else if(str == "SIK_teenMightNeedHelp") {		document.getElementById('SIK_teenChecklist').className = "subNavItemSelected";			}	else if(str == "SIK_teenSelfTest") {		document.getElementById('SIK_teenChecklist').className = "subNavItemSelected";			}	else if(str == "SIK_parentsNeedHelp") {		document.getElementById('SIK_teenChecklist').className = "subNavItemSelected";			}	else {		if((str.substr(str.lastIndexOf("_")+1, 8) != "default") && (str.substr(str.lastIndexOf("_")+1, 7) != "results") && (str.substr(str.lastIndexOf("_")+1, 11) != "description") && (str.substr(str.lastIndexOf("_")+1, 3) != "you")) document.getElementById(str).className = "subNavItemSelected";		}*/	}function setCareerAdImage() {	/*var filename = unescape(location.pathname)    //filename = filename.substring(21, filename.lastIndexOf('/'));		if(filename.substring(1,8).toLowerCase() == "gateway") filename = filename.substring(21, filename.lastIndexOf('/'));	else filename = filename.pathname.substring(1, location.pathname.lastIndexOf('/'));*/		var rand = Math.floor(Math.random() * (career_images)+1);	//var rand = 4;	if (filename != "/") {		document.getElementById('careers_ad').src = "../images/ad_careers_" + rand + ".jpg";	} else {		document.getElementById('careers_ad').src = "images/ad_careers_" + rand + ".jpg";	}}function setFastFactQuote() {	var rand = Math.floor(Math.random() * fast_facts_array.length);	document.getElementById('fast_fact_quote').innerHTML = fast_facts_array[rand];		/*var filename = unescape(location.pathname)    //filename = filename.substring(21, filename.lastIndexOf('/'));		if(filename.substring(1,8).toLowerCase() == "gateway") filename = filename.substring(21, filename.lastIndexOf('/'));	else filename = filename.pathname.substring(1, location.pathname.lastIndexOf('/'));	*/	if (filename != "/") {	document.getElementById('fast_fact_link').innerHTML = '<a href=\"../' + fast_facts__link_destination_array[rand] + '\" runat=\"server\" >' + fast_facts__link_array[rand] +'&nbsp;<img src=\"../images/greenArrow.gif\" width=\"5\" height=\"9\" alt=\"green arrow\" /></a>';	} else {		document.getElementById('fast_fact_link').innerHTML = '<a href=\"' + fast_facts__link_destination_array[rand] + '\" runat=\"server\" >' + fast_facts__link_array[rand] +'&nbsp;<img src=\"images/greenArrow.gif\" width=\"5\" height=\"9\" alt=\"green arrow\" /></a>';		}}function setNum(){	old_num = 0;}function faq(num){	//if a section is already open, close it	if (old_num != 0){		document.getElementById("faq_"+old_num).className = "faq_hide";		if (num == old_num) {			old_num = 0;		// if not, open new one		} else {			document.getElementById("faq_"+num).className = "faq_show";			old_num = num;		}				// if no section is open, open it and store it's number	} else {		document.getElementById("faq_"+num).className = "faq_show";		old_num = num;			}}function hide_faq(){	for (n=1;n<=10;n++){		document.getElementById("faq_"+n).className = "faq_hide";	}}function external() {    if (document.getElementsByTagName) {	var a;	a = document.getElementsByTagName('a');	for (i = 0; i<a.length; i++) {        if (a[i].getAttribute('href') && a[i].getAttribute('rel') == 'external'){    		a[i].target = '_blank';    					}		}	 }}function validateForm(a) {    	if(document.all || document.getElementById) {	    var email_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;		var err = new Boolean();		err = false;		        if(a[0].value.replace(/^\s+|\s+$/g, "") == "" || a[0].value == "First Name Required.") {            a[0].value = "First Name Required.";            err = true;        }                if(a[1].value.replace(/^\s+|\s+$/g, "") == "" || a[1].value == "Last Name Required.") {            a[1].value = "Last Name Required.";            err = true;        }                if(a[2].value.length == 0 || a[2].value == "Email Required." || a[2].value == "Invalid Email Address." || a[2].value == "Emails do not match.") {		    a[2].value = "Email Required.";		    a[3].value = "";		    err = true;	    } else if(!email_filter.test(a[2].value)) {		    a[2].value = "Invalid Email Address.";		    a[3].value = "";		    err = true;        } else if(!email_filter.test(a[2].value) || !email_filter.test(a[3].value) || (a[2].value != a[3].value)) {            a[2].value = "Emails do not match.";            a[3].value = "";            err = true;        }				if(err) { window.location.hash = "errorAnchor"; return(false); }		else return(true);	}}function validateCareers(a) {    if(document.getElementById) {        var loc = a[0].value;        var type = a[1].value;                if (loc != "F" && type != "F") return (true);        else {            if(loc == "F") document.getElementById("jobLocationsErr").style.display = "inline";            else document.getElementById("jobLocationsErr").style.display = "none";            if(type == "F") document.getElementById("jobTypesErr").style.display = "inline";            else document.getElementById("jobTypesErr").style.display = "none";            return (false);        }    }}function setActiveStyleSheet(title) {  var i, a, main;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {      if(a.getAttribute("title") == title) a.href = "../styles/gateway_print.css";    }  }}function checkList(questions_num,limit_num) {	var yes_num = 0;	var no_num = 0;	var unchecked_num = 0;	for (i=1; i<=questions_num; i++){		if (document.getElementById("radiobutton_yes_"+i).checked) {			yes_num = yes_num + 1;			}				else if (document.getElementById("radiobutton_no_"+i).checked == false){			unchecked_num = unchecked_num + 1;			} else if (document.getElementById("radiobutton_no_"+i).checked){			no_num = no_num + 1;		}	}	if (unchecked_num>0){		document.getElementById("help_response").className = "show";			document.getElementById("yes_response").className = "hide";		document.getElementById("no_response").className = "hide";		document.getElementById("submit").value = "Re-submit";	} else if (yes_num >=limit_num){		document.getElementById("yes_response").className = "show";		document.getElementById("no_response").className = "hide";		document.getElementById("help_response").className = "hide";		document.getElementById("submit").value = "Re-submit";		document.getElementById("yes_num").innerHTML = yes_num;	} else {		document.getElementById("no_response").className = "show";			document.getElementById("yes_response").className = "hide";		document.getElementById("help_response").className = "hide";		document.getElementById("submit").value = "Re-submit";	}	}function printResults(questions_num){	setActiveStyleSheet("main_stylesheet");	window.print();}function loadFAQ () {	var urlPath = window.location.href;	var qparts = urlPath.split("?");	/*var filename = unescape(location.pathname)    //filename = filename.substring(21, filename.lastIndexOf('/'));		if(filename.substring(1,8).toLowerCase() == "gateway") filename = filename.substring(21, filename.lastIndexOf('/'));	else filename = filename.pathname.substring(1, location.pathname.lastIndexOf('/'));	*/		if(filename == 'research' && qparts[1]) {    	var parts = qparts[1].split("=");    	faq(parts[1]);    		}}