//==========================================================================
//		Online Quiz Script Copyright (C) 2002 Simon Marshall
//==========================================================================
//		This script is to allow you to set up your own online
//		quiz without having to mess about writing your own 
//		script or setting up a CGI. All you have to do is fill in
//		the details below



//		USER PREFERENCES

// the title you would like to appear at the top of your Quiz
var quizTitle		= "EntitlementFactor";


// the text you would like to appear on the submit button at the end of your quiz
var submitString		= "What is my EntitlementFactor?";


// the possible outcomes of the quiz. You can add new ones to the list, or remove
// unused ones if you want less results.

var results		= new Array(
"1",
"2",
"3",
"4",
"5"	// no Comma after last entry
); 		// do not remove this 


// the string below will be placed before the result. You should change this to be
// relevant to your quiz (for example "The gods of rock and roll have deemed you to be")

var resultPrompt 	= "Your EntitlementFactor is ";

// the string below will show up if the answers give no outcome (this can happen if you
// set at least one answer for each question to not influence any result, or more likely
// if the user does not select any answers and simply submits the form

var noOutCome 	= "not available";


// you may want to provide a image for quiz takers to post in their journal. Set the
// variable below to 1 if you want to

var useImage	=	1;


// if you set the above to 1 then you need to provide a URL for the image file for each
// result. Please provide a full URL (starting with http://) for each image.

var resultImgs	= new Array(
"http://www.goingbridal.com/images/results1.gif",
"http://www.goingbridal.com/images/results2.gif",
"http://www.goingbridal.com/images/results3.gif",
"http://www.goingbridal.com/images/results4.gif",
"http://www.goingbridal.com/images/results5.gif"	// no Comma after last entry
);			 // do not remove this


// some users like to provide the HTML for quiz takers to post with the above images.
// the HTML will be generated automatically by this script. If you want to show this HTML along
// with the result set the below to 1

var useHtml		=	1;

// if you set the above to 1 then you should provide your name and a link to where other users
// can take this test. 

var yourName	= "BrideAudit";
var quizLink	= "http://www.goingbridal.com/brideaudit.shtml";

// enter the questions and answers below. Again add or remove questions to suit
// your requirements

var questions	= new Array(
"How much are you spending on your wedding?",
"Have any of your bridesmaids/groomsmen dropped out?",
"Are you marrying up or marrying down?",
"Is this really your wedding, or your mother's?",
"How much do you give for wedding gifts?",
"Are your friends cheap?",
"Are your relatives cheap?",
"Do you think people should come to weddings without a gift?",
"Do your bridesmaids owe you gifts?" 	// no Comma after last entry
); 					// do not remove this

// enter the answers to the questions, and which outcome each answer is biased
// toward. Note you need answers for every question.
// So for example if the first answer to Question 1 was "FISH" and that was weighted
// towards result3, you would put
// 		1, "FISH", 3,
// below

// If an answer does not bias any of the results simply leave the number as 0.


var answers		= new Array(
1, "A little less than we could be spending", 1,
1, "Exactly what we can afford", 2,
1, "A bit more than we wanted to, but it's worth it and really we can afford it", 3,
1, "More than we wanted to, I hope we can afford it somehow", 4,
1, "More than we can afford to, but I'm sure we'll get enough cash gifts to cover the bills", 5,

2, "No, they've all been wonderful", 1,
2, "No, but I'm worried about some of them", 2,
2, "No, but I'm ready to boot at least one", 4,
2, "Yes, but for good reasons", 3,
2, "Yes, several of them", 5,
2, "I'm not having attendants", 0,

3, "WTF?  What kind of question is that?", 1,
3, "Money differences aren't an issue", 2,
3, "I worry about impressing his parents and their friends", 3,
3, "His family is wealthier than mine and they let me know it", 4,
3, "His family is kind of trashy", 5,
3, "I'm marrying him for his money", 5,

4, "Mom is running the show", 4,
4, "My wedding!  I am the BRIDE!", 3,
4, "I'm letting Mom plan some stuff since she's better at it", 2,
4, "It is our wedding, actually - there is a guy involved, too", 1,
4, "I'm just playing a part in her production of The Wedding of the Century", 5,

5, "I don't give wedding gifts", 0,
5, "I give what I can afford at the time", 1,
5, "I give a little more for a big fancy wedding", 2,
5, "I give just enough so I'm not embarrassed", 3,
5, "I have to cover my plate at the reception", 4,
5, "There is a known minimum in my circle/family, and I always go above that", 5,

6, "WTF?  What kind of question is that?", 1,
6, "Yes, but I love them anyway", 2,
6, "Yes, so I'm not expecting much from them", 3,
6, "Yes, but I think they'll come through for my wedding", 4,
6, "No, but you should see his friends!  Talk about cheap!", 5,

7, "WTF?  What kind of question is that?", 1,
7, "Yes, but I love them anyway", 2,
7, "Yes, so I'm not expecting much from them", 3,
7, "Yes, but I think they'll come through for my wedding", 4,
7, "No, but you should see his family!  Talk about cheap!", 5,

8, "No - they owe the Bride and Groom something in exchange for the big party", 5,
8, "No, but even something small would be adequate", 4,
8, "Yes - it's more important to have them there than to get a gift", 1,
8, "Yes, but they need to send a gift ASAP!", 3,
8, "Yes, if they're having financial problems and apologize for it", 2,

9, "Of course - they get to go to the party, so they owe a gift", 4,
9, "Absolutely, and it should be something really good", 5,
9, "No one owes anyone a gift", 1,
9, "I'm just happy they're there - gifts don't matter", 2,
9, "A gift would be nice", 3,
9, "I don't have bridesmaids", 0

// no Comma after last entry

); 						// do not remove this

