/*ee
	fbto.js
	
	Specifieke javascript functions voor 	fbtoweb3
	Te plaatsen in statisch webdeel waar de apache webserver ze verwerkt.
	\fbtoweb3-web\fbtoweb3\docroot\fbto\script

	15-04-2005	,,	,,	,,	FBTOAlgemeenWebComponent
	-----------------------------------------------------------------------
	functie				versie	doel


	afsluiten				roept op basis van functienaam een unload-functie aan
	Browser					Retrieve browser and version info
	changeFont				verandert een font
	ChangeOpenerLocation			opent het opener window met parameterurl, als deze er niet is nieuw venster
	checkLength				geeft een alert als het aantal karakters meer is dan toegestaan
	closeImage				sluit een popup met layer
	getSelectValue			haalt een waarde uit een lijst
	getXY					Get cursor position with respect to the page
	LaadtTellerInFrame		laadt een counter url in een frame
	layerVisibleEnBlock		laat een layer zien. Geschikt voor IE en Firefox.
	limitChars				kapt een aantal karakters af in een tekst element
	load					laadt een pagina
	MM_callJS				2.0	evalueert argument (bv optellen)	
	MM_checkBrowser			4.0	checkt de browser
	MM_checkEnter			2.0	checkt Enter toets
	MM_checkEnterEnGotoLink				gaat naar een link als op ENTER is geklikt
	MM_checkEnterEnSubmitForm			submit een form als op ENTER is geklikt
	MM_checkEnterEnSubmitFormViaAction		submit een form als op ENTER is geklikt
	MM_displayLayers			laat een layer zien
	MM_displayStatusMsg			laat status zien
	MM_findObj			4.01	vindt een object in een document
	MM_openBrWindow			2.0	opent een popup	w=333 h=253
	MM_openBrWindowAdvies		2.0	opent een popup	w=420 h=400
	MM_openBrWindowBanner		2.0	opent een popup	w=600 h=310
	MM_openBrWindowBon		2.0	opent een popup	w=450 h=350
	MM_openBrWindowBonSlippen	2.0	opent een popup	w=369 h=650
	MM_openBrWindowBonHoog		2.0	opent een popup	w=450 h=550
	MM_openBrWindowCampagne		2.0	opent een popup	w=450 h=350
	MM_openBrWindowGroot		2.0	opent een popup	w=590 h=480
	MM_openBrWindowGrootSpec	2.0	opent een popup	w=620 h=480
	MM_openBrWindowMedium		2.0	opent een popup	w=550 h=400
	MM_openBrWindowOnderhoud	2.0	opent een popup	w=535 h=300
	MM_openBrWindowPartner		2.0	opent een popup	w=333 h=275
	MM_openBrWindowProducten        2.0	opent een popup	w=333 h=425
 	MM_openBrWindowTrinicom		2.0	opent een popup	w=655 h=700
	MM_openBrWindowVoorwaarden	2.0	opent een popup	w=590 h=400
	MM_openBrWindowWinterVoordeelActie 2.0	opent een popup	w=570 h=595
	MM_openBrWindowZelfservice 	2.0	opent een popup	w=700
	MM_openBrWindowBeveiligdWonen 2.0 opent een popup w=762 h=472
	MM_openBrWindowOVR 2.0        opent een popup w=762 h=472
	MM_openPDFWindow		2.0	opent een popup	w=600 h=480
	MM_openWindow			2.0	opent een popup, breedte en hoogte door te geven als parameter
	openWordWindow			2.0	opent een popup	w=800 h=600
	MM_preloadImages		3.0	laadt plaatjes
	MM_reloadPage				laadt pagina opnieuw. 
	MM_showHideLayers		6.0	laat layer zien of verbergt deze
	MM_submitForm			3.0	submit een formulier
	MM_swapImage			3.0	verwisselt plaatje
	MM_swapImgRestore		3.0	herstelt verwisselen van plaatje
	openAdressenWindow		2.0	opent een popup	w=510 h=500
	OpenBrWindow				opent een popup, breedte en hoogte door te geven als parameter
	openPopup				opent een popup	
	openWindowPrintenSessieGegevens	2.0	opent een popup	w=555 h=380
	opt					zet een link + tekst in een optietag
	popImage				opent een popup met layer
	reloadInFooterFrame			laadt url in footerFrame
	setTermijntekst				maakt een innerHTML obv. termijnparameter	
	showHideDisplay				laat layer zien of verbergt deze
	showPopupMailMijnOfferte			opent popup w=490 h=350
	showPopupWindow				opent een popup
	showPopupWindowGroot			opent een popup	w=640 h=480
	showPopupWindowKlein			opent een popup	w=343 h=253
	showPopupWindowMedium			opent een popup	w=550 h=400
	showPremieTool				opent een popup met parameters
	showPrintWindow				opent een popup	w=590 h=480
	sluitVensterEnLaadHomepage		sluit de huidige pagina en opent de homepage FBTO
	verbergKnop				vervangt de knop door een onzichtbare knop
	verVers					ververst een formulier
	voorkomDubbelclickVoorVerzendknop	verbergt de verzendknop
	openPDF					opent een popup bijna zo groot als het scherm met darain het pdf bestand. Popup is te resizen en is scrollable.
	CB_autoTab(input,len, e)
	setFocusElement(elementId)
	setSitestatString(secure, Scode)
	setSitestatStringNoReferrer(secure, Scode)
	showlinksmuteren()			maakt de options voor de select voor de te mueteren producten aan
*/

