﻿function writeResults() {	

    qs = new Querystring();

    age = parseInt(qs.get("age"));
    gender = parseInt(qs.get("gender"));
    genderWord = (gender == 0) ? "women" : "men";

    total = parseInt(qs.get("total"));

    // Lot's older	= 17+
    // Little older = 4 - 16
    // Same			= -1 - 3
    // Little young = -2 - -8
    // Little young = -9- 

    if (total >=17)
	    resultsHTML = "<table width=\"270\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><font face=\"Arial, helvetica, sans-serif\" size=\"2\" color=\"#000080\"><b>Your RealAge is at least <i>5 years older</i>.</b><br><br><b>Yikes!</b> Based on your answers, your RealAge is 5 or more years older than your calendar age.<br><br><b>What this means:</b> You're definitely ready for some lifestyle changes to put you on track to looking and feeling younger. <br><br><b>How:</b> Go to <a href=\"http://www.realage.com/ralong/entry4.aspx?cbr=HSW01\" target=\"_blank\">www.RealAge.com</a> and take the FREE RealAge Test. Answer simple questions, get expert advice and noticeable results!</font></td><td width=\"175\" align=\"center\"><img src=\"http://messaging.realage.com/external/walmart/chart_title.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5older_on.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5older_off.gif\" border=\"0\"><br>	<img src=\"http://messaging.realage.com/external/walmart/chart_aboutsame_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5younger_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5younger_off.gif\" border=\"0\"></td></tr></table>";
    else if (total < 17 && total >=4)
	    resultsHTML = "<table width=\"270\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><font face=\"Arial, helvetica, sans-serif\" size=\"2\" color=\"#000080\"><b>Your RealAge is about <i>1 to 5 years older</i>.</b><br><br><b>Oh, my!</b> Based on your answers, your RealAge is between 1 and 5 years older than your calendar age.<br><br><b>What this means:</b> You're ready for some lifestyle changes to put you on track to looking and feeling younger. <br><br><b>How:</b> Go to <a href=\"http://www.realage.com/ralong/entry4.aspx?cbr=HSW01\" target=\"_blank\">www.RealAge.com</a> and take the FREE RealAge Test. Answer simple questions, get expert advice and noticeable results!</font></td><td width=\"175\" align=\"center\"><img src=\"http://messaging.realage.com/external/walmart/chart_title.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5older_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5older_on.gif\" border=\"0\"><br>	<img src=\"http://messaging.realage.com/external/walmart/chart_aboutsame_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5younger_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5younger_off.gif\" border=\"0\"></td></tr></table>";
    else if (total < 4 && total >= -1)
	    resultsHTML = "<table width=\"270\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><font face=\"Arial, helvetica, sans-serif\" size=\"2\" color=\"#000080\"><b>Your RealAge is about the same age as you are.</b><br><br><b>Good going!</b> Based on your answers, your RealAge and your calendar age are about the same.<br><br><b>What this means:</b> You're on the right track, but you could look and feel even younger. <br><br><b>How:</b> Go to <a href=\"http://www.realage.com/ralong/entry4.aspx?cbr=HSW01\" target=\"_blank\">www.RealAge.com</a> and take the FREE RealAge Test. Answer simple questions, get expert advice and noticeable results!</font></td><td width=\"175\" align=\"center\"><img src=\"http://messaging.realage.com/external/walmart/chart_title.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5older_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5older_off.gif\" border=\"0\"><br>	<img src=\"http://messaging.realage.com/external/walmart/chart_aboutsame_on.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5younger_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5younger_off.gif\" border=\"0\"></td></tr></table>";
    else if (total < -1 && total >= -8)	
	    resultsHTML = "<table width=\"270\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><font face=\"Arial, helvetica, sans-serif\" size=\"2\" color=\"#000080\"><b>Your RealAge is about <i>1 to 5 years younger</i>.</b><br><br><b>Impressive!</b> Based on your answers, your RealAge is between 1 and 5 years younger than your calendar age.<br><br><b>What this means:</b> You're definitely on the right track, but you could look and feel even younger.<br><br><b>How:</b> Go to <a href=\"http://www.realage.com/ralong/entry4.aspx?cbr=HSW01\" target=\"_blank\">www.RealAge.com</a> and take the FREE RealAge Test. Answer simple questions, get expert advice and noticeable results!</font></td><td width=\"175\" align=\"center\"><img src=\"http://messaging.realage.com/external/walmart/chart_title.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5older_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5older_off.gif\" border=\"0\"><br>	<img src=\"http://messaging.realage.com/external/walmart/chart_aboutsame_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5younger_on.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5younger_off.gif\" border=\"0\"></td></tr></table>";
    else
	    resultsHTML = "<table width=\"270\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><font face=\"Arial, helvetica, sans-serif\" size=\"2\" color=\"#000080\"><b>Your RealAge is at least <i>5 years younger</i>.</b><br><br><b>Wow!</b> Based on your answers, your RealAge is 5 or more years younger than your calendar age.<br><br><b>What this means:</b> You're taking incredible care of yourself, but you could look and feel even younger. <br><br><b>How:</b> Go to <a href=\"http://www.realage.com/ralong/entry4.aspx?cbr=HSW01\" target=\"_blank\">www.RealAge.com</a> and take the FREE RealAge Test. Answer simple questions, get expert advice and noticeable results!</font></td><td width=\"175\" align=\"center\"><img src=\"http://messaging.realage.com/external/walmart/chart_title.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5older_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5older_off.gif\" border=\"0\"><br>	<img src=\"http://messaging.realage.com/external/walmart/chart_aboutsame_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_1_5younger_off.gif\" border=\"0\"><br><img src=\"http://messaging.realage.com/external/walmart/chart_5younger_on.gif\" border=\"0\"></td></tr></table>";
			
    document.getElementById("quizResult").innerHTML = resultsHTML;

}