//*****************************************************
// Algemene functies voor www.roofvogels-hw.nl
//
// Martin Mollet, Mei 2006
//
//*****************************************************




//*****************************************************
// FrontPage routines (3)
//*****************************************************
function SwapImage() 
{  
   var doc=document,args=arguments,elm,n;
   doc.$imgSwaps=new Array();
   for(n=2; n<args.length;n+=2)
   { 
      elm= GetObjectByID(args[n]);
      if(elm) 
      { 
         doc.$imgSwaps[doc.$imgSwaps.length]=elm;
         elm.$src=elm.src; elm.src=args[n+1];
      }
   }
}


//*****************************************************
// Preload images
//*****************************************************
function PreloadImages()
{  
   var d=document,a=arguments; 
   if (!d.FP_imgs)
      d.FP_imgs=new Array();

   for(var i=0; i<a.length; i++)
   { 
      d.FP_imgs[i]=new Image;
      d.FP_imgs[i].src=a[i];
   }
}


//*****************************************************
//
//*****************************************************
function GetObjectByID(id,o)
{  //v1.0
   var c,el,els,f,m,n;
   if (!o)
      o=document;
   if (o.getElementById)
      el=o.getElementById(id);
   else if (o.layers)
      c=o.layers;
   else if(o.all)
      el=o.all[id];

   if (el)
      return el;

   if (o.id==id || o.name==id)
      return o; 

   if (o.childNodes)
      c=o.childNodes;

   if (c)
      for (n=0; n<c.length; n++)
      {
         el= GetObjectByID(id,c[n]);
         if (el)
            return el;
      }

   f=o.forms;

   if (f)
      for (n=0; n<f.length; n++)
      {
         els=f[n].elements;
         for (m=0; m<els.length; m++)
         { 
            el= GetObjectByID(id,els[n]);
            if (el)
               return el;
         }
      }
   return null;
}


//*****************************************************
// PreLoad TABs en Button images
//*****************************************************
function PreLoadTabs ()
{
   PreloadImages('image/butHome.jpg','image/butSoorten.jpg','image/butDitJaar.jpg','image/butVorJaren.jpg','image/butMelden.jpg','image/butFoto.jpg','image/butInfo.jpg');
   PreloadImages('image/butNaarBoven.jpg','image/butVorigeG.jpg');
   PreloadImages('image/butHomeA.jpg','image/butHomeH.jpg','image/butSoortenA.jpg','image/butSoortenH.jpg','image/butDitJaarA.jpg','image/butDitJaarH.jpg','image/butVorJarenA.jpg','image/butVorJarenH.jpg','image/butMeldenA.jpg','image/butMeldenH.jpg','image/butFotoA.jpg','image/butFotoH.jpg','image/butInfoA.jpg','image/butInfoH.jpg');
   PreloadImages('image/butNaarBovenH.jpg','image/butVorigeGH.jpg','image/butDArchiefH.jpg');
}



//*****************************************************
// Schrijf gemeenschappelijke deel van header
//*****************************************************
function SchrijfHeader ()
{
   document.write('<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">');
   document.write('<META NAME="author" CONTENT="Martin Mollet">');
   document.write('<META NAME="keyword" CONTENT="roofvogel roofvogels Hoekse Hoeksche Waard Hoeksewaard Hoekschewaard buizerd buizerden buizerds torenvalk torenvalken kiek kieken kiekendief havik haviken sperwer sperwers boomvalk boomvalken slechtvalk slechtvalken valk valken">');
   document.write('<META http-equiv="imagetoolbar" content="false">');
   document.write('<LINK REL="shortcut icon" HREF="http://home.hetnet.nl/~wrhwo/image/favicon.ico" />');

}


