var sectionImgs;
var itembank;
var response1;
var response2;
var response3;
var response4;
var response5;
var response6;
var Info;
var Infotext;
	
var questionno 				= 0;
var sectionno 				= 999; 
var instructpage 			= 0;
var incorrectcount 			= 0;
//var testnav 				= false;
var gtryagain 				= false;
var objclearbutton			= null;
//var objbackbutton			= null;
//var objforwardbutton		= null;
var objfinishbutton			= null;	
var objinstructbutton		= null;
var objinstructbackbutton	= null;

function SetObjects()
{
//	objbackbutton  		  = GetLayer('backbutton');
//	objforwardbutton 	  = GetLayer('forwardbutton');
	objinstructbutton 	  = GetLayer('instructbutton');
	objinstructbackbutton = GetLayer('instructbackbutton');
}

function SetFirst(val){firsttime = val;}

function labeltextbits()
{
	Labeltext 	 = new Array;
	Labeltext[0] = "Cubiks online assessment: instructions and practice";
	Labeltext[1] = "Information about the assessment process";		
}

function labelSetUp(nPage)
{	
	if( nPage == 1 ){
		var labelcontent = '<table class="label" cellspacing="0" cellpadding="0" width="480" height="35">';			 
			labelcontent += '<tr height="35"><td width="15">&nbsp;</td>';
   			labelcontent += '<td width="465" class="label">';
			labelcontent += 'Cubiks online assessment: instructions and practice';
			labelcontent += '</td>';
			labelcontent += '</tr>';					
			labelcontent += '</table>';			
	
			SetLayerHtml('labellayer',labelcontent);
			ShowLayer	('labellayer');
	}	
	if( nPage >= 2 && nPage <= 6 ){

		var labelcontent = '<table class="label" cellspacing="0" cellpadding="0" width="480" height="35">';			 
			labelcontent += '<tr height="35"><td width="15">&nbsp;</td>';
   			labelcontent += '<td width="465" class="label">';
			labelcontent += 'Information about the assessment process';
			labelcontent += '</td>';
			labelcontent += '</tr>';					
			labelcontent += '</table>';			
	
			SetLayerHtml('labellayer',labelcontent);
			ShowLayer('labellayer');
	}
}

function OnInstructionPage( nPage )
{
   	var instructs;
  
	if( nPage == 1 ){
		instructs = '<table width="570"><tr><td>';
		instructs += '<p class="quot2"><b>Introduction</b>';
		instructs += '<p class="quotx">Welcome to the Cubiks online assessment information and practice site.</p>';
		instructs += '<p class="quotx">This information and practice site is designed to:</p>';
	    instructs += '<ul><li><span class="quotx">Help you become familiar with how online tests work</span></li>';
		instructs += '<li><span class="quotx">Give you some practice and feedback before you complete the real thing.</span></li></ul>';
		instructs += '<p class="quotx">Please note this practice site does not collect or store any data about you.</p>';
		instructs += '</td></tr></table>';	
		instructs += '<table width="570" height="60"><tr><td>';
		instructs += '</td></tr></table>';	
   	}
	if( nPage == 2 ){
		instructs = '<table width="570"><tr><td>';
		instructs += '<p class="quot2"><b>Why have I been asked to complete a reasoning test?</b></p>';
		instructs += '<p class="quotx">Employers use these tests to:</p>';
		instructs += '<ul><li><span class="quotx">Focus on the applicants with the right skills and abilities to progress to first interview or assessment centre</span></li>';
		instructs += '<li><span class="quotx">Screen out applicants who do not have the relevant skills and abilities required to succeed in their business.</span></li></ul>';
		instructs += '</td></tr></table>';	
		instructs += '<table width="570"><tr><td>';	
		instructs += '<p class="quotx">The advantage of ability tests is that they provide an objective measure of your abilities to complement the information they have already learnt about you from other sources (eg the application form).</p>';
		instructs += '<p class="quotx">These tests are often geared toward a particular type of job.  Generally, individuals who perform well on these tests tend to perform better in the job. Therefore, taking these tests is in your interests too as you do not want to end up in a job for which you are not suited.</p>';
		instructs += '<pThese tests are often geared toward a particular type of job.  Generally, individuals who perform well on these tests tend to perform better in the job. Therefore, taking these tests is in your interests too as you do not want to end up in a job for which you are not suited.</p>';
		instructs += '<p class="quotx">Click on ‘Next’ to learn more about the assessment process.</p>';
		instructs += '</td></tr></table>';	
	}
	if( nPage == 3 ){
		instructs = '<table width="570"><tr><td>';
		instructs += '<p class="quot2"><b>What is the process of taking the tests?</b></p>';
		instructs += '<p class="quotx">Reasoning tests will be completed over the Internet under timed conditions and are designed to be fairly challenging for anyone wishing to work in a graduate trainee or management position.</p>';
		instructs += '<p class="quotx">Be assured, however, that you will receive full instructions on the process before you start, and you will also have the opportunity to try out some example questions.</p>';
		instructs += '<p class="quotx">You may also be given some feedback on your performance in the test which could help you assess your strengths or development needs in terms of your career planning going forward.</p>';
		instructs += '<p class="quotx">The organisation may well assess your ability on this type of test again under supervised conditions, so it is in your interests to complete the test on your own and attempt to do as well as you are able.</p>';
		instructs += '<p class="quotx">Click on ‘Next’ to learn more about the assessment process.</p>';
		instructs += '</td></tr></table>';		
	}
	if( nPage == 4 ){
		instructs = '<table width="570"><tr><td>';
		instructs += '<p class="quot2"><b>Conditions while taking the test online</b></p>';
		instructs += '<p class="quotx">In order to do the test online you will need to use one of the following browsers:</p>';
		instructs += '<ul><li><span class="quotx">Internet Explorer version 5.01 or above</span></li>';
		instructs += '<li><span class="quotx">Netscape version 4.7 or above.</span></li><br>';
		instructs += '<span class="quotx"><b>Note:</b> If you do not have a compatible version of one of these browsers you can download Internet Explorer free of charge at <A href="http://www.microsoft.com"><span class="highlight">www.microsoft.com.</span></A>  Please ensure that you have the permission of the owner of the computer before installing any new or upgraded software.</span></ul>';
		instructs += '<p class="quotx">If you are in an Internet café, please ensure that you have sufficient credit/time to complete the test within the specified time.</p>';
		instructs += '<p class="quotx">Ensure that you take the test in a quiet area away from any distractions and that you will have sufficient time to complete the test online uninterrupted.</p>';
		instructs += '<p class="quotx">Click on ‘Next’ to learn more about the assessment process.</p>';
		instructs += '</td></tr></table>';	
	}
	if( nPage == 5 ){
		instructs = '<table width="570"><tr><td>';
		instructs += '<p class="quot2"><b>Personal circumstances while taking the test online</b></p>';
		instructs += '<p class="quotx">If you use reading glasses for viewing a computer monitor then please be sure to use these when taking the test.</p>';
		instructs += '<p class="quotx">If you have any particular disability or impairment which is either registered under the UK Disability Discrimination Act (1995), or that you think will hinder your performance on the test in any way, then please contact the person or organisation who sent you the invitation to take the test.  They can advise you on the best approach to take or make a reasonable adjustment to the assessment procedure to accommodate your particular needs.</p>';
		instructs += '<p class="quotx">Click on ‘Next’ to learn more about the assessment process.</p>';
		instructs += '</td></tr></table>';
	}	
	if( nPage == 6 ){
		instructs = ' ';		
		SetVisibility( true );
		InstructionLinkPage();
	}else{					
		SetLayerHtml('InstructionPage',instructs);
		ShowLayer('InstructionPage');		
 		instructpage = nPage;
		SetVisibility( false );  
	}
	instructpage = nPage;
	labelSetUp(nPage);		 	
}


