// Reinder Nijhoff 6-10-2000
//
//	todo:
//		-- if(x==null) then x=10 enz. vervangen door x||10
//

function view_loading() {
if (document.getElementById) {  // DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
if (document.layers) {  // Netscape 4
document.hidepage.visibility = 'hidden';
}
else {  // IE 4
document.all.hidepage.style.visibility = 'hidden';
      }
   }
}
XT=new Array();

//
//

//document.write("<script src=c:/IQIdata.dat><\/script>");

Q_ShowAlert=false	
var Q_Version= "2.301 (Pro)";
var Q_Loading=Q_Loading||"Page with intraQuest items loading! Please wait..."
var Q_Language=Q_Language||"DUTCH";
var Q_ScoreCookie=Q_ScoreCookie||'intraquest';

//
//

var Q_Debug=Q_Debug||false;

var Q_ScoreSimple=Q_ScoreSimple||false;
var Q_ScoreCookieReset=Q_ScoreCookieReset||false;
var Q_Verz=Q_Verz||false;
var Q_Style=Q_Style||'<font face=\"Arial, Helvetica, sans-serif\" size=2 color=black style=\"font-style: normal; text-decoration: none\">';
var Q_FbStyle=Q_FbStyle||Q_Style;
var Q_LayerStyle=Q_LayerStyle||Q_Style;

var Q_FStyle=Q_FStyle||'style=\"font-family:Arial; font-size:10pt; background-color:rgb(223,223,255); border-color:rgb(69,48,144); color:rgb(0,0,0); font-style:normal; font-weight:normal;\"';
var Q_Create=Q_Create||false;
var Q_AutoS=Q_AutoS||false;
var Q_NextS=Q_NextS||false;
var Q_NextP=Q_NextP||"";
var Q_ATK=Q_ATK||3;
var Q_Theme=Q_Theme||'blue_gradient';
var Q_BordC=Q_BordC||'#000000';
var Q_PresC=Q_PresC||'#9de8FF';
var Q_MatchW=Q_MatchW||700;
var Q_Filter=Q_Filter||1;
var Q_BUTABS=Q_BUTABS||0;
var Q_VerzS=Q_VerzS||false;
var Q_TIPL =Q_TIPL||40;
var Q_TIPR =Q_TIPR||40;
var Q_ScrSp =Q_ScrSp||10;
var Q_MH =Q_MH||300;
var Q_MW =Q_MW||500;
var Q_SrW =Q_SrW||500;
var Q_LT = Q_LT||0;
var Q_BT = Q_BT||28;
var Q_QT = Q_QT||0;
var Q_QL = Q_QL||0;
var Q_QH=Q_QH||0;
var Q_SignC =Q_SignC||'#ff0000';
var Q_LCen = Q_LCEn||(Q_LCen||false);
var Q_LCEn = Q_LCen||(Q_LCEn||false);
var Q_Dragable =Q_Dragable||false;
var Q_Status =Q_Status||"onMouseOver=\"self.status=''; return true;\"";
var Q_StTxt =Q_StTxt||"intraQuest";
var Q_HIDETIP= Q_HIDETIP||false;
var Q_FbLeft=Q_FbLeft||-999;
var Q_FbTop=Q_FbTop||-999;
var Q_Meta=Q_Meta||"---";
var Q_Random=Q_Random||false;
var Q_NextSDelay=Q_NextSDelay||2000;
var Q_TrainDelay=Q_TrainDelay||2000;
var Q_DescriptionToLC=Q_DescriptionToLC||true;
var Q_SelectWord=Q_SelectWord||false;
if((Q_ShowAlert||0)==0) var Q_ShowAlert=true; else var Q_ShowAlert=false;
if((Q_Train||0)==0) var Q_Train=true; else var Q_Train=false;
if((Q_Scroll||0)==0) var Q_Scroll=true; else var Q_Scroll=false;
if((Q_SWA||0)==0) var Q_SWA=true; else Q_SWA=false;
if((Q_ScrAu||0)==0) var Q_ScrAu=true; else Q_ScrAu=false;
if((Q_Score||0)==0) var Q_Score=true; else Q_Score=false;
if((Q_LinkIcons||0)==0) var Q_LinkIcons=true; else var Q_LinkIcons=false;
if((Q_Bord||0)==0) var Q_Bord=true; else Q_Bord=false;
var Q_J4 = (Q_J4||false);

var Q_Grey = 25;
var Q_Openperc = 40;
var Q_PuzC = Q_PuzC||'#000088';
var Q_NDC ='#ffffff';
if((Q_UseDot||0)==0) var Q_UseDot=true; else Q_UseDot=false;

// buttons
var Q_Btsr=Q_Btsr||"<div align=right><!--Q_IMGBUTTON--><!--OK_BUTTON--><!--STOP_BUTTON--><!--HINT_BUTTON--></div>";

if(Q_Btsr.indexOf("OK_BUTTON")<0) {
 	Q_Btsr = Q_Btsr.replace( "<!--Q_IMGBUTTON-->", "<!--Q_IMGBUTTON--><!--OK_BUTTON--><!--STOP_BUTTON--><!--HINT_BUTTON-->");
}
if(Q_Btsr.indexOf("OK_BUTTON")<0) {
 	Q_Btsr = "<div align=right><!--Q_IMGBUTTON--><!--OK_BUTTON--><!--STOP_BUTTON--><!--HINT_BUTTON--></div>";
}

var Q_Green=Q_Green||'#00ff00';
var Q_Red=Q_Red||'#ff0000';
var Q_PuzGreen=Q_PuzGreen||'#00ff00';
var Q_PuzRed=Q_PuzRed||'#ff0000';
var Q_C1=Q_C1||'#c0c0c0'
var Q_C2=Q_C2||'#d0d0d0'
var Q_C3=Q_C3||'#e0e0e0'
var Q_LC=null;
var XQ_LCEn=XQ_LCEn||false;
var Q_ImgCor = Q_ImgCor||false;
var Q_ImgInCor = Q_ImgInCor||false;
var Q_ImgBack = Q_ImgBack||false;
var Q_ImgTipBack = Q_ImgTipBack||false;
var Q_ImgBorRght = Q_ImgBorRght||false;
var Q_ImgBorBot = Q_ImgBorBot||false;
var Q_ImgBorBotRght = Q_ImgBorBotRght||false;

var Q_FbInScreen = Q_FbInScreen||false;
var Q_Symbol = Q_Symbol||false;

var Q_SwQF = "";
var Q_SwFbF = "";
var Q_SwFbFF = "";
var Q_SwFbTF = "";
var Q_HdFbF = "";
var Q_HdQF = "";
var Q_SwTipF = "";
var Q_InitF = "";
var Q_ItemF = "";
var Q_Link="";
var Q_StatusF="";
var Q_SelectWordF="";
var Q_StopF="";
var Q_Timer="";
var Q_SwPopupF = ""
var Q_HdPopupF = ""
var Q_HdTipF = ""

var Q_ID = 0
var Q_Qs = 0;
var Q_Q = new Array()
var Q = false;
var Q_VvVraag = new Array()
var Q_VvVragen = 0;
var Q_StatusText = Q_StTxt
var Q_Init=false;

Q_SwFbF+="Q.fb_is_visible = true;";
Q_HdFbF+="Q.fb_is_visible = false;";
Q_SwQF+="Q.fb_is_visible = false;";

DynAPI.setLibraryPath('lib/lib/')
DynAPI.include('dynapi.api.*');
DynAPI.include('dynapi.event.*');
DynAPI.setLibraryPath('lib/')

//DynAPI.include('images.themes.'+Q_Theme+'.theme.js')

DynAPI.include('core.ext.dynapi_extend.js')
DynAPI.include('core.ext.popup.js')
DynAPI.include('core.ext.popup.tip.js')
DynAPI.include('core.ext.keyboardhandler.js')
DynAPI.include('core.ext.popup.tiptext.js')
DynAPI.include('core.ext.score.js')
DynAPI.include('core.ext.score.simple_cookie.js')
DynAPI.include('core.ext.score.local-coach.js')
DynAPI.include('core.ext.linkicons.js')
if(Q_ScoreSimple)	DynAPI.include('core.ext.score.cookies.js')
DynAPI.include('core.ext.util.checks.js')

DynAPI.onLoad = function() {
IQI_Init();
}

