﻿/*
   
   Author: Eric Insko
   Date: January 26, 2011  

   Function List:
   showDate(dateObj)
      Returns the current date in the format mm/dd/yyyy

   showTime(dateObj)
      Returns the current time in the format hh:mm:ss am/pm

   calcDays(currentDate)
      Returns the number of days between the current date and January 1st
      of the next year

*/

function showDate(dateObj) {
   thisDate = dateObj.getDate();
   thisMonth = dateObj.getMonth()+1;
   thisYear = dateObj.getFullYear();
   return thisMonth + "/" + thisDate + "/" + thisYear;
}

function showTime(dateObj) {
   thisSecond=dateObj.getSeconds();
   thisMinute=dateObj.getMinutes();
   thisHour=dateObj.getHours();

   var ampm = (thisHour < 12) ? " a.m." : " p.m.";
   thisHour = (thisHour > 12) ? thisHour - 12 : thisHour;
   thisHour = (thisHour == 0) ? 12 : thisHour;

   thisMinute = thisMinute < 10 ? "0"+thisMinute : thisMinute;
   thisSecond = thisSecond < 10 ? "0"+thisSecond : thisSecond;

   return thisHour + ":" + thisMinute + ":" + thisSecond + ampm;
}

function calcDays(currentDate) {
   // create a date object for April 10 of this year
      newYear = new Date("February 14, 2012");
      nextYear = currentDate.getFullYear();
      newYear.setFullYear(2012);

   // calculate the difference between currentDate and April 10th
      days = (newYear - currentDate)/(1000*60*60*24);

      return days;
}


//#1 SPECIFY number of slideshows
var number_of_slideshows=4

//#2 SPECIFY interval between slide (2000=2 seconds)
var interval=3000

//#3 SHOULD each slide be linked to a unique URL?
var linked=0

var slideshows=new Array(number_of_slideshows)
for (i=0; i <number_of_slideshows; i++)
slideshows[i]=new Array()

slideshows[0][0]='pics/ecoMag.jpg'
slideshows[0][1]='pics/mfcAddress.gif'
slideshows[0][2]='pics/gfcAddress.gif'
slideshows[1][0]='pics/Biotics.bmp'
slideshows[1][1]='pics/footlevelers.jpg'
slideshows[1][2]='pics/posturePump.jpg'
slideshows[2][0]='pics/schiek.jpg'
slideshows[2][1]='pics/standardProcess.jpg'
slideshows[2][2]='pics/Aspa.jpg'
slideshows[3][0]='pics/BioFreeze.jpg'
slideshows[3][1]='pics/BioFreeze.bmp'
slideshows[3][2]='pics/ChinaGel.jpg'

//EXTEND THIS ARRAY if more than 3 slide shows


<!--Remove the below portion if "var linked" above is set to 0-->

var slidelinks=new Array(number_of_slideshows)
for (i=0; i <number_of_slideshows; i++)
slidelinks[i]=new Array()

//#5 SPECIFY urls of 1st slideshow
slidelinks[0][0]='http://mysite.com/car1.htm'
slidelinks[0][1]='http://mysite.com/car2.htm'
slidelinks[0][2]='http://mysite.com/car3.htm'
slidelinks[0][3]='http://mysite.com/house1.htm'
slidelinks[0][4]='http://mysite.com/house2.htm'
slidelinks[1][0]='http://mysite.com/house3.htm'
slidelinks[1][1]='http://mysite.com/boat1.htm'
slidelinks[1][2]='http://mysite.com/boat2.htm'
slidelinks[1][3]='http://mysite.com/boat3.htm'
slidelinks[1][4]='http://mysite.com/boat3.htm'

function clickredir(){
window.location=slidelinks[maininc][subinc]
}

<!-- END removal ---------------------------------->

var maininc=0
var subinc=0

if (linked)
document.write('<a href="javascript:clickredir()"><img src="'+slideshows[0][0]+'" name="multislide" border=0></a>')
else