function InstructNext(direction)
{
	OnInstructionPage( instructpage + direction );
	InstructionLinkPage();	
}

function keyDown(e)
{  	     
    var key_press = GetKeypressed(e)
	
    if( instructpage <= 6 ){
	    if( key_press == 13 || key_press == 34 || key_press == 39){
			if(IsLayerVisible('instructbutton')){
				InstructNext(1);	
				return;
			}	
		}
	}													
}

function StartQuestionnaire()
{   
 	onfocus="instructbutton.focus()"
	
	navigationSetUp();
	SetKeypressedFunc(keyDown);
	SetObjects();						
	InstructNext(1);
	HideLayer('InstructionLinkPage');
}

function DoResize()
{
	if( instructpage < 6 ){
		SetVisibility( false );
		OnInstructionPage(instructpage);
	}
	else {
		SetVisibility( true );
	}
}

function InstructionLinkPage()
{
	ShowLayer('InstructionLinkPage'); 
	HideLayer('instructbutton');
	HideLayer('labellayer');
	ShowLayer('CubiksCurvelayer');			
	ShowLayer('labellayer');
	ShowLayer('NextLinkbutton');	
	SetVisibility( false )
}

function SetVisibility( state )
{
	if( state == true ){
		HideLayer('InstructionPage');
		HideLayer('instructbutton');
		HideLayer('instructbackbutton');					
		HideLayer('CubiksCurvelayer');
		HideLayer('labellayer');				
	}else {
   				
		if(instructpage!=6){
			HideLayer('InstructionLinkPage'); 
			HideLayer('NextLinkbutton');
			ShowLayer('instructbutton');
		}	
		
		if(instructpage!=1)
			ShowLayer('instructbackbutton');
	
		if(instructpage==1)
			HideLayer('instructbackbutton');												
	
		ShowLayer('labellayer');
//		HideLayer('backbutton');
//		HideLayer('forwardbutton');		
	}
}

function navigationSetUp()
{
	nextNormal 		= "images/bnext.gif";
	nextOver 		= "images/rnext.gif";
	prevNormal 		= "images/bprev.gif";
	prevOver 		= "images/rprev.gif";
//	previousNormal 	= "images/bprev.gif";
//	previousOver 	= "images/rprev.gif";	
}

/*
function StartItemPages()
{
// 	var d;
//  d = new Date();
  	testnav = true;
	MoveQuestion(0);
}
*/

function SwapInstructPrev( onover )
{
	if( document.images ){
            var obj;
			if( !IsNS4() )
				obj = document.images["ginstback"];
			else  
				obj = document.instructbackbutton.document.images["ginstback"];
			
			obj.src = (onover == true)?prevOver:prevNormal;
	}
}


function SwapInstructNext( onover )
{
	if( document.images ){
            	var obj;
			if( !IsNS4() )
				obj = document.images["ginst"];
			else  
				obj = document.instructbutton.document.images["ginst"];
			
			obj.src = (onover == true)?"images/rnext.gif":"images/bnext.gif";		
	}
}