var McKinney = 0;
var Barr = 0;
var Obama = 0;
var McCain = 0;
var None = 0;

function result(p,r) {
 if (p.search(/McCain/) != -1) {
  McCain = McCain+1;
 }
 if (p.search(/Obama/) != -1) {
  Obama = Obama+1;
 }
 if (p.search(/Barr/) != -1) {
  Barr = Barr+1;
 }
 if (p.search(/McKinney/) != -1) {
  McKinney = McKinney+1;
 }
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">19</span></small><p><strong>How do you feel about the environment?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'two\')">States should decide.</a></li><li><a href="javascript:result(\'Obama\',\'two\')">Slightly more regulations are needed.</a></li><li><a href="javascript:result(\'Barr\',\'two\')">The courts and property rights should decide.</a></li><li><a href="javascript:result(\'McKinney\',\'two\')">Definitely more regulations are needed.</a></li><li><a href="javascript:result(\'None\',\'two\')">None of the above.</a></li></ol>';
 }
if (num == 'two') {
qid.innerHTML = '<small>question <span style="color: #00f">2</span> of <span style="color: #00f">19</span></small><p><strong>How would you improve the economy?</strong></p><ol><li><a href="javascript:result(\'McCain-Barr\',\'three\')">More tax cuts.</a></li><li><a href="javascript:result(\'Obama\',\'three\')">More regulations and stimulus checks.</a></li><li><a href="javascript:result(\'McKinney\',\'three\')">Roll back taxes cuts, balance the budget, and add more social programs.</a></li><li><a href="javascript:result(\'None\',\'three\')">None of the above.</a></li></ol>';
 }
if (num == 'three') {
qid.innerHTML = '<small>question <span style="color: #00f">3</span> of <span style="color: #00f">19</span></small><p><strong>Are you for or against net neutrality?</strong></p><ol><li><a href="javascript:result(\'Obama-Barr-McKinney\',\'four\')">For</a></li><li><a href="javascript:result(\'McCain\',\'four\')">Against</a></li></ol>';
 }
if (num == 'four') {
qid.innerHTML = '<small>question <span style="color: #00f">4</span> of <span style="color: #00f">19</span></small><p><strong>What do you think should be done with Iraq?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'five\')">More troops, no immidiate withdraw.</a></li><li><a href="javascript:result(\'Obama\',\'five\')">A phased withdraw.</a></li><li><a href="javascript:result(\'Barr-McKinney\',\'five\')">A deadline withdraw.</a></li><li><a href="javascript:result(\'None\',\'five\')">None of the above.</a></li></ol>';
 }
