Edit on
<div data-role="page" id="edd-calculator-page">

  <!--Set the header text-->
  <div data-role="header" id="block">
    <h1>EDD Calculator</h1>
  </div>

  <div role="main" class="ui-content">
    <!--Set the text to insruct the user on what to do. The header id is used when updating the text to display the edd-->
    <p>Use this calculator to estimate the expected delivery date for a pregnant woman.</p>
    <h2 id='EDD_Date'><span>When was the first day of her last period?</span></h2>

    <!--Built in calendar display using jquery mobile. The various data-options can be used to change the look and feel of the
				calendar and limit the dates to certain criteria. Fiddle around to design a calendar you like.-->
    <div>
      <input type="text" id="EDD-input" data-role="datebox" data-theme="d" data-options='{"mode":"calbox", "overrideDateFormat":"%Y-%m-%d", "overrideHeaderFormat": "%A, %-d %B, %Y", "overrideDateFieldOrder":["d","m","y"], "useHeader":false, "useInline": true, "hideInput": true, "themeDateToday": "d", "themeDate": "a", "beforeToday": true}'
      />
    </div>
  </div>

  <!--Set the footer content. Pressing the calculate button calls the CalculateEDD() with the onclick method. This is 
			a javascript function used to determine the EDD.-->
  <div data-role="footer" id="block">
    <a href='' data-role='button' id="calcID" onclick="CalculateEDD('EDD-input')">Calculate  </a>
  </div>
</div>


<!--Page1-->
<div data-role="page" id="firstTrimester">
  <!--This is where the information for the first trimester appears-->
  <div data-role="header" id="block">
    <h1>First Trimester</h1>
  </div>

  <div role="main" class="ui-content">

    <img src="https://www.uihealthcare.org/uploadedImages/UIHealthcare/Content/Campaigns/Pregnancy_Central/doc-and-pregnant-woman.jpg">
    <p>Hi there your patient is in the first trimester which is the first stages of the pregnancy. During this week they may feel nauseous. avoid foods with too much fat and spices. Eat dry bread or a dry biscuit when you wake up. you should take iron and
      folate pills and make sure to eat fresh foods.
      <br></br>
      <h3>Changes to happen to your baby</h3>During this trimester the head develops,the eyes are visible,toes form and fingernails develop.
    </p>
    <button onclick="myFunction()">DEPPRESION TEST</button>

  </div>
</div>


<!--page2-->
<div data-role="page" id="secondTrimester">

  <div data-role="header" id="block">
    <h1>Second Trimester</h1>
  </div>

  <div role="main" class="ui-content">

    <img src="http://www.austinpug.org/wp-content/uploads/2013/08/pregnant_woman_on_bench.jpg">
    <p>Have your blood pressure tested at a clinic – high blood pressure is dangerous. You will feel your baby move and kick inside you. Drink milk or maas every day.</p>

    <h3>Changes to occur to your baby</h3>
    <p>gender apparent, skeleton develops bones, baby can make sucking motion, fat accumulates, baby begins to hear baby can swallow, hair becomes visible, fingerprints and footprints form,responds to the mothers voice, lungs develop.
    </p>
    <button onclick="myFunction()">DEPPRESION TEST</button>

  </div>
</div>


<!--page3-->
<div data-role="page" id="thirdTrimester">

  <div data-role="header" id="block">
    <h1>Third Trimester</h1>
  </div>

  <div role="main" class="ui-content">


    <img src="http://www.weightmove.co.uk/wp-content/uploads/2015/08/2-Healthy-Recipes-For-Pregnant-Women-in-First-Trimester.jpg">
    <p> Your body is preparing to give birth-you may get practice contractions. Get the things you will need for the birth put them in a bag so you can go to the Hospital when labour starts
    </p>
    <h3>Changes to happen to your baby</h3>
    <p>Baby's eyes open, baby's bones are fully developed, nervous system development cntinues, baby practices breathing, baby detects light, rapid weight gain, develops a firm grasp, due date arrives.</p>
    <button onclick="myFunction()">DEPRESSION TEST</button>

  </div>
</div>

<!--page3-->
<div data-role="page" id="depression">


  <h3>Depression during pregnancy</h3>
  <img src="http://static.psychguides.com/wp-content/uploads/depressed-pregnant-woman-300x200.jpg">

  <p> Depression is an illness that involves the body, mood, and thoughts and that affects the way a person eats, sleeps, feels about himself or herself, and thinks about things. Although many people consider pregnancy a time of happiness, about 37%-42% of
    moms-to-be struggle with symptoms of depression.
    <br></br>
    <h4>What Causes Depression During Pregnancy?</h4>
    There are several causes of depression during pregnancy:
    <br></br>

    Having a history of depression or PMDD (premenstrual dysphoric disorder, a severe type of PMS) Age at time of pregnancy; the younger you are, the higher the risk. Living alone or having limited familial support Limited social support Marital conflict
    or domestic violence Uncertainty about the pregnancy
    <br></br>
    <h4>How Can Depression Affect My Pregnancy?</h4> It can interfere with a woman's ability to care for herself during her pregnancy. You may be less able to follow medical recommendations, as well as sleep and eat properly. The condition can also put you at risk for greater use of tobacco, alcohol,
    and illegal drugs that can harm you and your developing baby. Depression may interfere with your ability to bond with your growing baby, too.
    <br></br>How Does Pregnancy Affect Depression? Pregnancy stresses can contribute to depression or to the return or worsening of depression symptoms. Depression during pregnancy can place you at greater risk for having an episode of depression after delivery
    (postpartum depression).
  </p>
  <br></br>

  <button onclick="myFunction1()">CHECK ESTIMATED DUE DATE</button>

