home *** CD-ROM | disk | FTP | other *** search
- var moduleData = new ActiveXObject("Microsoft.XMLDOM");
- moduleData.load("data/wandeltest.xml");
- var moduleRoot = moduleData.documentElement;
-
- var minMax = new Array(0,60,0,60,50,450);
-
- var gewicht = parseFloat(parent.userRoot.selectSingleNode("gewicht").text);
- var geslacht = parent.userRoot.selectSingleNode("geslacht").text;
- var leeftijd = parseFloat(parent.userRoot.selectSingleNode("leeftijd").text);
- var lengte = parseFloat(parent.userRoot.selectSingleNode("lengte").text);
-
- function showPage() {
- buildPage();
- parent.goPage = 'wandeltest.html';
- AppScreen.style.visibility = "visible";
- }
-
- function buildPage() {
- style = new ActiveXObject("Microsoft.XMLDOM");
-
- styleRule = buildStyleRule(0);
- style.loadXML(styleRule);
- TextArea[0].innerHTML = moduleData.transformNode(style);
-
- styleRule = buildStyleRule(1);
- style.loadXML(styleRule);
- TextArea[1].innerHTML = moduleData.transformNode(style);
-
- styleRule = buildStyleRule(2);
- style.loadXML(styleRule);
- TextArea[2].innerHTML = moduleData.transformNode(style);
-
- styleRule = buildStyleRule(3);
- style.loadXML(styleRule);
- TextArea[3].innerHTML = moduleData.transformNode(style);
-
- styleRule = buildStyleRule(4);
- style.loadXML(styleRule);
- TextArea[4].innerHTML = moduleData.transformNode(style);
-
- styleRule = buildStyleRule(5);
- style.loadXML(styleRule);
- TextArea[5].innerHTML = moduleData.transformNode(style);
- }
-
- function CountAction(c) {
- theNum = c;
- theValue = parseInt(CountBox[c].value);
- if ((theValue >= minMax[theNum*2]) && (theValue <= minMax[(theNum*2)+1])) {
- CountBox[c].value = parseInt(CountBox[c].value);
- }
- else CountBox[c].value = minMax[theNum*2];
-
- minuten = parseFloat(CountBox[0].value);
- seconden = parseFloat(CountBox[1].value);
- hartslag = parseFloat(CountBox[2].value);
-
- resultValue = '';
- if ((geslacht == 'v') && (hartslag > 0) && (minuten + seconden > 0)) {
- resultValue = 304-((leeftijd*-0.4)+(minuten*8.5)+(seconden*0.14)+(hartslag*0.32)+(gewicht*11000/(lengte*lengte)));
- }
- else if ((geslacht == 'm') && (hartslag > 0) && (minuten + seconden > 0)) {
- resultValue = 420-((leeftijd*-0.2)+(minuten*11.6)+(seconden*0.2)+(hartslag*0.56)+(gewicht*26000/(lengte*lengte)));
- }
- Result.innerText = Math.round(resultValue);
- }
-
- function buildStyleRule(t) {
- styleRule = '<?xml version="1.0"?>';
- styleRule += '<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">';
- styleRule += '<xsl:template match="/">';
- styleRule += '<xsl:apply-templates select="wandeltest/text['+t+']">';
- styleRule += '<xsl:template>';
- styleRule += '<xsl:copy>';
- styleRule += '<xsl:apply-templates select="@* | * | comment() | pi() | text()"/>';
- styleRule += '</xsl:copy>';
- styleRule += '</xsl:template>';
- styleRule += '</xsl:apply-templates>';
- styleRule += '</xsl:template>';
- styleRule += '</xsl:stylesheet>';
- return styleRule;
- }
-
- var countTimer;
- var counting = false;
- var countObj;
-
- function RealCount() {
- clearTimeout(countTimer);
-
- theNum = parseInt(countObj.num);
- theFactor = (countObj.factor)?parseInt(countObj.factor):1;
- theValue = parseInt(CountBox[theNum].value);
- if (((countObj.innerText == '-') || (countObj.dirtype == '-')) && ((theValue-theFactor) >= minMax[theNum*2])) {
- theValue -= theFactor;
- }
- else if (((countObj.innerText == '+') || (countObj.dirtype == '+')) && ((theValue-theFactor) <= minMax[(theNum*2)+1])) {
- theValue += theFactor;
- }
- CountBox[theNum].value = theValue;
- CountAction(theNum);
-
- if (counting) countTimer = window.setTimeout('RealCount()',100);
- }