//*****************************************************
// Teken pagina kop (met tabs-bladen e.d.)
// Tab kan zijn HOM,SRT,DJR,VJR,MLD,FOT,INF of leeg
// specials: MAP of FAQ voor SiteMap of FAQ
//*****************************************************
function TekenPaginaKop (Tab)
{
   document.write('<TABLE WIDTH=1000 BORDER=0 CELLSPACING=0 CELLPADDING=0>');

   document.write('<TR>');
   document.write('   <TD ROWSPAN=2 WIDTH=100><IMG SRC=image/HeadTV.jpg ALT="Vrouwtje(L) en mannetje(R) torenvalk" TITLE="Vrouwtje(L) en mannetje(R) torenvalk"></TD>');
   document.write('   <TD COLSPAN=7 WIDTH=770><IMG SRC=image/HeadWRHWo.jpg ALT="Werkgroep Roofvogels Hoeksche Waard Oost" TITLE=""></TD>');
   document.write('   <TD ROWSPAN=2 WIDTH=130><IMG NAME=HeadRS SRC=image/HeadRS_empty.jpg ALT="" TITLE=""></TD>');
   document.write('</TR>');
  
   RandomRightSide();
    
   document.write('<TR>');



   if (Tab=="HOM")
      document.write('   <TD WIDTH=110><img border="0" src="image/butHomeA.jpg" height="35" width="110" ALT="Home" TITLE="Home"></TD>');
   else
      document.write('   <TD WIDTH=110><a href="index.html"><img border="0" id="img2" src="image/butHome.jpg" height="35" width="110" alt="Home" onmouseover="SwapImage(1,0,\'img2\',\'image/butHomeH.jpg\')" onmouseout="SwapImage(0,0,\'img2\',\'image/butHome.jpg\')"></a></TD>');

   if (Tab=="SRT")
      document.write('   <TD WIDTH=110><img border="0" src="image/butSoortenA.jpg" height="35" width="110" alt="Soorten in de Hoeksche Waard")></TD>');
   else 
      document.write('   <TD WIDTH=110><a href="soorten.html"><img border="0" id="img3" src="image/butSoorten.jpg" height="35" width="110" alt="Soorten in de Hoeksche Waard" onmouseover="SwapImage(1,0,\'img3\',\'image/butSoortenH.jpg\')" onmouseout="SwapImage(0,0,\'img3\',\'image/butSoorten.jpg\')"></a></TD>');
   
   if (Tab=="DJR")
      document.write('   <TD WIDTH=110><img border="0" src="image/butDitJaarA.jpg" height="35" width="110" alt="Gegevens van dit jaar"></TD>');
   else
      document.write('   <TD WIDTH=110><a href="ditjaar.html"><img border="0" id="img4" src="image/butDitJaar.jpg" height="35" width="110" alt="Gegevens van dit jaar" onmouseover="SwapImage(1,0,\'img4\',\'image/butDitJaarH.jpg\')" onmouseout="SwapImage(0,0,\'img4\',\'image/butDitJaar.jpg\')"></a></TD>');
  
   if (Tab=="VJR")
      document.write('   <TD WIDTH=110><img border="0" src="image/butVorJarenA.jpg" height="35" width="110" alt="Gegevens van vorige jaren"</a></TD>');
   else
      document.write('   <TD WIDTH=110><a href="vorigjaar.html"><img border="0" id="img5" src="image/butVorJaren.jpg" height="35" width="110" alt="Gegevens van vorige jaren" onmouseover="SwapImage(1,0,\'img5\',\'image/butVorJarenH.jpg\')" onmouseout="SwapImage(0,0,\'img5\',\'image/butVorJaren.jpg\')"></a></TD>');

   if (Tab=="MLD")
      document.write('   <TD WIDTH=110><img border="0" src="image/butMeldenA.jpg" height="35" width="110" alt="Waarneming melden"></TD>');
   else
      document.write('   <TD WIDTH=110><a href="melden.html"><img border="0" id="img6" src="image/butMelden.jpg" height="35" width="110" alt="Waarneming melden" onmouseover="SwapImage(1,0,\'img6\',\'image/butMeldenH.jpg\')" onmouseout="SwapImage(0,0,\'img6\',\'image/butMelden.jpg\')"></a></TD>');
   
   if (Tab=="FOT")
      document.write('   <TD WIDTH=110><img border="0" src="image/butFotoA.jpg" height="35" width="110" TITLE="Foto\'s" ALT="Foto\'s" ></TD>');
   else 
      document.write('   <TD WIDTH=110><a href="foto.html"><img border="0" id="img7" src="image/butFoto.jpg" height="35" width="110" alt="Foto\'s" onmouseover="SwapImage(1,0,\'img7\',\'image/butFotoH.jpg\')" onmouseout="SwapImage(0,0,\'img7\',\'image/butFoto.jpg\')"></a></TD>');
   
   if (Tab=="INF")
      document.write('   <TD WIDTH=110><img border="0" src="image/butInfoA.jpg" height="35" width="110" alt="Boeken en Links"></TD>');
   else 
      document.write('   <TD WIDTH=110><a href="meerinfo.html"><img border="0" id="img8" src="image/butInfo.jpg" height="35" width="110" alt="Boeken en Links" onmouseover="SwapImage(1,0,\'img8\',\'image/butInfoH.jpg\')" onmouseout="SwapImage(0,0,\'img8\',\'image/butInfo.jpg\')"></a></TD>');

   document.write('</TR>');

   document.write('<TR>');
   document.write('<TD COLSPAN=9><img src=image/barRood1000.jpg></TD>');
   document.write('</TR>');
  
 
   document.write(' <TR>  <TD WIDTH=1000 BGCOLOR=#F9DBC3 COLSPAN=9>');


   if (Tab!="HOM")
   {
      document.write('<BR>');
      /*
      document.write('<TABLE BORDER=0 WIDTH=1000 CELLSPACING="0" CELLPADDING="0" BGCOLOR=#F9DBC3>');
      document.write('<TR><TD>&nbsp;</TD>');
      document.write('<TD ALIGN=right><FONT FACE="ARIAL" SIZE=2>');
      if (Tab!="MAP") document.write('<A HREF="sitemap.html"><B>Sitemap</B></A>');
      if ((Tab!="MAP") && (Tab!="FAQ"))document.write(' | '); 
      if (Tab!="FAQ") document.write('<A HREF="faq.html"><B>FAQ</B></A>');
      document.write('</FONT>&nbsp;&nbsp;</TD></TR></TABLE>');
      */
   }
}


