var value_TypeOfSaving=-1;
var hashFlag=0;
var radioGrp1Value = "10_";
var radioGrp2Value = "20_";
var radioGrp3Value = "30_";
var checkBox1Value = "40_";
var checkBox2Value = "50_";
var checkBox3Value = "60_";
var checkBox4Value = "70_";
var checkBox5Value = "80";
	function  fillScreenContent_PreStep_SS()
	{
		currentStep = 0;
		updateComponent('txtPreStep_Heading',strPreStep_heading);
		updateComponent('lblTypeOfSaving_SS',strLabelPre_typeOfSaving_SS);
		updateComponent('lblRadioMySelf_SS', strLabel_QG1_radio0);
		updateComponent('lblMyChild_SS', strLabel_QG1_radio1);
		updateComponent('txtPreStep_introTxt_1_SS',strPreStep_introTxt_1_SS);
		document.getElementById('volgendebutton_SS').title=strTextPre_volgendeAlt_SS;
				
	}
	
	function  fillScreenContent_Step1()
	{
		currentStep = 1;	
		var strQuery = unescape(window.location.search.substring(1));	
		if (strQuery.substr(0,3)=='pos')
		  strQuery = removePos(strQuery);
		var arrTmpParams = strQuery.split('&');
		var intPos = arrTmpParams[0].indexOf('=');
		if (intPos > 0)
	      value_TypeOfSaving = arrTmpParams[0].substring(intPos+1);
		fo.question1a.checked = false;
        fo.question1b.checked = false;
		updateComponent('txtStep1_heading',strStep1_heading);
		updateComponent('txtStep1_introTxt_1',strStep1_introTxt_1);
		updateComponent('txtStep1Right_heading',strStep1Right_heading);
		updateComponent('txtQuestion_heading_active',strQuestion_heading);
		updateComponent('txtQuestion_heading_inactive',strQuestion_heading);
		updateComponent('txtAnswer_heading_active',strAnswer_heading);
		updateComponent('txtAnswer_heading_inactive',strAnswer_heading);
		updateComponent('lblRadioGrp1',strLabel_radioGroup1);
		updateComponent('lblRadioGrp2',strLabel_radioGroup2);
		updateComponent('lblRadioGrp3', strLabel_radioGroup3);
		updateComponent('lblcheckgrp4', strLabel_checkGroup4);
		updateComponent('lblRadioGrp1a', strLabel_QG1_radio0);
		updateComponent('lblRadioGrp1b', strLabel_QG1_radio1);
		updateComponent('lblRadioGrp2a', strLabel_QG2_radio0);
		updateComponent('lblRadioGrp2b', strLabel_QG2_radio1);
		updateComponent('lblRadioGrp3a', strLabel_QG3_radio0);
		updateComponent('lblRadioGrp3b', strLabel_QG3_radio1);
		updateComponent('lblcheckgrp4a', strLabel_QG4_check0);
		updateComponent('lblcheckgrp4b', strLabel_QG4_check1);
		updateComponent('lblcheckgrp4c', strLabel_QG4_check2);
		updateComponent('lblcheckgrp4d', strLabel_QG4_check3);
		updateComponent('lblcheckgrp4e', strLabel_QG4_check4);
		updateComponent('step1Disclaimer', strLabel_disclaimer);
		hideComponent('divAnswer_active');
		hideComponent('Question_inactive');
		hideComponent('divRadioGrp2');
		hideComponent('divRadioGrp3');
		hideComponent('divRadioGrp4');
		for(i=1;i<8;i++)
        {   
	       hideComponent(eval('sp'+i+'id'));
        }
		fillStoreValues();
		
		if(hashFlag==0)
		{
			if(parseInt(value_TypeOfSaving)==0)
			{ 
				fo.question1a.checked=true;			
				selection1();
			}
			else if(parseInt(value_TypeOfSaving)==1)
			{		
				fo.question1b.checked=true;
				selection2();
			}
		}
		
	}
	
	function validate_PreStep_SS(e){	
		var params="0="+getRadioValue(document.IAM_PreStep_SS.radioName);
		YAHOO.util.Event.preventDefault(e);	
			location.href=strURL_step1+'?pos='+strOmniture_variable+'&'+params;
			return false;	
			
	}

	
function GenKredietDiv(id,content,contentlink,amount,text,aanvragenlink,omniture_variable,srcButton,ButtonAlt)
{ 	
	return('<div id="'+id+ '" class="kredietforms "><h4 class="content"><a class="content" href="'+contentlink+'?pos='+omniture_variable+'">'+content+'</a></h4><p style="padding-bottom:1px"><b>'+amount+'</b><br></p><p style="padding:0 7px 7px 6px;  text-align:left;">'+text+'</p>           <div style="padding-top:35px;">  <a  href="'+aanvragenlink+'?pos='+omniture_variable+'"><img src="'+srcButton+'" title="'+ButtonAlt+'"  /></a></div>  </div>');
}
	