function slideit(){
subinc= (subinc<slideshows[maininc].length-1)? subinc+1: 0
document.images.multislide.src=slideshows[maininc][subinc]
document.images.multislide1.src=slideshows[maininc + 1][subinc]
document.images.multislide2.src=slideshows[maininc + 2][subinc]
document.images.multislide3.src=slideshows[maininc + 3][subinc]


}

function setslide(which){
clearInterval(runit)
maininc=which
subinc=0
runit=setInterval("slideit()",interval)
}

runit=setInterval("slideit()",interval)


function changeFontSize(inc)
{
var p = document.getElementsByTagName('p');
for(n=0; n<p.length; n++)
{    if(p[n].style.fontSize)
     {
         var size = parseInt(p[n].style.fontSize.replace("px", ""));
     }
     else 
     {
         var size = 16;
     }
     p[n].style.fontSize = size+inc + 'px';
 }
}


function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;
 
      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}


function TimeClock() {
      // the today variable contains the current date and time
         var today = new Date();

      // display the current date and time
         document.clockform.dateNow.value = showDate(today);
         document.clockform.timeNow.value = showTime(today);

      // calculate the time left until the next raffle
         var days = calcDays(today);

         // display days rounded to the next lowest integer
         document.countdown.daysLeft.value = Math.floor(days);

         // calculate the hours left in the current day
         var hours = (days - Math.floor(days))*24;

         // display hours rounded to the next lowest integer
         document.countdown.hrLeft.value = Math.floor(hours);

         // calculates the minutes left in the current hour
         var minutes = (hours - Math.floor(hours))*60;

         // display minutes rounded to the next lowest integer
         document.countdown.minLeft.value = Math.floor(minutes);

         // calculates the seconds left in the current minute
         var seconds = (minutes - Math.floor(minutes))*60;

         // display seconds rounded to the next lowest integer
         document.countdown.secLeft.value = Math.floor(seconds);
      }
      
      
      function CheckPhone(X,Y){
      tn=Y;
      
      ck_phone = /[^0-9]/;
      testValue = ck_phone.test(tn);
      if (testValue==true){
      alert("Text is not allowed in phone numbers.");
      tn="";
      X.focus();
      }
        
      if((Y.length>=1)&&(Y.length<=6)){alert("The number you entered is not long enough to be a valid phone number.");
         tn="";
         X.focus();}
       if(Y.length>=13){alert("The number you entered is too long to be a valid phone number.");
         tn="";
         X.focus();}
        
      if(Y.length==7){tn=Y.slice(0,3)+"-"+Y.slice(3,7);}
      if(Y.length==10){tn="("+Y.slice(0,3)+") "+Y.slice(3,6)+"-"+Y.slice(6,10);}
      if(Y.length==11){tn=Y.slice(0,1)+"-"+Y.slice(1,4)+"-"+Y.slice(4,7)+"-"+Y.slice(7,11);}
      if(Y.length==12){tn="("+Y.slice(0,3)+") "+Y.slice(4,12);}
      X.value=tn;
      
      
      }


function CheckZip(X,Y){
zc=Y;

if((Y.length>=1)&&(Y.length<=4)){alert("The number you entered is not long enough to be a valid zip code.");
   zc="";
   X.focus();}
       
if(Y.length>=11){alert("The number you entered is too long to be a valid zip code.");
   zc="";
   X.focus();}
        
if(Y.length==9){zc=Y.slice(0,5)+"-"+Y.slice(5,9);}
X.value=zc;
}


function CheckFirstName(X,Y){
var name=Y;
ck_name = /\W/;
testValue = ck_name.test(name);
if ((testValue==true)||(name.length == 1 || name.length >= 20)){
alert(name + " does not appear to be a valid first name.");
name="";
X.focus();
X.value=name;}


}

function dbadminalert(){
alert("Any changes made in PHPMyAdmin will not only alter the database, but could alter the functionality of the website. PROCEED WITH CAUTION!!!");
}


function CheckLastName(X,Y){
var name=Y;
ck_name = /\W/;
testValue = ck_name.test(name);
if ((testValue==true)||(name.length == 1 || name.length >= 20)){
alert("The text you entered does not appear to be a valid Last name.");
name="";
X.focus();
X.value=name;}
}

