var score = 0;

function result(s,r) {
score = score + s;
return question(r);
}

function question(num) {
    var qid = document.getElementById('question');

if (num == 'one') {
qid.innerHTML = '<small>question <span style="color: #00f">1</span> of <span style="color: #00f">6</span></small><p><strong>How old are you?</strong></p><ol><li><a href="javascript:result(5,\'two\')">17-</a></li><li><a href="javascript:result(6,\'two\')">18-24</a></li><li><a href="javascript:result(7,\'two\')">25-34</a></li><li><a href="javascript:result(10,\'two\')">35-45</a></li><li><a href="javascript:result(8,\'two\')">46+</a></li></ol>';
 }
if (num == 'two') {
qid.innerHTML = '<small>question <span style="color: #00f">2</span> of <span style="color: #00f">6</span></small><p><strong>Are you male or female?</strong></p><ol><li><a href="javascript:result(5,\'three\')">Male</a></li><li><a href="javascript:result(10,\'three\')">Female</a></li><li><a href="javascript:result(0,\'three\')">I don\'t know</a></li></ol>';
 }
if (num == 'three') {
qid.innerHTML = '<small>question <span style="color: #00f">3</span> of <span style="color: #00f">6</span></small><p><strong>Do you eat breakfast?</strong></p><ol><li><a href="javascript:result(10,\'four\')">Yes</a></li><li><a href="javascript:result(0,\'four\')">No</a></li><li><a href="javascript:result(5,\'four\')">Sometimes</a></li></ol>';
 }
if (num == 'four') {
qid.innerHTML = '<small>question <span style="color: #00f">4</span> of <span style="color: #00f">6</span></small><p><strong>Do you consider yourself...?</strong></p><ol><li><a href="javascript:result(7,\'five\')">Athletic</a></li><li><a href="javascript:result(4,\'five\')">Average</a></li><li><a href="javascript:result(10,\'five\')">Overweight</a></li><li><a href="javascript:result(0,\'five\')">Underweight</a></li></ol>';
 }
if (num == 'five') {
qid.innerHTML = '<small>question <span style="color: #00f">5</span> of <span style="color: #00f">6</span></small><p><strong>Do you consider yourself hairy?</strong></p><ol><li><a href="javascript:result(0,\'six\')">Yes</a></li><li><a href="javascript:result(10,\'six\')">No</a></li></ol>';
 }
 if (num == 'six') {
qid.innerHTML = '<small>question <span style="color: #00f">6</span> of <span style="color: #00f">6</span></small><p><strong>Is your armspan more than 3" longer than your height?</strong></p><ol><li><a href="javascript:result(10,\'seven\')">Yes</a></li><li><a href="javascript:result(0,\'seven\')">No</a></li><li><a href="javascript:result(5,\'seven\')">I don\'t know</a></li></ol>';
 }
if (num == 'seven'){
var say;
    if (score < 20){
        say = score * Math.round(Math.random() * 12000);
    }

    else if (score >=20 && score <=35){
        say = score * Math.round(Math.random() * 13000);
    }
    
    else if (score >35 && score < 50){
        say = score * Math.round(Math.random() * 14000);
    }

    else if (score >49){
        say = score * Math.round(Math.random() * 15000);
    }
qid.innerHTML = '<p><strong>You are worth ' + say + ' Entrecard credits!</strong></p><p><small>Copy and paste the HTML code to display it on your blog, profile or website to share your EC credit worth!</small></p></div><a href="http://impnerd.com/blog-badges" title="How many Entrecard credits are you worth?" style="display: block; text-decoration: none; border: none; height: 125px; width: 125px; text-align: center; background: url(http://impnerd.com/badges/ec-credits.png) 0 0 no-repeat; font-size: 16px; color:#fc3; font-family:arial,sans-serif;"><p style="padding: 8px 0; margin: 0;">I am worth</p><p style="padding: 0; margin: 0; color: #fff; font-size: 20px;">' + say + '</p></a><div style="margin-top: -130px; margin-left: 220px; font-size: 0.9em;"><strong>Badge HTML Code:</strong><br /><textarea rows=6 cols=40 style="padding-left: 5px;"><a href="http://impnerd.com/blog-badges" title="How many Entrecard credits are you worth?" style="display: block; text-decoration: none; border: none; height: 125px; width: 125px; text-align: center; background: url(http://impnerd.com/badges/ec-credits.png) 0 0 no-repeat; font-size: 16px; color:#fc3; font-family:arial,sans-serif;"><p style="padding: 8px 0; margin: 0;">I am worth</p><p style="padding: 0; margin: 0; color: #fff; font-size: 20px;">'+ say +'</p></a></textarea>';
}
}