if(/*IQI|Module.labirinth?|Boolean_1*/false/*IQI*/) DynAPI.include('core.global.doolhof.js')
if(/*IQI|Module.score cgi-script|Boolean_1*/false/*IQI*/) DynAPI.include('core.score.cgi.js')
if(/*IQI|Module.IQI|Boolean_1*/false/*IQI*/) DynAPI.include('core.global.showiqi.js')
if(/*IQI|Module.score web|Boolean_1*/false/*IQI*/) DynAPI.include('core.score.web.js')

if((Q_J4||false)) {
	DynAPI.include('core.ext.j4.j4.js');
	DynAPI.include('core.ext.j4.j4_evaluate.js');
	DynAPI.include('core.ext.j4.coach_comm.js');
	DynAPI.include('core.ext.j4.coach_implementation.js');
}

// hier onder functies die de DynAPI extenden

function LO(Hstr, Type, Number, OKButton, StopButton, TipButton)
{
	this.Vis=true;
	this.dragable = Q_Dragable
	this.scroll = Q_Scroll;
	this.bgcolor = Q_C1
	this.Bstr = Q_Btsr;
	if(Hstr) this.Hstr=Hstr; else this.Hstr = ""
	this.Name='Vraag '+Q_ID
	this.LA = new Array()
	this.AantalLayers = 0
	this.toolbarcreated=false;

	this.scrtxt=LOscrtxt
	this.scrup=LOscrup
	this.scrdown=LOscrdown

	this.Create=LOCreate
	this.CrSB=LOCrSB
	this.Resize=LOReSize
	this.WF=false
	this.Hide=LOHide
	this.Show=LOSw
	this.HdBt=LOHdBt
	this.SwBt=LOSwBt
	this.AL = LOAL
	this.RAL = LORAL
	this.SBCr=false;
	this.ChangeOKButton = LOChangeOKButton
	Type=this.type=(Type||"unknown")
	ofteken=" "
	var stopfnc = "eval(Q.StopF);Q_Q["+Q_ID+"].HdQ();"
 
	if(OKButton!="") var okfnc=OKButton
	else var okfnc = "Q_Q[Q_ID].SwFb(1);"

	if(OKButton=="")
	if(Type=="FbTrue")
	{
 		OKButton="OK"
		okfnc = "Q_Q["+Q_ID+"].HdQ();"
	}
	else
	if(Type=="FbFalse" || Type=="Tip")
	{
		OKButton="OK"
		okfnc = "Q_Q[Q_ID].HdFb("+Number+");"
	}

	var tipBtstr = "<a href=\"javascript:"+stopfnc+"\" "+Q_Status+">"+B_Hint+"</a>"+ofteken
	var okBtstr = "<a href=\"javascript:"+okfnc+"\" "+Q_Status+">"+B_Ok+"</a>"+ofteken
	var stopBtstr = "<a href=\"javascript:"+stopfnc+"\" "+Q_Status+">"+B_Stop+"</a>"+ofteken
 
 	if(this.Bstr.indexOf("OK_BUTTON")<0) {
	 	this.Bstr = this.Bstr.replace( "<!--Q_IMGBUTTON-->", "<!--Q_IMGBUTTON--><!--OK_BUTTON--><!--STOP_BUTTON--><!--HINT_BUTTON-->");
 	}
 	
	if(StopButton && (!Q_Verz || Q_VerzS)) this.Bstr = this.Bstr.replace( "<!--STOP_BUTTON-->", stopBtstr)
	if(OKButton) this.Bstr = this.Bstr.replace( "<!--OK_BUTTON-->", okBtstr )
	if(TipButton) this.Bstr = this.Bstr.replace( "<!--HINT_BUTTON-->", tipBtstr )
}

function LOCrSB()
{
	this.scrolltopdiv=IQIDynLayer('scrolltop',-100,0,0,0,Q_ScrC)
	var imgup='lib/images/themes/'+Q_Theme+'/scrolltop.gif';
	var imgdwn='lib/images/themes/'+Q_Theme+'/scrollbottom.gif';
	if( Q_LayerImages ) this.scrolltopdiv.setBgImage(imgup)
	this.scrollbottomdiv=IQIDynLayer('scrollbot',-100,0,0,0,Q_ScrC)
	if( Q_LayerImages ) this.scrollbottomdiv.setBgImage(imgdwn)
	this.scrollbackdiv=IQIDynLayer('scrollback',0,0,0,0, /*IQI|Question.bgcolor scrollbar|TEXT_1*/'#808080'/*IQI*/)
	this.scrolldiv=IQIDynLayer('scroll',-100,0,0,0,Q_ScrC)
	if( Q_LayerImages ) this.scrolldiv.setBgImage('lib/images/themes/'+Q_Theme+'/scroll.gif')
	this.scrolldiv.setBgImage('lib/images/themes/'+Q_Theme+'/scroll.gif')
	this.scrollbackdiv.addChild(this.scrolldiv)
	this.maindiv.addChild(this.scrollbackdiv)
	this.maindiv.addChild(this.scrollbottomdiv)
	this.maindiv.addChild(this.scrolltopdiv)
	DragEvent.setDragBoundary(this.scrolldiv)
	DragEvent.enableDragEvents(this.scrolldiv)
	myDrop=new EventListener(this.scrolldiv)
	myDrop.ondragmove=function(e) {
		var obj=e.getTarget();
		obj.parent.parent.lo.scrtxt(obj.getY())
	}
	this.scrolldiv.addEventListener(myDrop)
	this.scrolltopdiv.IQIsetHTML("<a href=javascript:"+this.Q_Name+".scrup()><img src="+imgup+" border=0></a>");
	this.scrollbottomdiv.IQIsetHTML("<a href=javascript:"+this.Q_Name+".scrdown()><img src="+imgdwn+" border=0></a>");
	this.SBCr=true;
}

function LOCreate(name)
{
	this.Q_Name=name
	this.toolbar = new toolbar(name);
	this.toolbarcreated=true;

	if( Q_Verz && this.bgcolor!=Q_C3 && this.id!="tip") this.Q_Verz=Q.Q_Verz; else this.Q_Verz=false;
	if(this.Q_Verz) var wd=Q_SrW-Q_TL-Q_TR; else var wd=Q_MW-Q_TL-Q_TR; 
	if( this.Q_Verz ) this.Q_Bord=false; else this.Q_Bord=Q_Bord;

	this.maindiv=IQIDynLayer('main'+Q_ID,1,1,1,1, this.bgcolor)
	if(Q_Filter||1!=1) this.maindiv.filter=Q_Filter;
	if(this.Q_Bord){
		this.rightdiv=IQIDynLayer('righ'+Q_ID,1,1,1,1, Q_RC)
		this.bottomdiv=IQIDynLayer('bott'+Q_ID,1,1,1,1, Q_BC)
		this.bottomrightdiv=IQIDynLayer('bori'+Q_ID,1,1,1,1,Q_BC)
	}
	this.clipdiv=IQIDynLayer('clip'+Q_ID,1,1,1,1)
	this.buttondiv=IQIDynLayer('butt'+Q_ID,1,1,wd,1)
	this.textdiv=IQIDynLayer('text'+Q_ID,1,1,wd,1)
	this.maindiv.lo=this;

	if(Q_Debug)
	{
		this.myListener = new EventListener(this.maindiv);
		this.myListener.ondblclick=function(e)
		{
			obj=e.getTarget()

			DynAPI.console.write("\n-- new lo ---\n");
			DynAPI.console.write(obj.lo.maindiv.tree());
		}
		this.myListener.onrtmousedown=function(e)
		{
			DynAPI.console.clear();
			DynAPI.console.write("\n--- clear ---\n");
		}
		this.maindiv.addEventListener(this.myListener);
	}

	if(this.OnMouseDown||this.OnMouseUp||this.OnMouseOver||this.OnMouseMove||this.OnMouseUp||this.OnMouseDblClick)
	{
		this.myListener = new EventListener(this.textdiv)
		if(this.OnMouseOver) this.myListener.onmouseover=this.OnMouseOver
		if(this.OnMouseMove) this.myListener.onmousemove=this.OnMouseMove
		if(this.OnMouseDown) this.myListener.onmousedown=this.OnMouseDown
		if(this.OnMouseOut) this.myListener.onmouseout=this.OnMouseOut
		if(this.OnMouseUp) this.myListener.onmouseup=this.OnMouseUp
		if(this.OnMouseDblClick) this.myListener.ondblclick=this.OnMouseDblClick
		this.textdiv.addEventListener(this.myListener)
	}
	if(!this.Q_Verz && this.id!="tip" && !this.OnMouseDown)
	{
		this.myListener = new EventListener(this.textdiv);
		this.myListener.onmousedown=function(e){if(Q_Tip.wegklikbaar) Q_Tip.maindiv.setZIndex(0);};
		this.maindiv.addEventListener(this.myListener);
	}
	if(this.Q_Bord){
		this.maindiv.addChild(this.rightdiv)
		this.maindiv.addChild(this.bottomdiv)
		this.maindiv.addChild(this.bottomrightdiv)
	}
	this.maindiv.addChild(this.buttondiv)
	this.clipdiv.addChild(this.textdiv)
	this.maindiv.addChild(this.clipdiv)
	if(this.toolbarcreated) this.maindiv.addChild(this.toolbar.maindiv);

	DynAPI.document.addChild(this.maindiv)
	this.maindiv.setVisible(false)

	this.maindiv.setZIndex(1)
	if( !this.Q_Verz||this.bgcolor==Q_C3||this.dragable )
	if( Q_LayerImages )
	{
		if(this.type=="FbTrue" && Q_Train) this.maindiv.setBgImage( (Q_ImgCor||'lib/images/themes/'+Q_Theme+'/correct.gif') );
		else
		if(this.type=="FbFalse" && Q_Train) this.maindiv.setBgImage( (Q_ImgInCor||'lib/images/themes/'+Q_Theme+'/incorrect.gif') );
		else
		if(this.id=="tip") this.maindiv.setBgImage( (Q_ImgTipBack||'lib/images/themes/'+Q_Theme+'/back.gif') );
		else
		this.maindiv.setBgImage( (Q_ImgBack||'lib/images/themes/'+Q_Theme+'/back.gif') );
		if(this.Q_Bord) {
			this.rightdiv.setBgImage((Q_ImgBorRght||'lib/images/themes/'+Q_Theme+'/right.gif'))
			this.bottomdiv.setBgImage((Q_ImgBorBot||'lib/images/themes/'+Q_Theme+'/bottom.gif'))
			this.bottomrightdiv.setBgImage((Q_ImgBorBotRght||'lib/images/themes/'+Q_Theme+'/bottom_right.gif'))
		}
	}
	if(this.dragable)
	{
		this.dragdiv=IQIDynLayer('drag'+Q_ID,0,0,0,0);
		this.dragdiv.setBgImage('lib/images/themes/'+Q_Theme+'/drag.gif')
		this.maindiv.addChild(this.dragdiv)
		if(Q_Debug) this.dragdiv.IQIsetHTML('<font size=1>'+name+'</font>')
		DragEvent.enableDragEvents(this.maindiv)
		this.myListener = new EventListener(this.buttondiv);
		this.myListener.onmousedown=function(e){e.setBubble(false)};
		this.buttondiv.addEventListener(this.myListener);

	}
	this.textdiv.IQIsetHTML(this.Hstr)
	this.buttondiv.IQIsetHTML (this.Bstr)
	this.maindiv.lo=this
}