/*
Herschreven: 	20-11-2006
Auteur:		Benny Bottema
	void (String, Object, Array)
     	- Roept dynamisch een voor gedeclareerde JS functie aan met 
		  gespecifieerde scope object en lijst met argumenten.
		- Deze functie kan mogelijk eruit gerefactored worden omdat alleen 
		  FBTOAlgemeenWebComponent/public_html/layouts/formuliervp.jsp er 
		  nog gebruik van maakt.
*/
function afsluiten(functionname, scope, args) { // v 2.0 Active Web java 
	if (args == null) args = new Array(); // IE fix (args mag niet null zijn)
	var func = eval(functionname);
	if (func != null) func.apply(scope, args);
}	

/*
   Class:       Browser
   Description: Retrieve browser and version info
   usage:       create a Browser object and examine its variables for make and
                version info.
*/
function Browser() {

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  var ua = navigator.userAgent;
  var s = "MSIE";
  var i;
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}



function changeFont(name) { // v 2.0 Active Web java 
		if((name != "") && (typeof(name) != "undefined")) {
			var obj = MM_findObj(name);
			if(obj.className == "broodselected") {
			  obj.className = "broodlink";
			} else {
			  obj.className = "broodselected";
			}
		}
}	

/*
Functienaam: 	ChangeOpenerLocation
Auteur:			Marc Huinink
Doel:			Opent een url in het venster waarmee de popup geopend is. 
				Wanneer	dit venster gesloten is zal een nieuw venster geopend worden.
				Elke andere link vanaf deze pagina wordt in ditzelfde nieuwe venster 
				geopend. 
ondersteund:	Microsoft Internet Explorer
				Firefox
				Netscape Navigator
*/
var openerteller=0;
var x;
function ChangeOpenerLocation(newLocation){ 
		if (openerteller==0 && window.opener!=null && !window.opener.closed){
			openerteller++;
			x=window.opener.top;
			window.opener.parent.location=newLocation;
			window.focus();
			this.blur();
		} else {
			if (x==null||x.closed){
				x= window.open(newLocation, 'fbto', "dependent=no, resizable=yes, titlebar=yes, toolbar=yes, statusbar=yes, menubar=yes, directories=yes, location=yes");
			}else{
				x.location.href=newLocation;
			}
			x.focus();
		}
} 

