
function popUp(winURL, title, width, height, scrollbar, resizable, location, menubar, status, toolbar, directories) {

	if (title == "") {  title = 'anwb'; }
	if ((width == "") || (width == "0")) {  width = 780;  }
	if ((height == "") || (height == "0")) { height = 580; } 

	var winl = (screen.width-width)/2;
	var wint = (screen.height-height)/2;

	if (scrollbar == "") { scrollbar = 'auto'; }
	if (resizable == "") { resizable = '0'; }
	if (location == "") { location = '0'; }
	if (menubar == "") { menubar = '0'; }
	if (status == "") { status = '0'; }
	if (toolbar == "") { toolbar = '0'; }
	if (directories == "") { directories = '0'; }
	
	var w=window.open(winURL,'anwb', "width="+width+", height="+height+", top="+wint+", left="+winl+", scrollbars="+scrollbar+", resizable="+resizable+", location="+location+", menubar="+menubar+", status="+status+", toolbar="+toolbar+", directories="+directories);
	w.focus();	
}

function GetElementValueFromClassName(className,element){var result="";var test=new String(className);var elementString=new String(element);elementString=elementString+":";var startpos=test.indexOf(elementString,0);if(startpos>=0){test=test.substr(startpos,test.length);if(test.indexOf(" ",0)>=0){test=test.substr(elementString.length,test.indexOf(" ",0)-elementString.length);}else{test=test.substr(elementString.length,test.length-elementString.length);}
result=test;}
return result;}


jQuery('a.popup').click(function(){

	var url = this.getAttribute("href");
	var width =  GetElementValueFromClassName(this.className, "w");
	var height = GetElementValueFromClassName(this.className, "h");
	
	var title = 'test'; /* OR GetElementValueFromClassName(this.className, "t"); */
	// unless GetElementValueFromClassName(this.className, "t") has been given
	if(GetElementValueFromClassName(this.className, "t")!=null && GetElementValueFromClassName(this.className, "t")!=""){
		title = GetElementValueFromClassName(this.className, "t"); 
	}
	
	var scrollbar = '1'; /* OR GetElementValueFromClassName(this.className, "s"); */
	// unless GetElementValueFromClassName(this.className, "s") has been given
	if(GetElementValueFromClassName(this.className, "s")!=null && GetElementValueFromClassName(this.className, "s")!=""){
		scrollbar = GetElementValueFromClassName(this.className, "s"); 
	}
	
	var resizable = '1'; /* OR GetElementsValueFromClassName(this.className,"r"); */
	// unless GetElementValueFromClassName(this.className, "r") has been given
	if(GetElementValueFromClassName(this.className, "r")!=null && GetElementValueFromClassName(this.className, "r")!=""){
		resizable = GetElementValueFromClassName(this.className, "r"); 
	}
	
	var location = '0'; /* OR GetElementsValueFromClassName(this.className,"l"); */
	// unless GetElementValueFromClassName(this.className, "l") has been given
	if(GetElementValueFromClassName(this.className, "l")!=null && GetElementValueFromClassName(this.className, "l")!=""){
		location = GetElementValueFromClassName(this.className, "l"); 
	}
	
	var menubar = '0'; /* OR GetElementsValueFromClassName(this.className,"m"); */
	// unless GetElementValueFromClassName(this.className, "m") has been given
	if(GetElementValueFromClassName(this.className, "m")!=null && GetElementValueFromClassName(this.className, "m")!=""){
		menubar = GetElementValueFromClassName(this.className, "m"); 
	}
	
	var status = '0'; /* OR GetElementsValueFromClassName(this.className,"st"); */
	// unless GetElementValueFromClassName(this.className, "m") has been given
	if(GetElementValueFromClassName(this.className, "st")!=null && GetElementValueFromClassName(this.className, "st")!=""){
		status = GetElementValueFromClassName(this.className, "st"); 
	}
	
	var directories = '0'; /* OR GetElementsValueFromClassName(this.className,"d"); */
	// unless GetElementValueFromClassName(this.className, "d") has been given
	if(GetElementValueFromClassName(this.className, "d")!=null && GetElementValueFromClassName(this.className, "d")!=""){
		directories = GetElementValueFromClassName(this.className, "d"); 
	}
	
	var toolbar = '0'; /* OR GetElementsValueFromClassName(this.className,"to"); */
	// unless GetElementValueFromClassName(this.className, "to") has been given
	if(GetElementValueFromClassName(this.className, "to")!=null && GetElementValueFromClassName(this.className, "to")!=""){
		toolbar = GetElementValueFromClassName(this.className, "to"); 
	}
		
	var meetcode = (this.className.indexOf('meetcode') != -1) ;	
	if (meetcode){
		var f = GetElementValueFromClassName(this.className, "meetcodeArgument");
		var href = this.getAttribute('href');	
		dest = addMeetcodeToUrl(f, href) ;
	}

	
	popUp(url, title, width, height, scrollbar, resizable, location, menubar, status, toolbar, directories);

	return false;
});