function LORAL()
{
	this.AantalLayers=this.LA.length-1;

	for(var tl=1; tl<=this.AantalLayers; tl++) this.LA[tl].del();

	this.LA=new Array();
	this.AantalLayers=0;
}

function LOAL(inhoudstring, drag, x, y, cl, ct, point, bord, space, xp, yp)
{
	this.AantalLayers++
	drag=drag||false
	space=space||false

	this.LA[ this.AantalLayers ]=IQIDynLayer(null,xp||0,yp||0,x||50,y||50, null, null, null, null, null||point, null||bord)
//	this.LA[ this.AantalLayers ].setClip([0,x||50,y||50,0])
	this.LA[ this.AantalLayers ].index=this.AantalLayers
	this.LA[ this.AantalLayers ].setZIndex(10);
	this.LA[ this.AantalLayers ].iq_html=inhoudstring;
	if(inhoudstring)
	if(ct!=null)
	{
		this.LA[ this.AantalLayers ].clipdiv=IQIDynLayer(null,cl,ct,(x-cl)||50,(y-ct)||50)
		this.LA[ this.AantalLayers ].clipdiv.IQIsetHTML(Q_LayerStyle+inhoudstring+"</font>", 2)
		this.LA[ this.AantalLayers ].addChild(this.LA[ this.AantalLayers ].clipdiv)
	}
	else
	{
		if(space) this.LA[ this.AantalLayers ].IQIsetHTML("<table border=0 celspacing=1 celpadding=1><tr><td>"+Q_LayerStyle+inhoudstring+"</font></td></tr></table>", 2);
		else this.LA[ this.AantalLayers ].IQIsetHTML(Q_LayerStyle+inhoudstring+"</font>", 2);
	}
	this.clipdiv.addChild(this.LA[ this.AantalLayers ])
	if(drag)
	{
		DragEvent.setDragBoundary(this.LA[ this.AantalLayers ])
		DragEvent.enableDragEvents(this.LA[ this.AantalLayers ])
	}
	
	return this.AantalLayers;
}

function LOReSize()
{
	if(Q_MH<Q_QH) Q_MH=Q_QH;

	this.WF?this.textdiv.setSize(10,null):this.textdiv.setSize(Q_MW-Q_TL-Q_TR,null)
	if( this.Q_Verz ) this.textdiv.setSize(Q_SrW-Q_TL-Q_TR,null)

	if(is.ns && is.v>=4) this.textdiv.setSize(Q_MW-Q_TL-Q_TR,null) 
	this.textdiv.getWidth()<this.textdiv.getContentWidth()?textbreedte=this.textdiv.getContentWidth():textbreedte=this.textdiv.getWidth()


	var laywidth=0;
	var layheight=0;

	// kijk of er layers zijn die de boel doen laten oprekken..
	if(this.LA.length)	// er zijn sublayers
	{
		for(var tl=1; tl<this.LA.length; tl++)
		{
			var tmpwidth  = IQI_parseInt(this.LA[tl].getWidth())+IQI_parseInt(this.LA[tl].getX());
			var tmpheight = IQI_parseInt(this.LA[tl].getHeight())+IQI_parseInt(this.LA[tl].getY());

			if(tmpwidth>laywidth) laywidth=tmpwidth;
			if(tmpheight>layheight) layheight=tmpheight;
		}
	}
	if(laywidth>textbreedte) textbreedte=laywidth;

	if(this.WF)
	{
		this.textdiv.setSize(this.textdiv.getContentWidth(),this.textdiv.getContentHeight())
		if(is.ns && is.v>=4) this.textdiv.setSize(Q_MW-Q_TL-Q_TR,this.textdiv.getContentHeight()) 
		this.textdiv.getWidth()<this.textdiv.getContentWidth()?textbreedte=this.textdiv.getContentWidth():textbreedte=this.textdiv.getWidth()
	}
	var texthoogte=this.textdiv.getContentHeight()

	if(layheight>texthoogte) texthoogte=layheight;

	var TB=0
	if(this.toolbar.filled())
	{
		TB=Q_TBH+Q_TBT
		if(this.dragable) TB+=Q_DrgT+Q_DrgH
	}

	var realtexthoogte=texthoogte;
	if( this.scroll )
	{ 
		if(texthoogte>(Q_MH-Q_TT-Q_TB-TB))
		{
			if(!this.SBCr) this.CrSB();
			texthoogte=Q_MH-Q_TT-Q_TB-TB;
			this.scrolltopdiv.setVisible(true);
			this.scrolltopdiv.moveTo(20,20);
			this.scrollbottomdiv.setVisible(true);
			this.scrollbackdiv.setVisible(true);
		}
		else
		{	
			if(this.SBCr){
			this.scrollbackdiv.setVisible(false);
			this.scrolltopdiv.setVisible(false);
			this.scrollbottomdiv.setVisible(false);}
		}
	}
	var hoogte=texthoogte+Q_TT+Q_TB+TB+(this.dragable?(Q_DrgH+Q_DrgT):0)
	if(Q_QH && this.type=="Q") hoogte=Q_QH;
	var breedte=textbreedte+Q_TL+Q_TR
// okiedo, ga nu alles sizen...
	this.maindiv.setSize(breedte, hoogte)
	this.clipdiv.setSize(textbreedte, texthoogte)
	this.textdiv.setSize(textbreedte, realtexthoogte)

	if(this.Q_Bord){
		Q_LayerImages?this.rightdiv.setSize(Q_Border, hoogte):this.rightdiv.setSize(1, hoogte)
		Q_LayerImages?this.bottomdiv.setSize(breedte,Q_Border):this.bottomdiv.setSize(breedte, 1)
		Q_LayerImages?this.bottomrightdiv.setSize(Q_Border, Q_Border):this.bottomrightdiv.setSize(1, 1)
	}
	if(this.SBCr)
	{
		this.scrollbackdiv.setSize(Q_ScrW, texthoogte-(2*Q_ScrTH))
		this.scrolldiv.setSize(Q_ScrW, Q_ScrH)
		this.scrolltopdiv.setSize(Q_ScrW, Q_ScrTH )
		this.scrollbottomdiv.setSize(Q_ScrW, Q_ScrTH )
		this.scrollbackdiv.moveTo(breedte-Q_ScrW-Q_ScrR,Q_TT+Q_ScrTH+TB )
		this.scrolltopdiv.moveTo(breedte-Q_ScrW-Q_ScrR,Q_TT+TB)
		this.scrollbottomdiv.moveTo(breedte-Q_ScrW-Q_ScrR,Q_TT+texthoogte-Q_ScrTH+TB )
		this.scrolldiv.moveTo(0,0)
	}

	this.clipdiv.moveTo(Q_TL, Q_TT+TB+(this.dragable?(Q_DrgH+Q_DrgT):0))
	this.textdiv.moveTo(0,0)
	if(this.Q_Bord) {
		Q_LayerImages?this.rightdiv.moveTo(breedte-Q_Border, 0):this.rightdiv.moveTo(breedte-1, 0)
		Q_LayerImages?this.bottomdiv.moveTo(0, hoogte-Q_Border):this.bottomdiv.moveTo(0, hoogte-1)
		Q_LayerImages?this.bottomrightdiv.moveTo(breedte-Q_Border, hoogte-Q_Border):this.bottomrightdiv.moveTo(breedte-1, hoogte-1)
	}
	if(this.dragable)
	{
		this.dragdiv.setSize(breedte-2*Q_DrgB, Q_DrgH)
		this.dragdiv.moveTo(Q_DrgB, Q_DrgT)
	}
	if(this.toolbar.filled())
	{
		this.toolbar.maindiv.setSize(breedte-Q_TBL-Q_TBR, Q_TBH)
		this.toolbar.maindiv.moveTo(Q_TBL, TB-Q_TBH)
		this.toolbar.maindiv.setVisible(true)
	}
	else this.toolbar.maindiv.setVisible(false);
	
	this.buttondiv.setSize(textbreedte, Q_BH)
	this.buttondiv.moveTo(Q_TL, hoogte-Q_BH)
	if(this.SBCr  && Q_ScrAu) {this.scrtxt(texthoogte-Q_ScrH);}

	if(this.WF && (this.scrollbackdiv||1)!=1) {this.scrollbackdiv.moveTo(-100,-100);this.scrolltopdiv.moveTo(-100,-100);this.scrollbottomdiv.moveTo(-100,-100);}
}

