var step=20;
var current = 20;
var voelxstart = 200;
var voelystart = 100;
var voelx ;
var voely ;
var max = 200;
var vormmax = 140;
var id;
var prentcounter = 1;

function changeShapeRef(kleur)
{
document.all.driehoek1.href="Afrikaans/Vorms/driehoek_"+kleur+".html"
document.all.driehoek2.href="Afrikaans/Vorms/driehoek_"+kleur+".html"
document.all.driehoek3.href="Afrikaans/Vorms/driehoek_"+kleur+".html"
document.all.ster1.href="Afrikaans/Vorms/ster_"+kleur+".html"
document.all.ster2.href="Afrikaans/Vorms/ster_"+kleur+".html"
document.all.ster3.href="Afrikaans/Vorms/ster_"+kleur+".html"
document.all.ster4.href="Afrikaans/Vorms/ster_"+kleur+".html"
}

function changeShapeRef_e(kleur)
{
document.all.driehoek1.href="English/Vorms/driehoek_"+kleur+".html"
document.all.driehoek2.href="English/Vorms/driehoek_"+kleur+".html"
document.all.driehoek3.href="English/Vorms/driehoek_"+kleur+".html"
document.all.ster1.href="English/Vorms/ster_"+kleur+".html"
document.all.ster2.href="English/Vorms/ster_"+kleur+".html"
document.all.ster3.href="English/Vorms/ster_"+kleur+".html"
document.all.ster4.href="English/Vorms/ster_"+kleur+".html"
}

function changeAuthor(ding)
{
document.author = ding
}

function movevoel_init()
{
voelx=voelxstart
voely=voelystart
document.all.voel.style.left = voelx
document.all.voel.style.top=voely
movevoel()
}

function movevoel() {
document.all.voel.style.visibility="visible"
voelx+=step
voely-=step/2
document.all.voel.style.top=voely
document.all.voel.style.left=voelx
if (voely<= -50) {
		clearTimeout(id)
}
else {
		id = setTimeout("movevoel()", 100)
}
}

function onLink(lnr) {
var obj = eval("document.all." + lnr + ".style");
obj.color= "red" ;
obj.backgroundColor = "yellow";
}

function offLink(lnr) {
var obj = eval("document.all." + lnr + ".style");
obj.color= "groen" ;
obj.backgroundColor = "";
}

function vorminit() {

document.all.mybody.style.backgroundColor = backcolor
document.fgColor = lettercolor
document.title=titel
document.all.letters.innerText = woordjie

vormintro()

}

function vormintro() {
	current +=step;

	document.all.vorm.style.width = current 
	if (current>= vormmax) {
		clearTimeout(id);
		id = setTimeout("vormprentjie()", 10)
	}	
	else {
		id = setTimeout("vormintro()", 100);
	}
}

function vormprentjie() {
    clearTimeout(id);
    id = setTimeout("woord()", 500)
}

function init() {
document.title=titel
document.author=geluid
document.all.main.innerText = titel
document.all.letters.innerText = woordjie
if (titel == "2") {
	document.all.img1.src=prent1
	document.all.img2.src=prent2
} else {
	if (isNaN(titel)) {
		document.all.img1.src=prent1
	} else {	
	for (i=1; i <= document.title; i++)
	{
		pr = eval("document.all.img" + i )
		pr.src = prent1	
	}
}  
}

intro()
}

function intro() {
	current +=step;
	document.all.main.style.fontSize = current;
	if (current>= max) {
		clearTimeout(id);
		id = setTimeout("prentjie()", 1000)
	}	
	else {
		id = setTimeout("intro()", 100);
	}
}

function prentjie() {

    pr = eval("document.all.img" + prentcounter + ".style")
    document.wegsteekvorm.nommer.value = prentcounter	

    playSound("nommer.html")


    pr.visibility = "visible"	
    prentcounter ++
    if (prentcounter <= document.title) {
	id = setTimeout("prentjie()", 1000)
    } else {
	    clearTimeout(id);
	    id = setTimeout("woord()", 1000)
    }
}

function woord() {
    playSound("sin.html")
    document.all.woord.style.visibility = "visible"	
    clearTimeout(id);
}

function playMusic() {
if ( klank.location.href.substring(klank.location.href.length-10) != "music.html")
   klank.location.href = "music.html";	
else
   klank.location.href = "nosound.html";
 }

function playSound(file) {
klank.location.href = file
}

function makeColor(col) {
document.fgColor = col

switch (col) {
	case "red": 
		backg = "pink"
		break;
	case "black":
		backg = "gray"
		break;
	case "orange":
		backg = "olive"
		break;
	case "brown":
		backg = "beige"
		break;
	case "white":
		backg = "black"
		break;
	case "purple":
		backg = "azure"
		break;
	case "pink":
		backg = "white"
		break;
	default:
		backg = "light" + col
}
document.all.mybody.style.backgroundColor = backg

playSound(col+".html")
}

function changeCase() {
playSound("hefboom.html")

var exp = new Date()
var nowPlusFiveYears = exp.getTime() + (5*366*24*60*60*1000)
exp.setTime(nowPlusFiveYears)
var str

if (document.all.main.style.textTransform == "lowercase") {
	str =  "Case=" 
	document.cookie = str
	document.all.main.style.textTransform = "uppercase"
	document.all.woord.style.textTransform = "capitalize"
	document.all.caseimg.src="hoofletters.gif"
} else {
	str =  "Case=" + "lowercase"
	str = str + ";expires=" + exp.toGMTString()
	document.cookie = str
	document.all.main.style.textTransform = "lowercase"
	document.all.woord.style.textTransform = "lowercase"
	document.all.caseimg.src="kleinletters.gif"
}

}

function showwin(ding) {
var obj
obj=eval("document.all." + ding + ".style")

if (obj.visibility == "visible")
{
	obj.visibility = "hidden"
}
else
{
	obj.visibility = "visible"
}
}

function showdelay(ding, sek) {
var obj
obj=eval("document.all." + ding + ".style")
obj.visibility = "visible"
id=setTimeout("stopdelay(obj)", 1000*sek)
}

function stopdelay(obj) {
obj.visibility = hidden
clearTimeout(id)
}

function reload_obj (ding, prentjie) {
var obj
obj=eval("document.all." + ding )
obj.src = prentjie
}
