var isNS = (navigator.appName.indexOf("Netscape")) >= 0 ? 1 : 0 ;
var isMinNS4 = (isNS && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinNS6 = (isNS && parseFloat(navigator.appVersion) >= 6) ? 1 : 0;

var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && parseFloat(navigator.appVersion) >= 5) >= 0 ? 1 : 0;
var isMinIE55 = (isMinIE4 && parseFloat(navigator.appVersion) >= 5.5) >= 0 ? 1 : 0;
var isMinIE6 = (isMinIE4 && parseFloat(navigator.appVersion) >= 6) >= 0 ? 1 : 0;

var isMac = (navigator.userAgent.indexOf('Mac')) > -1 ? 1: 0 ;


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_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
  var j=0
  var x
  var 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];
		}
}

var scrbreed = screen.availWidth; // screen-object not available in Netscape 3
var scrhoog = screen.availHeight;
function openWerkblad(theURL,winName,features) { //v2.0
	self.name = "Tijdwindow";
	var breed = 512, hoog = 400;
	// adjust for NN en IE:
	if (navigator.appName == 'Netscape') {
		breed += 20;
		hoog += 20;
	} else {
		breed += 50;
		hoog+= 50;
	}
	var rechts = 150;
	window.open(theURL,'werkblad','scrollbars=no,resizable=no,width=' + breed + ',height=' + hoog + ',top=100,left='+ rechts);
}

function PrintThisPage() { 
  window.print();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


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();
}
MM_reloadPage(true);


function MM_showHideLayers_original() { //v3.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 MM_showHideLayers_v3() { //v3.0 (modified to adjust the hider's height as well as its visibility
  var i,p,c,v,vn,obj,args=MM_showHideLayers_v3.arguments;
  for (i=0; i<(args.length-2); i+=4)  {
	if ((obj=MM_findObj(args[i]))!=null) { 
		vn = args[i] ; v=args[i+3]; c=args[i+2];
		if (obj.style) { 
			obj=obj.style;v=(v=='show')?'visible':(v='hide')?'hidden':v; 
			obj.left = (args[i+1] + (4 - args[i+2])*5 + args[i+2] - 4) ;
			}
		if (vn == 'hider' && v == 'hidden') obj.height = 0 ; 
		if (vn == 'hider' && v == 'visible') obj.height = 200 ;
		obj.visibility=v; 
		}
	}
}


function MM_showHideLayers() { //v3.1 (modified to pass leftpos as parameter and do a browsercheck
  var i,p,c,v,vn,obj,args=MM_showHideLayers.arguments;
  
  if ((isMinIE55 || isMinNS6) && isMac == 0 ) {
  for (i=0; i<(args.length-3); i+=4)  {

	if ((obj=MM_findObj(args[i]))!=null) { 
		vn = args[i] ; v=args[i+3]; c=args[i+2];
		if (obj.style) { 
			obj=obj.style;v=(v=='show')?'visible':(v='hide')?'hidden':v; 
			obj.left = args[i+1] 
			}
		if (vn == 'hider' && v == 'hidden') obj.height = 0 ; 
		if (vn == 'hider' && v == 'visible') obj.height = 200 ;
		obj.visibility=v; 
		}
	}
	}
}


function OpenWebView(imageurl,width,height,backcolor,text) { 
	OpenViewWin("webview_popup.aspx","webview",width,height,imageurl,text,backcolor)
	}

function OpenViewWin(viewurl,winname,width,height,imageurl,text,backcolor) {


	// adjust for NN en IE:
	if (navigator.appName == 'Netscape') {
		win_width = width + 20;
		win_height = height + 50;
	} else {
		win_width = width + 50;
		win_height= height + 80;
	}
	var rechts = 150;
	
	theURL = viewurl
	theURL += "?img=" + imageurl
	theURL += "&w=" + width
	theURL += "&h=" + height
	theURL += "&bc=" + backcolor
	theURL += "&txt=" + text
	
	var features = 'scrollbars=no,resizable=no,width=' + win_width + ',height=' + win_height + ',top=100,left='+ rechts
	
	winWebView = window.open(theURL,'webview',features);
	
}	

//-----------------------------------------------------------------------------
// added: Cookies
//-----------------------------------------------------------------------------

function get_cookie(Name) {
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) { // if cookie exists
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie value
			if (end == -1)
			end = document.cookie.length;
			returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}