<!--
var defaultEmptyOK = true;
var whitespace = " \t\n\r";
var DateSeparators = ".-:/";
var decimalPointDelimiter = ",";

var daysInMonth = new Array(12);
daysInMonth[1] = 31;
daysInMonth[2] = 29;   // must programmatically check this
daysInMonth[3] = 31;
daysInMonth[4] = 30;
daysInMonth[5] = 31;
daysInMonth[6] = 30;
daysInMonth[7] = 31;
daysInMonth[8] = 31;
daysInMonth[9] = 30;
daysInMonth[10] = 31;
daysInMonth[11] = 30;
daysInMonth[12] = 31;

function emailpage(title,url,paramtxt,param,page,pid,frompop) {
	if (page=="nieuws" && $pid!="") {
	} else if (page=="culinair" && $pid!="") {
	} else {
		if (frompop) {
			pop("email_link.php?title="+title+"&url="+url+"&paramtxt="+paramtxt+"&param="+param,450,320);
		} else {
			pop2("email_link.php?title="+title+"&url="+url+"&paramtxt="+paramtxt+"&param="+param,450,320);
		}	
	}
}	
var popWin = false
function printpage() {
	var arg=printpage.arguments;
	url=arg[0];
	if (url.indexOf("?")==-1) {
		url=url+"?prt=1";
	} else {
		url=url+"&prt=1";
	}
	frompop=arg[1]?arg[1]:false;
	if (frompop) {
		if (browser_ie && window.print) {
			popWin2=pop2(url,500,500,1);
			this.close();
			popWin2.print();
			//popWin=pop(url,500,500,1);
		} else {
			popWin2=pop2(url,500,500,1,1,1,1);
			this.close();
		}	
	} else {
		if (browser_ie && window.print) {
			popWin=pop(url,500,500,1);
			if (popWin.print()) popWin.close();
		} else {
			popWin=pop(url,500,500,1,1,1,1);
		}	
	
	}
}
function closeIfPrintWindow(prt) {
	if (prt) {
		if (browser_ie && window.print) {
			window.close();
		}	
	}
}
function popup(url) {
	if (popWin && !popWin.closed) popWin.close();
	popWin=pop(url,580,400,1);
}
function dlink(url,t) {

	// dynamic link - based on linktype, open url in same window, popup, parent window or second popup
	if (t=="S") {
		window.location.href=url;
	} else if (t=="P") {
		if (window.opener) {
			window.location.href=url;
		} else {
			pop(url,500,400,1,0,0,0,1);
		}
	} else if (t=="W") {
		if (window.opener) {
			window.opener.location.href=url;
			window.close();
		} else {
			window.location.href=url;
		}
	} else if (t=="X") {
		if (window.opener) {
			pop2(url,500,400,1,0,0,0,1);
		} else {
			pop(url,500,400,1,0,0,0,1);
		}
	}
}
function popScreen(url) {
	//url, width, height, scrol, resize, menu, toolbar, status
	var scrWidth = screen.width-10;
	var scrHeight = screen.height-100;
	winProperties="toolbar=no,location=no,directories=no,status=yes,menubar=no,";
	winProperties+="scrollbars=yes,resizable=no,";
	winProperties+="width="+scrWidth+",height="+scrHeight+",left=0,top=0";
	pScrWin = window.open(url,"poScreen",winProperties);
	pScrWin.focus();
	return (pScrWin);		
}
function pop() {
	//url, width, height, scrol, resize, menu, toolbar, status
	var arg=pop.arguments;
	var pWin=false;
	var argv=new Array();
    for (var i=0;i<8;i++) { 
		argv[i]=""; 
	}
    for (var i=0;i<arg.length;i++) { 
		argv[i]=arg[i]; 
	}
	if (argv[0]!="") {
		if (argv[1]=="") { argv[1]="200" };
		if (argv[2]=="") argv[2]="200";
		argv[3]=(argv[3]==""||argv[3]==0)?"no":"yes";
		argv[4]=(argv[4]==""||argv[4]==0)?"no":"yes";
		argv[5]=(argv[5]==""||argv[5]==0)?"no":"yes";
		argv[6]=(argv[6]==""||argv[6]==0)?"no":"yes";
		argv[7]=(argv[7]==""||argv[7]==0)?"no":"yes";
		var scrWidth = screen.width;
		var posLeft = Math.floor((scrWidth-argv[1])/2);
		if (posLeft<0) {posLeft=0};
		var txtLeft = "left="+posLeft;
		var scrHeight = screen.height;
		var posTop = Math.floor((scrHeight-argv[2])/2);
		if (posTop<0) {posTop=0};
		//posTop=50;
		txtTop="top="+posTop;
		winProperties="toolbar="+argv[6]+",location=no,directories=no,status="+argv[7]+",menubar="+argv[5]+",";
		winProperties+="scrollbars="+argv[3]+",resizable="+argv[4]+",";
		winProperties+="width="+argv[1]+",height="+argv[2]+","+txtLeft+","+txtTop;
		url=argv[0];
		url=url+((url.indexOf("?")==-1)?"?":"&")+"ispop=1";
		pWin = window.open(url,"Popup",winProperties);
		pWin.focus();
	}
	return (pWin);		
}