function CheckAge(X,Y){
var age=Y;
ck_age = /[1-9][0-9]/;
testValue = ck_age.test(age);
if (age >= 1 && age <= 17){
alert("You must Be 18 or older to fill out the registration form.");
age="";
X.focus();}
if (age > 110){
alert( age + " is too high to be a valid age.");
age="";
X.focus();}
if ((testValue==false) && (age != "")){
alert(age + " does not appear to be a valid age.");
age="";
X.focus();
X.value=age;}
}


function CheckAddress(X,Y){
var address=Y;
ck_address = /[^0-9a-zA-Z ,.]/;
testValue = ck_address.test(address);
if (((testValue==true)||(address.length < 2) || (address.length > 40)) && (address != "")){
alert("The text you entered does not appear to be a valid address.");
address="";
X.focus();
X.value=address;}
}

function CheckState(X,Y){
var state=Y;
ck_state = /[^a-zA-Z ]/;
testValue = ck_state.test(state);
if (((testValue==true)||(state.length < 2) || (state.length > 2)) && (state != "")){
alert("The text you entered does not appear to be a valid state.");
state="";
X.focus();
X.value=state;}
}

function CheckPic(X,Y){
var state=Y;
ck_state = /[^a-zA-Z ]/;
testValue = ck_state.test(state);
if (((testValue==true)||(state.length < 2) || (state.length > 2)) && (state != "")){
alert("The text you entered does not appear to be a valid state.");
state="";
X.focus();
X.value=state;}
}

function CheckCity(X,Y){
var city=Y;
ck_city = /[^a-zA-Z ]/;
testValue = ck_city.test(city);
if (((testValue==true)||(city.length < 2) || (city.length > 40)) && (city != "")){
alert("The text you entered does not appear to be a valid city.");
city="";
X.focus();
X.value=state;}
}

function CheckEmployment(X,Y){
var job=Y;
ck_job = /[^0-9a-zA-Z ,.]/;
testValue = ck_job.test(job);
if (((testValue==true)||(job.length < 2) || (job.length > 40)) && (job != "")){
alert("The text you entered does not appear to be a valid place of employment.");
job="";
X.focus();
X.value=job;}
}

function CheckComment(X,Y){
var comment=Y;
ck_comment = /[^0-9a-zA-Z ,.]/;
testValue = ck_comment.test(comment);
if (((testValue==true)||(comment.length < 2) || (comment.length > 40)) && (comment != "")){
alert("The text you entered does not appear to be a valid comment.");
comment="";
X.focus();
X.value=comment;}
}

function validateRaffle()
{
    valid = true;
    
    if (document.forms[0].First_Name.value == "" )
    {
        alert ( "Please fill in your first name." );
        document.forms[0].First_Name.focus();
        return false;
    }
    
    if (document.forms[0].Last_Name.value == "" )
        {
            alert ( "Please fill in your last name." );
            document.forms[0].Last_Name.focus();
            return false;
    }
    
    if (document.forms[0].Age.value == "" )
        {
            alert ( "Please fill in your age." );
            document.forms[0].Age.focus();
            return false;
    }
    
    if (document.forms[0].Address.value == "" )
        {
            alert ( "Please fill in your address." );
            document.forms[0].Address.focus();
            return false;
    }
    
    if (document.forms[0].City.value == "" )
        {
            alert ( "Please fill in your city." );
            document.forms[0].City.focus();
            return false;
    }
    
    if (document.forms[0].State.value == "" )
        {
            alert ( "Please fill in your state." );
            document.forms[0].State.focus();
            return false;
    }
    
    if (document.forms[0].Zip.value == "" )
        {
            alert ( "Please fill in your zip code." );
            document.forms[0].Zip.focus();
            return false;
    }
    
    if (document.forms[0].Contact_Number.value == "" )
        {
            alert ( "Please fill in your phone number." );
            document.forms[0].Contact_Number.focus();
            return false;
    }
    
    if (document.forms[0].Employment.value == "" )
        {
            alert ( "Please fill in the something for your place of employment." );
            document.forms[0].Employment.focus();
            return false;
    }

    return valid;
}


 function clearForm()
{
var agree=confirm("Are you sure you want to clear the form?");
if (agree)
	return true ;
else
	return false ;
}
  
 function validateRequest()
{
    valid = true;
    
    if (document.forms[0].First_Name.value == "" )
    {
        alert ( "Please fill in your first name." );
        document.forms[0].First_Name.focus();
        return false;
    }
    
    if (document.forms[0].Last_Name.value == "" )
        {
            alert ( "Please fill in your last name." );
            document.forms[0].Last_Name.focus();
            return false;
    }
    
    
    
    if (document.forms[0].Contact_Number.value == "" )
        {
            alert ( "Please fill in your phone number." );
            document.forms[0].Contact_Number.focus();
            return false;
    }
    
    
    return valid;
    
}