/*
Functienaam: 	ChangeOpenerLocationAndCloseWindow
Auteur:			Jan Willem Omlo
Doel:			Opent een url in het venster waarmee de popup geopend is. 
				Wanneer	dit venster gesloten is zal een nieuw venster geopend worden.
				Vervolgens wordt de pagina gesloten.
ondersteund:	Microsoft Internet Explorer
				Firefox
				Netscape Navigator
*/
var x;
function ChangeOpenerLocationAndCloseWindow(newLocation){ 
		if (window.opener!=null && !window.opener.closed) {
			x=window.opener.top;
			window.opener.parent.location=newLocation;
		} else {
			x=window.open(newLocation, 'fbto', "dependent=no, resizable=yes, titlebar=yes, toolbar=yes, statusbar=yes, menubar=yes, directories=yes, location=yes");
		}
		x.focus();
		this.close();
} 


/*
Functienaam: 	ChangeOpenerLocationAndCloseWindow
Auteur:			Jan Willem Omlo
Doel:			Opent een url in het venster waarmee de popup geopend is. 
				Wanneer	dit venster gesloten is zal een nieuw venster geopend worden.
				Vervolgens wordt de pagina gesloten.
ondersteund:	Microsoft Internet Explorer
				Firefox
				Netscape Navigator
*/
var x;
function CloseWindowAndOpenNewWindow(newLocation){ 
		x=window.open(newLocation, '_blank', "dependent=no, resizable=yes, titlebar=yes, toolbar=yes, statusbar=yes, menubar=yes, directories=yes, location=yes");

		x.focus();
		this.close();
} 
function checkLength(nameField, lengte ) { // v 2.0 Active Web java 			
		
	var obj,aantal,value,args=checkLength.arguments; 			
	obj=MM_findObj(args[0]);
	value = obj.value;			
	aantal = value.length;

	if(aantal > lengte )
	{
		alert("De lengte van de ingevoerde tekst mag niet meer dan " + lengte + " tekens bedragen.");
		obj.focus();			
	}
}

function closeImage(layer) {
		var obj1 = MM_findObj(layer + '1');
		obj1 = obj1.style;
		obj1.display = 'block';
		
		var obj2 = MM_findObj(layer + '2');
		obj2 = obj2.style;
		obj2.display = 'none';
}

function getSelectValue(selectObject){
		return selectObject.options[selectObject.selectedIndex].value;
}

/*
   Description: Get cursor position with respect to the page.
   uses:        Browser
*/
function getXY (event) {
   var x, y;
   var browser = new Browser();
   if (browser.isIE) {
      x = window.event.clientX + document.documentElement.scrollLeft
        + document.body.scrollLeft;
      y = window.event.clientY + document.documentElement.scrollTop
        + document.body.scrollTop;
   } else if (browser.isNS) {
      x = event.clientX + window.scrollX;
      y = event.clientY + window.scrollY;
   }
   return {x:x, y:y};
}



function LaadtTellerInFrame()
{
	var url="http://counter.checkit.nl/counter.aspx?";
	var agt=navigator.userAgent.toLowerCase();
	var win=((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1));
	URL+=("origin=1");
	if(win)
	{
		url+=("&referrer="+escape(document.referrer));
		url+=("&url="+escape(document.location.href));
	}
	frames[frames.length-1].location.href = url;
}	

function layerVisibleEnBlock(layer) { //v1.0 Active Webjava
	document.getElementById(layer).style.visibility='visible';
	document.getElementById(layer).style.display='block';
}

function limitChars(numChars) 
	{  
	    if(event.propertyName != "value") return; 
	    var oTextArea = event.srcElement; 
	    var currTextLength = oTextArea.value.length; 
	    if(currTextLength > numChars) 
	    {  
	        oTextArea.value = oTextArea.value.substring(0, numChars); 
	    }
}