function pop2() {
	//url, width, height, scrol, resize, menu, toolbar
	var arg=pop2.arguments;
	var pWin2=false;
	var argv=new Array();
    for (var i=0;i<7;i++) { 
		argv[i]=""; 
	}
    for (var i=0;i<arg.length;i++) { 
		argv[i]=arg[i]; 
	}
	if (argv[0]!="") {
		if (argv[1]=="") { argv[1]="200" };
		if (argv[2]=="") argv[2]="200";
		argv[3]=(argv[3]=="")?"no":"yes";
		argv[4]=(argv[4]=="")?"no":"yes";
		argv[5]=(argv[5]=="")?"no":"yes";
		argv[6]=(argv[6]=="")?"no":"yes";
		var scrWidth = screen.width;
		var posLeft = Math.floor((scrWidth-argv[1])/2);
		if (posLeft<0) {posLeft=0};
		var txtLeft = "left="+posLeft;
		var scrHeight = screen.height;
		var posTop = Math.floor((scrHeight-argv[2])/2);
		if (posTop<0) {posTop=0};
		//posTop=50;
		txtTop="top="+posTop;
		winProperties="toolbar="+argv[6]+",location=no,directories=no,status=no,menubar="+argv[5]+",";
		winProperties+="scrollbars="+argv[3]+",resizable="+argv[4]+",";
		winProperties+="width="+argv[1]+",height="+argv[2]+","+txtLeft+","+txtTop;
		url=argv[0];
		url=url+((url.indexOf("?")==-1)?"?":"&")+"ispop=1";
		pWin2 = window.open(url,"Popup2",winProperties);
		pWin2.focus();
	}
	return (pWin2);		
}
function showStat(s) {
	window.status=s;
	document.retVal=true;
}
function closeIfPrintWindow(prt) {
	if (prt) {
		if (browser_ie && window.print) {
			window.close();
		}	
	}
}
function js(s) {
  return eval(s)
}
function ValidEmail(s) {
	if (!emailOk(s,true)) {
		alert ("Ongeldig email adres");
		return false;
	}
	return true;	
}
function emailOk (s) {   

	// isEmail (STRING s [, BOOLEAN emptyOK])
	// 
	// Email address must be of form a@b.c -- in other words:
	// * there must be at least one character before the @
	// * there must be at least one character before and after the .
	// * the characters @ and . are both required

	if (isEmpty(s)) 
       if (emailOk.arguments.length == 1) return defaultEmptyOK;
       else return (emailOk.arguments[1] == true);
   
    // is s whitespace?
    if (isWhitespace(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function isWhitespace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function isYear (s)
{   if (isEmpty(s)) 
       if (isYear.arguments.length == 1) return defaultEmptyOK;
       else return (isYear.arguments[1] == true);
    if (!isNonnegativeInteger(s)) return false;
    return ((s.length == 2) || (s.length == 4));
}

function isIntegerInRange (s, a, b)
{   if (isEmpty(s)) 
       if (isIntegerInRange.arguments.length == 1) return defaultEmptyOK;
       else return (isIntegerInRange.arguments[1] == true);

    // Catch non-integer strings to avoid creating a NaN below,
    // which isn't available on JavaScript 1.0 for Windows.
    if (!isInteger(s, false)) return false;

    // Now, explicitly change the type to integer via parseInt
    // so that the comparison code below will work both on 
    // JavaScript 1.2 (which typechecks in equality comparisons)
    // and JavaScript 1.1 and before (which doesn't).
    var num = parseInt(parseFloat (s));
    return ((num >= a) && (num <= b));
}

function isMonth (s)
{   if (isEmpty(s)) 
       if (isMonth.arguments.length == 1) return defaultEmptyOK;
       else return (isMonth.arguments[1] == true);
    return isIntegerInRange (s, 1, 12);
}

function isDay (s)
{   if (isEmpty(s)) 
       if (isDay.arguments.length == 1) return defaultEmptyOK;
       else return (isDay.arguments[1] == true);   
    return isIntegerInRange (s, 1, 31);
}

function daysInFebruary (year)
{   // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
}


// isDate (STRING year, STRING month, STRING day)
//
// isDate returns true if string arguments year, month, and day 
// form a valid date.
// 

function isDate (year, month, day)
{   // catch invalid years (not 2- or 4-digit) and invalid months and days.

    if (! (isYear(year, false) && isMonth(month, false) && isDay(day, false))) return false;

    // Explicitly change type to integer to make code work in both
    // JavaScript 1.1 and JavaScript 1.2.
    var intYear = parseInt(year);
    var intMonth = parseInt(month);
    var intDay = parseInt(day);

    // catch invalid days, except for February
    if (intDay > daysInMonth[intMonth]) return false; 

    if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false;

    return true;
}

function isNonnegativeInteger (s)
{   var secondArg = defaultEmptyOK;

    if (isNonnegativeInteger.arguments.length > 1)
        secondArg = isNonnegativeInteger.arguments[1];

    // The next line is a bit byzantine.  What it means is:
    // a) s must be a signed integer, AND
    // b) one of the following must be true:
    //    i)  s is empty and we are supposed to return true for
    //        empty strings
    //    ii) this is a number >= 0

    return (isSignedInteger(s, secondArg)
         && ( (isEmpty(s) && secondArg)  || (parseInt (s) >= 0) ) );
}

function isSignedInteger (s)

{   if (isEmpty(s)) 
       if (isSignedInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isSignedInteger.arguments[1] == true);

    else {
        var startPos = 0;
        var secondArg = defaultEmptyOK;

        if (isSignedInteger.arguments.length > 1)
            secondArg = isSignedInteger.arguments[1];

        // skip leading + or -
        if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
           startPos = 1;    
        return (isInteger(s.substring(startPos, s.length), secondArg))
    }
}

function isInteger (s)

{   var i;

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

function Replace(strSource, charReplaceWhat, charReplaceWith) {

	var S1 = strSource;
	var C1 = charReplaceWhat;
	var C2 = charReplaceWith;
	var C = "";
	var S2 = "";
	for (i=0;i<S1.length;i++) {
		C = S1.substring(i,i+1);
		if (C==C1) {
			C=C2;
		}
		S2 = S2 + C;	
	}
	return S2;
}

function Fld2Date(fld, warning, dob) {
	var i;
	var f = fld;
	if (isEmpty(f)) return "";
	var a = new Array(2);
	a[0] = "";
	a[1] = "";
	a[2] = "";

	if (isInteger(f) && (f.length==6 || f.length==8)) {

		a[0] = f.substring(0,2);
		a[1] = f.substring(2,4);
		a[2] = f.substring(4,f.length);
				
	} else {
		// convert all separators to /

		for (i=0;i<DateSeparators.length;i++) {
			C = DateSeparators.substring(i,i+1);
			f = Replace(f,C,"/");
		}

		// get day, month, year

		occ = 0;
		p = 0;
		i = 0
		while (p>=0 && i<=2) {
			p = f.indexOf("/", occ)
			if (p >= 0) {
				a[i] = f.substring(occ,p);
				occ = p + 1;
				i=i+1;	
			} else {
				a[i] = f.substring(occ,f.length)	
			}
		}	
	}

	// check date and return valid date or empty string

	if (isDate(a[2],a[1],a[0])) {
		a0 = a[0].toString();
		a1 = a[1].toString();
		if (a0.length < 2) a[0]="0" + a0;
		if (a1.length < 2) a[1]="0" + a1;
		if (a[2].length <= 2) {
			var century = 2000;
			if (dob) {
				if (a[2] > 1) century = 1900;
			}	
			a[2] = century + parseInt(a[2]);
		}
		return (a[0] + "-" + a[1] + "-" + a[2]); 	
	} else {
		if (warning) {
			alert("Ongeldige datum");
		}	
		return "";
	}	
}	

function CheckDate(dt) {
	d1 = dt.value;
	if (!isEmpty(d1)) {
		d2 = Fld2Date(d1,true);
		if (isEmpty(d1)) {
			return false;
		} else {	
			dt.value = d2;
			return true;
		}
	}		
}

function Fld2Cur(fld, warning) {
	if (isCurrency(fld)) {
		return formatCur(fld);
	} else {
		if (warning) alert("Ongeldige invoer");
		return "";
	}		
}

function Str2Num(s) {
	return (parseFloat(numbersOnly(s)));
}

function formatCur(s) {
	return (formatNum(s,2));
}

function formatNum(expr,decplaces) {
	expr = Replace(expr, ",", ".");
	var str = (Math.round(parseFloat(expr) * Math.pow(10,decplaces))).toString()
	while (str.length <= decplaces) {
		str = "0" + str
	} 
	var decpoint = str.length - decplaces
	return str.substring(0,decpoint) + "," + str.substring(decpoint,str.length)
}

function numbersOnly(strIn) {
	var retVal;
	if (strIn=="") {
		return 0;
	} else {		
		retVal = strIn.replace('.','');
		retVal = retVal.replace('$','');
		retVal = retVal.replace('%','');
		return (parseFloat(retVal));
	}	
}
function isFloat (s) {   
	// returns -1 if not a number
	// returns number of decimals if a number
	var i;
	var seenDecimalPoint = false;
	if (isEmpty(s)) return 0;
    	if (s == decimalPointDelimiter) return -1;
	var numDecimals = 0;
    	for (i = 0; i < s.length; i++) {   
	        var c = s.charAt(i);
	        if ((c == decimalPointDelimiter) && !seenDecimalPoint) {
			seenDecimalPoint = true;
	        } else {
			if (!isDigit(c)) return -1;
			if (seenDecimalPoint) {
				numDecimals = numDecimals + 1;
			}
		}
	}
	return (numDecimals);
}

function isCurrency (s) {
	if (isIntegerInRange(isFloat(s),0,2)) {
		return true;
	} else {
		return false;
	} 
}
// -->