if (num == 'five') {
qid.innerHTML = '<small>question <span style="color: #00f">5</span> of <span style="color: #00f">19</span></small><p><strong>How should Iran be dealt with?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'six\')">No tolerance.</a></li><li><a href="javascript:result(\'Obama\',\'six\')">Negotiate differences.</a></li><li><a href="javascript:result(\'Barr-McKinney\',\'six\')">Stay out of their way.</a></li><li><a href="javascript:result(\'None\',\'six\')">None of the above.</a></li></ol>';
 }
 if (num == 'six') {
qid.innerHTML = '<small>question <span style="color: #00f">6</span> of <span style="color: #00f">19</span></small><p><strong>Should the United States have a fiat dollar?</strong></p><ol><li><a href="javascript:result(\'McCain-Obama\',\'seven\')">Yes</a></li><li><a href="javascript:result(\'Barr-McKinney\',\'seven\')">No</a></li><li><a href="javascript:result(\'None\',\'seven\')">I don\'t know</a></li></ol>';
 }
 if (num == 'seven') {
qid.innerHTML = '<small>question <span style="color: #00f">7</span> of <span style="color: #00f">19</span></small><p><strong>What is your position on abortion?</strong></p><ol><li><a href="javascript:result(\'Obama-McKinney\',\'eight\')">Women should have the right to choose, regardless of situation.</a></li><li><a href="javascript:result(\'McCain\',\'eight\')">It depends on the situation.</a></li><li><a href="javascript:result(\'Barr\',\'eight\')">Each state should decide, not the federal government.</a></li><li><a href="javascript:result(\'None\',\'eight\')">None of the above</a></li></ol>';
 }
 if (num == 'eight') {
qid.innerHTML = '<small>question <span style="color: #00f">8</span> of <span style="color: #00f">19</span></small><p><strong>What is your feelings about civil liberties?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'nine\')">Security comes first, liberties second.</a></li><li><a href="javascript:result(\'Obama\',\'nine\')">Giving up some liberties for security should be expected.</a></li><li><a href="javascript:result(\'Barr-McKinney\',\'nine\')">Liberty always come first.</a></li><li><a href="javascript:result(\'None\',\'nine\')">None of the above.</a></li></ol>';
 }
 if (num == 'nine') {
qid.innerHTML = '<small>question <span style="color: #00f">9</span> of <span style="color: #00f">19</span></small><p><strong>What is your position on gay and lesbian marriage?</strong></p><ol><li><a href="javascript:result(\'McKinney\',\'ten\')">Support.</a></li><li><a href="javascript:result(\'McCain\',\'ten\')">Against.</a></li><li><a href="javascript:result(\'Obama\',\'ten\')">Against, but support civil unions.</a></li><li><a href="javascript:result(\'Barr\',\'ten\')">Each state should decide.</a></li></ol>';
 }
 if (num == 'ten') {
qid.innerHTML = '<small>question <span style="color: #00f">10</span> of <span style="color: #00f">19</span></small><p><strong>What should be done with the income tax?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'eleven\')">Make the Bush tax cuts permanent with additional tax cuts.</a></li><li><a href="javascript:result(\'Obama\',\'eleven\')">Repel Bush tax cuts, less taxes on the poor, and more on capital gains.</a></li><li><a href="javascript:result(\'Barr\',\'eleven\')">A flat tax or fair tax should be implemented.</a></li><li><a href="javascript:result(\'McKinney\',\'eleven\')">Repel Bush tax cuts and take away all corporate tax breaks.</a></li><li><a href="javascript:result(\'None\',\'eleven\')">None of the above.</a></li></ol>';
 }
 if (num == 'eleven') {
qid.innerHTML = '<small>question <span style="color: #00f">11</span> of <span style="color: #00f">19</span></small><p><strong>What is your thoughts on marijuana?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'twelve\')">Federal law against all marijuana use, including medicinal.</a></li><li><a href="javascript:result(\'Obama\',\'twelve\')">It should be legal for medicinal purposes only.</a></li><li><a href="javascript:result(\'Barr\',\'twelve\')">It is for each state to decide.</a></li><li><a href="javascript:result(\'McKinney\',\'twelve\')">Full legalization.</a></li><li><a href="javascript:result(\'None\',\'twelve\')">None of the above.</a></li></ol>';
 }
 if (num == 'twelve') {
qid.innerHTML = '<small>question <span style="color: #00f">12</span> of <span style="color: #00f">19</span></small><p><strong>What should be done about health care?</strong></p><ol><li><a href="javascript:result(\'Obama-McCain\',\'thirteen\')">Make healthcare affordable and high quality by more regulations.</a></li><li><a href="javascript:result(\'Barr\',\'thirteen\')">Lower regulations and allow the market to decide costs.</a></li><li><a href="javascript:result(\'McKinney\',\'thirteen\')">Taxes should provide free healthcare for all.</a></li><li><a href="javascript:result(\'None\',\'thirteen\')">None of the above.</a></li></ol>';
 }
 if (num == 'thirteen') {
qid.innerHTML = '<small>question <span style="color: #00f">13</span> of <span style="color: #00f">19</span></small><p><strong>What are your thoughts on immigration?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'fourteen\')">Give more visas, relax restrictions on social programs, and allow guest worker programs.</a></li><li><a href="javascript:result(\'Obama\',\'fourteen\')">Stronger border security and illegal immigrants should go to the back of the line for legalization.</a></li><li><a href="javascript:result(\'Barr\',\'fourteen\')">Aggresively secure the borders by adding personnel. No additional visas.</a></li><li><a href="javascript:result(\'McKinney\',\'fourteen\')">The current laws and rules are fine.</a></li><li><a href="javascript:result(\'None\',\'fourteen\')">None of the above.</a></li></ol>';
 }
 if (num == 'fourteen') {
qid.innerHTML = '<small>question <span style="color: #00f">14</span> of <span style="color: #00f">19</span></small><p><strong>Do you support capital punishment?</strong></p><ol><li><a href="javascript:result(\'McCain-Barr\',\'fifteen\')">Yes.</a></li><li><a href="javascript:result(\'Obama-McKinney\',\'fifteen\')">No.</a></li></ol>';
 }
 if (num == 'fifteen') {
qid.innerHTML = '<small>question <span style="color: #00f">15</span> of <span style="color: #00f">19</span></small><p><strong>How would you fix the high prices of prescription drugs?</strong></p><ol><li><a href="javascript:result(\'McCain-McKinney\',\'sixteen\')">Expand medicare so the elderly can easily afford medications.</a></li><li><a href="javascript:result(\'Obama\',\'sixteen\')">Expand medicare and allow prescription drugs from Canada.</a></li><li><a href="javascript:result(\'Barr\',\'sixteen\')">Reform policies towards prescription drugs assuring the market decides the price.</a></li><li><a href="javascript:result(\'None\',\'sixteen\')">None of the above.</a></li></ol>';
 }
 if (num == 'sixteen') {
qid.innerHTML = '<small>question <span style="color: #00f">16</span> of <span style="color: #00f">19</span></small><p><strong>What is your view on current gun control?</strong></p><ol><li><a href="javascript:result(\'Obama-McKinney\',\'seventeen\')">More control is needed.</a></li><li><a href="javascript:result(\'McCain\',\'seventeen\')">Slightly less control.</a></li><li><a href="javascript:result(\'Barr\',\'seventeen\')">Most regulations should be abolished.</a></li><li><a href="javascript:result(\'None\',\'seventeen\')">None of the above.</a></li></ol>';
 }
 if (num == 'seventeen') {
qid.innerHTML = '<small>question <span style="color: #00f">17</span> of <span style="color: #00f">19</span></small><p><strong>Should the federal government give school vouchers?</strong></p><ol><li><a href="javascript:result(\'McCain-Barr\',\'eighteen\')">Yes.</a></li><li><a href="javascript:result(\'Obama-McKinney\',\'eighteen\')">No.</a></li></ol>';
 }
 if (num == 'eighteen') {
qid.innerHTML = '<small>question <span style="color: #00f">18</span> of <span style="color: #00f">19</span></small><p><strong>How would you fix social security?</strong></p><ol><li><a href="javascript:result(\'McCain\',\'nineteen\')">Allow some privatization.</a></li><li><a href="javascript:result(\'Barr\',\'nineteen\')">Privatize all of it.</a></li><li><a href="javascript:result(\'Obama\',\'nineteen\')">Remove tax cap of $97,000 for social security (salary above $97,000 should be taxed for social security).</a></li><li><a href="javascript:result(\'McKinney\',\'nineteen\')">Stop spending the funds and allow government investments.</a></li><li><a href="javascript:result(\'None\',\'nineteen\')">None of the above.</a></li></ol>';
 }
 if (num == 'nineteen') {
qid.innerHTML = '<small>question <span style="color: #00f">19</span> of <span style="color: #00f">19</span></small><p><strong>What would be your energy policy moving forward?</strong></p><ol><li><a href="javascript:result(\'McCain-Barr\',\'twenty\')">More oil drilling. More nuclear power.</a></li><li><a href="javascript:result(\'Obama\',\'twenty\')">Increase funds to renewable sources. More drilling.</a></li><li><a href="javascript:result(\'McKinney\',\'twenty\')">Substantial investment in substainable power (wind, solar, geothermal, etc), but not nuclear.</a></li><li><a href="javascript:result(\'None\',\'twenty\')">None of the above.</a></li></ol>';
 }