function load(object) {
	window.location.href = object.options[object.selectedIndex].value;
	return false;
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function isOlderIE(version) {
	return (navigator.appName == "Microsoft Internet Explorer") && (parseFloat(navigator.appVersion) < version)
}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v4.0
	  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
	  if (app.indexOf('Netscape') != -1)
	  {
	    if (version >= NSvers) 
	    {
		if (NSpass>0) newURL=(NSpass==1)?URL:altURL;
	    }
	    else 
	    {
		if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;
	    }
	  } else if (app.indexOf('Microsoft') != -1)
	  {
	    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
	    {
		if (IEpass>0) newURL=(IEpass==1)?URL:altURL;
	    }
	    else 
	    {
		if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;
	    }
	  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
	  
	  if (newURL) 
	  { 
		window.location=unescape(newURL); 
		document.MM_returnValue=false;
	  }
	
}
	
	
//Functie aangepast door Marc Huinink op 24-11-2005
//nu ook firefoxproof (door arguments[0] te nemen ipv arguments)
function MM_checkEnter() { // v 3.0 Active web java
	anEvent=MM_checkEnter.arguments[0];
	var toets;
	if (anEvent.keyCode != null)
	{
		toets = anEvent.keyCode;	
	} 
	else 	
	{
		toets = window.event.keyCode;
	}
		
	if (toets==13) 	
	{	
		return true;
	}
	return false;
}		

function MM_checkEnterEnGotoLink(gotoLink) {
	
	if (MM_checkEnter()==true)
	{
		self.focus();
   		self.location.href = gotoLink;
  	}
}


function MM_checkEnterEnSubmitForm() { // v 1.0 Active web java

	if (MM_checkEnter()==true)
	{
		self.focus();
		MM_findObj('submitaction').value='volgende';
		MM_submitForm('formulier');
	}
}

function MM_checkEnterEnSubmitFormViaAction(action) {	
	
	if (MM_checkEnter()==true)
	{
		self.focus();
		MM_findObj('submitaction').value=action;
		MM_submitForm('formulier');
	}
}

function MM_displayLayers() {
	var i,p,v,obj,args=MM_displayLayers.arguments;
	
	for (i=0; i<(args.length-2); i+=3)
		if ((obj=MM_findObj(args[i])) != null) {
			v=args[i+2];
			if (obj.style) { 
				obj=obj.style; 
				v=(v=='show')?'block':(v='hide')?'none':v;
		}
		obj.display=v;
	}
}

function MM_displayStatusMsg(msgStr) { //v1.0
	  status=msgStr;
	  document.MM_returnValue = true;
}

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_openBrWindow(theURL, winName, features) { //v2.0
	var args=MM_openBrWindow.arguments;
	if (args.length == 2 || (args.length == 3 && features == "")) {
		popupklein=window.open(theURL, winName, "scrollbars=yes,width=333,height=253");
		popupklein.focus();
	} else {
		window.open(theURL, winName, features);
	}
}

function MM_openBrWindowAdvies(theURL,winName) { //v2.0
	popupadvies=window.open(theURL,winName,"scrollbars=no,width=420,height=400");
	popupadvies.focus();
}

function MM_openBrWindowBanner(theURL,winName) {
	popupbelmij=window.open(theURL,winName,"scrollbars=no,width=600,height=310");
	popupbelmij.focus();
}

function MM_openBrWindowBon(theURL,winName, breedte, hoogte) { //v2.0
	popupklein=window.open(theURL,winName,"scrollbars=no,width="+breedte+",height="+hoogte);
	popupklein.focus();
}

function MM_openBrWindowBonHoog(theURL,winName) { //v2.0
	popupklein=window.open(theURL,winName,"scrollbars=yes,width=450,height=550");
	popupklein.focus();
}

function MM_openBrWindowBonSlippen(theURL,winName) { //v2.0
  	popupklein=window.open(theURL,winName,"scrollbars=no,width=369,height=650");
  	popupklein.focus();
}

function MM_openBrWindowCampagne(theURL,winName) { //v2.0 
	window.open(theURL,winName,"width=597,height=460");
}

function MM_openBrWindowGroot(theURL,winName) { //v2.0
  	popupgroot=window.open(theURL,winName,"scrollbars=yes,width=590,height=480");
  	popupgroot.focus();
}

function MM_openBrWindowGrootSpec(theURL,winName) { //v2.0
	popupgroot=window.open(theURL,winName,"scrollbars=yes,width=620,height=480");
	popupgroot.focus();
}

function MM_openBrWindowMedium(theURL,winName) { //v2.0
	popupklein=window.open(theURL,winName,"scrollbars=yes,width=550,height=400");
	popupklein.focus();
}

function MM_openBrWindowOnderhoud(theURL,winName) { //v2.0 
	window.open(theURL,winName,"width=535,height=300");
}

function MM_openBrWindowPartner(theURL,winName) { //v2.0
  	popup=window.open(theURL,winName,"scrollbars=yes,width=333,height=275");
  	popup.focus();
}

function MM_openBrWindowProducten(theURL,winName) { //v2.0
  popup=window.open(theURL,winName,"scrollbars=yes,width=333,height=425");
  popup.focus();
}


function MM_openBrWindowTrinicom(theURL,winName) { //v2.0
	popupklein=window.open(theURL,winName,"scrollbars=yes,width=655,height=700");
	popupklein.focus();
}

function MM_openBrWindowVoorwaarden(theURL,winName) { //v2.0
	popupgroot=window.open(theURL,winName,"scrollbars=yes,width=590,height=400");
	popupgroot.focus();
}

function MM_openBrWindowWinterVoordeelActie(theURL,winName) {
  	popupwinter=window.open(theURL,winName,"scrollbars=no,width=570,height=595");
  	popupwinter.focus();
}   

function MM_openBrWindowZelfservice(theURL,winName) { //v2.0
	popupgroot=window.open(theURL,winName,"scrollbars=auto,width=700");
	popupgroot.focus();
}

function MM_openBrWindowBeveiligdWonen(theURL,winName) { //v2.0
	popupgroot=window.open(theURL,winName,"scrollbars=no, width=762, height=472");
	popupgroot.focus();
}

function MM_openBrWindowORV(theURL,winName) { //v2.0
	popupgroot=window.open(theURL,winName,"scrollbars=no, width=1024, height=768");
	popupgroot.focus();
}

function MM_openPDFWindow(theURL,winName) { //v2.0 
	popupgroot=window.open(theURL,winName,"scrollbars=yes,width=600,height=480,resizable=yes");
	popupgroot.focus();
}

function MM_openWindow(theURL,winName, _width, _height) { //v2.0
	var winAtts="scrollbars=yes,";
	
	winAtts += "width=" + _width + ",";
	winAtts += "height=" + _height;
	popupgroot=window.open(theURL,winName,winAtts);
	popupgroot.focus();
}

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_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) 
		with (navigator) {
			if ((appName=="Netscape") && (parseInt(appVersion)==4)) {
				document.MM_pgW=innerWidth;
				document.MM_pgH=innerHeight;
				onresize=MM_reloadPage;
			}
		}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
		location.reload();
}

