var bdr = '';
var DHTML = (document.getElementById || document.all || document.layers);
var marked_row = new Array;

function getObj(name)
{
	if (document.getElementById)
	{
		return document.getElementById(name).style;
	}
	else if (document.all)
	{
		return document.all[name].style;
	}
	else if (document.layers)
	{
		return document.layers[name];
	}
}

function volgendeFoto()
{
 arg = arg + 1;

 if (arg == imgs.length)
 {
  arg = 0;
 }
 else
 {
  if (arg < 0)
  {
   arg = imgs.length - 1;
  }
  var pad = bdr + imgs[arg][0];
  document.images.grotefoto.src=pad;
 }

 marked_row = Array();
 marked_row[arg] = true;

 var pad = bdr + imgs[arg][0];
 document.images.grotefoto.src=pad;

 var menu_nr = "menu" + arg;

}

function vorigeFoto()
{
 arg = arg - 1;

 if (arg == imgs.length)
 {
  arg = 0;
 }
 else
 {
  if (arg < 0)
  {
   arg = imgs.length - 1;
  }
  var pad = bdr + imgs[arg][0];
  document.images.grotefoto.src=pad;
 }

 marked_row = Array();
 marked_row[arg] = true;
 var menu_nr = "menu" + arg;

 var pad = bdr + imgs[arg][0];
 document.images.grotefoto.src=pad;

}

function toonFoto(nr)
{
 arg = nr;
 arg = arg - 1;

 if (arg == imgs.length)
 {
  arg = 0;
 }
 else
 {
  if (arg < 0)
  {
   arg = imgs.length - 1;
  }
  var pad = bdr + imgs[arg][0];
  document.images.grotefoto.src=pad;
 }

 marked_row = Array();
 marked_row[arg] = true;
 var menu_nr = "menu" + arg;

 var pad = bdr + imgs[arg][0];
 document.images.grotefoto.src=pad;

}

 var d = document;
  var wH; // window handler

  function zoom2(pad,naam,id,pag)
  {
	foto = new Image;
	foto.src = pad;
	w = d[naam].width;
    alert(w);
  }
  
  function zoom(pad,img,id,pag,schaling)
  {
	foto = new Image;
	foto.src = pad;

	w = Math.round(d[img].width * schaling); // foto.width <- IE4;
	h = Math.round(d[img].height * schaling) + 50; // foto.height <- IE4;
	
	x = (screen.width - w) / 2;
	y = (screen.height - h) / 2;

	url = pag + '&id=' + id + '&w=' + w + '&h=' + h;
	options = "width=" + w + ",height=" + h + ",left=" + x + ",top=" + y + ",scrollbars=no";

	wH = window.open (url, 'image', options);
	if (!wH) wH.opener = self;
  }

  function zoom3(pad,img,id,pag,afmeting)
  {
	foto = new Image;
	foto.src = pad;

    if (d[img][0])
    {
     breedte = d[img][0].width;
     hoogte = d[img][0].height;

    }
    else
    {
     breedte = d[img].width;
     hoogte = d[img].height;
    }

    if (breedte >= hoogte)
    {
	  percentage = afmeting / breedte;
    }
    else
    {
	  percentage = afmeting / hoogte;
	}

	w = Math.round(breedte * percentage) -3; // foto.width <- IE4;
	h = Math.round(hoogte * percentage) - 1; // foto.height <- IE4;
	
	x = (screen.width - w) / 2;
	y = (screen.height - h) / 2;

	url = pag + '&id=' + id + '&w=' + w + '&h=' + h;
	options = "width=" + w + ",height=" + h + ",left=" + x + ",top=" + y + ",scrollbars=no";

	wH = window.open (url, 'image', options);
	if (!wH) wH.opener = self;
  }

function openVenster(url, naampag, w, h, scroll) {
var winl = (screen.width - w) / 2;

if (h == '*') {

 if ((screen.availHeight - 10) > 700) 
	{
	 var winh = 700;
	 var wint = ((screen.availHeight - 30) - winh) / 2;
    } else {
	 var winh = screen.availHeight - 30;
	 var wint = 0;
	}

  } else {
	 var winh = h;
	 var wint = ((screen.availHeight - 30) - h) / 2;
	}
	
winprops = 'height='+winh+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(url, naampag, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function groteFoto(pid,sid,tid,fid) 
{
 	var url = '/?pag_id=' + pid + '&site_id=' + sid + '&dr=zm' + '&tid=' + tid + '&fid=' + fid;
		openVenster(url,'popupwin','680','*','1');	
}

function groteFotoNieuws(pid,sid,nid,fid) 
{
 	var url = '/?pag_id=' + pid + '&site_id=' + sid + '&dr=zm' + '&nid=' + nid + '&fid=' + fid;
		openVenster(url,'popupwin','680','*','1');
}

function groteFotoFB(pid,sid,tid,fid) 
{
 	var url = '/?pag_id=' + pid + '&site_id=' + sid + '&dr=zm' + '&tid=' + tid + '&fid=' + fid;
		openVenster(url,'popupwin','680','*','1');	
}

function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var ns6=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1;
var ns4=document.layers;

function toonTekst(content)
{
 if(ie4)
 {
  toonTekstObj=document.all.tekst_laag;
 }
 if(ns6)
 {
  toonTekstObj=document.getElementById("subkop");
 }
 if(ie4||ns6)
 {
  if(toonTekstObj.innerHTML!=content)
  {
   toonTekstObj.innerHTML=content;
  }
  else
  {

  }
 }
 if(ns4)
 {
  document.nslaag.document.write(content);
  document.nslaag.document.close();
 }
}

function toonTekst2(content)
{
 if(ie4)
 {
  toonTekst2Obj=document.all.tekst_laag;
 }
 if(ns6)
 {
  toonTekst2Obj=document.getElementById("omschrijving");
 }
 if(ie4||ns6)
 {
  if(toonTekst2Obj.innerHTML!=content)
  {
   toonTekst2Obj.innerHTML=content;
  }
  else
  {

  }
 }
 if(ns4)
 {
  document.nslaag.document.write(content);
  document.nslaag.document.close();
 }
}

function toonTekst3(content)
{
 if(ie4)
 {
  toonTekst2Obj=document.all.tekst_laag;
 }
 if(ns6)
 {
  toonTekst2Obj=document.getElementById("uitverkocht");
 }
 if(ie4||ns6)
 {
  if(toonTekst2Obj.innerHTML!=content)
  {
   toonTekst2Obj.innerHTML=content;
  }
  else
  {

  }
 }
 if(ns4)
 {
  document.nslaag.document.write(content);
  document.nslaag.document.close();
 }
}


function toonGroteFoto(naam,w,h,label,omschrijving,uitverkocht)
{
 document.getElementById('toongrotefoto').src = naam;
 toonTekst(label);
  toonTekst2(omschrijving);
  toonTekst3(uitverkocht);  
 //document.images.grotefoto.width=w
 //document.images.grotefoto.height=h
}


