
function wOpen(link) {
    leftPos = (screen.width - 800)/2;
    topPos = (screen.height - 560)/2;

    var height = '575';

    if (screen.height <= 600)
    	height = '500';

    var win = window.open(link, 'edit', 'directories = no, fullscreen = no, height = '+height+', menubar = no, resizable = yes, status = no, titlebar = no, toolbar = no, width=750, screenX=0, hotkeys=no, left = ' + leftPos + ', top = ' + topPos);
    win.focus();
}

function wOpenScroll(link) {
    leftPos = (screen.width - 700)/2;
    topPos = (screen.height - 575)/2;
    leftPos = 0;
    topPos = 0;
    var win = window.open(link, 'edit', 'directories = no, fullscreen = no, height = 575, menubar = no, resizable = no, status = no, titlebar = no, toolbar = no, width=700, screenX=0, scrollbars=1, hotkeys=no, left = ' + leftPos + ', top = ' + topPos);
    win.focus();
}


function wOpenSmall(link) {
    leftPos = (screen.width - 700)/2;
    topPos = (screen.height - 575)/2;
    var win = window.open(link, '', 'fullscreen = no, height = 1, toolbar = no, status = no, addresbar = no, resizable = no, width=1, screenX=0, left = ' + leftPos + ', top = ' + topPos);
    win.focus();

}

function wDownload(link) {
    leftPos = (screen.width - 700) / 2;
    topPos = (screen.height - 575) / 2;
    var win = window.open(link, '', 'fullscreen = no, height = 450, toolbar = no, addresbar = no, resizable = no, width=600, screenX=0, left = ' + leftPos + ', top = ' + topPos);
    /*win.setTimeout('window.print()', 1000);*/
    win.setTimeout('self.close()', 3000);
}

function wPrint(link) {
    leftPos = (screen.width - 700)/2;
    topPos = (screen.height - 575)/2;
    var win = window.open(link, '', 'fullscreen = no, height = 450, toolbar = no, addresbar = no, resizable = no, width=600, screenX=0, left = ' + leftPos + ', top = ' + topPos);
		win.setTimeout('window.print()', 1000);
		win.setTimeout('self.close()', 3000);
}

function wPrintContent(link, printpage)
{
	var div = document.getElementById("printDivContent");
	if (div == null || typeof(div) == "undefined")
	{
		wPrint(link);
	}
	else
	{
		wPrint(printpage);
	}
}

function wPrint2() {
    leftPos = (screen.width - 700)/2;
    topPos = (screen.height - 575)/2;
    var win = window.open('print.asp', '', 'fullscreen = no, height = 450, toolbar = no, addresbar = no, resizable = no, width=600, screenX=0, left = ' + leftPos + ', top = ' + topPos);
}


function wOpenHelp(link) {
    leftPos = (screen.width - 800)/2;
    topPos = (screen.height - 600)/2;
    var win = window.open(link, 'help', 'fullscreen = no, height = 500, toolbar = no, addresbar = no, resizable = no, width=700, screenX=0, left = ' + leftPos + ', top = ' + topPos);
    win.focus();
}

function UpdateOnKeyDown(e,f)
{
	if (e.keyCode==13)
	{
		eval(f);
	}
}

function sizecheck(){

		if (navigator.appName=="Netscape") {
	  	if ( (self.innerWidth < 750) || (self.innerHeight < 400) ) {
		  	self.resizeTo( self.screen.width,  self.screen.height );
				self.moveTo(1,1);
	  	}
	  }
	  else if (navigator.appName.indexOf("Microsoft")!=-1) {
			if ((document.body.clientWidth < 750 ) || (document.body.clientHeight < 400)) {
				window.moveTo( 0, 0 );
		  	window.resizeTo( window.screen.availWidth, window.screen.availHeight );
			}
		}
}