function popUp(apptID){

var popurl="person.php"

winpops=window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=600");
winpops.document.write("<form name='myform' action='person.php' method='post'>");
winpops.document.write("<input type='hidden' name='id' value='"+ apptID +"'>");
winpops.document.write("</form>");
winpops.document.forms.myform.submit();
}



function DateTime(X,Y){
      doot=Y;
      
      doot=Y.slice(8,10)+"-"+Y.slice(5,7)+"-"+Y.slice(0,4);
      return doot;
      X.value=doot;
      
      }
 
   
function ChangeText(choice,name,clinic){
names=("'" + name + "'");
clinics=("'" + clinic + "'");
if(choice=="Answered"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hi, this is ________ from ' + clinic + ' Family Chiropractic. Is ' + name + ' available?</h3><br><input type="button" name="yes1" value="Yes" onclick="ChangeText(this.name,' + names  + ',' + clinics + ')" ><input type="button" name="no1" value="No" onclick="ChangeText(this.name,' + names  + ',' + clinics + ')" >';
} else if(choice=="No Answer or busy"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
} else if(choice=="Voicemail"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Leave a message, then choose a date and time to call them back and enter it below.</h3>';
} else if(choice=="Disconnected or wrong number"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
} else if(choice=="yes1"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">I am glad you scheduled when you did, all our new patient openings are closing fast!</h3><h3 class="highlight2">I have an opening at __________ can you make that?</h3><br><input type="button" name="yes2" value="Yes" onclick="ChangeText(this.name,' + names  + ',' + clinics + ')" ><input type="button" name="no2" value="No" onclick="ChangeText(this.name,' + names  + ',' + clinics + ')" >';
} else if(choice=="no1"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">When would be a good time to speak with ' + name + '?</h3>';
} else if(choice=="yes2"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Who can we thank for referring you to our office?</h3><h3 class="highlight3">enter the referral below</h3>';
} else if(choice=="no2"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">What day is best for you, and do you prefer mornings or afternoons? I will see where I can squeeze you in.</h3><h3 class="highlight3">After you set up an appointment date and time ask....</h3><h3 class="highlight2">"Who can we thank for referring you to our office?"</h3><h3 class="highlight3">then enter the referral below</h3>';
}
}



function showlines(num,passform)
{ 
	alert(num + "-" + passform)
}


function establishDay(dayofWeek){
     alert("The day of the week is " + dayofWeek);
     }
     
     
     
     

  function ChangePost(choice){

if(choice=="Scheduled an appointment"){
document.form1.status.value = "closed";
} else if(choice=="cancelled"){
document.form1.status.value = "closed";
} else if(choice=="Setup a callback"){
document.form1.status.value = "open";
} else if(choice=="Left a message"){
document.form1.status.value = "open";
}
}

function popUp2(apptID){

var popurl="ticket.php"

winpops=window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=600");
winpops.document.write("<form name='myform' action='ticket.php' method='post'>");
winpops.document.write("<input type='hidden' name='id' value='"+ apptID +"'>");
winpops.document.write("</form>");
winpops.document.forms.myform.submit();
}


