
function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function generate_address(suffix, hostname, username) {
	var atsign = "&#64;";
	var addr = username + atsign + hostname + '.' + suffix;
	document.write( 
	"<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" +
	addr +
	"<\/a>");
}

function NM_setLabel(objName){ // v1.0 based on anarchos.xs.mw/
	var obj = MM_findObj(objName);
	if (!obj.base) obj.base = obj.value
	if (obj.value == obj.base) obj.value = "";
	else if (obj.value == "") obj.value = obj.base;
}

function clearText(thefield){
	if (thefield.defaultValue==thefield.value) {
	thefield.value = '';
	}
}	

function search(){
	document.searchform.submit();
}

function printThisPage() { 
	window.focus();
	if (window.print)
		window.print();
}

function openPopup(url, width, height, resizable, toolbar, menubar) {
	var args = new Array();
	if (width){
		width = Math.min(width, screen.availWidth);
		args.push("width=" + width);
		args.push("left=" + (screen.width - width)/2);
	}
	if (height){
		height = Math.min(height, screen.availHeight);
		args.push("height=" + height);
		args.push("top=" + (screen.height - height)/2);
	}
	if (resizable){args.push("resizable=yes,scrollbars=yes");}
	if (toolbar){args.push("toolbar=yes");}
	if (menubar){args.push("menubar=yes");}
	window.status=args.join();
	window.open(url, '', args.join());
	return false;
}

function SetSize(pagina) {

  window.defaultStatus=(document.title);
  if (self != top) top.location.replace(self.location);

/*  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  myHeight = myHeight-250;
  if (document.getElementById) {
    var myElem = document.getElementById("maincol");
    myElem.style.height = myHeight + 'px';
    if (pagina=='home') {
     var adres = document.getElementById("pushadres");
	 adresHeight = myHeight-340;
	 if (adresHeight>0) {
     adres.style.height = adresHeight + 'px';}
    }
  }
*/}

function markAsRequired(veldnaam) { 
	document.form1.elements[veldnaam].style.border = '1px solid #CC0000';
	document.form1.elements[veldnaam].focus();
}

function validateForm() {
  var i,p,nm,test,args=validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) {nm=val.name; if ((val=val.value)!="") {
		if (test.charAt(0) == 'R') document.form1.elements[nm].style.border = '1px solid #CCCCCC';
			if (test.indexOf('isEmail')!=-1) {
			  var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			  if (filter.test(val)) {document.form1.elements[nm].style.border = '1px solid #CCCCCC';} else {document.form1.elements[nm].style.border = '1px solid #CC0000';}
			}
     	}
	 	else if (test.charAt(0) == 'R') document.form1.elements[nm].style.border = '1px solid #CC0000'; 
	}
  } 
}

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) {window.attachEvent("onload", sfHover);}