function MM_showHideLayers() { //v6.0
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	    obj.visibility=v; }
}

function ShowHideLayers() { //v3.0
  var i,p,v,obj,args=ShowHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='J')?'block':(v=='N')?'none':v; 
	}
    obj.display=v; 
  }
}

//v1.0: kopie van ShowHideLayers() behalve geen gebruik van block ivm ongewenst layouteffecten in Firefox
function ShowHideLayersNoBlock() { 
  var i,p,v,obj,args=ShowHideLayersNoBlock.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='J')?'':(v=='N')?'none':v; 
	}
    obj.display=v; 
  }
}

function MM_submitForm() { //v3.0
	var obj,args=MM_submitForm.arguments;
	
	document.MM_returnValue = false;
	obj=MM_findObj(args[0]);
	obj.submit();
}

/**
 * MM_swapImage accepteert parameters in groepen van 3.
 *  
 * Het eerste parameter is het id van het plaatje
 * Het tweede parameter wordt niet gebruikt
 * Het derde parameter is het url van het plaatje die geladen moet worden
 */
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];
		}
}

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 openAdressenWindow(theURL,winName) { //v2.0
	  popupklein=window.open(theURL,winName,"scrollbars=yes,width=510,height=500");
	  popupklein.focus();
}

function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
	  if(window.screen)if(isCenter)if(isCenter=="true"){
	    var myLeft = (screen.width-myWidth)/2;
	    var myTop = (screen.height-myHeight)/2;
	    features+=(features!='')?',':'';
	    features+=',left='+myLeft+',top='+myTop;
	  }
	  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function openPopup(URL) {
	   //URL = "intro.html";
	   day = new Date();
	   id = day.getTime();
	   
	   if (screen.height<=600) {
		  winTop = 0;
		  winLeft = 0;
	   } else { 
		  winTop = (screen.height-510)/2;
		  winLeft = (screen.width-820-1)/2;
	   }
	   
	   eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=820,height=510,top=' + winTop + ',left=' + winLeft);");
}

