/*
 * LimeSurvey
 * Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
 * All rights reserved.
 * License: GNU/GPL License v2 or later, see LICENSE.php
 * LimeSurvey is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 * 
 * 
 * Description: Javascript file for templates. Put JS-functions for your template here.
 *  
 * 
 * $Id:$
 */
 
 
 window.onload=function(){
  
  var ele = document.getElementById("divAssessments");
  
  if(ele != null)
  {
     showAssessments();
  }
 }



/*
 * The function focusFirst puts the Focus on the first non-hidden element in the Survey. 
 * 
 * Normally this is the first input field (the first answer).
 */
function focusFirst(Event)
{
	var i=0;
	// count up as long as the elements are hidden
	while(document.forms[0].elements[i].type == "hidden" &&
		document.forms[0].elements[i].style.visibility == 'visible')
	{
		i++;
	}
	// put focus on the element we just counted.
	if (document.forms[0].elements[i].type == "hidden" &&
		document.forms[0].elements[i].style.visibility == 'visible')
	{
		document.forms[0].elements[i].focus();
	}
	return;
}
/*
 * The focusFirst function is added to the eventlistener, when the page is loaded.
 * 
 * This can be used to start other functions on pageload as well. Just put it inside the 'ready' function block
 */

/** Uncomment if you want to use the focusFirst function

$(document).ready(function(){
   focusFirst();
})
	
**/



function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{

}


function showAssessments() {
	var ele = document.getElementById("divAssessments");
	ele.style.display = "block";
	
	var eleNavigator = document.getElementById("divNavigator");
	eleNavigator.style.display = "block";
	
	var eleQuestion = document.getElementById("divQuestion");
		
	if(eleNavigator.style.display == "block")
	{
		eleQuestion.style.display = "block";	
	}
	else
	{
		eleQuestion.style.display = "none";
	}
	
	
	var ele = document.getElementById("divThankyou");
	ele.style.display = "none";
	
	
	
	var eleStep3 = document.getElementById("divStep3");
	eleStep3.style.display = "block";
	
	var eleThanksLabel = document.getElementById("divThanksLabel");
	eleThanksLabel.style.display = "none";	
	
	
	// Update Values
	document.Assessment.repeatName.value = document.Assessment.surveyName.value;
	document.Assessment.repeatEmail.value = document.Assessment.surveyEmail.value;
	document.Assessment.repeatOrganization.value = document.Assessment.surveyOrganization.value;
	document.Assessment.repeatPhone.value = document.Assessment.surveyPhone.value;
}


function showInformation() {
	var ele = document.getElementById("divInformation");
	ele.style.display = "block";
}

function hideInformation() {
	var ele = document.getElementById("divInformation");
	ele.style.display = "none";
}

function showThankyou() {
	var ele = document.getElementById("divThankyou");
	ele.style.display = "block";
	
	var eleNavigator = document.getElementById("divNavigator");
	eleNavigator.style.display = "none";
	
	var eleInformation = document.getElementById("divInformation");
	eleInformation.style.display = "none";
	
	var eleAssessments = document.getElementById("divAssessments");
	eleAssessments.style.display = "none";
	
	var eleQuestion = document.getElementById("divQuestion");
	eleQuestion.style.display = "none";	
	
	
	
	var eleStep3 = document.getElementById("divStep3");
	eleStep3.style.display = "none";
		
	var eleThanksLabel = document.getElementById("divThanksLabel");
	eleThanksLabel.style.display = "block";	
}
