	function printNotMACIE(){



		var agt=navigator.userAgent.toLowerCase();

		this.major = parseInt(navigator.appVersion);

		this.mac    = (agt.indexOf("mac")!=-1);

		this.ie   = (agt.indexOf("msie") != -1);



		if (this.mac && this.ie){

			alert("Sorry, your browser doesn't support this feature. Please use the file menu to print this window.");

		}else{

			window.print();

		}//end if-else



	}// end printNotMACIE

	

	

	

	//Created by Javier Castillo

	//Rexoxox@aol.com

	function doMessageForSelect(TheQuestion){

		if(!(reloadedPage)){

			//nothing

		}else{

			if(String(Parameters[("SELECT" + TheQuestion.getNum())]) == "undefined"){//If option left blank, dont write anything and exits

				//nothing

			}else if (String(Parameters[("SELECT" + TheQuestion.getNum())]) == ""){//If option left blank, dont write anything and exits

				//nothing

			}else{

				//Answered, now compare to see if its right

				//Check all Option until you get the answer

				for(oCount=0;oCount<TheQuestion.getOptions().length; oCount++){

					if(TheQuestion.getOptions()[oCount].getAns() == true){

						//Found the right answer, nwo compare to what they choose

						if (returnNiceString(String(Parameters[("SELECT" + TheQuestion.getNum())])) == TheQuestion.getOptions()[oCount].getTitle()){

							//They choose the right answer

							return String("<FONT COLOR=\"#037550\">" + TheQuestion.getMessagePos() + "</FONT>");

						}else{

							//They choose the wrong answer

							return String("<FONT COLOR=\"#FF0000\">" + TheQuestion.getMessageNeg() + "</FONT>");

						}// end if

					}// end if

				}// end for

			}// end if-else

		}// end if-else

		return String("");

	}// end function

	

	function doMessageForFillIn(TheQuestion){

		if(!(reloadedPage)){

			//nothing

		}else{

			//Repeat through each option.

			InpCount = 0;	//Number of InputBoxes

			AnsCount = 0;	//Number with stuff in them

			for(oCount=0;oCount<TheQuestion.getOptions().length; oCount++){

				//If Option FilledIn then continues to next and eventually spit out message.

				if(TheQuestion.getOptions()[oCount].getTitle() == ""){ 

					//Get Input Box

					if(String(Parameters[TheQuestion.getNum() + TheQuestion.getOptions()[oCount].getNum()]) == "undefined"){//If option left blank, dont write anything and exits

						InpCount++;

					}else if (String(Parameters[TheQuestion.getNum() + TheQuestion.getOptions()[oCount].getNum()]) == ""){//If option left blank, dont write anything and exits

						InpCount++;

					}else{

						AnsCount++;

						InpCount++;

					}// end if

				}// end if

			}// end for

			

			if (AnsCount == InpCount){

				//All Options must be filled.

				document.write("<FONT COLOR=\"#037550\">");

				document.write(TheQuestion.getMessagePos());

				document.write("</FONT>");

			}else if(AnsCount > 0 && AnsCount < InpCount){

				document.write("<FONT COLOR=\"#FF0000\">");

				document.write(TheQuestion.getMessageNeg());

				document.write("</FONT>");

			}else{

				//Didn't Answer any

			}// end if-else

			

		}// end if

	}// end doMessageForFillIn

	

	//Dave function modified 'TO THE MAX'

	function doCheckMarksRadio(ParamName, TheOption) {

		if(!(reloadedPage) || String(Parameters[ParamName]) == "undefined"){

			document.write("<img src='../../images/spacer.gif' border='0' width='20' height='20'><BR>");

		}else{

			if (TheOption.getAns() == true) {

				//The choice is the right one

				document.write("<img src='../../biocoach/images/main/check.gif' border='0' width='21' height='20' alt='checkmark'><BR>");

			}else{

				//The choice is wrong

				if (String(Parameters[ParamName]) == TheOption.getNum()){

					document.write("<img src='../../biocoach/images/main/x.gif' border='0' width='21' height='21' alt='x'><BR>");

				}else{

					document.write("<img src='../../images/spacer.gif' border='0' width='20' height='20'><BR>");

				}//end if

			}//end if

		}//end if-else	

	}// end doCheckMarksRadio

	

	

	//Dave function modified

	//Created by: Javier Castillo

	//Rexoxox@aol.com

	function doCheckMarksRadioNoChecks(ParamName, TheOption) {

		if(!(reloadedPage) || String(Parameters[ParamName]) == "undefined"){

			document.write("<img src='../../images/spacer.gif' border='0' width='20' height='20'><BR>");

		}else{

			if (TheOption.getAns() == true) {

				//The choice is the right one

				if (String(Parameters[ParamName]) == TheOption.getNum()){//ANSWERED CORRECTLY

					document.write("<img src='../../biocoach/images/main/check.gif' border='0' width='21' height='20' alt='checkmark'><BR>");

				}else{//ANSWERED WRONG

					document.write("<img src='../../images/spacer.gif' border='0' width='20' height='20'><BR>");

				}// end if-else

				

			}else{

				//The choice is wrong

				if (String(Parameters[ParamName]) == TheOption.getNum()){

					document.write("<img src='../../biocoach/images/main/x.gif' border='0' width='21' height='21' alt='x'><BR>");

				}else{

					document.write("<img src='../../images/spacer.gif' border='0' width='20' height='20'><BR>");

				}//end if

			}//end if

		}//end if-else	

	}// end doCheckMarksRadio

	

	function doMessageForRadio(RInput, TheQuestion){

		if(!(reloadedPage) || String(Parameters[("radio"+TheQuestion.getNum())]) == "undefined"){

			//nothing

		}else{

				for(rCount=0; rCount<RInput.length; rCount++){

					if(RInput[rCount].checked){

						//Find the answer and then compare

						for(oCount=0;oCount<TheQuestion.getOptions().length; oCount++){

							if(TheQuestion.getOptions()[oCount].getAns()){//IF this is the Answer then compare

								//Found Answer

								if(TheQuestion.getOptions()[oCount].getNum() == RInput[rCount].value){

									//Matches so: Answered Correctly

									document.write("<FONT COLOR=\"#037550\">");

									document.write(TheQuestion.getMessagePos());

									document.write("</FONT>");

								}else{

									//Doesn't Match so: Answered Wrong

									document.write("<FONT COLOR=\"#FF0000\">");

									document.write(TheQuestion.getMessageNeg());

									document.write("</FONT>");

								}// end if

								return true; // did compare, now exit the function	

							}// end if

						}// end for

						//No Answer has been defined....

						return false; // exit the function

					}// end if

				}// end for

		}//end if

	}// end doMessageForRadio

	

	//Comments: This is a contructor for the Question Object

	//Parameters: TheNum is the Number (or letter) to be displayed for this Question.

	//Parameters: TheType is used to store teh type of question this is (radio, fillIn, pullDown)

	//Parameters: TheTitle is the title of the question.

	//Parameters: TheOptions is an array of Options for this Question Object.

	function Question(TheNum, TheType, TheTitle, TheMessagePos, TheMessageNeg){

		//Properties

		this.Num = TheNum; //number or letter to be displayed before the question.

		this.TypeOf = TheType; //radio, fillIn, or pullDown

		this.Title = TheTitle; // The Question Title

		this.QOptions = new Array(); //array of Option objects

		this.MessagePos = TheMessagePos;

		this.MessageNeg = TheMessageNeg;

		//Methods

		this.addOptToQues = addOptToQues;

		this.getTitle = getTitle;

		this.getNum = getNum;

		this.getOptions = getOptions;

		this.getTypeOf = getTypeOf;

		this.getMessagePos = getMessagePos;

		this.getMessageNeg = getMessageNeg;

	}// end Question object

	

	function QOption(TheNum, TheTitle, TheAnswer, TheMessagePos, TheMessageNeg){																																																												//Created by: Javier Castillo22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222//Rexoxox@aol.com

		//Properties

		this.Num = TheNum; //The Option Number

		this.Title = TheTitle; // The Option text

		this.IsAns = TheAnswer; // true, false (for type: radio) or string for type: pullDown

		//this.TypeOf = TheType; //void, Text or Inputbox (used for FillIn questions)

		this.MessagePos = TheMessagePos;

		this.MessageNeg = TheMessageNeg;

		//Methods

		this.getTitle = getTitle;

		this.getNum = getNum;

		this.getAns = getAns;

		this.getMessagePos = getMessagePos;

		this.getMessageNeg = getMessageNeg;

		//this.getTypeOf = getTypeOf;

	}// end Option object

	

	//Created by - Javier Castillo

	//Rexoxox@aol.com

	

	//Used for Both Question and Option

	function getTitle(){

		return this.Title;

	}

	function getNum(){

		return this.Num;

	}

	function getTypeOf(){

		return this.TypeOf;

	}

	function getMessagePos(){

		return this.MessagePos;

	}

	function getMessageNeg(){

		return this.MessageNeg;

	}

	

	//Used for only Question

	function getOptions(){

		return this.QOptions;

	}

	function addOptToQues(TheOption){

		this.QOptions[this.QOptions.length] = TheOption;

	}// end addOptToQues

	

	

	//Used for only Option

	function getAns(){

		return this.IsAns;

	}

	

	//The naming convetion for Radio buttons is: 

	//Question Number

	//Example name: RADIO1, RADIO2...

	function writeRadioBox(TheQuestion, TheOptionObj){

			if (String(Parameters[("radio"+TheQuestion.getNum())]) == "undefined"){

			

				document.write("<INPUT align=\"middle\" TYPE=\"radio\" NAME=\"radio" + TheQuestion.getNum() + "\" VALUE=" + TheOptionObj.getNum() +"> " + TheOptionObj.getNum()+".<BR>");

			}else if(String(Parameters[("radio"+TheQuestion.getNum())]) == TheOptionObj.getNum()){

				document.write("<INPUT align=\"middle\" TYPE=\"radio\" NAME=\"radio" + TheQuestion.getNum() + "\" VALUE=" + TheOptionObj.getNum() +" CHECKED> "+TheOptionObj.getNum()+".<BR>");

			}else{		

				document.write("<INPUT align=\"middle\" TYPE=\"radio\" NAME=\"radio" + TheQuestion.getNum() + "\" VALUE=" + TheOptionObj.getNum() +"> "+TheOptionObj.getNum()+".<BR>");

			}// end if

	}// end writeRadioBox

	

	//The naming convetion for Select boxes is: 

	//Question Number + Option Number or Name

	//Example name: 2a, 2b, 2c, 2d 

	function writeSelectBox(TheQuestion){

		//Write Select Box

		theSString = "<select name=\"SELECT" + TheQuestion.getNum() + "\">";

		//alert(theSString); //For Debugging

		document.write(theSString);

		document.write("<option value=\"\"></option>");

		

		//Loop through each option	

		for(var i=0; i<TheQuestion.getOptions().length; i++){

			//alert(String(Parameters[(TheQuestion.getNum() + TheOptionObj.getNum())]));

			if(String(Parameters[("SELECT" + TheQuestion.getNum())]) == "undefined"){//If option left blank, dont write anything and exits

				theOptionString = "<option value=\"" + TheQuestion.getOptions()[i].getTitle() + "\">" + TheQuestion.getOptions()[i].getTitle() + "</option>";

			}else if (returnNiceString(String(Parameters[("SELECT" + TheQuestion.getNum())])) == TheQuestion.getOptions()[i].getTitle()){

				theOptionString = "<option value=\"" + TheQuestion.getOptions()[i].getTitle() + "\" selected>" + TheQuestion.getOptions()[i].getTitle() + "</option>";

			}else{

				theOptionString = "<option value=\"" + TheQuestion.getOptions()[i].getTitle() + "\">" + TheQuestion.getOptions()[i].getTitle() + "</option>";

			}//end if

			document.write(theOptionString);

		}// end for

												

		document.write("</select>");

	}// end writeSelectBox

	



	//The naming convetion for Input boxes is: 																																									

	//Question Number + Option Number or Name

	//Example name: 3fillIn1, 3fillIn2 

	function writeInputBox(TheQuestion, TheOptionObj){

		if (TheOptionObj.getTitle() == ""){

			//Input box

			if (String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]) == "undefined"){

					theIBoxString = "<input type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\"> ";

					//alert((TheQuestion.getNum()+TheOptionObj.getNum()));

			}else if (String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]) == ""){

					theIBoxString = "<input type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\"> ";

			}else{

					var theString = returnNiceString(String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]));

					theIBoxString = "<input type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\" VALUE=\"" + theString + "\"> ";																									//Created by: Javier Castillo //Rexoxox@aol.com

			}// end if-else

			//alert(theIBoxString); //For Debugging

			document.write(theIBoxString);	

		}else{

			//Text

			document.write(TheOptionObj.getTitle());

		}// end if-else

	}// end writeInputBox

	

	function writeInputBoxFixedSize(TheQuestion, TheOptionObj, theSize){

		if (TheOptionObj.getTitle() == ""){

			//Input box

			if (String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]) == "undefined"){

					theIBoxString = "<input size= \"" + theSize + "\" type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\"> ";

					//alert((TheQuestion.getNum()+TheOptionObj.getNum()));

			}else if (String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]) == ""){

					theIBoxString = "<input size= \"" + theSize + "\" type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\"> ";

			}else{

					var theString = returnNiceString(String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]));

					theIBoxString = "<input size= \"" + theSize + "\" type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\" VALUE=\"" + theString + "\"> ";																									//Created by: Javier Castillo //Rexoxox@aol.com

			}// end if-else

			//alert(theIBoxString); //For Debugging

			document.write(theIBoxString);	

		}else{

			//Text

			document.write(TheOptionObj.getTitle());

		}// end if-else

	}// end writeInputBox



	function writeTextAreaFixedSize(TheQuestion, TheOptionObj, theSizeCol, theSizeRow){

		if (TheOptionObj.getTitle() == ""){

			//Input box

			if (String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]) == "undefined"){

					theIBoxString = "<textarea cols= \"" + theSizeCol + "\" rows= \"" + theSizeRow + "\" type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\"></textarea>";

					//alert((TheQuestion.getNum()+TheOptionObj.getNum()));

			}else if (String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]) == ""){

					theIBoxString = "<textarea cols= \"" + theSizeCol + "\" rows= \"" + theSizeRow + "\" type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\"></textarea>";

			}else{

					var theString = returnNiceString(String(Parameters[(TheQuestion.getNum()+TheOptionObj.getNum())]));

					theIBoxString = "<textarea cols= \"" + theSizeCol + "\" rows= \"" + theSizeRow + "\" type=\"text\" name=\"" + TheQuestion.getNum() + TheOptionObj.getNum() + "\">" + theString + "</textarea>";																									//Created by: Javier Castillo //Rexoxox@aol.com

			}// end if-else

			//alert(theIBoxString); //For Debugging

			document.write(theIBoxString);	

		}else{

			//Text

			document.write(TheOptionObj.getTitle());

		}// end if-else

	}// end writeInputBox

	

	function returnNiceString(daString){

		stringArray = daString.split("+");

		daString = stringArray.join(" ");

		stringArray = daString.split("%28");

		daString = stringArray.join("(");

		stringArray = daString.split("%29");

		daString = stringArray.join(")");

		return daString;

	}// end returnNiceString

	//Created by Javier Castillo

	//Rexoxox@aol.com

