 
/***********************************************
* I do stuff here
***********************************************/
var score1=0;
var score2=0;
var score3=0;
var score4=0;

//the next four functions grade 4 questions each - these will be used for the 4 personality factors


function gradeit1(){
// grade the first set of questions
score1= 0*1;
for (q=1;q<=4;q++){
	var thequestion=eval("document.myquiz.question"+q)
	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true)
			score1 = (score1 *1 ) + (thequestion[c].value * 1);
		}
}
//alert('The score of the first quiz is ' + score1 );
//document.getElementById("quiz1").style.visibility = "hidden";
//document.getElementById("quiz1").style.display = "none";
//document.getElementById("quiz2").style.visibility = "visible";
//document.getElementById("quiz2").style.display = "inline";
}

function gradeit2(){
// grade the first set of questions
score2= 0*1;
for (q=5;q<=8;q++){
	var thequestion=eval("document.myquiz.question"+q)
	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true)
			score2 = (score2 *1 ) + (thequestion[c].value * 1);
		}
}
//alert('The score of the first quiz is ' + score2 );
//document.getElementById("quiz2").style.visibility = "hidden";
//document.getElementById("quiz2").style.display = "none";
//document.getElementById("quiz3").style.visibility = "visible";
//document.getElementById("quiz3").style.display = "inline";
}

function gradeit3(){
// grade the first set of questions
score3= 0*1;
for (q=9;q<=12;q++){
	var thequestion=eval("document.myquiz.question"+q)
	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true)
			score3 = (score3 *1 ) + (thequestion[c].value * 1);
		}
}
//alert('The score of the first quiz is ' + score3 );
//document.getElementById("quiz3").style.visibility = "hidden";
//document.getElementById("quiz3").style.display = "none";
//document.getElementById("quiz4").style.visibility = "visible";
//document.getElementById("quiz4").style.display = "inline";
}

function gradeit4(){


// grade the first set of questions
score4= 0*1;
for (q=13;q<=16;q++){
	var thequestion=eval("document.myquiz.question"+q)
	for (c=0;c<thequestion.length;c++){
		if (thequestion[c].checked==true)
			score4 = (score4 *1 ) + (thequestion[c].value * 1);
		}
}
//alert('The score of the first quiz is ' + score4 );

//Now we get outselves a string and open up the appropriate page
var thePage = generateType();

//quizcontent = 'This is the content. This can be changed in javascript on line 103. The score of the first quiz is ' + thePage;
 
results(thePage);

//document.getElementById(thePage).style.visibility = 'visible';


}