function openWindowPrintenSessieGegevens(theURL,winName) { //v2.0
	
	  popupgroot=window.open(theURL,winName,"scrollbars=yes,width=555,height=380,dependent=yes");
	  popupgroot.focus();
}

function openWordWindow(theURL,winName) { //v2.0
	  popupgroot=window.open(theURL,winName,"scrollbars=yes,width=800,height=600");
	  popupgroot.focus();
}

function opt(text, href) {
	document.write('<option value="',href,'">',text,'<\/option>');
}

function popImage(layer) {
		var obj1 = MM_findObj(layer + '1');
		obj1 = obj1.style;
		obj1.display = 'none';
		
		var obj2 = MM_findObj(layer + '2');
		obj2 = obj2.style;
		obj2.display = 'block';
}


function reloadInFooterFrame(newHref) {
		top.footerFrame.document.location.href = newHref;
}


function setTermijntekst(termijn){
	var elements = document.getElementsByName("termijntekst");
	if (elements[0]==null){}
	else if (termijn=="1"){
		elements[0].innerHTML="jaarlijks ";
	}else if (termijn=="2"){
		elements[0].innerHTML="maandelijks ";
	}else if (termijn=="3"){
		elements[0].innerHTML="eenmalig ";
	}else if (termijn=="4"){
		elements[0].innerHTML="per half jaar ";
	}else if (termijn=="5"){
		elements[0].innerHTML="per kwartaal ";
	} //voeg hier eventueel nieuwe betalingstermijnen toe
}



function showHideDisplay() {
	  var i,p,v,obj,args=showHideDisplay.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v='hide')?'none':v; }
	    obj.display=v; }
}


function showPopupWindow(url, features) {
  popup=window.open(url, "popup", features);
  popup.focus();
}

function showPopupWindowDirectContact(url, features) {
  popup=window.open(url, "directcontact", features);
  popup.focus();
}

function showPopupWindowGroot(url) {
  popup=window.open(url, "popup", "scrollbars=yes, width=640, height=480");
  popup.focus();
}

function showPopupWindowKlein(url) {
  popup=window.open(url, "popup", "scrollbars=yes, width=343, height=253");
  popup.focus();
}

function showPopupWindowMedium(url) {
  popup = window.open(url, "popup", "scrollbars=yes, width=550, height=400");
  popup.focus();
}

function showPopupMailMijnOfferte(url) {
  popup = window.open(url, "popup", "scrollbars=yes, width=490, height=350");
  popup.focus();
}

function showPopupWindowOrv(url) {
  popup=window.open(url, "popup", "scrollbars=yes, width=640, height=680");
  popup.focus();
}