function QO()
{
	this.QCounter=0
	this.AnCounter=0
	this.FbCounter=2
	this.FirstTime=true
	this.Tip=false
	this.AantalKansen=Q_ATK
	this.vvpoging=this.AantalKansen
	this.IQIKT=0
	this.SwTipError=false
	this.StFb = "standaard feedback"
	this.FUF=""
	this.FUS=""
	this.FUT=""
	this.FUF1=""
	this.KeyF=""
	this.Popup=new Array();
	this.Training = Q_Train
	this.HdFbF=""
	this.RegScore=Q_Score
	this.StopF="Q.hidden=true;"+Q_StopF
	this.hidden=true;
	this.Variables=new Array();

	this.QA = new Array()
	this.AA = new Array()
	this.FA = new Array()
	this.An = new Array()
	this.created=false;

	this.InitFunction = "void(null);"
	this.EvalFunction= ""; // evalueer na een form submit..
	this.Q_Verz=Q_Verz
 
	this.FA[1]= new LO("", "FbTrue", 1, "","","","100","200")
	this.FA[2]= new LO("", "FbFalse", 2, "","","","100","200")

	this.AddQ=QOAddQ
	this.AddAn=QOAddAn
	this.AddFb=QOAddFb

	this.ChQ=QOChQ
	this.ChFb=QOChFb
	this.ChAn=QOChAn

	this.HdQ=QOHdQ
	this.HdQ2=QOHdQ2
	this.SwQ=QOSwQ
	this.HdFb=QOHdFb
	this.SwFb=QOSwFb
	this.EvalOK=QOEvalOK
	this.Arrange=QOArrange
	this.Q_Fb=QOQ_Fb
	
	this.Model="unknown";
}

function QOAddQ(Hstr)
{
	this.QCounter++
	this.QA[ this.QCounter ] = new LO(Hstr, "Q", this.QCounter, "","","")
	return this.QCounter
}

function QOAddAn(Hstr, OKFunction)
{
	this.AnCounter++
	this.EvalFunction=OKFunction
	this.AA[ this.AnCounter ] = new LO(Hstr, "An", this.AnCounter, OKFunction,"Stop","","100","200")
	return this.AnCounter
}

function QOAddFb(Hstr, True, OKButton, Tip)
{
	if(OKButton==null) OKButton=""

	if(!Tip)
	{
		this.FbCounter++
		if(True) this.FA[ this.FbCounter ] = new LO(Hstr, "FbTrue", this.FbCounter, 	OKButton,"","","100","200");
		else this.FA[ this.FbCounter ] = new LO(Hstr, "FbFalse", this.FbCounter, 	OKButton,"","","100","200")
	}
	else this.FA[ 0 ] = new LO(Hstr, "Tip", 0, OKButton,"","","100","200")
	return this.FbCounter
}

function QOChQ(Hstr, Number, popup)
{	
	Number=Number||1 

	if(!this.QA[Number].toolbar.filled())
	{
		ToolbarPopup("QUESTION", "BUTTON", this.QA[Number].toolbar)
		this.QA[Number].toolbar.show()
	}

	IQI_alert(Hstr+', '+Number)
	this.QA[Number].textdiv.IQIsetHTML(Hstr)
	this.QA[Number].Resize()
	this.Arrange(true)
}

function QOChAn(Hstr, Number, popup)
{ 
	Number=Number||1 

	if(!this.AA[Number].toolbar.filled())
	{
		ToolbarPopup("SPA", "SPA", this.AA[Number].toolbar)
		ToolbarPopup("ANSWER", "BUTTON", this.AA[Number].toolbar)
		this.AA[Number].toolbar.show()
	}

	IQI_alert(Hstr+', '+Number)
	this.AA[Number].textdiv.IQIsetHTML(Hstr)
	this.AA[Number].Resize()
	this.Arrange(true)
}

function QOChFb(Hstr, Number, okbutton, popup, numfb, fin)
{ 
	Number=Number||1 
	numfb=(numfb+1)||'x'

	if(this.FA[Number].toolbar.filled()) this.FA[Number].toolbar.reset()
	ToolbarPopup("FEEDBACK", "BUTTON", this.FA[Number].toolbar)
	if(this.FA[Number].type=="FbFalse") ToolbarPopup("FEEDBACK_FALSE", "BUTTON", this.FA[Number].toolbar);
	if(this.FA[Number].type=="FbTrue") ToolbarPopup("FEEDBACK_TRUE", "BUTTON", this.FA[Number].toolbar);
	if((fin||'test')!='test') ToolbarPopup("FINALBACK", "BUTTON", this.FA[Number].toolbar);
	ToolbarPopup("OPTION_"+numfb, "BUTTON", this.FA[Number].toolbar);

	okbutton=this.EvalOK(okbutton, Number)
	if(!this.Training)	// einde van de vraag..
	{
		var okbutton=this.EvalOK("end", Number)
		var Hstr=Q_VolgV
 		if(Q_TrainDelay>0) setTimeout(okbutton, Q_TrainDelay);
	}	
	this.FA[Number].ChangeOKButton(okbutton)
	IQI_alert(Hstr+', '+Number+', '+okbutton)
	this.FA[Number].textdiv.IQIsetHTML(Hstr, true)
	this.FA[Number].Resize()
	// werkt wel, maar klopt niet..
	EvalPopup("OPTION_"+(numfb), "OPEN");
	if((fin||'test')!='test') EvalPopup("FINALBACK", "OPEN");
}