function results(divlocation) {


$("#" + divlocation).fadeIn();




if (divlocation = 'ESTJ') { 
$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');
} 


if (divlocation = 'ISTJ') { 
$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');
} 

if (divlocation = 'ESFJ') { 
$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');
} 


if (divlocation = 'ESTP') { 
$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 



if (divlocation = 'ISTP') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 

if (divlocation = 'ESFP') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 



if (divlocation = 'ISFP') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 



if (divlocation = 'ENTJ') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 

if (divlocation = 'INTJ') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 

if (divlocation = 'ENTP') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 


if (divlocation = 'INTP') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 


if (divlocation = 'ENFJ') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 

if (divlocation = 'INFJ') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 


if (divlocation = 'ENFP') { 

$("#poiList").html('<li title="food" id="pizza" name="pizza">Pizza</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 
if (divlocation = 'INFP') { 

$("#poiList").html('<li title="food" id="gym" name="gym">gym</li><li title="restaurant" id="restaurantgourmet" name="restaurant">restaurants</li>');

} 


/*
$("#" + divlocation).fadeIn("slow");
*/


$("#full_quiz").hide('slow');

htmlval = $("#" + divlocation).html();

$("#scroller_4").fadeIn(htmlval);

 
camefrom = 4;
$("#content_1").hide("slow");


$("#content_" + camefrom).fadeIn("slow");
loaded(camefrom);

//$("#quizresult").html(content);

/*
	setTimeout( function() {
		document.ontouchmove = function(e) { e.preventDefault(); return false; }
		myScroll = new iScroll( document.getElementById('scroller_4') );
	}, 100);

alert('a');
*/

}

function generateType() {

//here we take the results and make the appropriate page

var theString = "";
	//part 1 - positive - E - Negative - I
	if (score1 >= 0){
		theString = theString + "E";
	} else {
		theString = theString + "I";
	}

	//part 2 - positive - S - Negative - N
		if (score2 >= 0){
			theString = theString + "S";
		} else {
			theString = theString + "N";
	}

	//part 3 - positive - T - Negative - F
		if (score3 >= 0){
			theString = theString + "T";
		} else {
			theString = theString + "F";
	}

	//part 4 - positive - J - Negative - P
		if (score4 >= 0){
			theString = theString + "J";
		} else {
			theString = theString + "P";
	}

	return theString;

}

function showMap() {
//showContent('map');

	$("#footer").hide();
	$("#labelAssess").hide();
	$("#content_4").hide();		
	
	
$("#content_1").hide("slow");
$("#content_map").fadeIn("slow"); 

		      
OnLoad();
 
 
//$("#fullNav").hide("slow");



}

function showResultsDiv() {

	$("#content_4").fadeIn('slow');	
	$("#content_map").hide('slow');	
	$("#footer").fadeIn('slow');	
		
}


var manager = new jsAnimManager();

function animation1() {

        shroom = document.getElementById("mushroom");

	manager.registerPosition("mushroom");

    shroom.setPosition(-200,265);

    var anim = manager.createAnimObject("mushroom");
	var anim22 = manager.createAnimObject("mushroom");

    anim.add({property: Prop.position, to: new Pos(10,290),
        duration: 1000, ease: jsAnimEase.backout(0.62)});
	anim.add({property: Prop.wait, duration: 1800});
	anim.add({property: Prop.dimension, to: new Dim(43,43),
    duration: 500});
	anim22.add({property: Prop.wait, duration: 2700});
	anim22.add({property: Prop.position, to: new Pos(104,492),
    duration: 700});

    shroom = document.getElementById("mushroom1");

manager.registerPosition("mushroom1");

shroom.setPosition(60,230);

var anim1 = manager.createAnimObject("mushroom1");

anim1.add({property: Prop.wait, duration: 500});
anim1.add({property: Prop.dimension, to: new Dim(100,100),
    duration: 500});
anim1.add({property: Prop.positionCircle(true), to: new Pos(60,325),
    duration: 1000, ease: jsAnimEase.parabolicNeg});
anim1.add({property: Prop.wait, duration: 400});
anim1.add({property: Prop.position, to: new Pos(90,220),
        duration: 800, ease: jsAnimEase.backin(0.62)});
anim1.add({property: Prop.position, to: new Pos(-115,310), duration: 11000, loop:-1, ease: jsAnimEase.bounceSmooth});

	    shroom = document.getElementById("mushroom23");

manager.registerPosition("mushroom23");

shroom.setPosition(45,210);

var anim1 = manager.createAnimObject("mushroom23");

anim1.add({property: Prop.wait, duration: 600});
anim1.add({property: Prop.dimension, to: new Dim(70,70),
    duration: 500});
anim1.add({property: Prop.positionCircle(false), to: new Pos(45,300),
    duration: 700, ease: jsAnimEase.parabolicPos});
	anim1.add({property: Prop.wait, duration: 600});
anim1.add({property: Prop.position, to: new Pos(80,330),
        duration: 800, ease: jsAnimEase.backin(0.62)});
anim1.add({property: Prop.position, to: new Pos(-15,220), duration: 14000, loop:-1, ease: jsAnimEase.bounceSmooth});


shroom = document.getElementById("mushroom77");

manager.registerPosition("mushroom77");

shroom.setPosition(85,250);

var anim23a = manager.createAnimObject("mushroom77");

anim23a.add({property: Prop.wait, duration: 700});
anim23a.add({property: Prop.dimension, to: new Dim(90,90),
    duration: 800});
anim23a.add({property: Prop.positionCircle(false), to: new Pos(85,300),
    duration: 700, ease: jsAnimEase.parabolicPos});
anim23a.add({property: Prop.wait, duration: 200});
anim23a.add({property: Prop.position, to: new Pos(-140,290),
        duration: 800, ease: jsAnimEase.backin(0.62)});
anim23a.add({property: Prop.position, to: new Pos(115,240), duration: 19000, loop:-1, ease: jsAnimEase.bounceSmooth});

	shroom = document.getElementById("mushroom70");

manager.registerPosition("mushroom70");

shroom.setPosition(65,290);

var anim23b = manager.createAnimObject("mushroom70");

anim23b.add({property: Prop.wait, duration: 600});
anim23b.add({property: Prop.dimension, to: new Dim(50,50),
    duration: 700});
anim23b.add({property: Prop.positionCircle(true), to: new Pos(65,320),
    duration: 700, ease: jsAnimEase.parabolicPos});
anim23b.add({property: Prop.wait, duration: 400});
anim23b.add({property: Prop.position, to: new Pos(-90,210),
        duration: 800, ease: jsAnimEase.backin(0.62)});
anim23b.add({property: Prop.position, to: new Pos(115,330), duration: 12000, loop:-1, ease: jsAnimEase.bounceSmooth});


var anim5 = manager.createAnimObject("footer");

   anim5.add({property: Prop.wait, duration: 3300});
    anim5.add({property: Prop.backgroundColor, to: new Col(255,255,0),
        duration:1000});

		    shroom = document.getElementById("mushroom3");

manager.registerPosition("mushroom3");

shroom.setPosition(110,21);

var anim5a = manager.createAnimObject("mushroom3");

   anim5a.add({property: Prop.wait, duration: 3100});
anim5a.add({property: Prop.dimension, to: new Dim(0,0),
    duration: 5});

shroom = document.getElementById("DHGlogobox");

manager.registerPosition("DHGlogobox");

shroom.setPosition(-300,27);

var anim6a = manager.createAnimObject("DHGlogobox");

	 anim6a.add({property: Prop.wait, duration: 4000});
	 anim6a.add({property: Prop.position, to: new Pos(-120,27),
        duration: 1000, ease: jsAnimEase.backout(0.62)});

shroom = document.getElementById("DHGlogo");

manager.registerPosition("DHGlogo");

shroom.setPosition(-300,16);

var anim6b = manager.createAnimObject("DHGlogo");

	 anim6b.add({property: Prop.wait, duration: 4800});
	 anim6b.add({property: Prop.position, to: new Pos(-90,16),
        duration: 1000, ease: jsAnimEase.backout(0.62)});


}


function show_next_q(camefrom) {
next = camefrom + 1;
$("#quiz_" + camefrom).hide();
$("#quiz_" + next).fadeIn('5000');
}

function show_prev_q(camefrom) {
next = camefrom - 1;
$("#quiz_" + camefrom).hide();
$("#quiz_" + next).fadeIn('5000');
}


 
