pipidodo

Calorie Calculator /js/diets3.js

Jun 23rd, 2021
736
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <!--
  4.     Last update 23-12-08
  5. -->
  6. <head>
  7. <meta name="description" content="A diet calculator (and food reference based on USDA research) showing weight gain/loss in real time.">
  8. <meta name="keywords" content="weightloss, food, balanced diet, diet, dieting, weight, weight control, loosing weight, weightwatcher, fat, skinny, calories, cals, Kcalories, Kcals, Kjoule, Kjoule, joule, joules, Calcium, Ca,Carbohydrate,Carotene alpha, Carotene beta, Carotene, Cholesterol, Copper, Cu, Cryptoxanthin, beta, "monounsaturated, polyunsaturated, Fatty, acids, saturated, Fiber, dietary, Folate, DFE, Iron, Fe, Lutein, zeaxanthin, Lycopene, Magnesium, Mg, Manganese, Mn, Niacin, Pantothenic, acid, Phosphorus, P, Potassium, K, Protein, Riboflavin, Selenium, Se, Sodium, Na, Sugar, sugars ,Thiamin,Total lipid fat , lipid fat, lipid, fat, Vitamin A RAE, Vitamin A, a, Vitamin B-12,Vitamin B12,b-12,b12, Vitamin B-6,Vitamin B6, b6, b-6,Vitamin C, C,ascorbic acid, Vitamin, E,alpha-tocopherol, Vitamin, K ,phylloquinone, Water,Zinc, Zn">
  9. <META NAME="copyright" CONTENT="July 2006 P">
  10. <META NAME="revisit-after" CONTENT="14 days">
  11. <META NAME="Robot" CONTENT="ALL">
  12. <META NAME="rating" CONTENT="General">
  13. <META NAME="Creator" CONTENT="P">
  14. <META NAME="Publisher" CONTENT="P">
  15.  
  16. <title>Calorie Calculator - Graph</title>
  17. <link REL="SHORTCUT ICON" href="../ico/wagon.jpg">
  18. <script type="text/javascript" src="../js/dietsCommon.js"></script>
  19. <link rel="stylesheet" href="../css/draw.css">
  20.  
  21.  
  22. </head>
  23. <body style="background-image: url('../jpg/back3.jpg')">
  24. <div class="smaller" style="position:absolute; right:1em; bottom:1em;">Last drawn: <?php echo date ('g:i a'); ?></div>
  25. <div style="position:absolute; height:93%; width:93%">
  26.    
  27.    
  28.     <hr color="green" style="position:absolute; top:49%; left:4%; width:96%; color:green">
  29.     <span class="smaller" style="position:absolute; top:1%; left:5%">gaining weight</span>
  30.     <span class="smaller" style="position:absolute; bottom:0%; left:5%">loosing weight</span>
  31.     <span class="smaller" style="position:absolute; top:52%; right:0%">PM</span>
  32.     <span class="smaller" style="position:absolute; top:52%; left:5%">AM</span>
  33.     <input type="button" style="position:absolute; top:1%; right:1%" value="Explain" onclick="open_win('explainGraph.php')">
  34.  
  35. <SCRIPT language="JavaScript"><!--
  36.    
  37.     str = document.location.search;
  38.     if (str.match("cals=")){
  39.    
  40.         MRstr = str.substr(4,3);
  41.         str = str.slice(12);
  42.         w = str.indexOf("&");
  43.         MRSstr = str.substr(0,w)*1;
  44.         str = str.slice(9);
  45.         w = str.indexOf("&");
  46.         NUMstr = str.substr(0,w);
  47.         CALstr = str.substr((w+6))*1;
  48.         document.write("<span class='smaller' style='position:absolute; top:52%; left:30%; color:green'>This green line represents your " +MRstr+ " of "+ MRSstr + "</span>");
  49.    
  50.         wot = 96/24;
  51.         for (z = 1; z < 25; z++){
  52.             document.write('<span class="smallest" style="position:absolute; top:48%; left:' + (wot*z +3) + '%">' + z + "</span>");
  53.         }
  54.        
  55.     }  
  56.    
  57.         for (x=0; x<=100; x++){
  58.             if (!(x%5)){
  59.                 if (x == 50) y = 0;
  60.                 if (x < 50)
  61.                     if(x > 40) y = '+ 0' + (50 - x);
  62.                     else y = '+ ' + (50 - x);
  63.                 if (x > 50)
  64.                     if (x < 60) y = '- 0' + (x - 50);
  65.                     else  y = '- ' +(x - 50);
  66.                 document.write('<span class="smallest" style="position:absolute; top:' + x + '%;" >' + y);
  67.             }
  68.             document.write('</span><span style="position:absolute; top:' + x + '%; left:3.5%;">&brvbar</span>');
  69.         }
  70.        
  71.     b = 0;
  72.     aa = 1;
  73.     var point = new Array();
  74.     while (aa < NUMstr.length){
  75.         point[b] = NUMstr.substr(aa, 3)*1;
  76.         aa = aa + 4;
  77.         b=b+1;
  78.     }
  79.     for (c = 0; c < 25; c++){
  80.         if (point[c]){
  81.             document.write('<span class="smallest" style="position:absolute; top:' + point[c] + '%; left:' + (wot*c +4) + '%">&deg</span>');
  82.  
  83.             if (c > 0){
  84.                 diff = Math.abs(point[c] - point[c-1]);
  85.                 if (point[c-1] > point[c]){
  86.                     for (q = 0; q < diff; q++){
  87.                         document.write('<span class="smallest" style="position:absolute; top:' + (point[c-1]-q) + '%; left:' + (wot*(c-1) +4 +wot*q/diff) + '%">&deg</span>'); 
  88.                         }
  89.                 }
  90.                 else if (point[c-1] < point[c]){
  91.                     for(q = 0; q < diff; q++){
  92.                         document.write('<span class="smallest" style="position:absolute; top:' + (point[c-1]+q) + '%; left:' + (wot*(c-1) +4 +wot*q/diff) + '%">&deg</span>'); 
  93.                 }          
  94.             }
  95.                 else{
  96.                 for(q = 0; q < 7; q++){
  97.                         document.write('<span class="smallest" style="position:absolute; top:' + (point[c]) + '%; left:' + (wot*(c-1) +4 +wot*q/7) + '%">&deg</span>');
  98.                     }
  99.                 }
  100.             }
  101.         }
  102.     }
  103.     if (CALstr < 0) document.write('<span style="position:absolute; top:5%; left:30%; font-size:smaller; color:darkgreen">You lost ' + Math.abs(CALstr) + ' Kcal (' + Math.round(Math.abs(CALstr)*4.1868 ,2) + ' Kj) today<br />That is approx. ' + Math.round(Math.abs(CALstr / 7.778)) + 'gr. of weight loss</span>');
  104.     else if (CALstr > 0) document.write('<span style="position:absolute; top:5%; left:30%; font-size:smaller; color:Maroon">You gained ' + CALstr + ' Kcal (' + Math.round(Math.abs(CALstr)*4.1868 ,2) + ' Kj) today<br />That is approx. ' + Math.round(Math.abs(CALstr / 7.778)) + 'gr. of weight gain</span>');
  105.     else if (CALstr == 0) document.write('<span style="position:absolute; top:5%; left:30%; font-size:smaller; color:navy">You neither gained nor lost anything.</span>'); 
  106.    
  107. // --></SCRIPT>
  108.  
  109. </div>
  110. </body>
  111. </html>
RAW Paste Data