var cur;

function window.onbeforeprint()

{
	document.all.formtable.style.visibility = "hidden";
}
function window.onafterprint()
{
	document.all.formtable.style.visibility = "visible";	
}
function Init()
{

	cur = 0;

	//setInterval("Rotate()", 100);

}
function Rotate()
{

	var tmp = new String("");

	cur++;

	cur%=4;

	tmp = cur+1;

	var name = "rot" + tmp + ".gif";

//	document.all.im.src = name;

	//document.all.mtable.style.visibility = "hidden";

}
function GetNaam(teken)
{

	switch (teken)
	{
		case 1:
			return "-";
		break;
		case 2:
			return "-";
		break;
		case 3:
			return "-";
		break;
		case 4:
			return "-";
		break;
		case 5:
			return "-";
		break;
		case 6:
			return "-";
		break;
		case 7:
			return "-";
		break;
		case 8:
			return "-";
		break;
		case 9:
			return "-";
		break;
	}
	return "";
}
function DoFont()
{
	var tmp = document.all.textsize.selectedIndex;
	switch(tmp)
	{
		case 0:
			document.all.laptextdiv.style.fontSize = "8";
		break;
		case 1:
			document.all.laptextdiv.style.fontSize = "10";		
		break;
		case 2:
			document.all.laptextdiv.style.fontSize = "12";		
		break;
		case 3:
			document.all.laptextdiv.style.fontSize = "14";		
		break;
		case 4:
			document.all.laptextdiv.style.fontSize = "16";		
		break;
		case 5:
			document.all.laptextdiv.style.fontSize = "20";		
		break;
		case 6:
			document.all.laptextdiv.style.fontSize = "24";		
		break;
		case 7:
			document.all.laptextdiv.style.fontSize = "30";		
		break;
		case 8:
			document.all.laptextdiv.style.fontSize = "42";		
		break;		
	}
}

