function lTrim(x) {while(x.charAt(0)==" ") x=x.substring(1,x.length) return x} function rTrim(x) {while(x.charAt(x.length-1)==" ") x=x.substring(0,x.length-1) return x} function allTrim(x) {x = rTrim(lTrim(x)) return x} function isDate(dateStr) { var strDate = allTrim(dateStr) if (strDate.length < 6) { return false } var dateArray = strDate.split("/") for (var j = 0; j < dateArray.length; j++) { if (!isDigit(dateArray[j])) { return false } if (j == 0) { if (dateArray[j] < 1 || dateArray[j] > 12) { return false } } if (j == 1) { if (dateArray[0] == 4 || dateArray[0] == 6 || dateArray[0] == 9 || dateArray[0] == 11) { if (dateArray[j] < 1 || dateArray[j] > 30) { return false } } else if (dateArray[0] == 2) { if (dateArray[j] < 1 || dateArray[j] > 29) { return false } } else { if (dateArray[j] < 1 || dateArray[j] > 31) { return false } } } } return true } function isDigit(digitStr) { var dg = allTrim(digitStr) if (dg.length == 0) { return false } else { for (var i=0; i < dg.length; i++) { var digit = dg.charAt(i) if (digit < "0" || digit > "9") { if (digit == "," || digit == "$" || digit == "-" || digit == "." || digit == "(" || digit == ")") { } else { return false } } } return true } } function javSubmit() { if (document.frmPlug.Contact_First_Name.value.length == 0) { alert("First name required.") document.frmPlug.Contact_First_Name.focus() return } if (document.frmPlug.PRI_PHONE.value.length == 0) { alert("Phone required.") document.frmPlug.PRI_PHONE.focus() return } if (document.frmPlug.Internet_Address.value.length == 0) { alert("Email required.") document.frmPlug.Internet_Address.focus() return } if (document.frmPlug.Internet_Address.value.length > 0) { var iem=false,gotAt=0,posAt=0,gotPeriod=0,posPeriod=0,Email=document.frmPlug.Internet_Address.value for (i = 0; i < Email.length; i++) { ltr = Email.charAt(i); if (ltr=="@") { gotAt = gotAt + 1 posAt = i } if (ltr==".") { gotPeriod = gotPeriod + 1 posPeriod = i } } if (gotAt != 1) {iem = true} if (gotPeriod == 0) {iem = true} if (posAt >= posPeriod) {iem = true} if (posAt <= 0) {iem = true} posAt = posAt + 1 if (posAt == posPeriod || Email.charAt(posAt)==".") {iem = true} posAt = Email.length - 2 if (posAt <= posPeriod) {iem = true} if (Email.indexOf("\\") > -1) {iem = true} if (Email.indexOf("/") > -1) {iem = true} if (iem == true) { alert("You have entered an invalid email address.") document.frmPlug.Internet_Address.select() return } } if (document.frmPlug.Q1970.value.length > 4000) { alert("Comment is limited to 4,000 characters for this question:\r\nList any Drug Rehab Program(s) Previously Attended:") document.frmPlug.Q1970.focus() return } if (document.frmPlug.Q1972.value.length > 4000) { alert("Comment is limited to 4,000 characters for this question:\r\nAdditional Info:") document.frmPlug.Q1972.focus() return } document.frmPlug.submit() } function javSpelling() { if (document.frmPlug.CheckSpelling.value=="T") { document.frmPlug.CheckSpelling.value="F" document.images.Spell.src = "button_spellOFF.gif" document.images.Spell.alt = "Click to turn ON" } else { document.frmPlug.CheckSpelling.value="T" document.images.Spell.src = "button_spellON.gif" document.images.Spell.alt = "Click to turn OFF" } } function javChange() { document.frmPlug.Changed.value = "T" } function javSetDate() { var today = new Date() thisYear = today.getYear() thisMinute = today.getMinutes() thisTime = today.getTime() if (thisYear < 100) { thisYear = "19" + thisYear } if ((thisYear >= 100) && (thisYear < 1000)) { thisYear = parseInt(thisYear) + 1900 thisYear = thisYear.toString() } if (thisMinute < 10) { thisMinute = "0" + thisMinute } document.frmPlug.LocalDate.value = (today.getMonth() + 1) + "/" + today.getDate() + "/" + thisYear + " " + today.getHours() + ":" + thisMinute } function javUpload() { window.open("http://www.crmtool.net/cf_AttachFile.asp?cid=6476&FormID=157&RECDNO=241310","up1","top=50,left=50,width=500,height=500,menubar=no,scrollbars=yes,resizable=yes") } function javDate(fld) { var now_month; var now_day; var now_year; var now_daytime; var now_datetime; now_datetime = new Date(); now_month = now_datetime.getMonth() + 1; now_day = now_datetime.getDate(); now_year = now_datetime.getYear(); if (now_year < 100) { now_year = '19' + now_year; } if ((now_year >= 100) && (now_year < 1000)) { now_year = parseInt(now_year) + 1900; now_year = now_year.toString(); } LocalDate = now_month + '/' + now_day + '/' + now_year; window.open("dlgDate.asp?DateSetting=1&fld=" + fld + "&LocalDate=" + LocalDate,"dlgDate","resizable=yes,scrollbars=no,statusbar=no,top=300,left=300,width=270,height=190") } function showForm(){ var formHTML = "
 
Fields marked in red are required.
Your First Name:
Your Last Name:
State/Province:
Phone
(Best number to reach you):
  
2nd Phone #:  
Email:
Addict's first name
(If you are seeking help for someone else):


 1.  Your relationship to Addict:
 
 2.  Is the Addict seeking Help?
 YesNo
 3.  Drug(s) of Choice
(Fill out to the best of your knowledge as some drugs DO require a detox):
 Alcohol
 Marijuana
 Cocaine
 Crack
 Heroin
 Opiates (Oxycotin, Vicodin)
 Methadone
 Crystal Methamphetamine
 Prescription Pills (Xanax, Valium, Klonipin)
 Psychiatric Medication
 Other Unlisted Drugs
 4.  List any Drug Rehab Program(s) Previously Attended:
 
 5.  Type of Insurance:
 
 6.  Additional Info:
 
 
 
" if(!formShown){ document.writeln(formHTML); } formShown=true; } var formShown = false; showForm();