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 writeAddress( i, c )
{
  var prefix = new Array();
  var server = new Array();

  /* Sanware */
  prefix[0] = 'info';
  server[0] = 'sanware.nl';
  
  /* Camping Poelzicht */
  prefix[1] = 'campingpoelzicht';
  server[1] = 'worldmail.nl';
  
  /* Lān en Mar */
  prefix[2] = 'info';
  server[2] = 'campingheeg.nl';
    
  /* De Wetterspetter */
  prefix[3] = 'wetterspetter.aukes';
  server[3] = 'hetnet.nl';
   
  /* Camping Ykema */
  prefix[4] = 'campingykema';
  server[4] = 'hetnet.nl';
  
  /* Camping Het Klokhuis */
  prefix[5] = 'fam.reijenga';
  server[5] = 'xs4all.nl';
   
  /* Sathe Landzicht */
  prefix[6] = 'hornstra-camping';
  server[6] = 'planet.nl';
  
  /* De Pressefinne */
  prefix[7] = 'info';
  server[7] = 'pressefinne.nl';
  
  /* Camping De Oosthoek */
  prefix[8] = 'klbakker';
  server[8] = 'zonnet.nl';
  
  /* output the address */
  if ( c == '' )
    document.write( '<a href="mailto:' + prefix[i] + '@' + server[i] + '">' + prefix[i] + '@' + server[i] + '</a>' );
  else
    document.write( '<a href="mailto:' + prefix[i] + '@' + server[i] + '">' + c + '</a>' );
}              
  


function changeImage( id, src )
{
  /* load the image */
  var img = MM_findObj(id);
  
  /* change the image */
  if ( img != null )
  {
    img.src = src;
  }
}

function initPage( loadGoogle )
{
  /* calculate the window width and height */
  var wWidth = 0, wHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    wWidth = window.innerWidth;
    wHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    wWidth = document.documentElement.clientWidth;
    wHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    wWidth = document.body.clientWidth;
    wHeight = document.body.clientHeight;
  }
  
  /* load the container */
  var con = MM_findObj("page_container");
    
  /* do we need to change the position of the container */
  if ( wHeight <= 603 )
  {
    con.style.marginTop = "0px";
  } else {
    con.style.marginTop = Math.floor((wHeight - 603)/2)+"px";
  }
  
  if ( wWidth <= 980 )
  {
    con.style.width = "1000px";
  } else {
    con.style.width = "auto";
  }

  /* resize the container if needed */
  window.onresize = function() {  initPage(false); };  
  
  /* google maps */
  if ( loadGoogle )
    load();
}

var speed = 4;
var timerId;
var limit;

function galleryPrev()
{
  timerId = setInterval("galleryPrevStep()", 70);
}

function galleryNext( max )
{
  if ( max >= 0 )
  {
    /* save the end */
    limit = max;
    timerId = setInterval("galleryNextStep()", 70);
  }
}


function galleryStop()
{
  /* remove gallery calls */
  clearInterval(timerId);
  
  /* restore original pictures */
  changeImage( "gallery_control_previous", "./design/left.gif" );
  changeImage( "gallery_control_next", "./design/right.gif" );
}

function galleryPrevStep()
{  
  /* load the container */
  var container = MM_findObj("gallery_pics_container");
  
  /* change left-value */
  var new_pos = (parseInt( container.style.left ) + speed);
  if ( new_pos < 0 )
  {
    /* change image */
    changeImage( "gallery_control_previous", "./design/lefthover.gif" );
    container.style.left = new_pos + "px";  
  }
  else if ( container.style.left != 0 )
  {
    /* change image */
    changeImage( "gallery_control_previous", "./design/left.gif" );
     
    /* change position */
    container.style.left = "0px";
    
    /* stop de procedure */
    clearInterval(timerId);
  }
}

function galleryNextStep()
{ 
  /* load the container */
  var container = MM_findObj("gallery_pics_container");

  /* change left-value */
  var new_pos = (parseInt( container.style.left ) - speed);
  
  if ( new_pos > (-1)*limit )
  {
    /* change image */
    changeImage( "gallery_control_next", "./design/righthover.gif" );  
    container.style.left = new_pos + "px";  
  }
  else if ( container.style.left != 0 )
  {
    /* change image */
    changeImage( "gallery_control_next", "./design/right.gif" ); 
      
    /* change position */
    container.style.left = (-1*limit) + "px";
    
    /* stop de procedure */
    clearInterval(timerId);
  } 
}

function goUp()
{
  /* load the content container */
  var container = MM_findObj("content_container");
  container.scrollTop = 0;
}