function ChangeText2(choice,name,clinic){
names=("'" + name + "'");
clinics=("'" + clinic + "'");
if(choice=="Answered"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hello, This is ______ calling on behalf of ' + clinic + ' Family Chiropractic. May I speak with ' + name + '?</h3><br><input type="button" name="yes1" value="Yes" onclick="ChangeText2(this.name,' + names  + ',' + clinics + ')" ><input type="button" name="no1" value="No" onclick="ChangeText2(this.name,' + names  + ',' + clinics + ')" >';
} else if(choice=="No Answer or busy"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
} else if(choice=="Voicemail"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Leave a message, then choose a date and time to call them back and enter it below.</h3>';
} else if(choice=="Disconnected or wrong number"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
} else if(choice=="yes1"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">I am calling to confirm your eligibility and telephone number for the _____ Raffle you entered.</h3><h3 class="highlight2">Is this the best time and number to contact you?</h3><br><input type="button" name="yes2" value="Yes" onclick="ChangeText2(this.name,' + names  + ',' + clinics + ')" ><input type="button" name="no2" value="No" onclick="ChangeText2(this.name,' + names  + ',' + clinics + ')" >';
} else if(choice=="no1"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">When would be a good time to speak with ' + name + '?</h3>';
} else if(choice=="yes2"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Great. You are still eligible to win the _____ in the Raffle that will be held on ______. In the meantime, we have pulled out a handful of entries to receive our Free Health Pass and your name was one of them that was chosen. This Health Pass is good for you and a friend or family member and is valued at $130.00 in services from our office that include a Free Consultation, Free Examination, 2 Free X-Rays if needed and a Free 15-minute treatment on our Hydro Massage Table. FEDERAL MEDICARE AND MEDICAID REGULATIONS APPLY.</h3><h3 class="highlight2">We are open Monday through Saturday and even offer late hours on Tuesdays and Thursdays. When would be a good day for you to schedule an appointment and use this Free Health Pass?</h3><h3 class="highlight3">Enter the date and time below, then check to see if they need directions.</h3>';
} else if(choice=="no2"){
document.getElementById('callscript').innerHTML ='<h3 class="highlight2">What is the best time or number to contact you?</h3><h3 class="highlight3">After you get their contact information say</h3><h3 class="highlight2">"Who can we thank for referring you to our office?"</h3><h3 class="highlight3">then enter the referral below</h3>';
}
}



function popUp3(){

var popurl="locations.php"

window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=300");

}

function popUp4(){

var popurl="addMarquee.php"

window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=1000,height=200");

}

function popUp5(){

var popurl="addWinner.php"

window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=300");

}


function deleteEntry()
{
var agree=confirm("Are you sure you want to delete the selected entries?");
if (agree)
	return true ;
else
	return false ;
}
   
   
 function popUp6(){

var popurl="addEntry.php"

window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=700,height=600");

}


function popUp7(){

var popurl="addScreening.php"

window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=500");

} 


function popUp8(){

var popurl="addEvent.php"

window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=575,height=400");

}  




function popUp9(apptID){

var popurl="screen.php";

winpops=window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=700");
winpops.document.write("<form name='myform' action='screen.php' method='post'>");
winpops.document.write("<input type='hidden' name='id' value='"+ apptID +"'><input type='hidden' name='appset' value='yes'><input type='hidden' name='datepassed' value='yes'>");
winpops.document.write("</form>");
winpops.document.forms.myform.submit();
} 
document.getElementById('callscript5').innerHTML ='';
 

function popUp10(){

var popurl="anevent.php"

window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=575,height=400");

} 