function QOArrange(qo)
{
	qo=qo||false;
	pageY=is.ie?pageY=document.body.scrollTop:pageY=window.pageYOffset
	if(Q_Verz) pageY=0

	var he=Q_QT+this.QA[1].maindiv.getHeight()+this.AA[1].maindiv.getHeight()-Q_BT;
	if(he<Q_BUTABS) pageY+=Q_BUTABS-he

	for(var t1=1; t1<=this.QCounter; t1++) 
	if(!qo) this.QA[t1].maindiv.moveTo(Q_QL,Q_QT+pageY)

	var left=this.QA[1].maindiv.getX()
	if( !Q_Verz ) left+=Q_LT
	var top=this.QA[1].maindiv.getY()+this.QA[1].maindiv.getHeight()-Q_BT
	for(var t1=1; t1<=this.AnCounter; t1++) 
	this.AA[t1].maindiv.moveTo(left,top)
/*
	left=this.AA[1].maindiv.getX()+Q_LT
	top=this.AA[1].maindiv.getY()+this.AA[1].maindiv.getHeight()-Q_BT
	this.Tip?start=0:start=1
	if(Q_FbLeft!=-999) left=Q_FbLeft;
	if(Q_FbTop!=-999) top=Q_FbTop;

	for(var t1=start; t1<=this.FbCounter; t1++) this.FA[t1].maindiv.moveTo(left, top)
*/	
}

function QOSwQ()
{
	if(Q_Verz) self.scrollTo(0,0);

	if(Q_HIDETIP)
	{
		HdTip();
		HdTip_Hide();
	}

	if(Q_Init)
	{
		Q_FbS=Q_Fb;
		Q=Q_Q[Q_ID];
		this.IQIKT=0
		
		// doe variabele popups...
		for(var tl=0; tl<Q.Popup.length; tl++)
			if(Q.Popup[tl].type=="POPUP_VARIABLE") eval(GetFuncPopup("POPUP_VARIABLE", this.Popup[tl].args));
		
		if(!Q_Create && Q.FirstTime && !this.created)
		{
			this.created=true;
			for(var t2=1; t2<=this.QCounter; t2++) 
			{this.QA[t2].bgcolor=Q_C1;this.QA[t2].Create("Q.QA["+t2+"]")}
			for(t2=1; t2<=this.AnCounter; t2++) 
			{this.AA[t2].bgcolor=Q_C2;this.AA[t2].Create("Q.AA["+t2+"]")}
			this.Tip?start=0:start=1	
 			for(t2=start; t2<=this.FbCounter; t2++)
			{this.FA[t2].bgcolor=Q_C3;this.FA[t2].Create("Q.FA["+t2+"]")}
		}
		if(this.Vraag==null) this.Vraag=""
		this.CD=String("@@"+this.ID.charAt(2)+this.ID.charAt(3)+this.ID.charAt(4)+this.ID.charAt(5)+this.ID.charAt(6)+this.ID.charAt(7)+"#"+this.Vraag.toLowerCase())
		eval(this.InitFunction)
		if (dasf())
		{
			for(var t1=1; t1<=Q_Qs; t1++) 
			{
				Q_Q[t1].HdQ2()
			}
			this.QA[1].Resize()
			this.AA[1].Resize()
			this.Arrange()
			this.FirstTime=false
			this.QA[1].Show()			
			if(Q_SWA) this.AA[1].Show()
			this.hidden=false;
			eval(Q_SwQF)
		}
		else IQI_alert(Q_ItemVerl, true);
	}
	
	IQI_alert("* Open Question\nFilename:\t\t"+Q.FileName+"\nModel used:\t\t"+Q.Model+"\nRegister Score:\t\t"+Q.RegScore+"\nNumber of Chances:\t"+Q.AantalKansen);
}

function LOSw()
{
	if(this.Vis)
	{
		if(this.toolbar.filled()) this.toolbar.show();
		this.Resize()
		this.maindiv.setVisible(true)
		this.buttondiv.setVisible(true)
	}
}

function LOSwBt(){ this.buttondiv.setVisible(true)}

function QOSwFb(number)
{
	if(Q_FbInScreen)
	{
		var offset = IQI_parseInt(Q_FbInScreen);
	
		if( (this.AA[1].maindiv.getY()+this.AA[1].maindiv.getHeight()-Q_BT+this.FA[number].maindiv.getHeight()) > DynAPI.document.getHeight()-5-offset)
		{
			this.FA[number].maindiv.moveTo(null, DynAPI.document.getHeight()-5-offset-this.FA[number].maindiv.getHeight());
		} else {
			var left = this.AA[1].maindiv.getX()+Q_LT
			var top = this.AA[1].maindiv.getY()+this.AA[1].maindiv.getHeight()-Q_BT
	
			if(Q_FbLeft!=-999) left=Q_FbLeft;
			if(Q_FbTop!=-999) top=Q_FbTop;
 
			this.FA[number].maindiv.moveTo(left, top)	
		}
	} else {
		var left=this.AA[1].maindiv.getX()+Q_LT
		var top=this.AA[1].maindiv.getY()+this.AA[1].maindiv.getHeight()-Q_BT
	
		if(Q_FbLeft!=-999) left=Q_FbLeft;
		if(Q_FbTop!=-999) top=Q_FbTop;
 
		this.FA[number].maindiv.moveTo(left, top)	
	}

	if(this.FA[number].type=="Tip")
	{
		EvalPopup("HINT", "OPEN");
		if(!this.FA[number].toolbar.filled()) ToolbarPopup("HINT", "BUTTON", this.FA[number].toolbar);
	}
	if( number>0 ) this.IQIKT++
	IQI_alert('poging: '+this.IQIKT)
	if(!(!this.Training && (Q_TrainDelay<=0)) || !(this.FA[number].type!="Tip")) this.FA[number].Show();
	for(var t1=1; t1<=this.AnCounter; t1++) this.AA[t1].HdBt()
	if( number>0 )eval(Q_SwFbF); else eval(Q_SwTipF);
	if(!this.Training && (Q_TrainDelay<=0) && (this.FA[number].type!="Tip")) this.HdQ(true);
}

function QOHdQ()
{
	this.hidden=true;
	if(Q.FUS!="")
	{
		SwVv( Q.FUS );
	}
	else
	{
		if(this.created)
		{
			this.Tip?start=0:start=1
			if(this.QA[1].maindiv.getVisible()) eval(Q_HdQF);
			for(var t1=1; t1<=this.QCounter; t1++) this.QA[t1].Hide(true);
			for(t1=1; t1<=this.AnCounter; t1++)	this.AA[t1].Hide(true);
			for(t1=start; t1<=this.FbCounter; t1++) this.FA[t1].Hide(true);
		}
		if(Q_NextS)
		{
			Q_ID++
			if(Q_ID<=(Q_Q.length-1)) Q_Q[Q_ID].SwQ();
			else {if(Q_NextP!="") setTimeout("NextP();", Q_NextSDelay);}
		}
	}
}

function QOHdQ2(next, ev)
{
	this.hidden=true;
	if(ev||'false'!='false') eval(Q_HdQF);
	if(this.created)
	{
		this.Tip?start=0:start=1
		for(var t1=1; t1<=this.QCounter; t1++) this.QA[t1].Hide(true);
		for(t1=1; t1<=this.AnCounter; t1++)	this.AA[t1].Hide(true);
		for(t1=start; t1<=this.FbCounter; t1++) this.FA[t1].Hide(true);
	}
	if(Q_NextS && (next||'false')!='false')
	{
		Q_ID++
		if(Q_ID<=(Q_Q.length-1)) Q_Q[Q_ID].SwQ();
		else {if(Q_NextP!="") setTimeout("NextP();", Q_NextSDelay);}
	}
}

function NextP()
{
	self.location.href=Q_NextP;
}

function LOHide(fin)
{
	this.maindiv.setVisible(false)
	this.buttondiv.setVisible(false)
	if((fin||'niks')!='niks')
	{
		this.maindiv.moveTo(1,1)
		this.buttondiv.moveTo(1,1)
	}
}

function LOHdBt(){ this.buttondiv.setVisible(false)}

function QOHdFb(number)
{
	this.Tip?start=0:start=1
	for(var t1=start; t1<=this.FbCounter; t1++) this.FA[t1].Hide()
	for(t1=1; t1<=this.AnCounter; t1++) this.AA[t1].SwBt()
	eval(Q_HdFbF)
	eval(Q.HdFbF)
	if(Q_Verz) Q_Tip.maindiv.setZIndex(100);
}

