/*
    
   
    $Log: kompass.js,v $
    Revision 1.5  2009/01/09 13:10:51  cvsosir
    Added CVS subtitute command

    Revision 1.4  2009/01/08 18:06:43  cvsosir
    *** empty log message ***
    Revision 1.3  2009/01/08 18:00:03  cvsosir
    *** empty log message ***
*/

/* This script is used in "Investment Kompass". It makes the functions of tabNav available.*/
var myKompassTabNav;

/* To initialize the tabNav object@param1 sessionId*/
function initKompassTabNav(sessionId)
{    
	myKompassTabNav=new TabNavDev(sessionId,'!KompassContentDataParser','contentData',false,'kompassTab',false);
}

/* Is used to return the content data@param1 The tab that should be activated@param2 The radioObj/answer that got chosen by the user */
function getKompassData(tab,radioObj)
{ 	 		
	var paramNames=[];
 	var paramValues=[];
 	
 	radioValue=getRadioValue(radioObj);
	//when the user did chose an answer
	if(radioValue!=false) 		
	{
		$('hint').toggleClassName('hideHint'); 
		radioName=radioObj[0].name; 
		//every radio button has the same name 
		paramNames[0]=radioName;
		paramValues[0]=radioValue;
		//when there are additional hidden parameters pass them within the parameter
		try	 		
		{		 			
			paramValues[1]=$('frage1').getValue();
			paramNames[1]='frage1';
		}	 		
		catch(err)
		{	
		}	 
		
		try	 		
		{	 			
			paramValues[2]=$('frage2').getValue();	 			
			paramNames[2]='frage2';	 				 				 		
		}
		catch(err)	 		
		{	 			 		
		}	 			 		
		try	 		
		{	 			
			paramValues[3]=$('frage3').getValue();	 			
			paramNames[3]='frage3';	 			 		
		}
		catch(err)	 		
		{	 			 		
		}	 			 		
		
		try	 		
		{	 			
			paramValues[4]=$('frage4').getValue();	 			
			paramNames[4]='frage4';	 			 		
		}
		catch(err)	 		
		{	 			 		
		}	 			 		
		
		try	 		
		{	 			
			paramValues[5]=$('frage5').getValue();	 			
			paramNames[5]='frage5';	 			 		
		}
		catch(err)	 		
		{	 			 		
		}	 			 			 		
		
		//passing a list of parameters to the parser...	 		
		myKompassTabNav.publicGetTabDataByParams(tab,paramNames,paramValues	);	 	
	}	 	
	else	 	
	{	 		
		//when the user did not chose an answer...	 		
		//show a hint	 		
		//$('hint').toggleClassName('showHint');	 		
		$('hint').removeClassName('hideHint');	 		
		$('hint').addClassName('showHint');	 	
	}			 	     
}
function getKompassContent (tab)
{	
	myKompassTabNav.publicGetTabData(tab);
}

/* Returns the value of the radio button that is checked*/
function getRadioValue(radioObj)
{    
	for (var i=0; i<radioObj.length; i++)
	
	if (radioObj[i].checked)
	 	return radioObj[i].value;
	 
	 return false;
}

function toggleDisplay ( id ) 
{  
	if (document.getElementById)   
	{    
		vis  = document.getElementById(id).style.display;
		if (vis == "none") {
			document.getElementById(id).style.display = "block";
		}	
		else 
		{
			document.getElementById(id).style.display = "none";
		}	
	}
}