function ChangeText3(choice,ptname,clinic,appset,apptime,appday,passed,event){
names=("'" + ptname + "'");
clinics=("'" + clinic + "'");
appsets=("'" + appset + "'");
apptimes=("'" + apptime + "'");
appdays=("'" + appday + "'");
passeds=("'" + passed + "'");
events=("'" + event + "'");

if(clinic=="Maysville"){
   directions=("We are located across from the Mason County High School next to Arby's.");
   phnumber=("(606)564-4213");
} else{
   directions=("We are located at 100 Eastside Drive. Across from Southern States.");
   phnumber=("(502)868-0097");
}
if((appset=="yes")&&(passed=="yes")){
   if(choice=="yes2"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Great, enter the appointment date and time below.</h3><br>';
   document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="yes"/>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="reminder"/>';
   } else if(choice=="no2"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Give them a call to try to schedule another appointment</h3>';
   document.getElementById('callscript5').innerHTML ='<label for="When_Called">When I called:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">Disconnected or wrong number</option><option value="No Answer or busy">No answer or busy</option><option value="Voicemail">Voicemail</option><option value="Answered1">Someone Answered</option></select><br />';
  } else if(choice=="yes1"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Great, Did ' + ptname + ' schedule another appointment?</h3><br><input type="button" name="yes2" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no2" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   document.getElementById('callscript1').innerHTML ='<input type="hidden" id="apptmade" name="apptmade" value="add"/>';
   } else if(choice=="no1"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Did ' + ptname + ' reschedule the appointment?</h3><br><input type="button" name="yes3" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no3" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   } else if(choice=="first"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Did ' + ptname + ' show up for the appointment on '+ appday +'?</h3><br><input type="button" name="yes1" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no1" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   document.getElementById('callscript1').innerHTML ='<input type="hidden" id="apptmade" name="apptmade" value="nochange"/>';
   document.getElementById('callscript2').innerHTML ='<input type="hidden" id="apptmissed" name="apptmissed" value="nochange"/>';
   document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="nochange"/>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="nochange"/>';
   document.getElementById('callscript5').innerHTML ='<input type="hidden" id="When_Called" name="When_Called" value="notused"/>';
  } else if(choice=="Answered1"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hello, This is ______ with ' + clinic + ' Family Chiropractic. Is ' + ptname + ' available?</h3><br><input type="button" name="yes4" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no4" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   } else if(choice=="Answered2"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hi, This is ______ with ' + clinic + ' Family Chiropractic. Is ' + ptname + ' available?</h3><br><input type="button" name="yes5" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no5" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   } else if(choice=="No Answer or busy"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
   document.getElementById('callscript1').innerHTML ='<input type="hidden" id="apptmade" name="apptmade" value="nochange"/>';
   document.getElementById('callscript2').innerHTML ='<input type="hidden" id="apptmissed" name="apptmissed" value="nochange"/>';
   document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="nochange"/>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="nochange"/>';
   } else if(choice=="Voicemail"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Leave a message, then choose a date and time to call them back and enter it below.</h3>';
   } else if(choice=="Disconnected or wrong number"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
   } else if(choice=="yes3"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Great, enter the appointment date and time below so we know when to give them a reminder call.</h3>';
   document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="yes"/>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="reminder"/>';
   } else if(choice=="no3"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Give them a call to try to schedule another appointment</h3>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="apptmissed" name="apptmissed" value="add"/>';
   document.getElementById('callscript5').innerHTML ='<label for="When_Called">When I called:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">Disconnected or wrong number</option><option value="No Answer or busy">No answer or busy</option><option value="Voicemail">Voicemail</option><option value="Answered2">Someone Answered</option></select><br />';
  } else if(choice=="yes4"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hi ' + ptname + ', we noticed you have not scheduled your next appointment. Would you like to do that now?</h3><br><input type="button" name="yes6" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no6" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   } else if(choice=="no4"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">When would be a good time to reach ' + ptname + '?</h3><br><h3 class="highlight3">Enter the best callback time below then say</h3><br><h3 class="highlight2">Thank you and have a wonderful day.</h3>';
   document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="no"/>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="schedule"/>';
   } else if(choice=="yes5"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight"2">Hi ' + ptname + ', we noticed you had missed your appointment on ' + appday + ', would you like for me to put you down for the same time tommorrow?</h3><br><input type="button" name="yes6" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no6" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   } else if(choice=="no5"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">When would be a good time to reach ' + ptname + '?</h3><br><h3 class="highlight3">Enter the best callback time below then say</h3><br><h3 class="highlight2">Thank you and have a wonderful day.</h3>';
   } else if(choice=="yes6"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Great, we will see you tommorrow at ' + apptime + '.</h3>';
   document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="yes"/>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="reminder"/>';
   } else if(choice=="no6"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">What day and time would be best for you?</h3><br><h3 class="highlight3">Select the appropriate End Result at the bottom. If you plan on doing a callback, enter the callback date and time.</h3>';
   } else if(choice=="noaction"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">' + ptname + ' does not need to be called for anything at this time.</h3><h3 class="highlight3">Has something changed?</h3><label for="When_Called">Make changes:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">They are no longer interested</option><option value="No Answer or busy">They want to reschedule the appointment</option><option value="No Answer or busy">cancelled the appointment, but are still interested</option><option value="Answered">Someone Answered</option></select>';
   document.getElementById('callscript5').innerHTML ='<label for="When_Called">Make changes:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">They are no longer interested</option><option value="No Answer or busy">They want to reschedule the appointment</option><option value="No Answer or busy">cancelled the appointment, but are still interested</option><option value="Answered">Someone Answered</option></select>';
 }
}
else if((appset=="yes")&&(passed=="no")){
   if(choice=="Answered"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hi, This is ______ with ' + clinic + ' Family Chiropractic. Is ' + ptname + ' available?</h3><br><input type="button" name="yes1" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no1" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   } else if(choice=="No Answer or busy"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
   } else if(choice=="Voicemail"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Leave this message.</h3><h3 class="highlight2">Hi ' + ptname + ', this is ______ with ' + clinic + ' Family Chiropractic. We just wanted to call you and remind you of your appointment on ' + appday + ' at ' + apptime + '. Our phone number is ' + phnumber + '. Thank you and have a wonderful day.</h3><br><h3 class="highlight3">Choose a date and time to call them back and enter it below.</h3>';
   } else if(choice=="Disconnected or wrong number"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
   } else if(choice=="yes1"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hi ' + ptname + ', we just wanted to call you and remind you of your appointment on ' + appday + ' at ' + apptime + '.</h3><h3 class="highlight2">Do you know where we are located?</h3><br><input type="button" name="yes2" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no2" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
   } else if(choice=="no1"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">When would be a good time to reach ' + ptname + '?</h3><br><h3 class="highlight3">Enter the best calback time below then say</h3><br><h3 class="highlight2">Thank you and have a wonderful day.</h3>';
   } else if(choice=="yes2"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Great, we will see you then.</h3>';
   } else if(choice=="no2"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight2">'+ directions +'</h3>';
   } else if(choice=="first"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Give ' + ptname + '  a call to remind them of their appointment</h3><label for="When_Called">When I called:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">Disconnected or wrong number</option><option value="No Answer or busy">No answer or busy</option><option value="Voicemail">Voicemail</option><option value="Answered">Someone Answered</option></select><br />';
   document.getElementById('callscript1').innerHTML ='<input type="hidden" id="apptmade" name="apptmade" value="nochange"/>';
   document.getElementById('callscript2').innerHTML ='<input type="hidden" id="apptmissed" name="apptmissed" value="nochange"/>';
   document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="nochange"/>';
   document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="nochange"/>';
   } else if(choice=="first2"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
   } else if(choice=="noaction"){
   document.getElementById('callscript').innerHTML ='<h3 class="highlight3">' + ptname + ' does not need to be called for anything at this time.</h3><h3 class="highlight3">Has something changed?</h3><label for="When_Called">Make changes:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">They are no longer interested</option><option value="No Answer or busy">They want to reschedule the appointment</option><option value="No Answer or busy">cancelled the appointment, but are still interested</option><option value="Answered">Someone Answered</option></select>';
   }
}
else{
   if(choice=="Answered"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hi, This is ______ with ' + clinic + ' Family Chiropractic. Is ' + ptname + ' available?</h3><br><input type="button" name="yes1" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no1" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
      } else if(choice=="No Answer or busy"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
      } else if(choice=="Voicemail"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Leave this message.</h3><h3 class="highlight2">Hi ' + ptname + ', this is _______ with ' + clinic + ' Family Chiropractic. We screened you at ' + event + '. We just wanted to call you and let you know that you are still eligible for your free exam, 2 free x-rays, and free consultation, a $130.00 value. Please call us to schedule your free appointment. Our phone number is ' + phnumber + '. Thank you and have a wonderful day.</h3><h3 class="highlight3">Choose a date and time to call them back and enter it below.</h3>';
      } else if(choice=="Disconnected or wrong number"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Choose a date and time to call them back and enter it below</h3>';
      } else if(choice=="yes1"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Hi ' + ptname + ', You had stopped by our screening booth at ' + event + ' and we wanted to follow up with you and see when you would like to use your ambassador pass.</h3><br><h3 class="highlight2">Remember, you get two free x-rays, a free 15 minute aqua massage, and a free exam and consultation which is good for you and a friend or family member. You just have to let me know who you would like to bring with you and the best day and time for you guys to come in.</h3><br><h3 class="highlight3">Suggest a day and time. (ie How about Wednesday at 10:30?)</h3><br><input type="button" name="yes2" value="Appointment was made" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no2" value="No appointment made" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
      } else if(choice=="no1"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight2">When would be a good time to reach ' + ptname + '?</h3><br><h3 class="highlight3">Enter the best calback time below then say</h3><br><h3 class="highlight2">Thank you and have a wonderful day.</h3>';
      } else if(choice=="no3"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight2">Great, we will see you then.</h3>';
      } else if(choice=="yes3"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight2">'+ directions +'</h3>';
      } else if(choice=="first"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Give ' + ptname + '  a call to try and schedule an appointment</h3><label for="When_Called">When I called:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">Disconnected or wrong number</option><option value="No Answer or busy">No answer or busy</option><option value="Voicemail">Voicemail</option><option value="Answered">Someone Answered</option></select><br />';
      document.getElementById('callscript1').innerHTML ='<input type="hidden" id="apptmade" name="apptmade" value="nochange"/>';
      document.getElementById('callscript2').innerHTML ='<input type="hidden" id="apptmissed" name="apptmissed" value="nochange"/>';
      document.getElementById('callscript3').innerHTML ='<input type="hidden" id="apptset" name="apptset" value="nochange"/>';
      document.getElementById('callscript4').innerHTML ='<input type="hidden" id="action" name="action" value="nochange"/>';
      } else if(choice=="yes2"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight3">Do you need directions?</h3><br><input type="button" name="yes3" value="Yes" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><input type="button" name="no3" value="No" onclick="ChangeText3(this.name,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" >';
      } else if(choice=="noaction"){
      document.getElementById('callscript').innerHTML ='<h3 class="highlight3">' + ptname + ' does not need to be called for anything at this time.</h3><h3 class="highlight3">Has something changed?</h3><label for="When_Called">Make changes:</label><select id="When_Called" name="When_Called" onblur="ChangeText3(this.value,' + names  + ',' + clinics + ',' + appsets + ',' + apptimes + ',' + appdays + ',' + passeds + ',' + events + ')" ><option value="Disconnected or wrong number">They are no longer interested</option><option value="No Answer or busy">They want to reschedule the appointment</option><option value="No Answer or busy">cancelled the appointment, but are still interested</option><option value="Answered">Someone Answered</option></select>';
      }
   }
}


function popUp11(apptID){

var popurl="screen.php";

winpops=window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=700");
winpops.document.write("<form name='myform' action='screen.php' method='post'>");
winpops.document.write("<input type='hidden' name='id' value='"+ apptID +"'><input type='hidden' name='appset' value='yes'><input type='hidden' name='datepassed' value='no'>");
winpops.document.write("</form>");
winpops.document.forms.myform.submit();
} 

function popUp12(apptID){

var popurl="screen.php";

winpops=window.open(popurl,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=700");
winpops.document.write("<form name='myform' action='screen.php' method='post'>");
winpops.document.write("<input type='hidden' name='id' value='"+ apptID +"'><input type='hidden' name='appset' value='no'><input type='hidden' name='datepassed' value='no'>");
winpops.document.write("</form>");
winpops.document.forms.myform.submit();
}
