﻿// JScript File
var resultA = 0;
var resultB = 0;
var resultC = 0;
var resultD = 0;



function swap(id1, id2, choice)
{
if (choice == 'A')
resultA = resultA +1;

if (choice == 'B')
resultB = resultB +1;

if (choice == 'C')
resultC = resultC +1;

if (choice == 'D')
resultD = resultD +1;

/*for questions 1-9*/
if (id2 != 'result')
{

document.getElementById(id1).style.display = 'none';			
document.getElementById(id2).style.display = 'block';
}

/*for question 10 display results*/
if (id2 == 'result')
{
document.getElementById(id1).style.display = 'none';
document.getElementById('footer').style.display = 'block';

if ((resultA >= resultB) && (resultA >= resultC) && (resultA >= resultD))
document.getElementById('rA').style.display = 'block';
else
if ((resultB >= resultA) && (resultB >= resultC) && (resultB >= resultD))
document.getElementById('rB').style.display = 'block';
else
if ((resultC >= resultB) && (resultC >= resultA) && (resultC >= resultD))
document.getElementById('rC').style.display = 'block';
else
if ((resultD >= resultB) && (resultD >= resultC) && (resultD >= resultA))
document.getElementById('rD').style.display = 'block';

}		
}



function swap_size(w, h, txt, img)
{
document.getElementById(txt).innerHTML = '&lt;a title="What Kind of Shopper Are You?" href="http://www.consolidatedcredit.org" style="color: #353535; text-decoration: none; display: block; width:' + w + 'px; height:' + h + 'px;  background: url(http://www.catwalkcatfight.com/shoppers-quiz/img/'+ img +'.png) no-repeat;"&gt;&lt;/a&gt;&lt;p&gt;This quiz was provided by - &lt;a href="http://www.consolidatedcredit.org"&gt;Consolidated Credit&lt;/a&gt;&lt;/p&gt;';
}


/*function gup()
{

 var url = window.location.toString(); 
 url.match(/\?(.+)$/);
 var param = RegExp.$1;
 param = param.split("=");     
 var result = param[1];
 alert(result);

if (result == 'A')
{
document.getElementById('divA').style.display = 'block';
}
if (result == 'B')
{
document.getElementById('divB').style.display = 'block';
}
if (result == 'C')
{
document.getElementById('divC').style.display = 'block';
}
if (result == 'D')
{
document.getElementById('divD').style.display = 'block';
}
}*/



function MySpace(result, img)
{
var tmp = document.getElementById('c').value = '<a href="http://www.catwalkcatfight.com/shoppers-quiz/result'+ result +'.htm"><img src=http://www.catwalkcatfight.com/shoppers-quiz/img/'+ img +'.png alt="What Kind Of Shopper Are You?" /></a><p>Created by <a href="http://www.consolidatedcredit.org">Consolidated Credit</a></p>';
document.getElementById('u').value = 'http://www.catwalkcatfight.com/shoppers-quiz/result'+ result +'.htm';
document.getElementById('myspacepostto').submit();return false;
}
