// starting the script on page load
$(document).ready(function(){
						   
var $paneTarget = $('#savingsSelectorTool');

/*------------- INTRO PANEL FUNCTIONALITY -------------*/

 $('#introBtn').click(function(){
		
			scrollToPanel('#panel1');	 
			
 }); 

/*------------- FIRST PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ1').click(function(){
		
		if (jQuery('#question1:checked').val() == 'a1')
 		{
			scrollToPanel('#panel2');
		}
		
		if (jQuery('#question2:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel17');	 
 		}
	
				
 }); 
 
  $('#backBtnQ1').click(function(){
		
			scrollToPanel('#introPanel');
		
 });
	
/*------------- SECOND PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ2').click(function(){
		
		if (jQuery('#question2form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#panel10');	
		}	
		
		if (jQuery('#question2form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#panel3');
		}
		
		if (jQuery('#question2form input:radio:checked').val() == 'a3')
 		{
			scrollToPanel('#panel6');	 
 		}
		
 }); 
 
   $('#backBtnQ2').click(function(){
		
			scrollToPanel('#panel1');
		
 });
 
 /*------------- THIRD PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ3').click(function(){
		
		if (jQuery('#question3form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#panel4');
 		}
			if (jQuery('#question3form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#panel15');
 		}	
		
		
 }); 
 
 $('#backBtnQ3').click(function(){
		
			scrollToPanel('#panel2');
		
 });
 
  /*------------- FOURTH PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ4').click(function(){
		
		if (jQuery('#question4form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel1');
 		}	
			if (jQuery('#question4form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel1');
 		}	
			if (jQuery('#question4form input:radio:checked').val() == 'a3')
 		{
			scrollToPanel('#resultPanel2');
 		}
				if (jQuery('#question4form input:radio:checked').val() == 'a4')
 		{
			scrollToPanel('#resultPanel2');
 		}	
		
 }); 

 $('#backBtnQ4').click(function(){
		
			scrollToPanel('#panel3');
		
 });
 
   /*------------- 15th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ15').click(function(){
		
		if (jQuery('#question15form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel3');
 		}	
			if (jQuery('#question15form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel3');
 		}	
			if (jQuery('#question15form input:radio:checked').val() == 'a3')
 		{
			scrollToPanel('#resultPanel18');
 		}
				if (jQuery('#question15form input:radio:checked').val() == 'a4')
 		{
			scrollToPanel('#resultPanel18');
 		}	
		
 }); 

 $('#backBtnQ15').click(function(){
		
			scrollToPanel('#panel3');
		
 });
 
 /*------------- RESULT PANEL 1,2 FUNCTIONALITY -------------*/


 $('.backBtnR1').click(function(){
		
			scrollToPanel('#panel4');
		
 });
 
  /*------------- RESULT PANEL 3,17 FUNCTIONALITY -------------*/


 $('.backBtnR3').click(function(){
		
			scrollToPanel('#panel15');
		
 });
 
   /*------------- 5th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ5').click(function(){
		
		if (jQuery('#question5form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel4');
 		}	
			if (jQuery('#question5form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel5');
 		}	
	
		
 }); 

 $('#backBtnQ5').click(function(){
		
			scrollToPanel('#panel3');
		
 });
 
  /*------------- RESULT PANEL 4,5 FUNCTIONALITY -------------*/


 $('.backBtnR4').click(function(){
		
			scrollToPanel('#panel5');
		
 });
 
    /*------------- 6th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ6').click(function(){
		
		if (jQuery('#question6form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#panel7');
 		}	
			if (jQuery('#question6form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#panel8');
 		}	
	
		
 }); 

 $('#backBtnQ6').click(function(){
		
			scrollToPanel('#panel2');
		
 });
 
/*------------- 7th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ7').click(function(){
		
		if (jQuery('#question7form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel6');
 		}	
			if (jQuery('#question7form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel6');
 		}	
			if (jQuery('#question7form input:radio:checked').val() == 'a3')
 		{
			scrollToPanel('#resultPanel7');
 		}	
			if (jQuery('#question7form input:radio:checked').val() == 'a4')
 		{
			scrollToPanel('#resultPanel7');
 		}	
	
		
 }); 

 $('#backBtnQ7').click(function(){
		
			scrollToPanel('#panel6');
		
 });
 
   /*------------- RESULT PANEL 6,7 FUNCTIONALITY -------------*/


 $('.backBtnR6').click(function(){
		
			scrollToPanel('#panel7');
		
 });
 
 /*------------- 8th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ8').click(function(){
		
		if (jQuery('#question8form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#panel9');
 		}	
			if (jQuery('#question8form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#panel9');
 		}	
			if (jQuery('#question8form input:radio:checked').val() == 'a3')
 		{
			scrollToPanel('#resultPanel10');
 		}	
			if (jQuery('#question8form input:radio:checked').val() == 'a4')
 		{
			scrollToPanel('#resultPanel10');
 		}	
	
		
 }); 

 $('#backBtnQ8').click(function(){
		
			scrollToPanel('#panel6');
		
 });
 
  /*------------- 9th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ9').click(function(){
		
		if (jQuery('#question9form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel8');
 		}	
			if (jQuery('#question9form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel9');
 		}	
	
	
		
 }); 

 $('#backBtnQ9').click(function(){
		
			scrollToPanel('#panel8');
		
 });
 
 
  
   /*------------- RESULT PANEL 8,9 FUNCTIONALITY -------------*/


 $('.backBtnR8').click(function(){
		
			scrollToPanel('#panel9');
		
 });
 
    /*------------- RESULT PANEL 10 FUNCTIONALITY -------------*/


 $('.backBtnR10').click(function(){
		
			scrollToPanel('#panel8');
		
 });
 
 
   /*------------- 10th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ10').click(function(){
		
		if (jQuery('#question10form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#panel11');
 		}	
			if (jQuery('#question10form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#panel12');
 		}	
	
	
		
 }); 

 $('#backBtnQ10').click(function(){
		
			scrollToPanel('#panel2');
		
 });
 
    /*------------- 11th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ11').click(function(){
		
		if (jQuery('#question11form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel11');
 		}	
			if (jQuery('#question11form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel11');
 		}	
			if (jQuery('#question11form input:radio:checked').val() == 'a3')
 		{
			scrollToPanel('#resultPanel12');
 		}	
			if (jQuery('#question11form input:radio:checked').val() == 'a4')
 		{
			scrollToPanel('#resultPanel12');
 		}	
	
	
		
 }); 

  $('#backBtnQ11').click(function(){
		
			scrollToPanel('#panel10');
		
 });
 
     /*------------- RESULT PANEL 11,12 FUNCTIONALITY -------------*/


 $('.backBtnR11').click(function(){
		
			scrollToPanel('#panel11');
		
 });

     /*------------- 12th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ12').click(function(){
		
		if (jQuery('#question12form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#panel13');
 		}	
			if (jQuery('#question12form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#panel13');
 		}	
			if (jQuery('#question12form input:radio:checked').val() == 'a3')
 		{
			scrollToPanel('#panel14');
 		}	
			if (jQuery('#question12form input:radio:checked').val() == 'a4')
 		{
			scrollToPanel('#panel14');
 		}	
	
	
		
 }); 

  $('#backBtnQ12').click(function(){
		
			scrollToPanel('#panel10');
		
 });
  
       /*------------- 13th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ13').click(function(){
		
		if (jQuery('#question13form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel13');
 		}	
			if (jQuery('#question13form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel14');
 		}	
	
	
	
		
 }); 

  $('#backBtnQ13').click(function(){
		
			scrollToPanel('#panel12');
		
 });
  
 /*------------- RESULT PANEL 13,14 FUNCTIONALITY -------------*/


 $('.backBtnR13').click(function(){
		
			scrollToPanel('#panel13');
		
 });
 
 
        /*------------- 14th PANEL FUNCTIONALITY -------------*/

 $('#nextBtnQ14').click(function(){
		
		if (jQuery('#question14form input:radio:checked').val() == 'a1')
 		{
			scrollToPanel('#resultPanel15');
 		}	
			if (jQuery('#question14form input:radio:checked').val() == 'a2')
 		{
			scrollToPanel('#resultPanel16');
 		}	
	
	
	
		
 }); 

  $('#backBtnQ14').click(function(){
		
			scrollToPanel('#panel12');
		
 });
  
   /*------------- RESULT PANEL 15,16 FUNCTIONALITY -------------*/


 $('.backBtnR15').click(function(){
		
			scrollToPanel('#panel14');
		
 });
 
    /*------------- RESULT PANEL 17 FUNCTIONALITY -------------*/


 $('.backBtnR17').click(function(){
		
			scrollToPanel('#panel1');
		
 });


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  /*------------- START AGAIN FUNCTIONALITY -------------*/


 $('.startAgain').click(function(){
		
			scrollToPanel('#introPanel');
		
 });





function scrollToPanel(panel){
	$paneTarget.stop().scrollTo( panel , 400);
}



});//end of jquery pageload