</div>
body {
  text-align: center;
}

.ui-header .ui-title {
  white-space: normal;
  margin: 0.6em 10% 0.8em !important;
}

.ui-footer .ui-btn {
  overflow: visible !important;
  white-space: normal !important;
  padding: 12px;
  font-size: 14px;
}

.ui-datebox-inline,
.ui-datebox-inlineblind,
.ui-datebox-container {
  border: 40px ;
}

img {
  text-align : center;
  width : 200px;
  length : 200px;  
}


.ui-datebox-container {
  -webkit-box-shadow: none !important;
  box-shadow: none !important;
  width: 100% !important;
  background-color: pink;
}  

.ui-field-contain {
  border: 500px;
}


      // This function takes an input date, defined by the name property and calculates the EDD
      // using the moment.js library. The EDD is calculated by adding 280 days to the input date
      // and the format is changed to be more reader-friendly.
      // Finally, the text of the header is then updated to display on screen.

 //     function CalculateEDD(name)       // This function takes an input date, defined by the name property and calculates the EDD
      // using the moment.js library. The EDD is calculated by adding 280 days to the input date
      // and the format is changed to be more reader-friendly.
      // Finally, the text of the header is then updated to display on screen.

function myFunction1(){
  $(":mobile-pagecontainer" ).pagecontainer( "change", "#edd-calculator-page");
}


function myFunction(){
      
  // this prompt and alert and it asks the nurse question which the nurse will ask the patient to check whether they are depressed or not    
      var one = prompt("I have been able to laugh and see the funny side of things: \n\n0.As much as I always could  \n1.Not quite so much now  \n2.Definitely not so much now \n3.Not at all \n");
  one = parseInt(one);
  if(one>3 || one<0){
    alert("you made a mistake");
    one =-1;
    //return;
  }
  
      
      var two= prompt("I have looked forward with enjoyment to things: \n\n0.As much as I ever did  \n1.A little less than I used to  \n2.Much less than I used to \n3.Hardly at all \n");
  two = parseInt(two); 
  if(two>3 || two<0){
    alert("you made a mistake");
    two=-1;
  }
      
       var three = prompt("I have blamed myself when things went wrong, and it wasn't my fault: \n\n0.Yes, most of the time  \n1.Yes, some of the time  \n2.Not very much \n3.No, never \n");
      three = parseInt(three);
     if(three>3 || three<0){
alert("you made a mistake");
       three = -1;
}
      var four = prompt("I have been worried and I don't know why: \n\n0.No, not at all  \n1.Hardly ever  \n2.Yes, sometimes \n3.Yes, very much \n");
    four = parseInt(four);
     if(four>3 || four<0){
alert("you made a mistake");
       four =-1;
}
      
         var five = prompt("I have felt scared and panicy and I don't know why: \n\n0.Yes, quite a lot \n1.Yes, sometimes  \n2.No, not much  \n3.No, not at all \n");
        five = parseInt(five);
     if(five>3 || five<0){
alert("you made a mistake");
       five=-1;
}
  //This adds up the answers given and from there it checks if the sum is above 7 or less then 7 if it is the result will be that the patient is depressed or not depressed.
    var sum = one+two+three+four+five;  
    sum = parseInt(sum);
  //This 
  if(sum<0){
    alert("h1 Retake the test!!! \h1");
  }else if(sum > 7) {
      alert("Unfortunately your patient is depressed");
    }else{
      alert("Fortunately your patient is not depressed");
    }
  
  /*if(sum => 7){
    elert("Unfortunately you are depressed");
  }if(sum < 7){
    alert("You are not depressed");
  }*/
  
  
  
  
  $(":mobile-pagecontainer" ).pagecontainer( "change", "#depression");
  
  
  
    }



      function CalculateEDD(id) {
        var date = $("#" + id).val();
        var edd = moment(date).add(280, 'days').format('DD MMM YYYY');
        $("#EDD_Date").html("Your estimated EDD is:   " + edd);
        
//This checks for the trimester calculating how many weeks each trimester lasts and then calculating the trimester        
        var firstTri= moment(date).add(7*13, 'days');
        var secTri= moment(date).add(27*7, 'days');
        var thirdTri= moment(date).add(40*7, 'days');
        var now = moment();
        
        //This if else statements calls the pages for the trimesters determining on the estimated due date of the patient 
         if(moment(now).isBefore(firstTri)){
            $(":mobile-pagecontainer" ).pagecontainer( "change", "#firstTrimester");
        }else if(moment(now).isBefore(secTri)){
            $(":mobile-pagecontainer" ).pagecontainer( "change", "#secondTrimester");
        }else if(moment(now).isBefore(thirdTri)){    
            $(":mobile-pagecontainer" ).pagecontainer( "change", "#thirdTrimester");
          
          }
      };
Rerun