function SpecificKredietDiv(id,content,contentlink,amount,text,aanvragenlink,omniture_variable_a,omniture_variable_b,srcButton,ButtonAlt)
{ 	
	return('<div id="'+id+ '" class="kredietforms "><h4 class="content"><a class="content" href="'+contentlink+'?pos='+omniture_variable_a+'">'+content+'</a></h4><p style="padding-bottom:1px"><b>'+amount+'</b><br></p><p style="padding:0 7px 7px 6px;  text-align:left;">'+text+'</p>           <div style="padding-top:35px;">  <a  href="'+aanvragenlink+'?pos='+omniture_variable_b+'"><img src="'+srcButton+'" title="'+ButtonAlt+'"  /></a></div>  </div>');
}
	
function GenAdviceDiv(id,content,text)
{
	return('<div id="'+id+ '" class="kredietforms "><h4 >'+content+'</h4><br><br><p style="padding:0 7px 7px 6px;  text-align:left;">'+text+'</p> </div>'); 
}	
	
function GenLayer()
{
	var content = '&nbsp;'
	
	for(i=1;i<=8;i++)
	{   
	    if(i==8)
		 content=content+GenAdviceDiv(eval('sp'+i+'id'),eval('sp'+i),eval('sp'+i+'text'));
		else if(i === 1 || i === 2 || i === 3 || i === 4 || i === 6 || i === 7)
		{
		 content=content+SpecificKredietDiv(eval('sp'+i+'id'),eval('sp'+i),eval('sp'+i+'contentlink'),eval('sp'+i+'amount'),eval('sp'+i+'text'),eval('sp'+i+'A'),eval('sp'+i+'Omniture_variable_a'),eval('sp'+i+'Omniture_variable_b'),eval('sp'+i+'URL_Button'),eval('sp'+i+'Text_aanvragenAlt'));	
		}
		else
		{
			content=content+GenKredietDiv(eval('sp'+i+'id'),eval('sp'+i),eval('sp'+i+'contentlink'),eval('sp'+i+'amount'),eval('sp'+i+'text'),eval('sp'+i+'A'),eval('sp'+i+'Omniture_variable'),eval('sp'+i+'URL_Button'),eval('sp'+i+'Text_aanvragenAlt'));
		}
	}					
	
	document.write(content);
}
	

function showForm(obj)
{	
	storeInputValues(obj);
	switch(obj)
	{
	case 1:	
		selection1();	
		break;
		
	case 2:
		selection2();					
		break;
		
	case 3: 
		selection3();
		break;
		
	case 4: 
		selection4();
		break;
		
	case 5:
        selection5();
	    break;
	   
	case 6:	
		selection6();					
		break; 
		
	case 7:	
		selection7();					
		break; 	
				
	default: break;
	} 
		
}


function  selection1()
{
	
    hideUnhide1();
    fo.question3a.checked = false;
    uncheck();
    hideComponent('divRadioGrp2');
    hideComponent('divRadioGrp4');
    unhideComponent('divRadioGrp3');	
    for(i=1;i<=8;i++)
    {   
	 hideComponent(eval('sp'+i+'id'));
    }
}

function  selection2()
{
    hideUnhide1();
    fo.question3a.checked = false;
    uncheck();
    hideComponent('divRadioGrp3');
    hideComponent('divRadioGrp4');
    unhideComponent('divRadioGrp2');
  
   for(i=1;i<=8;i++)
   {   
	 hideComponent(eval('sp'+i+'id'));
   }
}

function  selection3()
{
   hideUnhide2();
   hideComponent('divBK');
   hideComponent('divBTK');
   unhideComponent('divOK');
}

function  selection4()
{
   hideUnhide2();
  
   hideComponent('divOK');
   unhideComponent('divBK');
   unhideComponent('divBTK');
}

function  selection5()
{ 
   hideUnhide2();
   uncheck();
   hideComponent('divRadioGrp4');
   for(i=1;i<=8;i++)
   {   
	 hideComponent(eval('sp'+i+'id'));
   }
   unhideComponent('divOK1');
   unhideComponent('divBK');
}

function  selection6()
{ 
   hideUnhide1();
   hideComponent('divOK');
   hideComponent('divBK');
   unhideComponent('divRadioGrp4');
}

function  selection7()
{ 
   hideUnhide1();
   for(i=1;i<=8;i++)
     {   
	  hideComponent(eval('sp'+i+'id'));
     }
   if(fo.question4a.checked == true )
     {
	  hideUnhide2();
	  unhideComponent('divBK');
	  unhideComponent('divBTK');
	  unhideComponent('divBSH');
	 }
   if(fo.question4b.checked == true )
     {
	  hideUnhide2();
	  unhideComponent('divOK1');
	  unhideComponent('divBTK');
	  unhideComponent('divBK');
	 }	 
   if(fo.question4c.checked == true )
     {
	  hideUnhide2();
	  unhideComponent('divBK');
	  unhideComponent('divBTK');
	  unhideComponent('divAAL');
	}
   if(fo.question4d.checked == true )
     {
	  hideUnhide2();
	  unhideComponent('divBK');
	  unhideComponent('divOK1');
	 } 	 
   if(fo.question4e.checked == true )
     {
	  hideUnhide2();
	  unhideComponent('divAOM');
	 }
	  
}