function showPremieTool(theURL,winName,features, myWidth, myHeight, isCenter){
	if(window.screen)if(isCenter)if(isCenter=="true"){
    		var myLeft = (screen.width-myWidth)/2;
    		var myTop = (screen.height-myHeight)/2;
    		features+=(features!='')?',':'';
    		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function showPrintWindow(url) {
  popup=window.open(url, "popup", "scrollbars=yes, width=590, height=480");
  popup.focus();
}

function sluitVensterEnLaadHomepage(){  
		if (window.opener!=null && !window.opener.closed ){
			window.opener.top.location.replace('/nsecure/fbto/index_homepage.jsp');
			window.close(); 
		} else {
			window.open("/nsecure/fbto/index_homepage.jsp","fbto","scrollbars=yes");
		}
}

function verbergKnop(knop) {
	  var obj = MM_findObj(knop);
	  if(obj!=null)
	    obj.src = "/fbto/assets/images/layout/transparant.gif";
}

function verVers() {
	  MM_findObj('submitaction').value='ververs';
	  MM_submitForm('formulier');
}

function voorkomDubbelclickVoorVerzendKnop(){
		MM_showHideLayers('knopVerzend', '', 'hide');
}


var is_acrobat_installed_ask_only_once=false;
function openPDF(pdfURL) {
  if (is_acrobat_installed_ask_only_once || isAcrobatInstalled()) {
    var width = screen.width - 40;
    var height = screen.height - 140;
		
    var left = ((screen.width / 2) - (width / 2)) - 5;
    var top = (screen.height / 2) - (height / 2);
		
    window.open(pdfURL,'info',"scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left);
  } else {
    popup=window.open('/fbto/algemeen/html/infoschermen/Info_BRAcrobatReader.html','info',"scrollbars=yes,width=333,height=253");
    popup.focus();   
  }
	
  is_acrobat_installed_ask_only_once=true;
}


var isNN = (navigator.appName.indexOf("Netscape") !=-1);
var x,y,a,b;

function CB_autoTab(input,len, e) {	
	var keyCode = (isNN) ? e.which : e.keyCode;
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !CB_containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(CB_getIndex(input)+1) % input.form.length].focus();
	};

	function CB_containsElement(arr, ele) {
		var found = false, index = 0;
		while(!found && index < arr.length) {
			if(arr[index] == ele) {
				found = true;	
			} else {
				index++;
			};
		};
		return found;
	};

	function CB_getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1) {
			if (input.form[i] == input) {
				index = i;
			} else {
				i++;
			};
		};
		return index;
	};
}

/**
 *	Zorgt ervoor dat een veld met een bepaald id gefocusd wordt. Mocht deze veld nog niet bestaan dan wordt om de 2 seconden 
 *  gezocht naar het veld net zolang tot het veld gevonden wordt.
 *
 *	elementId Het id van het veld
 */
function setFocusElement(elementId) {
	var focusElement = MM_findObj(elementId);
		
	if (focusElement) {
		window.focus();
		focusElement.focus();
	} else {
		setTimeout("setFocusElement(" + elementId + ")", 2000);
	}
}

/**
 *	Print het gecorrigeerd sitestat code naar de browser
 *
 *  secure Als het pagina secure is of niet
 *	Scode Met sitestats code zoals staat aangegeven in de SSOM
 *	Voor de witte pagina's mag de referer niet worden gebruikt omdat deze niet bestaat en daardoor het script niet correct wordt uitgevoerd
 */
function setSitestatStringNoReferrer(secure, Scode) {
	var linkSs = '//nl.sitestat.com/achmea/fbto/s?';
	var secureText = '';
	if ( (secure == 'false') ? secureText = 'http:' : secureText = 'https:');
	var correctedLink=secureText+linkSs+Scode;
	var datetime = (new Date()).getTime();
    correctedLink+='&ns__t='+datetime;
	var ns_pixelUrl = correctedLink;
	if (document.images) {
		ns_1=new Image();
		ns_1.src=correctedLink;
	} else { 
		document.write("<img src=" + ns_l + " width=1 height=1>"); 
	}
}