//*****************************************************
// Teken pagina voet (met tabs-bladen e.d.)
// PagType kan zijn: MAP FAQ FOTO LEDEN
//*****************************************************
function TekenPaginaVoet (PagType)
{
   document.write('</TD>');
   document.write('</TR>');
   document.write('</TABLE>');
   
   document.write('<TABLE BORDER=0 WIDTH=1000>');
   document.write('   <TR>');
   document.write('      <TD ALIGN="left" WIDTH=33%>');      
   document.write('         <FONT FACE="ARIAL" SIZE=2>');  
   if (PagType!="MAP")                       document.write('<A HREF="sitemap.html"><B>Sitemap</B></A>');
   if ((PagType!="MAP") && (PagType!="FAQ")) document.write(' | '); 
   if (PagType!="FAQ")                       document.write('<A HREF="faq.html"><B>FAQ</B></A>');
   document.write('         </FONT>');        
   document.write(' ');        

   document.write('         <!-- counter 2 -->');

   if (PagType=="DOWNLOAD")
   {
      document.write('<!-- Start of StatCounter Code -->');
      document.write('<script type="text/javascript">');
      document.write('var sc_project=3395738; ');
      document.write('var sc_invisible=1; ');
      document.write('var sc_partition=37; ');
      document.write('var sc_security="542a0ac7"; ');
      document.write('</script>');
      document.write('<script type="text/javascript"');
      document.write('src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div');
      document.write('class="statcounter"><a class="statcounter"');
      document.write('href="http://www.statcounter.com/"><img class="statcounter"');
      document.write('src="http://c38.statcounter.com/3395738/0/542a0ac7/1/" alt="screen');
      document.write('resolution stats" /></a></div></noscript>');
      document.write('<!-- End of StatCounter Code -->');
   }
   else if (PagType=="LEDEN")
   {  // leden pagina's
      document.write('<!-- StatCounter Ledenpagina, invisible -->');
      document.write('<!-- Start of StatCounter Code -->');
      document.write('<script type="text/javascript" language="javascript">');
      document.write('var sc_project=2455009; ');
      document.write('var sc_invisible=1; ');
      document.write('var sc_partition=23; ');
      document.write('var sc_security="3fe14cbd"; ');
      document.write('var sc_text=4; ');
      document.write('</script>');
      document.write('');
      document.write('<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c24.statcounter.com/counter.php?sc_project=2455009&amp;java=0&amp;security=3fe14cbd&amp;invisible=0" alt="free hit counter" border="0"></a> </noscript>');
      document.write('<!-- End of StatCounter Code -->');
   }  
   else if (PagType=="FOTO")
   { // Foto dsp en Serie's
      document.write('<!-- Statcounter FOTO IN-Visible -->');
      document.write('<!-- Start of StatCounter Code -->');
      document.write('<script type="text/javascript" language="javascript">');
      document.write('var sc_project=1049903; ');
      document.write('var sc_invisible=1; ');
      document.write('var sc_partition=6; ');
      document.write('var sc_security="972f5d32"; ');
      document.write('</script>');
      document.write('');
      document.write('<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c7.statcounter.com/counter.php?sc_project=1049903&amp;java=0&amp;security=972f5d32&amp;invisible=0" alt="statistics" border="0"></a> </noscript>');
      document.write('<!-- End of StatCounter Code -->');
   }
   else
   {  // 
      document.write('<!-- StatCounter gewoon, invisible -->');
      document.write('<!-- Start of StatCounter Code -->');
      document.write('<script type="text/javascript" language="javascript">'); 
      document.write('var sc_project=1049774;'); 
      document.write('var sc_invisible=1;'); 
      document.write('var sc_partition=6;'); 
      document.write('var sc_security="c47f950b";'); 
      document.write('</script>');
      document.write('');
      document.write('<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c7.statcounter.com/counter.php?sc_project=1049774&amp;java=0&amp;security=c47f950b&amp;invisible=0" alt="counter" border="0"></a> </noscript>');
      document.write('<!-- End of StatCounter Code -->');
   }

   document.write('      </TD>');
   document.write('      <TD ALIGN="center" WIDTH=33%>');
   document.write('         <A href=#top><IMG BORDER="0" id="img100" SRC="image/butNaarBoven.jpg" height="25" width="125" alt="naar bovenzijde van deze pagina" onmouseover="SwapImage(1,0,\'img100\',\'image/butNaarBovenH.jpg\')" onmouseout="SwapImage(0,0,\'img100\',\'image/butNaarBoven.jpg\')"></A>');
   document.write('         &nbsp; &nbsp;'); 
   document.write('         <A href="javascript:history.go(-1)" onMouseOver="window.status=\'\'; return true;"><IMG BORDER="0" id="img101" SRC="image/butVorigeG.jpg" height="25" width="125" alt="naar vorige pagina" onmouseover="SwapImage(1,0,\'img101\',\'image/butVorigeGH.jpg\')" onmouseout="SwapImage(0,0,\'img101\',\'image/butVorigeG.jpg\')"></A>');
   document.write('      </TD>');   
   document.write('      <TD ALIGN="right" WIDTH=33%>');
   document.write('         <FONT FACE="ARIAL" SIZE=2>Aantal bezoekers:</FONT><BR>');
   document.write('         <!--WEBBOT bot="HTMLMarkup" startspan ALT="Site Meter" -->');
   document.write('         <a href="http://sm6.sitemeter.com/stats.asp?site=sm6WRHWOCNT" target="_top">');
   document.write('         <img src="http://sm6.sitemeter.com/meter.asp?site=sm6WRHWOCNT" alt="Site Meter" border="0"/></a>');
   document.write('         <!--WEBBOT bot="HTMLMarkup" Endspan -->');
   document.write('      </TD>');
   document.write('   </TR>');
   document.write('</TABLE>');
}


