<!--

///* Style Sheet Selector */
//if (navigator.appName.indexOf("Explorer") != -1)
//{
//  document.write('<link rel=\"stylesheet\" href=\"/include/style.css\">');
//}else{
//  document.write('<link rel=\"stylesheet\" href=\"/include/style_ns.css\">');
//}


/* Scherm printen */
function custom_print() {
    window.print();
}




// Check if a string is null or has no length.
function isEmpty(s) {
 if (s == null) {
  return true;
 }
 if (s.length == 0) {
  return true;
 }
 return false;
}




// Shows a photo in a popup window.
function viewPhoto(id) {
 return popUp('/photos/' + id + '.jpg',680,515,0,1,1,0,0,0);
}



/* Open browser window en centreer*/
var popup; // global popup window object

// Only the 1st 3 parameters are required, the rest may have one of the
// values null, 0, or 1. Optional parameters that are not specified or have
// the value null will default to the value 0. See the Javascript
// window.open() function documentation for the effect of these parameters.
// This function always returns false.
function popUp(p_url,p_width,p_height,p_resizable,p_scrollbars,p_status,p_toolbar,p_location,p_menubars) {
 // Close any existing popup
 if (popup != null) {
  if (!popup.closed) {
   popup.close();
  }
  popup = null;
 }
 // Set properties
 if (p_resizable == null) {
  p_resizable = 0;
 }
 if (p_scrollbars == null) {
  p_scrollbars = 0;
 }
 if (p_status == null) {
  p_status = 0;
 }
 if (p_toolbar == null) {
  p_toolbar = 0;
 }
 if (p_location == null) {
  p_location = 0;
 }
 if (p_menubars == null) {
  p_menubars = 0;
 }
 var properties = 'height=' + p_height + ',width=' + p_width + ',resizable=' + p_resizable +
                  ',scrollbars=' + p_scrollbars+ ',status=' + p_status + ',toolbar=' + p_toolbar +
                  ',location=' + p_location + ',menubars=' + p_menubars;
 // Determine left and top of new popup window
 if ((document.all) || ((window.innerHeight) && (window.screenX))) {
  var self_h = 0;
  var self_w = 0;
  var self_x;
  var self_y;
  if (typeof( window.innerWidth ) == 'number') {
   //Non-IE
   self_x = window.screenX;
   self_y = window.screenY;
   self_w = window.innerWidth;
   self_h = window.innerHeight;
  }
  else {
   self_x = window.screenLeft;
   self_y = window.screenTop;
   if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
    //IE 6+ in 'standards compliant mode'
    self_w = document.documentElement.clientWidth;
    self_h = document.documentElement.clientHeight;
   }
   else if(document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    self_w = document.body.clientWidth;
    self_h = document.body.clientHeight;
   }
  }
  if ((self_h > 0) && (self_w > 0)) {
   var x = self_x + ((self_w - p_width) >> 1);
   var y = self_y + ((self_h - p_height) >> 1);
   properties += ',left=' + x + ',top=' + y;
  }
 }
 // Create, show, and focus popup window.
 popup = window.open(p_url,'popup',properties);
 if (popup.opener == null) {
  popup.opener = self;
 }
 popup.focus();
 return false;
}





/**
 * Escapes all HTML entities in the given string.
 */
function html_encode_entities(s) {
  if ((typeof s == 'string') && (s.length > 0)) {
    return s.replace(/&<>/g, function(c) { if (c == '&') return '&amp;'; if (c == '<') return '&lt;'; if (c == '>') return '&gt;'; });
  }
  return s;
}




/**
 * Limits input to characters of the given string.
 */
function filterInputKeyPress(e,chars) {
 var key;
 var keychar;
 if (window.event) {
  key = window.event.keyCode;
 }
 else if (e) {
  key = e.which;
 }
 else {
  return true;
 }
 keychar = String.fromCharCode(key);
 // control keys
 if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27)) {
  return true;
 }
 // limit input
 else if (chars.indexOf(keychar) > -1) {
  return true;
 }
 return false;
}




/**
 * Filters a currency input field with a "," decimal seperator.
 */
function currencyFieldKeyPress(obj,e) {
 if (filterInputKeyPress(e,"-,0123456789")) {
  var key;
  var keychar;
  if (window.event) {
   key = window.event.keyCode;
  }
  else if (e) {
   key = e.which;
  }
  else {
   return true;
  }
  keychar = String.fromCharCode(key);
  // allow only 1 decimal seperator or sign character to be entered.
  if (keychar == ',') {
   if (obj.value.indexOf(',') > -1) {
    return false;
   }
   else if (obj.value.length == 0) {
    obj.value = '0';
   }
  }
  else if (keychar == '-') {
   if (obj.value.indexOf('-') == -1) {
    obj.value = '-' + obj.value;
   }
   return false;
  }
  return true;
 }
 return false;
}




/**
 * Filters a currency input field with a "," decimal seperator.
 */