/**
 *	Print het gecorrigeerd sitestat code naar de browser
 *
 *  secure Als het pagina secure is of niet
 *	Scode Het sitestats code zoals staat aangegeven in de SSOM
 */
function setSitestatString(secure, Scode) {
	var linkSs = '//nl.sitestat.com/achmea/fbto/s?';
	var secureText = '';
	if ( (secure == 'false') ? secureText = 'http:' : secureText = 'https:');
	var correctedLink=secureText+linkSs+Scode;
	var datetime = (new Date()).getTime();
    correctedLink+='&ns__t='+datetime;
	var ns_pixelUrl = correctedLink;
	ns_0 = top.document.referrer;
	ns_0=(ns_0.lastIndexOf("/")==ns_0.length-1)?ns_0.substring(ns_0.lastIndexOf("/"),0):ns_0;

	if (ns_0.length>0)
		correctedLink+="&ns_referrer="+escape(ns_0);

	if (document.images) {
		ns_1=new Image();
		ns_1.src=correctedLink;
	} else { 
		document.write("<img src=" + ns_l + " width=1 height=1>"); 
	}
}

function showlinksmuteren() {	
	opt('Maak een keuze','/fbto/home.jsp'); 
	opt('Contactgegevens wijzigen', '/secure/fbto/overige_index.jsp?forwardPage=/secure/fbto/algemeen/jsp/relatiebeheer/AdresWijzigenIntroductie.jsp&topSwitch=yes');
	opt('Rekeningnummer', '/secure/fbto/overige_index.jsp?forwardPage=/secure/fbto/relatiebeheer/jsp/RBMUTRekeningnrIntroductie.jsp&topSwitch=yes');
	opt('Ziektekosten', '/nsecure/fbto/overige_index.jsp?forwardPage=/nsecure/fbto/algemeen/jsp/ziektekosten/ZiektekostenWijzigenIntroductie.jsp&topSwitch=yes');				   
	opt('Auto', '/secure/fbto/motorrijtuigen/jsp/muteren/MRWijzigenBasis.jsp');
	opt('Woonverzekeringen', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/nieuwwoon/muteren/woonMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
	opt('Reis', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/recreatie/reis/muteren/reisMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
	opt('Ongevallen', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/ongevallen/muteren/ongevallenMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');	
	opt('Pleziervaartuig', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/recreatie/boot/muteren/bootMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
	opt('Caravan', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/recreatie/caravan/muteren/caravanMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
	opt('Motor', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/motorrijtuigen/motor/muteren/motorMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
	opt('Rechtsbijstand', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/rechtsbijstand/muteren/rechtsbijstandMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
	opt('Uitvaart', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/leven/uvv/muteren/uvvMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
	opt('Overlijdensrisico', '/nsecure/fbto/overige_index.jsp?forwardPage=/fbto/leven/orv/muteren/orvMuterenIntroductiePrepareAction.do&topSwitch=yes&param1=previous&paramValue1=/fbto/homeredirect.jsp');
}

/**
 * Levert window.opener op als die bestaat, anders window.parent.
 */
function getOpenerOrParent() {
	if (window.opener != null) {
		return window.opener;
	} else {
		return window.parent;
	}
}

/*
functie creeert een date object met de datum als param
*/
function createDate(day, month, year){
	var aDate = new Date();
	aDate.setDate(day);
	aDate.setMonth(month -1);
	aDate.setYear(year);
	aDate.setHours(0);
	return aDate;
}

function reloadInParentFooterFrame(newHref) {
	window.parent.footerFrame.document.location.href = newHref;
}

function setColor(id, newColor){
	obj = ele(id)
	if (obj != null){
		obj.style.color = newColor;
	}
}