//==========================================================================
//		Do not edit below this line

writeHeader();
drawForm();
writeFooter();

function drawForm() {

document.write("<form onSubmit='return(doResults());' name='quiz'>"					+
"<table border=0  align=\"center\" cellpadding=0>"	
);	

for (var i=0;i<questions.length;i++) {
document.write("<tr valign=top><td colspan=2 class=header>&nbsp;<br>");
document.write( questions[i] );
document.write("</td></tr>");

for (var j=0; j<answers.length; j=j+3) {
if (answers[j] == i+1) {
document.write("<tr valign=top><td align='right'>");
document.write("<input type='radio' name='q" + i + "' value=" + j + ">");
document.write("</td><td>");
document.write(answers[j+1]);
document.write("</td></tr>");
}
}
}
document.write("<tr><td colspan=2 align=\"center\"><input type='submit' value=' " + submitString + "' STYLE='color:#FFFFFF; background: #336633; font-weight: bold'>"		+
" <input type='reset' STYLE='color:#FFFFFF; background: #336633; font-weight: bold'></td></tr>");
document.write("</table>");
document.write("</form>");

}


function doResults() {

var yourAnswers = getResults();



// evaluate answers

var resVals = new Array();

for (a=0;a<results.length;a++) {
resVals[a] = 0;
}

for (z=0;z<yourAnswers.length;z++) {

holder = eval(yourAnswers[z]) + 2;
holder = answers[holder];
if (holder != 0) {
resVals[holder-1]++;
}
}	

var theResult = 0;
var resultString = "";
var aResult = false;

for (b=0;b<results.length;b++) {

if ((resVals[b] >= resVals[theResult]) && (resVals[b] != 0)){
theResult = b;
aResult = true;
}
}
if (!aResult) {
resultString = noOutCome;
} else {
resultString = resultPrompt + " " + results[theResult];
}


// write it all

writeHeader();
document.write("<p class='header'>" + quizTitle + " Results");

document.write("<p class='result'>" + resultString + "");	

if (useImage == 1) {
// show appropriate image
if (aResult) {
document.write("<p><img src=\"" + resultImgs[theResult] + "\" alt=\"" + resultString + "\">");
document.write("<P>Remember your EntitlementFactor - and now we'll <a href='/audit/msgcalc.shtml'><b>see what you're owed</b></a>!<P class=results><a href='/audit/msgcalc.shtml'><font size='+1'>Next Step &raquo;</font></a>");

document.write("<p>You can copy and paste this html if you want to use this image.");
}
}

if (useHtml == 1) {
// create text area with html text inside
if (aResult) {
document.write("<p class=\"center\"><form><textarea rows=4 cols=30>");
if (useImage == 1) {
	document.write("&lta href=\"" + quizLink + "\"&gt&ltimg src=\"" + resultImgs[theResult] + "\" alt=\"" + quizTitle + "\" border=0&gt&lt/a&gt<br>&lta href=\"" + quizLink + "\"&gtBrideAudit&#153;&lt/a&gt");
} else {
	document.write("&lta href=\"" + quizLink + "\"&gt" + quizTitle + "\"&lt/a&gt");
}

document.write("</textarea></form>");

}
}

writeFooter();

return false;
}

function getResults() {
// gets results from form, puts in array and returns

var resultsArray = new Array(questions.length);
var temp = "";

for(y=0; y<questions.length;y++) {
temp = "document.quiz.q" + y;
for(x=0; x<eval(temp).length; x++) {

if (eval(temp)[x].checked == true) {
resultsArray[y] = eval(temp)[x].value;
}
}
}

return resultsArray;

}


function writeHeader() {

document.write("<head><title>BrideAudit: Get What's Coming To You</title><link rel=stylesheet type=\"text/css\" href=\"auditstyle.css\"></head><body bgcolor=#99cc99 topmargin=0 leftmargin=0 text=#000000 marginwidth=0 marginheight=0>");
document.write("<center><table width=750 cellpadding=2 cellspacing=0 border=0><TR valign=top><td valign=top bgcolor=#999999><table width=100% cellpadding=0 cellspacing=0 border=0 bgcolor=#336633><tr><td width=246 align=center valign=top><A href=\"/brideaudit.shtml\"><img src=\"/images/batitle.jpg\" width=246 height=365 border=0></a> &nbsp;<br><a href=\"/\"><font color=#ccff99>Going Bridal</font></a><p>&nbsp;<p><font color=#808080>this site is a parody.  if you actually think this a good idea, there is something wrong with your priorities.<br>&nbsp;<p><table bgcolor=white bordercolor=ffffcc border=4 width=180><tr><td align=center><a href=http://www.cafeshops.com/bridezilla target=_blank><img src=/images/gbthumb.jpg width=152 height=144 border=0 vspace=10></a><br><b><a href=http://www.cafeshops.com/bridezilla target=_blank>Greedy Bride Store</a></b></td></tr></table>");
document.write("</td><td bgcolor=#ffffff width=20>&nbsp;</td><td align=left valign=top bgcolor=#ffffff width=444>");
document.write("<img src=/images/efactor.gif width=449 height=77 border=0 alt=\"What's Your Entitlement Factor?\"><p>");

}

function writeFooter() {


document.write("<br>&nbsp;<br>&nbsp;</td><td bgcolor=#ffffff width=20>&nbsp;</td><td width=20>&nbsp;</td></tr></table></td></TR></table></center></body>");
}