function integerFieldKeyPress(obj,e) {
 if (filterInputKeyPress(e,"-0123456789")) {
  var key;
  var keychar;
  if (window.event) {
   key = window.event.keyCode;
  }
  else if (e) {
   key = e.which;
  }
  else {
   return true;
  }
  keychar = String.fromCharCode(key);
  // allow only 1 sign character to be entered.
  if (keychar == '-') {
   if (obj.value.indexOf('-') == -1) {
    obj.value = '-' + obj.value;
   }
   return false;
  }
  return true;
 }
 return false;
}





/* Afbeeldingen mouse-over */
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_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];}
}

/* Check all checkboxes*/
var checkflag = "false";
function check(field) {
  if (checkflag == "false") {
  for (i = 0; i < field.length; i++) {
  field[i].checked = true;}
  checkflag = "true";
  return "Deselecteer alles"; }
else {
  for (i = 0; i < field.length; i++) {
  field[i].checked = false; }
  checkflag = "false";
  return "Selecteer alles"; }
}




// Translate a name into an email address.
function translateNameToEmail(name) {
  // Do what you want here to return the correct email address that belongs to the given name.
  var map = new Array();
  map['Edger van Faassen'] = new Array('e.van.faassen','mosadex','nl');

  // Contactinformatie vestiging Elsloo
  map['Dhr. Drs. L.F.P. Castelijns, apotheker'] = new Array('l.castelijns','mosadex', 'nl');
  map['Dhr. A.A.M. van Esch']                   = new Array('a.van.esch'  ,'mosadex', 'nl');
  map['Dhr. P. Feskens, MBA']                   = new Array('p.feskens'   ,'mosadex', 'nl');
  map['Dhr. J. Keulers']                        = new Array('j.keulers'   ,'mosadex', 'nl');
  map['Mevr. F. Bartoli']                       = new Array('f.bartoli'   ,'mosadex', 'nl');
  map['Dhr. M. de Ruiter']                      = new Array('m.d.ruiter'  ,'mosadex', 'nl');
  map['Dhr. L.A.M. Verhoeven, RA']              = new Array('b.verhoeven' ,'mosadex', 'nl');
  map['Mevr. T. Klunder']                       = new Array('t.klunder'   ,'mosadex', 'nl');

  // Contactinformatie vestiging Leiden
  map['Dhr. J. Vlieland']   = new Array('j.vlieland'   , 'mosadex' ,'nl');
  map['Dhr. R. Buytendijk'] = new Array('r.buytendijk' , 'mosadex' ,'nl');
  map['Dhr. H. Claus']      = new Array('h.claus'      , 'mosadex' ,'nl');
  map['Dhr. R. Buytendijk'] = new Array('inkoopleiden' , 'mosadex' ,'nl');

  // Contactinformatie vestiging Den Bosch
  map['Dhr. P. Feskens'] = new Array('p.feskens', 'mosadex', 'nl');
  map['Dhr. E. Konings'] = new Array('e.konings', 'mosadex', 'nl');

  var parts = map[name];
  if (!parts) {
    return null;
  }
  return parts[0] + '@' + parts[1] + '.' + parts[2];
}


// Fix the 'mailto:' link in an <a> tag.
function fixEmail(a, name) {
  if ((a.href != null) && (a.href.substr(0,7) == 'mailto:')) {
    if (!name) {
      name = a.innerText; // not DOM compliant code, but skips all embedded html elements if any.
      if (!name) {
        // DOM complient code, but won't work if there are any embedded html elements between the <a> and </a> tags.
        aChildNodes = a.childNodes;
        if (aChildNodes.length) {
          name = a.childNodes[0].nodeValue;
        }
      }
    }
    if (name) {
      var email = translateNameToEmail(name);
      if (email) {
        a.href = a.href.replace(/^(mailto\:)([^\?]*)(\?.*)?$/, '$1' + email + '$3');
      }
    }
  }
  return true;
}



// Extend some core classes.
if (!String.prototype.toHtml) {
	String.prototype.toHtml = function() {
		return this.replace(/[&<>]/g, function(c) { if (c == '&') return '&amp;'; if (c == '<') return '&lt;'; if (c == '>') return '&gt;'; });
	}
}



// xGetElementById, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xGetElementById(e) {
	if(typeof(e)=='string') {
		if(document.getElementById) e=document.getElementById(e);
		else if(document.all) e=document.all[e];
		else e=null;
	}
	return e;
}



// xAddEventListener, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
// http://cross-browser.com/x/lib/view.php?sym=xAddEventListener
// Modified by Craig Manley to accept arrays of event names.
// Modified by Craig Manley to support stacked on* events in old browsers.
function xAddEventListener(e,eT,eL,cap) {
	if ((typeof(eT) == 'object') && (eT.constructor.toString().indexOf('function Array()') != -1)) {
		for (var i=0; i<eT.length; i++) {
			xAddEventListener(e,eT[i],eL,cap);
		}
	}
	else {
		if(!(e=xGetElementById(e)))return;
		eT=eT.toLowerCase();
		if(e.addEventListener)e.addEventListener(eT,eL,cap||false);
		else if(e.attachEvent)e.attachEvent('on'+eT,eL);
		//else e['on'+eT]=eL;
		else {
			if (e['on'+eT]) {
				var f = e['on'+eT];
				e['on'+eT] = function() {
					f();
					eL();
				}
			}
			else {
				e['on'+eT]=eL;
			}
		}
	}
}
