// Rollover images
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

// Visit
function visit( url ){
	
	// if url entered
	if ( (url == null) || (url == "http://") )
		alert('Er is geen hyperlink opgegeven.');
	else
		// Open in popup
		window.open( "" + url + "", 'preview', '');
}

// Confirm
function confirm_logoff(){
	// Popup
	var answer=confirm("Weet u zeker dat u zich wilt afmelden?");

	// If pressed "Yes"
	if ( answer == 1 )
		// Forward
		window.location = "./?action=logoff";
}

// Check ticks
function textCounter( field, cntfield, maxlimit ){
	
	// Set default
	if ( maxlimit == null )
		 maxlimit = 520;
	
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
		document.form2.count.value = maxlimit - field.value.length;	
}

// Insert hyperlink
function insert_url(){
	// Popup
	var value = prompt("Voer hyperlink in", "http://");	
	
	// If filled in
	if ( value != null )
		// Set
		document.form2.text.value = document.form2.text.value + " <a href=\"" + value + "\">" + value + "</a> ";
}

// Insert email
function insert_email(){
	// Popup
	var value = prompt("Voer emailadres in", "naam@domein.nl");	
	
	// If filled in
	if ( value != null )
		// Set
		document.form2.text.value = document.form2.text.value + " <mailto=\"" + value + "\">" + value + "</a> ";
}

// Ask confirm before proceeding
function submit_cms_askconfirm(){

	// Popup
	var answer=confirm("Weet u zeker dat u deze wijzigingen wilt doorvoeren?");

	// If pressed "Yes"
	if ( answer == 1 )
		// Submit
		document.form2.submit();
}

// Popupwindow
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' 
	win = window.open(mypage,myname,settings)
}

// Send contactform
function submit_contactform(){
	var errorString = "";
	var aanhef = "";
	
	// Set aanhef
	if ( document.contactform.aanhef[0].checked == true) aanhef = "Dhr";
	if ( document.contactform.aanhef[1].checked == true) aanhef = "Mevr";
	
	// Check if all fields have been entered
	if ( document.contactform.aanhef[0].checked == false)
	if ( document.contactform.aanhef[1].checked == false){
		errorString = errorString + "- Aanhef \n\r";
	}
	
	if ( document.contactform.voornaam.value == '' ){
		errorString = errorString + "- Voornaam \n\r";		
	}
	
	if ( document.contactform.achternaam.value == '' ){
		errorString = errorString + "- Achternaam \n\r";		
	}	
	
	if ( document.contactform.adres.value == '' ){
		errorString = errorString + "- Adres \n\r";		
	}
	
	if ( document.contactform.nummer.value == '' ){
		errorString = errorString + "- Nummer \n\r";		
	}	
	
	if ( document.contactform.postcode.value == '' ){
		errorString = errorString + "- Postcode \n\r";		
	}
	
	if ( document.contactform.plaats.value == '' ){
		errorString = errorString + "- Plaats \n\r";		
	}	
	
	if ( document.contactform.tel.value == '' ){
		errorString = errorString + "- Tel \n\r";		
	}	
	
	if ( document.contactform.emailadres.value == '' ){
		errorString = errorString + "- Emailadres \n\r";		
	}	
	
	if ( document.contactform.vraagopmerking.value == '' ){
		errorString = errorString + "- Vraag/opmerking \n\r";		
	}	

	// If errors found
	if ( errorString != "" ){
		// Add sentence
		errorString = "De volgende velden zijn niet ingevuld: \n\r" + errorString;
		
		// Popup
		alert(errorString);
		
		// Set action
		var action = "verify";
	} // Else
	else{
		// Set action
		var action = "submit";
	}
	
		// Forward
		document.location = "./sub_contact.php?action="+action+"&aanhef="+aanhef+"&voornaam="+document.contactform.voornaam.value+"&achternaam="+document.contactform.achternaam.value+"&adres="+document.contactform.adres.value+"&nummer="+document.contactform.nummer.value+"&postcode="+document.contactform.postcode.value+"&plaats="+document.contactform.plaats.value+"&tel="+document.contactform.tel.value+"&emailadres="+document.contactform.emailadres.value+"&vraagopmerking="+document.contactform.vraagopmerking.value;	
}