function QOQ_Fb(arg, vv, pop, num)
{
	if(Q_StatusText.charAt(/*IQI|Question.Checksum1 letter zoveel|INTEGER_1*/6/*IQI*/-1)!=/*IQI|Question.Checksum1 letter|TEXT_1*/"Q"/*IQI*/) return true;
	IQI_alert( 'aantal kansen='+this.AantalKansen+', aantal keer geprobeerd is '+this.IQIKT)
	if(this.AantalKansen)
	{
		if((this.AantalKansen-1)<=this.IQIKT)
		{
			this.IQIKT++;ChFb(this.StFb||Q_Wrong,2,"end",pop||"", num, true);SwFb(2);return false;
		}
	}
	if(arg=="")
	{
		if(this.SwTipError && (this.IQIKT==0) && (Q_FbS==Q_Fb)) {SwFbFalse(this.FA[0].textdiv.getHTML(),"",pop||"",num);return false;}
		else
		{SwFbFalse(Q_Wrong+"<br><br>"+Q_FbS,"stfb", pop||"",num);return false;}
	}
	else return true;
}

function WriteFunction(FunctionString)
{
	if(is.ns) document.open()
	document.write("<script>"+FunctionString+"</script>")
	if(is.ns) document.close()
}

function WriteQ(InitFunction)
{
	if(InitFunction!=null) Q_Q[Q_ID].InitFunction=InitFunction;
	else Q_Q[Q_ID].InitFunction="void(null);"
}

function IQI_ITEM(Name, nlink)
{
	nlink=nlink||false;
	Q_Link=""
	eval(Q_ItemF)
	if(Name!="definition") //TdL
	{
		if(Name!="noitem" && !nlink) document.write("<a href=javascript:if(Q_Init){Q_ID="+Q_ID+";Q_Q["+Q_ID+"].SwQ();} "+Q_Status+">"+Q_Link+Name+"</a>")
		else
		{ if(Name!="noitem" && nlink)
			document.write(Q_Link+Name);
		}
	}
}


function NewQ(Hstr)
{
	Q_Qs++
	Q_ID=Q_Qs
 
	Q_Q[Q_ID] = new QO()
	Q = Q_Q[Q_ID]

	Q_Q[Q_ID].AddQ(Hstr)
}


function IQI_Init()
{ 
	// buttons
	Q_Btsr=Q_Btsr||"<div align=right><!--Q_IMGBUTTON--><!--OK_BUTTON--><!--STOP_BUTTON--><!--HINT_BUTTON--></div>";

	if(Q_Btsr.indexOf("OK_BUTTON")<0) {
	 	Q_Btsr = Q_Btsr.replace( "<!--Q_IMGBUTTON-->", "<!--Q_IMGBUTTON--><!--OK_BUTTON--><!--STOP_BUTTON--><!--HINT_BUTTON-->");
	}
	if(Q_Btsr.indexOf("OK_BUTTON")<0) {
	 	Q_Btsr = "<div align=right><!--Q_IMGBUTTON--><!--OK_BUTTON--><!--STOP_BUTTON--><!--HINT_BUTTON--></div>";
	}
	
	Q = false;
	
	if(Q_ShowAlert)
	{
		myListener = new EventListener(DynAPI.document);
		myListener.onrtmousedown=function(e)
		{
			alert('intraQuest\nEducational Interaction Library ' +Q_Version+'\n\nPage: '+document.location.href);
			return false;
		}
		DynAPI.document.addEventListener(myListener);
	}

	if(Q_SelectWord)
	{

//		DynAPI.errorHandling = false;
//		DynAPI.returnErrors = false;
	
	
		myListener = new EventListener(DynAPI.document);
		myListener.onmousedown=function(e)
		{
			var e=event.srcElement;
			var text=event.srcElement.innerHTML;
			if (	text && 				// geen form...
				text.indexOf("<TBODY")<0	// geen table
			)
			{ 
				var tr=document.body.createTextRange();
				tr.moveToPoint(event.x, event.y);
				tr.expand("word");
				Q_SelectedWord = tr.text;
				eval(Q_SelectWordF);
			}
		}    
		DynAPI.document.addEventListener(myListener);
		
	}

	if(Q_Debug) Q_dynB='#c0c0c0';
	var obj
	if(Q_Verz) {Q_C1=""; Q_C2="";}

	if(Q_Random)	// maak vragen random...
	{
		for(var t1=1; t1<=Q_Qs; t1++)
		{
			obj = Q_Q[t1];
			tl=IQI_parseInt(Math.random()*Q_Qs) + 1;
			Q_Q[t1]=Q_Q[tl];
			Q_Q[tl]=obj;
		}
	}

	if(Q_Create)
	for(var t1=1; t1<=Q_Qs; t1++)
	{
		obj = Q_Q[t1]
		obj.created=true;
		IQI_alert( 'Q_Q['+t1+']')
		for(t2=1; t2<=obj.QCounter; t2++) 
		{obj.QA[t2].bgcolor=Q_C1;obj.QA[t2].Create("Q.QA["+t2+"]")}
		for(t2=1; t2<=obj.AnCounter; t2++) 
		{obj.AA[t2].bgcolor=Q_C2;obj.AA[t2].Create("Q.AA["+t2+"]")}
		obj.Tip?start=0:start=1	
 		for(t2=start; t2<=obj.FbCounter; t2++)
		{obj.FA[t2].bgcolor=Q_C3;obj.FA[t2].Create("Q.FA["+t2+"]")}
	}
	for(var t1=1; t1<=Q_Qs; t1++)
	{
		obj = Q_Q[t1]
		for(t2=0; t2<obj.Popup.length; t2++) 
		{
			obj.Popup[t2].event=obj.Popup[t2].event.toUpperCase();
			obj.Popup[t2].event=obj.Popup[t2].event.replace(/FINAL FEEDBACK/gi, 'FINALBACK');
			obj.Popup[t2].event=obj.Popup[t2].event.replace(/ /gi, '_');
			obj.Popup[t2].args=obj.Popup[t2].args.replace(/"/g,'')
		}
	}
	Q_LC = new LC();

	Q_Init=true
	if(Q_Q.length) eval(Q_InitF)
	view_loading();

	Q_Timer=setTimeout("UpSt()", 100)
	var tmp=location.href.slice(location.href.indexOf('?')+1,location.href.length)
	
	if( location.href.indexOf('=') < 0 ) {
		if(location.href.indexOf('?')+1)
		{
			if(tmp!='')
			{
				if(tmp==IQI_parseInt(tmp)) {Q_ID=tmp;Q_Q[tmp].SwQ()}
				else {
					Q = false;
					SwVv(tmp);
				}
			}
		}
		else if(Q_AutoS && Q_Q.length>0) {Q_ID=1;Q=Q_Q[1];Q.SwQ();}
	}
	else if(Q_AutoS && Q_Q.length>0) {Q_ID=1;Q=Q_Q[1];Q.SwQ();}
	self.focus();

	DynAPI.onUnload=function()
	{
		Q_Q=null;
		score.vraagdata=null;
		score=null;
	}

	if((Q_J4||false)) {
		j4_init();
	}
}

function Q_Vv( bestandsnaam )
{
	Q_VvVraag[Q_VvVragen]=new Array()
	Q_VvVraag[Q_VvVragen][1]=bestandsnaam.toLowerCase()
	Q_VvVraag[Q_VvVragen][2]=Q_ID
	Q.FileName=bestandsnaam
	IQI_alert(Q_VvVraag[Q_VvVragen][1]+' is Vvvraag. (nummer '+Q_VvVraag[Q_VvVragen][2]+')')
	Q_VvVragen++
}

function SwVv( bestandsnaam, back )
{
	var back=back||false;

	if(Q) {
		oldfile=Q.FileName
		Q.HdQ2(false, true);
	}
	IQI_alert('Show Vvvraag :'+bestandsnaam)
	for(var t1=0; t1<Q_VvVragen;t1++)
	{
		IQI_alert(t1+'='+Q_VvVraag[t1][1])
		if(Q_VvVraag[t1][1]==bestandsnaam.toLowerCase()) 
		{
			IQI_alert('Dat is vraag '+Q_VvVraag[t1][2])
			if(Q) Q.HdQ2(false)
			Q_ID=IQI_parseInt(Q_VvVraag[t1][2]);
			IQI_alert('Q=Q_Q['+Q_ID+']')
			Q=Q_Q[Q_ID]
			if(back) {AddFollowUp(oldfile);Q.FUS=oldfile;}
			Q.SwQ()
			var t1=1000;
			break;
		}
	}
	if( Q.IQIKT!=0 ) {IQI_alert('Fout!!\n\nVervolgvraag \"'+bestandsnaam+'\" niet op deze pagina gevonden');}
}

function UpSt()
{
	eval(Q_StatusF)
	self.status=Q_StatusText
	Q_Timer=setTimeout("UpSt()",/*IQI|Question.status-bar updaten om x miliseconden|INTEGER_1*/100/*IQI*/)
}

function LOChangeOKButton(okfnc)
{
	if(okfnc!="")
	{
		this.Bstr = Q_Btsr;
		this.Bstr = this.Bstr.replace("<!--OK_BUTTON-->", "<a href=\"javascript:"+okfnc+"\" "+Q_Status+">"+B_Ok+"</a>"+ofteken);
		this.buttondiv.IQIsetHTML(this.Bstr)
	}
}

function QOEvalOK(argr, Number)
{
	ee=IQI_parseInt(Q.ID.charAt(8));	t=10*IQI_parseInt(Q.ID.charAt(15+ee))+IQI_parseInt(Q.ID.charAt(16+ee));
	if(t==0||Q.CD.charAt(t+1)=='e'){} else {Q_StTxt='#@!$#!#@%^';Q_StatusText=Q_StTxt;}
	var arg="";
	if ( argr=="" || argr=="end" || argr=="stfb" ) 
	{
		if(this.FA[Number].type=="FbTrue") 
		{
			if(this.FUT!="") arg="SwVv('"+this.FUT+"')";
			else arg="Q_Q["+Q_ID+"].HdQ();"
		}
		else 
		{
			if(this.FA[Number].type=="FbFalse")
			{

				IQI_alert(this.AantalKansen+', '+this.IQIKT+', '+(this.IQIKT>=(this.AantalKansen-1))+', '+this.FUF)
				if(this.AantalKansen && this.FUF!="" && (this.IQIKT>=(this.AantalKansen-1))) arg="SwVv('"+this.FUF+"')";
				else 
				{
					if(argr!="end") arg="Q_Q["+Q_ID+"].HdFb("+Number+");";
					else arg="Q_Q["+Q_ID+"].HdQ();";
				}
				if(this.FUF1!="" && argr!="stfb") arg="SwVv('"+this.FUF1+"')";
			}
			else 
			{
				arg="Q_Q["+Q_ID+"].HdFb("+Number+");";
			}
		}
	}
	else arg="SwVv('"+argr+"')";
	return arg;
}

function dasf()
{
	now = new Date()
	var day = now.getDate()
	var month = now.getMonth()+1
	var year = ""+now.getFullYear()
	time = ""+year.charAt(2)+year.charAt(3)
	time += ((month<10)? "0" : "")+month
	time += ((day<10)? "0" : "")+day
	time2 =""+Q.ID.charAt(2)+Q.ID.charAt(3)+Q.ID.charAt(4)+Q.ID.charAt(5)+Q.ID.charAt(6)+Q.ID.charAt(7)
	if( time2>time ) return true; else return false;
}

function AddQ(Hstr) {Q_Q[Q_ID].AddQ(Hstr)}
function AddAn(Hstr, OKFunction) {Q_Q[Q_ID].AddAn(Hstr, OKFunction)}
function AddFb(Hstr, True){ Q_Q[Q_ID].AddFb(Hstr, True)}
function AddTip(Hstr, OKButton, canopened, showafter)
{
	var str=""
	var a=arguments
	if(a.length<2) OKButton=""
	
	if(Hstr!="")
	{
		Q_Q[Q_ID].AddFb(Q_TipText +":<br><br>"+Hstr, "", OKButton, true)
		okfnc = "Q_Q[Q_ID].SwFb(0);"
		ofteken=" "
		Q.Tip=true
		Q.tipBtstr = "<a href=\"javascript:"+okfnc+"\" "+Q_Status+">"+B_Hint+"</a>"+ofteken;
		Q.SwTipError=showafter
		if(canopened) Q.AA[1].Bstr = Q.AA[1].Bstr.replace( "<!--HINT_BUTTON-->", Q.tipBtstr)
	}
}

function EndThink()
{
  if(Q_Score) score.EndThink()
}

function IQI_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.IQI_p) d.IQI_p=new Array();
    var i,j=d.IQI_p.length,a=IQI_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.IQI_p[j]=new Image; d.IQI_p[j++].src=a[i];}}
}