if (num == 'twenty'){

if (McCain >= Obama) {
 if (McCain >= Barr) {
  if (McCain >= McKinney) {
   var candidate = 'McCain';
  }
  else if (McCain < McKinney) {
   var candidate = 'McKinney';
  }
 }
 else if (McCain < Barr) {
  if (Barr >= McKinney) {
   var candidate = 'Barr';
  }
  else if (Barr < McKinney) {
   var candidate = 'McKinney';
  }
 }
}
else {
 if (Obama >= Barr) {
  if (Obama >= McKinney) {
   var candidate = 'Obama';
  }
  else if (Obama < McKinney) {
  }
   var candidate = 'McKinney';
 }
 else if (Obama < Barr) {
  if (Barr >= McKinney) {
   var candidate = 'Barr';
  }
  else if (Barr < McKinney) {
   var candidate = 'McKinney';
  }
 }
}

qid.innerHTML = '<p><strong>You are ' + candidate + '!</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="What 2008 Presidential Candidate Are You?" style="display: block; text-decoration: none; border: none; height: 125px; width: 125px; text-align: left; background: url(http://impnerd.com/badges/'+candidate+'.png) 0 0 no-repeat; font-size: 16px; color:#fff; font-family:arial,sans-serif;"><p style="padding: 70px 5px 8px; margin: 0; color: #002868;">I am</p><p style="padding: 0 5px; margin: 0; color: #fff; font-size: 20px; font-weight: bold;">'+candidate+'</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="What 2008 Presidential Candidate Are You?" style="display: block; text-decoration: none; border: none; height: 125px; width: 125px; text-align: left; background: url(http://impnerd.com/badges/'+candidate+'.png) 0 0 no-repeat; font-size: 16px; color:#fff; font-family:arial,sans-serif;"><p style="padding: 70px 5px 8px; margin: 0; color: #002868;">I am</p><p style="padding: 0 5px; margin: 0; color: #fff; font-size: 20px; font-weight: bold;">'+candidate+'</p></a></textarea>';
}
}