var autoPopulate={sInputClass:'autopopulate',init:function(){if(!document.getElementById||!document.createTextNode){return;}
var arrInputs=jQuery('input.'+autoPopulate.sInputClass);var iInputs=arrInputs.length;var oInput;for(var i=0;i<iInputs;i++){oInput=arrInputs[i];if(oInput.type!='text'){continue;}
if((oInput.value=='')&&(oInput.title!='')){oInput.value=oInput.title;jQuery(oInput).addClass('defaultInput');}
if(oInput.value==oInput.title){jQuery(oInput).addClass('defaultInput');}
jQuery('input.autopopulate').focus(function(){if(this.value==this.title){this.value='';this.select();jQuery(this).val('').removeClass('defaultInput');}});jQuery('input.autopopulate').blur(function(){if(!this.value.length){this.value=this.title;jQuery(this).addClass('defaultInput');}
else{if(this.value!=this.title){jQuery(this).removeClass('defaultInput');}}});}}};

autoPopulate.init();




/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-20 03:23:36 +0200 (Mi, 20 Jun 2007) $
 * $Rev: 2110 $
 *
 * Version 2.1
 */

(function($){

/* @name bgiframe
 * @type jQuery
 * @cat Plugins/bgiframe
 * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 */

$.fn.bgIframe = $.fn.bgiframe = function(s) {
	// This is only for IE6
	if ( $.browser.msie && parseInt($.browser.version) <= 6 ) {
		s = $.extend({
			top     : 'auto', // auto == .currentStyle.borderTopWidth
			left    : 'auto', // auto == .currentStyle.borderLeftWidth
			width   : 'auto', // auto == offsetWidth
			height  : 'auto', // auto == offsetHeight
			opacity : true,
			src     : 'javascript:false;'
		}, s || {});
		var prop = function(n){return n&&n.constructor==Number?n+'px':n;},
		    html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+
		               'style="display:block;position:absolute;z-index:-1;'+
			               (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+
					       'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+
					       'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+
					       'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+
					       'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+
					'"/>';
		return this.each(function() {
			if ( $('> iframe.bgiframe', this).length == 0 )
				this.insertBefore( document.createElement(html), this.firstChild );
		});
	}
	return this;
};

// Add browser.version if it doesn't exist
if (!$.browser.version)
	$.browser.version = navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];

})(jQuery);

(function($){var def={selector:"#tooltip"},helper;$.fn.extend({tooltip:function(settings){settings=$.extend({},def,settings);ensureHelper(settings);this.each(function(){var node=$(this),title=node.attr("title");if(!title||!title.length)return;node.data("tip",title).removeAttr("title").mouseenter(function(e){var node=$(this),jpos;if(this.nodeName.toLowerCase()=="area"){jpos=calcPosForArea(node,$(e.relatedTarget));}else{jpos=node.offset();jpos.left+=node.outerWidth();}
helper.html(node.data("tip"));jpos.top-=helper.outerHeight();helper.css(jpos).show();}).mouseleave(function(){helper.hide();});})
return this;}});function ensureHelper(settings){if(!helper){helper=$(settings.selector);if(!helper.length)throw"Selector '"+settings.selector+"' does not exist.";helper.css({"position":"absolute","left":"0px","top":"0px"});}}
function calcPosForArea(node){var imgOffs=$('img[usemap=#'+node.parent().attr("name")+']:visible').offset(),c=node.attr("coords").split(","),r;switch(node.attr("shape").toLowerCase()){case"circle":if(c.length>2){r=parseInt(c[3]);return{top:imgOffs.top+parseInt(c[1])+r,left:imgOffs.left+parseInt(c[0])+r}}
break;case"rect":case"poly":var x2=c[0],y2=c[1],i=2,l=c.length;for(;i<l;i+=2){x2=Math.max(x2,parseInt(c[i]));y2=Math.min(y2,parseInt(c[i+1]));}
return{top:imgOffs.top+y2,left:imgOffs.left+x2};default:return relImage.offset();}
return null;}})(jQuery);
$(".tooltip").tooltip();


/* meten van externe links */
	var external = function (href) {
		var re = /^(https?):\/\/(.*?)\/(.*)$/;
		var matches = re.exec(href);
		if (matches && matches[2].indexOf('anwb.nl') == -1) {
			// TODO: Theoretically this doesn't catch external requests like 'anwb.nl.domain.tld'
			
			// strip first '/' from location path
			var path = window.location.pathname;
			if (path.length > 0) {
				path = window.location.pathname.substring(1);
			}
			var pagina = path + window.location.hash + window.location.search;
			pageTracker._trackPageview("/outgoing/routeplanner/" +href);
		}
	};

function ExpandOrCollapse(obj1,obj2) {

var el = document.getElementById(obj1);
var il = document.getElementById(obj2);


        if ( el.style.display != "none" ) {
		el.style.display = 'none';
		il.className = 'in';
        }
        else {
		el.style.display = '';
		il.className = 'out';
        }
}



function Expand (obj1,obj2,obj3) {

var el = document.getElementById(obj1);
var il = document.getElementById(obj2);
var al = document.getElementById(obj3);


        if ( el.style.display != "none" ) {
		el.style.display = 'none';
		il.className = 'in';
		al.className = 'txtin';
        }
        else {
		el.style.display = '';
		il.className = 'out';
		al.className = 'txtout';
        }
}
