var radioPlayerWindow="undefined";
var videoPlayerWindow="undefined";

/**
 * Download counter
 */
function dc(sender) {
	if (sender.href) {
		var img=new Image;
		img.src="/scripts/downloadcounter.php?doc="+sender.href;
	}
}

function videoPlayer(url,title) {
  videoPlayerWindow=window.open("/videoplayer.php?fragment="+url+"&title="+title,'popup_videoplayer','width=600,height=520,scrollbars=no,status=no,menubar=no,location=no,resizable=yes,titlebar=no');
  videoPlayerWindow.focus();
}

function audioPlayer(url,title) {
	radioPlayerWindow=window.open("/audioplayer.php?fragment="+url+"&title="+title,'popup_audioplayer','width=280,height=70,scrollbars=no,status=no,menubar=no,location=no,resizable=no,titlebar=no');
  radioPlayerWindow.focus();
}

function toonVergroting(afbeelding) {
	var	breedte=500;
	var hoogte=400;
	var l=(screen.width-breedte)/2;
	var t=(screen.height-hoogte)/2;

  var w=window.open("/fotoviewer?afbeelding="+afbeelding,"vergroting","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+breedte+",height="+hoogte+",left="+l+",top="+t);
  w.focus();
}

function submitFilterForm(f,veld){
	//alert(f.name);
	var trefwoord_id = document.getElementById("trefwoord_id");
	var mdg_id = document.getElementById("mdg_id");

	if(veld=="trefwoord_id"){
		mdg_id.value=0;
	}
	if(veld=="mdg_id"){
		trefwoord_id.value=0;
	}

	f.submit();
}

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_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 MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

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_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];}
}

/**
 * Doorsturen
 */
function stuurDoor(p) {
	var v="";
	var w=window.open("/stuur_door"+v+"?p="+p,'stuurdoor_window','width=564, height=525, scrollbars=auto');
	w.focus();
}

/* FAQ - VRAAG & ANTWOORD */

function groupShow(groep) {
	hideOtherGroups("groep"+groep);
	currgroep=groep;

	//toggle clicked div
	var div_vragen=document.getElementById("groep"+groep);
	div_vragen.style.display=(div_vragen.style.display=='none')?div_vragen.style.display='block':div_vragen.style.display='none';
}

function hideOtherGroups(groep) {
	divs=document.getElementsByTagName("div");
	for (var i=0; i<divs.length; i++) {
	  if (divs[i].id!=groep && divs[i].id.substr(0, 5)=="groep" && divs[i].style.display!="none") {
	  	divs[i].style.display="none";
		}
	}
}

/**
 * Doorsturen
 */
function stuurDoor(v) {
	var w=window.open(""+v+"" ,'stuurdoor_window','width=430,height=800,status=no,menubar=no,location=no,resizable=yes,titlebar=no,scrollbars=yes');
	w.focus();
}

jQuery(document).ready(function(){
    jQuery(function() {
        //jQuery('.photoAlbumContainer a').lightBox({fixedNavigation:false});
		jQuery('.photoAlbumContainer a').prettyPhoto({ theme: 'light_rounded' });
    });	
    jQuery("#searchfield").autocomplete('ajax_handler.php');
   
	$("a[rel^='prettyPhoto']").prettyPhoto({
		theme: 'light_rounded'
	});
	$("area[rel^='prettyPhoto']").prettyPhoto({
		theme: 'light_rounded',
		default_width: 530,
		default_height: 410
	});
});


 

//popups

PositionX = 100;
PositionY = 100;
defaultWidth  = 500;
defaultHeight = 500;


var AutoClose = true;

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage (imageURL, caption) {

if (caption=="NL") {caption="Uitvergroting";}
if (caption=="EN") {caption="Large image";}


  var windowTop = 100;                // Top position of popup
  var windowLeft = 100                // Left position of popup
  var defaultWidth = 730;             // Default width (for browsers that cannot resize)
  var defaultHeight = 532;            // Default height (for browsers that cannot resize)
  var onLoseFocusExit = true;         // Set if window to exit when it loses focus
  var undefined;

  // Set up the window open options
  var Options = "width=" + defaultWidth + ",height=" + defaultHeight + ",top=" + windowTop + ",left=" + windowLeft + ",resizable"
  
  // Now write the HTML markup to the new window, ensuring that we insert the 
  // parameter URL of the image and the parameter description of the image in 
  // the right place.
  var myScript = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" +
    "<html>\n" + 
    "<head>\n" + 
    "<title>" + caption + "\</title>\n" +
    "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n" +
    "<meta http-equiv=\"Content-Language\" content=\"en-gb\">\n" +
    "<script language=\"JavaScript\" type=\"text/javascript\">\n" +
    "function resizewindow () {\n" +
    "  var width = document.myimage.width;\n" + 
    "  var height = document.myimage.height;\n";
  
  // Netscape  
  if (navigator.appName.indexOf("Netscape") != -1) {  
    myScript = myScript +  "  window.innerHeight = height;\n  window.innerWidth = width;\n"
  }
   
  // Opera 
  else if (navigator.appName.indexOf("Opera") != -1) {
    myScript = myScript +  "  window.resizeTo (width+12, height+31);\n"
  }
  
  // Microsoft 
  else if (navigator.appName.indexOf("Microsoft") != -1) { 
    myScript = myScript + "  window.resizeTo (width+12, height+31);\n" 
  }
  
  // Assume a frig factor for any other browsers
  else {
    myScript = myScript + "  window.resizeTo (width+14, height+34);\n"
  }
      
  myScript = myScript + "}\n" + "window.onload = resizewindow;\n" +
    "</script>\n</head>\n" + "<body ";
    
  // If the window is required to close when it loses focus.
  if (onLoseFocusExit) {myScript = myScript + "onblur=\"self.close()\" ";}
    
  myScript = myScript + "style=\"margin: 0px; padding: 0px;\">\n" +
    "<a href='javascript:window.close();'><img src=\"" + imageURL + "\" alt=\"" + caption + "\" title=\"" + caption + "\" name=\"myimage\" border='0'></a>\n" + 
    "</body>\n" +  "</html>\n";
        
  // Diagnostic - uncomment the next line if you wish to see the script generated.   
  //alert (myScript);
  
  // Create the popup window
  var imageWindow = window.open ("","imageWin",Options);
  imageWindow.document.write (myScript)
  imageWindow.document.close ();
  if (window.focus) imageWindow.focus();
  return false;
}