function IQI_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=IQI_findObj(n,d.layers[i].document); return x;
}

function IQI_swapImage() { //v3.0
  var i,j=0,x,a=IQI_swapImage.arguments; document.IQI_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=IQI_findObj(a[i]))!=null)if(!(x.lock||false)){document.IQI_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function IQI_setImage(n,s)
{
	if ((x=IQI_findObj(n))!=null)
	{
		if(!(x.lock||false)) x.old=x.src;
		x.src=s;
		x.lock=true;
	}
}

function IQI_releaseImage(n)
{
	if ((x=IQI_findObj(n))!=null)
	{
		if(x.old||false) x.src=x.old;
		x.lock=false;
	}
}

function ChFb(arg1, arg2, arg3, arg4, arg5, arg6) {Q_Q[Q_ID].ChFb(arg1, arg2, arg3, arg4, arg5, arg6)}
function ChAn(arg1, arg2, arg3, arg4, arg5) {Q_Q[Q_ID].ChAn(arg1, arg2, arg3, arg4, arg5)}
function ChQ(arg1, arg2, arg3, arg4, arg5) {Q_Q[Q_ID].ChQ(arg1, arg2, arg3, arg4, arg5)}
function ChTip(arg1, arg2, arg3, arg4, arg5) {Q_Q[Q_ID].ChFb(arg1, 0, arg3, arg4, arg5)}

function SwFb(number){ Q_Q[Q_ID].SwFb(number)}
function HdFb(number){ Q_Q[Q_ID].HdFb(number)}
function AddFileName(arg) {Q_Vv(arg)}
function AddStFb(arg) {Q.StFb=arg}
function AddFollowUp(arg) {Q.FUF=arg;Q.FUT=arg}
function AddFollowUpS(arg) {Q.FUS=arg;}
function AddFollowUp1(arg) {if(arg!="") Q.FUF1=arg}
function AddFollowUpFalse(arg) {if(arg!="") Q.FUF=arg}
function AddFollowUpTrue(arg) {if(arg!="") Q.FUT=arg}

function SwFbTrue( arg1, arg2, arg3, arg4  ) {ChFb((arg1||Q_Right),1,arg2, arg3, arg4 );eval(Q_SwFbTF);SwFb(1)}
function SwFbFalse( arg1, arg2, arg3, arg4  ) {if(Q.Q_Fb(arg1, arg2,arg3,arg4)){ChFb((arg1||Q_Wrong),2,arg2, arg3, arg4 );eval(Q_SwFbFF);SwFb(2)}}
function SwFbToF( tof, arg1, arg2, arg3, arg4 ) {if(tof){SwFbTrue( arg1,arg2, arg3, arg4 )}else{SwFbFalse( arg1,arg2, arg3, arg4 )}}

function LOscrtxt(y)
{
	var maxh=this.scrollbackdiv.getHeight()-Q_ScrH;
	if(y<0) y=0;
	if(y>maxh) y=maxh;
	this.scrolldiv.moveTo(0, y);
	var scr=IQI_parseInt( ((this.textdiv.getHeight()-this.clipdiv.getHeight())*y)/(maxh))
	this.textdiv.moveTo(0,-scr)
	return true;
}

function QPopup(type)
{
	this.type=type
	this.event=""
	this.args=""
}

function LOscrup(){this.scrtxt(this.scrolldiv.getY()-Q_ScrSp);}

function LOscrdown(){this.scrtxt(this.scrolldiv.getY()+Q_ScrSp);}

function toolbar(name)
{
	this.name=name+'.toolbar'
	this.maindiv=IQIDynLayer('toolbar',0,0,Q_MW-Q_TBL-Q_TBR,0, Q_TBC )
	this.maindiv.setBgImage('lib/images/themes/'+Q_Theme+'/toolbar.gif')
	this.fill=false
	this.filled = function(){return this.fill}
	this.icons=new Array()
	this.str="<table border=0 cellspacing=0 cellpading=0 width=100%><tr><td align=left><Q_LEFT> </td><td align=middle> <Q_MIDDLE></td><td align=right><SPSTART><SP1><SP2><SP3><SP4><SP5><SP6><SP7><SP8><SP9><SP10><SP11><SP12><SP13><SP14><SP15><SP16><SP17><SP18><SP19><SPEND><Q_RIGHT></td></tr></table>"

	this.setImage = function(id, source)
	{
		for(var tl=0; tl<this.icons.length; tl++)
			if(this.icons[tl].id==id)
			{
				name=this.icons[tl].name.replace(/<NAME/g, this.maindiv.dynid);
				IQI_setImage(name, source);
			}
		return true;
	}
	this.relImage = function(id)
	{
		for(var tl=0; tl<this.icons.length; tl++)
			if(this.icons[tl].id==id)
			{
				name=this.icons[tl].name.replace(/<NAME/g, this.maindiv.dynid);
				IQI_releaseImage(name);
			}
		return true;
	}


	this.addicon = function(img, str, pos)
	{
		var id=arguments[3]||"unknown";
		var selected=arguments[4]||false;

		var tmpic=this.icons.length
		this.lname="<NAMEpopup"+tmpic;
		this.icons[tmpic]=new icon(img, str, tmpic, id, this.lname)

		var tmpstr="<a href=javascript:"+this.name+".icons["+tmpic+"].eval()><img src="+img.replace('icons/', 'icons/down_')+" name=\""+this.lname+"\" onMouseOut=\"IQI_swapImage('"+this.lname+"','', '"+img.replace('icons/', 'icons/down_')+"',1);\" onMouseOver=\"IQI_swapImage('"+this.lname+"','', '"+img+"',1);\" border=0></a>"
		if(selected) var tmpstr="<a href=javascript:"+this.name+".icons["+tmpic+"].eval()><img src="+img+" name=\""+this.lname+"\" border=0></a>"

		IQI_preloadImages(img.replace('icons/', 'icons/down_'));
		this.fill=true;
		if(pos=='left') this.str=this.str.replace('<Q_LEFT>', tmpstr+'<Q_LEFT>');
		else
		if(pos=='middle') this.str=this.str.replace('<Q_MIDDLE>', tmpstr+'<Q_MIDDLE>');
		else
		if(pos=='right') this.str=this.str.replace('<Q_RIGHT>', tmpstr+'<Q_RIGHT>');
		else
		if(pos==1)
		{
			this.str=this.str.replace('<SPSTART>', '<img src=\"lib/images/icons/spa_start.gif\" width=25 height=25>');
			this.str=this.str.replace('<SPEND>', '<img src=\"lib/images/icons/spa_end.gif\" width=25 height=25>');
		}
		this.str=this.str.replace('<SP'+pos+'>', tmpstr);
	}
	this.reset = function()
	{
		this.str="<table border=0 cellspacing=0 cellpading=0 width=100%><tr><td align=left><Q_LEFT> </td><td align=middle> <Q_MIDDLE></td><td align=right><SPSTART><SP1><SP2><SP3><SP4><SP5><SP6><SP7><SP8><SP9><SP10><SP11><SP12><SP13><SP14><SP15><SP16><SP17><SP18><SP19><SPEND><Q_RIGHT></td></tr></table>"
		this.maindiv.IQIsetHTML(this.str);
		this.icons=null;
		this.icons=new Array()
		this.fill=false
	}
	this.show = function()
	{
		this.maindiv.IQIsetHTML(this.str);
	}
}

function icon(img, str, num)
{
	this.name=arguments[4]||"";
	this.id=arguments[3]||"";
	this.img=img;
	this.str=str;
	this.num=num;
	this.eval=function(){eval(this.str);}
}

IQI_preloadImages('lib/images/themes/'+Q_Theme+'/hint_button.gif');
IQI_preloadImages('lib/images/themes/'+Q_Theme+'/ok_button.gif');
IQI_preloadImages('lib/images/themes/'+Q_Theme+'/stop_button.gif');

function num_get_deci( value, precision )
{
	var dot_str = ".";

	if(precision>0)
	{
		if(Gtnh_Punt) value=(""+value).replace(/,/gi,'.');
		else value=(""+value).replace(/\./gi,',');	
	
  	      value = "" + value //convert value to string
	      precision = IQI_parseInt(precision);

	      var whole = "" + Math.round(value * Math.pow(10, precision));

        	var decPoint = whole.length - precision;

		whole += "00000000000000";

	      if(decPoint > 0) {
                result = whole.substring(0, decPoint);
                result += dot_str;
                result += whole.substring(decPoint, decPoint+precision);
        	} else {
               	result = "0" + dot_str;
			for(var x=0; x<-decPoint; x++) result+="0";
			result += whole;
                  result = result.substring(0, 2+precision);
        	}
	  	IQI_alert(value+' -> '+result);
	      return result;
	}
	else
	{
		IQI_alert(value+' -> '+Math.round(value));
		return Math.round(value);
	}
}

function IQI_parseInt(tmp)	// speciaal voor netscape?
{
	var x=parseInt(tmp, 10)
	if(isNaN(x)) x=0;
	return x;
}

function LC()
{
	this.str="";
	this.maxl=60;
	this.index=0;
	this.refresh=800;

	this.update = function()
	{
		this.str=this.str.replace(/\|\|/g, '|');
		tmpstr=""
		if((this.str+"").length>0)
		{

			if((this.str+"").length<this.maxl)
			{
				var ind=this.str.length;
				tmpstr=this.str.substring(0, ind)+"|";
			}
			else
			{
				var ind=this.maxl;
				tmpstr=(this.str+"").substring(0, ind);
// check of er een = teken of een | teken moet komen.. = teken als string afgebroken is
				if(this.str.charAt(ind)=="|") tmpstr+="|"; else tmpstr+="=";
			}
			this.str=(this.str+"").substring(ind);

			if(Q_LCEn || Q_LCen) top.document.title='IQI|'+this.ltime()+'|'+tmpstr;
		}
		else if(Q_LCEn || Q_LCen) top.document.title='IQI|99||';
		setTimeout( "Q_LC.update();", this.refresh);
	}
	this.Wr = function(name, val, nxt)
	{
		name=name.replace(/\||\[|\]/g, '');
		val=val.replace(/\|/g, '');
		nxt=nxt||false;
		if(!nxt) this.str+='|XT["X'+name+'"]="'+val+'"|';
		else this.str+="|"+name+"="+val+"|";
	}
	this.Raw = function(val)
	{
		val=val.replace(/\||\[|\]/g, '');
		this.str+="|"+val+"|";
	}

	this.stop = function(arg)
	{
		if(Q_LCEn) this.str+='|_STOP_|';
	}
	this.ltime = function()
	{
		return ((this.index++) % 10);
	}
	this.get = function(name)
	{
		name='X'+name.replace(/\W+/g,'')
		eval('tmp=XT["'+name+'"]||false')
		return tmp
	}
	if(!XQ_LCEn)
	{
		if(Q_LCEn || Q_LCen) this.str+='|XLCEn=true|XT=new Array()|';
	}
	setTimeout( "Q_LC.update();", 1000);
}

/*
   Core DynAPI Distribution
   Cookies class
*/ 
DynAPI.cookies = {
	saveCookie : function(name,value,days) {
		//IQI_alert(document.cookie.length)
		name=name.replace(/;/gi, 'þ')
		name=name.toLowerCase();
		value=(value+'').replace(/;/gi, 'þ') 

		Q_LC.Wr(name, value);

		if(document.cookie.length>3800) value="";
	 	if (days) {
			var date=new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000))
			var expires="; expires="+date.toGMTString()
		} else expires="";
		document.cookie=name+"="+value+expires+"; path=/"
		if(document.cookie.length>3700) return false; else return true;
	},
	readCookie : function(name) {
		name=name.replace(/;/gi, 'þ')
		name=name.toLowerCase();
		var nameEQ=name+"="
		var ca=document.cookie.split(';')
		for(var i=0;i<ca.length;i++) {
			var c=ca[i];
			while (c.charAt(0)==' ') c=c.substring(1,c.length)
			if (c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length).replace(/þ/gi, ';')
		}
		ret=Q_LC.get(name);
		return ret;
	},
	deleteCookie : function(name) {	DynAPI.cookies.saveCookie(name,"",-1) }
}

// variable gedeelte

var POPUP_VARIABLE=true
var POPUP_VARIABLE_FUNC="SetVariable"
var POPUP_VARIABLE_ICON="lib/images/icons/text.gif"

function SetVariable(name, value)
{
	var val="";

	if(typeof(value)=="object")
	{
		// dit was -2 omdat ik vaak een #X# op het einde van Teun krijg. hou in de gaten of dat nog steeds zo is.
		var get=IQI_parseInt(Math.random()*(value.length-1)+0.49)
		val=value[get];
	}
	else
	{
		val=value;
	}
	Q.Variables[name]=val;
}

document.write('<div id="hidepage" style="position: absolute; left:5px; top:5px; background-color: #FFFFCC; layer-background-color: #FFFFCC; height: 10px; width: 80%; z-index:999;"><table width=80%><tr><td>'+Q_Loading+'</td></tr></table></div>'); 