//*****************************************************
//
// Get pagename of HTML page
//   returns HTML pagename "http://www.sever.nl/pagename.html?param=1"
//   returns "index?" if url end with '/' like "http://www.sever.nl/btg/"
//
//*****************************************************
function GetPageName ()
{
   //var url = document.URL;
   //var url = window.location.href;
   var url = location.href;
   var iBegin = url.lastIndexOf('/') + 1;
   var iHekje = url.indexOf('#', iBegin);
   var iVraagt = url.indexOf('?', iBegin);
   var iPunt = url.indexOf('.', iBegin);
   var sPageName = "?";

   if (-1 == iHekje)  iHekje = url.length;
   if (-1 == iVraagt) iVraagt = url.length;
   if (-1 == iPunt) iPunt = url.length;

   if (url.lastIndexOf('/') == url.length-1)
      sPageName = "index?";
   else
      sPageName = url.substring(iBegin, Math.min(iHekje, iVraagt, iPunt));

   //document.writeln( " [>" + sPageName + "<]");
   return (sPageName);
}


//*****************************************************
//  PrintSoortenLinks
//*****************************************************
function PrintSoortenLinks ()
{
   var szPageName = GetPageName();
   var iRelWidth = 100/8;

   document.writeln("<TABLE BORDER=0 WIDTH=900><TR>");

   if ( (szPageName== "soortenbu") || (szPageName== "buizerd") )
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>Buizerd</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='soortenbu.html'><B>Buizerd</B></a></TD>");

   if ( (szPageName== "soortensp") || (szPageName== "sperwer") )
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>Sperwer</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='soortensp.html'><B>Sperwer</B></a></TD>");

   if ( (szPageName== "soortenha") || (szPageName== "havik") )
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>Havik</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='soortenha.html'><B>Havik</B></a></TD>");

   if ( (szPageName== "soortentv") || (szPageName== "torenvalk") )
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>Torenvalk</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='soortentv.html'><B>Torenvalk</B></a></TD>");

   if ( (szPageName== "soortenbv") || (szPageName== "boomvalk") )
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>Boomvalk</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='soortenbv.html'><B>Boomvalk</B></a></TD>");

   if ( (szPageName== "soortensv") || (szPageName== "slechtvalk") )
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>Slechtvalk</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='soortensv.html'><B>Slechtvalk</B></a></TD>");

   if ( (szPageName== "soortenbk") || (szPageName== "bruinekiek") )
      document.writeln("<TD WIDTH='" + 18 + "%' ALIGN=CENTER><B>Bruine kiekendief</B></TD>");
   else
      document.writeln("<TD WIDTH='" + 18 + "%' ALIGN=CENTER><a href='soortenbk.html'><B>Bruine kiekendief</B></a></TD>");

   document.writeln("</TR></TABLE>");
}