function hideUnhide2()
{
   unhideComponent('Question_inactive');
   unhideComponent('divAnswer_active');
   hideComponent('Question_active');
   hideComponent('divAnswer_inactive'); 
 
}

function hideUnhide1()
{  
   hideComponent('Question_inactive');
   hideComponent('divAnswer_active');
   unhideComponent('Question_active');
   unhideComponent('divAnswer_inactive');  

}

function uncheck()
{
  fo.question2a.checked = false;
  fo.question2b.checked = false;
  fo.question3b.checked = false;
  fo.question4a.checked = false;
  fo.question4b.checked = false;
  fo.question4c.checked = false;
  fo.question4d.checked = false;
  fo.question4e.checked = false;
}

function fillStoreValues()
	{
		
		if(window.location.hash != '')
		{
			var storedValue = window.location.hash;
			var startIndex=storedValue.indexOf('#');
			var storedRadioGrp1Value= storedValue.substring(startIndex+1,3);
			var storedRadioGrp2Value= storedValue.substring(startIndex+4,6);
			var storedRadioGrp3Value= storedValue.substring(startIndex+7,9);
			var storedCheckBox1Value= storedValue.substring(startIndex+10,12);
			var storedCheckBox2Value= storedValue.substring(startIndex+13,15);
			var storedCheckBox3Value= storedValue.substring(startIndex+16,18);
			var storedCheckBox4Value= storedValue.substring(startIndex+19,21);
			var storedCheckBox5Value= storedValue.substring(startIndex+22,24);
				if(storedRadioGrp1Value == "11")
				{
					hashFlag=1;
					fo.vraag1[0].checked = true;
					selection1();
				}
				else if(storedRadioGrp1Value == "12")
				{
					hashFlag=1;
					fo.vraag1[1].checked = true;
					selection2();
				}
				if(storedRadioGrp2Value == "21")
				{
					hashFlag=1;
					fo.vraag2[0].checked = true;
					selection3();
				}
				else if(storedRadioGrp2Value == "22")
				{
					hashFlag=1;
					fo.vraag2[1].checked = true;
					selection4();
				}
				if(storedRadioGrp3Value == "31")
				{
					hashFlag=1;
					fo.vraag3[0].checked = true;
					selection5();
				}
				else if(storedRadioGrp3Value == "32")
				{
					hashFlag=1;
					fo.vraag3[1].checked = true;
					selection6();
				}
				if(storedCheckBox1Value=="41")
				{
					hashFlag=1;
					document.getElementById('question4a').checked=true;
					selection7();
				}
				
				if(storedCheckBox2Value=="51")
				{
					hashFlag=1;
					document.getElementById('question4b').checked=true;
					selection7();
				}
				
				if(storedCheckBox3Value=="61")
				{
					hashFlag=1;
					document.getElementById('question4c').checked=true;
					selection7();
				}
				
				if(storedCheckBox4Value=="71")
				{
					hashFlag=1;
					document.getElementById('question4d').checked=true;
					selection7();
				}
				
				if(storedCheckBox5Value=="81")
				{
					hashFlag=1;
					document.getElementById('question4e').checked=true;
					selection7();
				}
				
			
	
		}
	}	
function storeInputValues(id)
	{	
		if(id=="1"){
		radioGrp1Value = "11_";
		radioGrp2Value = "20_";
		radioGrp3Value = "30_";
		}
		if(id=="2"){
		radioGrp1Value = "12_";
		radioGrp2Value = "20_";
		radioGrp3Value = "30_";
		}
		if(id=="3"){
		radioGrp1Value = "12_";
		radioGrp2Value = "21_";
		}
		if(id=="4"){
		radioGrp1Value = "12_";
		radioGrp2Value = "22_";
		}
		if(id=="5"){
		radioGrp1Value = "11_";
		radioGrp3Value = "31_";
		}
		if(id=="6"){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		}
		if(id=="7" && document.getElementById('question4a').checked==true){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox1Value = "41_";
		}
		else if(id=="7" && document.getElementById('question4a').checked==false){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox1Value = "40_";
		}
		if(id=="7" && document.getElementById('question4b').checked==true){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox2Value = "51_";
		}
		else if(id=="7" && document.getElementById('question4b').checked==false){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox2Value = "50_";
		}
		if(id=="7" && document.getElementById('question4c').checked==true){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox3Value = "61_";
		}
		else if(id=="7" && document.getElementById('question4c').checked==false){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox3Value = "60_";
		}
		if(id=="7" && document.getElementById('question4d').checked==true){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox4Value = "71_";
		}
		else if(id=="7" && document.getElementById('question4d').checked==false){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox4Value = "70_";
		}
		if(id=="7" && document.getElementById('question4e').checked==true){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox5Value = "81";
		}
		else if(id=="7" && document.getElementById('question4e').checked==false){
		radioGrp1Value = "11_";
		radioGrp3Value = "32_";
		checkBox5Value = "80";
		}
		window.location.hash =radioGrp1Value+radioGrp2Value+radioGrp3Value+checkBox1Value+checkBox2Value+checkBox3Value+checkBox4Value+checkBox5Value;
		
	}