function ClickIt()
{

	var jaar = new String("");

	var maand = new String("");

	

	jaar = document.all.jaar.innerText;

// 	maand = document.all.maand.innerText;

	maand = "3";

	var ijaar = 0;

	var imaand = 0;

	ijaar = parseInt(jaar);

	imaand = parseInt(maand);



	if(isNaN(imaand))

	{
		imaand = -1;		
	}

	
	if(isNaN(ijaar))

	{
		ijaar = -1;
	}
	

	if(ijaar == -1)

	{
		alert("Please Key In the Date");

		return;
	}



	if( imaand == 1)

		ijaar--;

	

	

	document.all.spanjaar.innerText = jaar + " ";

	document.all.laptext.style.visibility = "visible";

//	document.all.mtable.style.visibility = "visible";

	//document.all.im.style.visibility = "hidden";

	

	var nw, w, ne, s, n, sw, e, se;

	

	

	var center = Math.floor(((ijaar-64)%180/20))+1;

	document.all.m.innerText = 	center;

	document.all.cnumber.innerText = center;

	document.all.cnumber1.innerText = center + " " ;

	document.all.spanteken.innerText = GetNaam(center) +" ";

	

	



	nw = Math.floor(((ijaar-44)%180/20))+1;

	w = Math.floor(((ijaar-24)%180/20))+1;

	ne = Math.floor(((ijaar-4)%180/20))+1;

	s = Math.floor(((ijaar+16)%180/20))+1;

	n = Math.floor(((ijaar+36)%180/20))+1;

	sw = Math.floor(((ijaar+56)%180/20))+1;

	e = Math.floor(((ijaar+76)%180/20))+1;

	se = Math.floor(((ijaar+96)%180/20))+1;



	document.all.nw.innerText = nw;

	document.all.w.innerText = w;

	document.all.ne.innerText = ne;

	document.all.s.innerText = s;

	document.all.n.innerText = n;

	document.all.sw.innerText = sw;

	document.all.e.innerText = e;

	document.all.se.innerText = se;

	

	document.all.nw.style.color = "BLACK";

	document.all.w.style.color = "BLACK";

	document.all.ne.style.color = "BLACK";

	document.all.s.style.color = "BLACK";

	document.all.n.style.color = "BLACK";

	document.all.sw.style.color = "BLACK";

	document.all.e.style.color = "BLACK";

	document.all.se.style.color = "BLACK";

	document.all.m.style.color = "BLACK";

	

	

	document.all.nw.style.fontSize = "large";

	document.all.w.style.fontSize = "large";

	document.all.ne.style.fontSize = "large";

	document.all.s.style.fontSize = "large";

	document.all.n.style.fontSize = "large";

	document.all.sw.style.fontSize = "large";

	document.all.e.style.fontSize = "large";

	document.all.se.style.fontSize = "large";

	document.all.m.style.fontSize = "large";



	var grsel = document.all.graden.selectedIndex;

	var tmp = grsel%3;

	var tmpl = Math.floor(grsel/3);

	

	var startl, startr;

	var richtingsit;

	var richtingface;

	

	switch(tmpl)

	{

		case 0:

			startl = s;

			startr = n;

			richtingsit = "South ";

			richtingface = "North ";

			document.all.n.style.color = "BROWN";

			document.all.n.style.fontSize = "xx-large";

			document.all.s.style.color = "BLACK";

			document.all.s.style.fontSize = "xx-large";

			

		break;

		case 1:

			startl = sw;

			startr = ne;

			richtingsit = "South-West ";

			richtingface = "North-East ";

			document.all.ne.style.color = "BROWN";

			document.all.ne.style.fontSize = "xx-large";

			document.all.sw.style.color = "BLACK";

			document.all.sw.style.fontSize = "xx-large";

				

		break;

		case 2:

			startl = w;

			startr = e;

			richtingsit = "West ";

			richtingface = "East ";

			document.all.e.style.color = "BROWN";

			document.all.e.style.fontSize = "xx-large";

			document.all.w.style.color = "BLACK";

			document.all.w.style.fontSize = "xx-large";

				

		break;

		case 3:

			startl = nw;

			startr = se;

			richtingsit = "North-West ";

			richtingface = "South-East ";

			document.all.se.style.color = "BROWN";

			document.all.se.style.fontSize = "xx-large";

			document.all.nw.style.color = "BLACK";

			document.all.nw.style.fontSize = "xx-large";

				

		break;

		case 4:

			startl = n;

			startr = s;		

			richtingsit = "North ";

			richtingface = "South" ;

			document.all.s.style.color = "BROWN";

			document.all.s.style.fontSize = "xx-large";

			document.all.n.style.color = "BLACK";

			document.all.n.style.fontSize = "xx-large";

				

		break;

		case 5:

			startl = ne;

			startr = sw;

			richtingsit = "North-East ";

			richtingface = "South-West ";			

			document.all.sw.style.color = "BROWN";

			document.all.sw.style.fontSize = "xx-large";

			document.all.ne.style.color = "BLACK";

			document.all.ne.style.fontSize = "xx-large";

				

		break;

		case 6:

			startl = e;

			startr = w;	

			richtingsit = "East ";

			richtingface = "West ";

			document.all.w.style.color = "BROWN";

			document.all.w.style.fontSize = "xx-large";

			document.all.e.style.color = "BLACK";

			document.all.e.style.fontSize = "xx-large";

				

		break;

		case 7:

			startl = se;

			startr = nw;		

			richtingsit = "South-East ";

			richtingface = "North-West ";			

			document.all.nw.style.color = "BROWN";

			document.all.nw.style.fontSize = "xx-large";

			document.all.se.style.color = "BLACK";

			document.all.se.style.fontSize = "xx-large";

				

		break;

	}

	document.all.richtingface.innerText =  richtingface;

	document.all.richtingsit.innerText = richtingsit;

	document.all.facing.innerText = GetNaam(startr);

	document.all.sitting.innerText = GetNaam(startl);

	//var ttt = startr;

	//startr = startl;

	//startl = ttt;

	

	document.all.ml.innerText = startl;

	document.all.mr.innerText = startr;

	

	var stepl, stepr;



	if(startl == 5)

	{

		if(center%2 == 0)

		{

			stepl = -1;

		}

		else

		{

			stepl = 1;

		}



		if(tmp != 0)

		{

			stepl=-stepl;

		}

	}

	else

	{	

		if(startl%2 == 0)

		{

			stepl = -1;

		}

		else

		{

			stepl = 1;

		}

		if(tmp != 0)

		{

			stepl=-stepl;

		}

	}



	if(startr == 5)

	{

		if(center%2 == 0)

		{

			stepr = 1;

		}

		else

		{

			stepr = -1;

		}



		if(tmp == 0)

		{

			stepr=-stepr;

		}

	}

	else	

	{

		if(startr%2 == 0)

		{

			stepr = 1;

		}

		else

		{

			stepr = -1;

		}

		if(tmp == 0)

		{

			stepr=-stepr;

		}

	}



	if(stepl == 1)

		startl+=18;

	else

		startl+=16;



	if(stepr == 1)

		startr+=18;

	else

		startr+=16;



	

	document.all.nwl.innerText = (startl)%9+1;

	document.all.wl.innerText = (startl+1*stepl)%9+1;;

	document.all.nel.innerText = (startl+2*stepl)%9+1;;

	document.all.sl.innerText = (startl+3*stepl)%9+1;;

	document.all.nl.innerText = (startl+4*stepl)%9+1;;

	document.all.swl.innerText = (startl+5*stepl)%9+1;;

	document.all.el.innerText = (startl+6*stepl)%9+1;;

	document.all.sel.innerText = (startl+7*stepl)%9+1;;

	

	document.all.nwr.innerText = (startr)%9+1;

	document.all.wr.innerText = (startr+1*stepr)%9+1;;

	document.all.ner.innerText = (startr+2*stepr)%9+1;;

	document.all.sr.innerText = (startr+3*stepr)%9+1;;

	document.all.nr.innerText = (startr+4*stepr)%9+1;;

	document.all.swr.innerText = (startr+5*stepr)%9+1;;

	document.all.er.innerText = (startr+6*stepr)%9+1;;

	document.all.ser.innerText = (startr+7*stepr)%9+1;;


}