//*****************************************************
//  PrintJarenLinks
//*****************************************************
function PrintJarenLinks ()
{
   var szPageName = GetPageName();
   var iRelWidth = 100/7;

   document.writeln("<CENTER> <FONT FACE='ARIAL' SIZE=3> <TABLE BORDER=0 WIDTH=900> <TR>");

   if (szPageName== "vorigjaar")
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>2008</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaar.html'><B>2008</B></a></TD>");


   if (szPageName== "vorigjaar07")
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>2007</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaar07.html'><B>2007</B></a></TD>");

   if (szPageName== "vorigjaar06")
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>2006</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaar06.html'><B>2006</B></a></TD>");

   if (szPageName== "vorigjaar05") 
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>2005</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaar05.html'><B>2005</B></a></TD>");

   if (szPageName== "vorigjaar04") 
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>2004</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaar04.html'><B>2004</B></a></TD>");

   if (szPageName== "vorigjaar03") 
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>2003</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaar03.html'><B>2003</B></a></TD>");
 
   if (szPageName== "vorigjaar02") 
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>2000-2006</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaar02.html'><B>2000-2006</B></a></TD>");

   if (szPageName== "vorigjaarwt") 
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><B>Wintertellingen</B></TD>");
   else
      document.writeln("<TD WIDTH='" + iRelWidth + "%' ALIGN=CENTER><a href='vorigjaarwt.html'><B>Wintertellingen</B></a></TD>");

   document.writeln("</TR></TABLE></FONT></CENTER>");
}