function checkDate (day,month,year)
{
  //alert( day + month+ year);
	if (isEmpty(year) || year < 1920 || year > 2020)
		return "Jaar moet tussen 1920 en 2020 liggen";
  var maxday = 0;
	var monthName = "";

	switch (month) {
		case "1":
			monthName = "januari";
			break;
		case "2":
			monthName = "februari";
			break;
		case "3":
			monthName = "maart";
			break;
		case "4":
			monthName = "april";
			break;
		case "5":
			monthName = "mei";
			break;
		case "6":
			monthName = "juni";
			break;
		case "7":
			monthName = "juli";
			break;
		case "8":
			monthName = "augustus";
			break;
		case "9":
			monthName = "september";
			break;
		case "10":
			monthName = "oktober";
			break;
		case "11":
			monthName = "november";
			break;
		case "12":
			monthName = "december";
			break;
	}


	switch (month) {
		case "1":
		case "3":
		case "5":
		case "7":
		case "8":
		case "10":
		case "12":
			maxday = 31;
			break;
		case "2":
			if (LeapYear(year))
				maxday = 29
			else
				maxday = 28;
			break;
		case "4":
		case "6":
		case "9":
		case "11":
			maxday = 30;
			break;
	}

	if ((maxday < day) || (day < 1))
	{
		if (maxday < 30)
		{
		  return ("De maand " + monthName + " heeft maar " + maxday + " dagen in " + year + ".");
		}
		else
		  return ("De maand " + monthName + " heeft maar " + maxday + " dagen" + ".");
	}
	return "";
}

function LeapYear(intYear)
{
	if (intYear % 100 == 0)
	{
		if (intYear % 400 == 0) { return true; }
	}
	else
	{
		if ((intYear % 4) == 0) { return true;	}
	}
	return false;
}

function meta_tab_onload()
{
	var tab = document.getElementById('meta_tab_1');
	if (tab!=null)
	{
		var href = tab.getElementsByTagName('A');
		window.open(href[0].href,'metadata');

		set_meta_tab('0');
	}
}

function set_meta_tab(select)
{
	var p = document.getElementById('meta_tabs');
	var tabs = p.getElementsByTagName('TABLE');
	var klasses;

	for(var i=0;i<tabs.length;i++)
	{
		klasses = tabs[i].getElementsByTagName('TD');

		if (i!=select)
		{
			if (i!=0)
				klasses[0].className = 'TabLevel2NietActiefLinks'
			else
				klasses[0].className = 'TabLevel2NietActiefLinksLinks'

			klasses[1].className = 'TabLevel2NietActief'
			klasses[2].className = 'TabLevel2NietActiefRechts'
		}
		else
		{
			if (i!=0)
				klasses[0].className = 'TabLevel2ActiefLinks'
			else
				klasses[0].className = 'TabLevel2ActiefLinksLinks'

			klasses[1].className = 'TabLevel2Actief'
			klasses[2].className = 'TabLevel2ActiefRechts'
		}


	}
}

function mod_tab_onload()
{
	var tab = document.getElementById('mod_tab_1');
	if (tab!=null)
	{
		var href = tab.getElementsByTagName('A');
		window.open(href[0].href,'main');

		set_mod_tab('0');
	}
}

function set_mod_tab(select)
{
	var p = document.getElementById('mod_tabs');
	var tabs = p.getElementsByTagName('TABLE');
	var klasses;

	for(var i=0;i<tabs.length;i++)
	{
		klasses = tabs[i].getElementsByTagName('TD');

		if (i!=select)
		{
			if (i!=0)
				klasses[0].className = 'TabNietActiefLinks'
			else
				klasses[0].className = 'TabNietActiefLinksLinks'

			klasses[1].className = 'TabNietActief'
			klasses[2].className = 'TabNietActiefRechts'
		}
		else
		{
			if (i!=0)
				klasses[0].className = 'TabActiefLinks'
			else
				klasses[0].className = 'TabActiefLinksLinks'

			klasses[1].className = 'TabActief'
			klasses[2].className = 'TabActiefRechts'
		}


	}
}

function enter(event){
  if (event.keyCode !=13) {return false;}
  return true;
 }

function txtOnFocus (obj) {
	obj.style.backgroundImage = '';
}

function txtOnBlur (obj,image) {
	if (obj.value == '') {
    obj.style.backgroundImage = 'url(' + image.replace(' ', '%20') + ')';
		obj.style.backgroundRepeat = 'no-repeat';
		obj.style.backgroundPositon = 'left center';
	}
}

function StartReadSpeaker()
{
	var rs_form = document.getElementById('rs_form');
	if (rs_form)
	{
		// In plaats van meteen beginnen met lezen eerst 
    // wachten op '<!-- RSPEAK_START -->'-comment 	
    rs_form.selectedtext.value = '<!-- RSPEAK_STOP -->' + document.body.innerHTML; 
    var rsWindow = window.open('','rs','width=380,height=180,toolbar=0');
		rs_form.target = rsWindow.name; //'rs'
    setTimeout(function() {rs_form.submit();},500);
	}
}

