// Begin nieuws.js 
DynAPI.setLibraryPath('/javascripts/lib/')

DynAPI.include('dynapi.api.*')
DynAPI.include('dynapi.event.listeners')
DynAPI.include('dynapi.event.mouse.js')
DynAPI.include('dynapi.ext.inline.js')
DynAPI.include('narchief.event2.submenu.js');

var collectiesub, voorouderssub, onderwijssub, archiefbeheersub, organisatiesub;
var oldSubmenu;

//
//
//
DynAPI.onLoad=function() {



collectiesub = setLayer('collectiesub');
onderwijssub = setLayer('onderwijssub');
voorouderssub = setLayer('voorouderssub');
archiefbeheersub = setLayer('archiefbeheersub');
organisatiesub = setLayer('organisatiesub');

// set layer width for all divs (with id) or ie4 will set endless width
// divs need to be absolutionally positioned!
if (is.ie4) {
   allDivsWithID = new Array(); y = 0;
   
   for (i=0;i<document.all.tags('div').length;i++) {
   var allDivs = document.all.tags('div');
      if (allDivs[i].id) {
         allDivsWithID[y] = allDivs[i];
         y++;
      }
   }
   if (allDivsWithID!=null) {
      for (i=0; i<allDivsWithID.length; i++) {
         DynAPI.document.all[allDivsWithID[i].id].setWidth(this.getContentWidth,null);
      }
   }

}

// needed for ns4    needed for ns6    -- both work for ie
collectiesub.moveTo(80,70);   if (!is.ns4) collectiesub.css.top = '70px', collectiesub.css.left = '80px';
voorouderssub.moveTo(160,70); if (!is.ns4) voorouderssub.css.top = '70px', voorouderssub.css.left = '160px';
onderwijssub.moveTo(260,70);  if (!is.ns4) onderwijssub.css.top = '70px', onderwijssub.css.left = '260px';
archiefbeheersub.moveTo(350,70);if (!is.ns4) archiefbeheersub.css.top = '70px', archiefbeheersub.css.left = '350px';
organisatiesub.moveTo(465,70);   if (!is.ns4) organisatiesub.css.top = '70px', organisatiesub.css.left = '465px';

collectiesub.setBgColor('#FF7310');collectiesub.setSubMenuListener();collectiesub.setZIndex(20);
voorouderssub.setBgColor('#FF7310');voorouderssub.setSubMenuListener();voorouderssub.setZIndex(20);
onderwijssub.setBgColor('#FF7310');onderwijssub.setSubMenuListener();onderwijssub.setZIndex(20);
archiefbeheersub.setBgColor('#FF7310');archiefbeheersub.setSubMenuListener();archiefbeheersub.setZIndex(20);
organisatiesub.setBgColor('#FF7310');organisatiesub.setSubMenuListener();organisatiesub.setZIndex(20);

DynAPI.document.all['ZoekAll'].setZIndex(10);
DynAPI.document.all['HeadersAll'].setZIndex(10); DynAPI.document.all['HeadersAll'].setHeight(14);
DynAPI.document.all['subMenuHide'].setZIndex(5);
DynAPI.document.all['subMenuHide'].setSubMenuHider();
DynAPI.document.all['subMenuHide'].moveTo(0,0); if (!is.ns4) DynAPI.document.all['subMenuHide'].css.top = '0px', DynAPI.document.all['subMenuHide'].css.left = '0px';

DynAPI.document.all['logoDPLayer'].moveTo(48,9);
DynAPI.document.all['logoDPLayer'].setZIndex(15);
DynAPI.document.all['logoDPLayer'].setVisible('true')

//////////////////////////////////////////
// Begin customizing tbv PopUp window
/////////////////////////////////////////
if (!is.ns4) arrangePopups();
//////////////////////////////////////////
// Einde customizing tbv PopUp window
/////////////////////////////////////////

}

//
//
//
imgDir = 'images/';
function changeImage2 (thisDivID,thisImgID,thisImgSrc) {
if (!is.ns4) {
   DynAPI.document.all[thisDivID].doc.images[thisImgID].src = thisImgSrc;
}
}

//
//
//
function setLayer (menuName) {

if (is.ns4) {
   menuName = DynAPI.document.all[menuName + 'layer'];
   }
else
   menuName = DynAPI.document.all[menuName + 'div'];

menuName.setVisible(false);

return menuName;
}

//
//
//
function selectSubmenu (submenu) {
if(oldSubmenu) oldSubmenu.setVisible(false);
if(submenu) {
   submenu.setVisible(true);
   oldSubmenu = submenu;
}
}

//////////////////////////////////////////
// Begin customizing tbv PopUp window
/////////////////////////////////////////

function arrangePopups() {

   allPopups = new Array()
   // Opmerkingen ter beter begrip van deze functie
   // 1. De namen moeten UNIEK zijn op de HTML pagina waar ze gebruikt worden. Via de 
   //    Anchortag (waarin ze staan als bijv. Name="zoekURL" ) wordt nu een Popup
   //    window geopend dat gecustomized wordt volgens de parameters die meegegeven worden
   // 2. De StyleGuides geven de netto afmetingen van de diverse Popup-Windows
   //    Om de zwarte balk rechts te laten aansluiten corrigeren we dit proefondervindelijk, zie onder in array
   //    StyleGuide netto afmetingen zijn:
   // Arraycompnummers van 0 .. 29 
   // 0. Zoek         : 600 x 350  
   // 1. SiteMap      : 600 x 350
   // 2. Bezoekinformatie
   // 3. Printversie  : 568 x 345
   // 4. PrintversieTwee : (vanuit een eerdere Popup de Printversie bouwen voor deze popUp)
   // 5. CopyRight
   // 6. Disclaimer
   // 7. Privacy
   // 8. Tijdbalk (tekst  vanuit zwarte balk) : 700 x 370; worden in SUBHOME-pagina's gebruikt
   // 9. Tijdbalk (circle vanuit zwarte balk) : 700 x 370; worden in SUBHOME-pagina's gebruikt
   // 10. t/m 29 variabel aantal malen tbv Content Rechts : 580 x 345  (Actueel, VeelgesteldeVragen)
   // 30 TijdbalkTekst   (in zwarte balk); worden in subhomeCONTENT-pagina's gebruikt
   // 31 TijdbalkCircle  (in zwarte balk); worden in subhomeCONTENT-pagina's gebruikt
   
   allPopups[0] = new Array("zoekURL",600,350,"No");
   allPopups[1] = new Array("sitemapURL",600,350,"No");
   allPopups[2] = new Array("bezoekinformatieURL",600,350,"No");
   allPopups[3] = new Array("printversie_tweeURL",620,350,"Yes"); // LET OP : toolbar gewenst
   allPopups[4] = new Array("printversieURL",620,350,"Yes");   // LET OP : toolbar gewenst
   allPopups[5] = new Array("copyrightURL",600,350,"No");   
   allPopups[6] = new Array("disclaimerURL",600,350,"No");  
   allPopups[7] = new Array("privacyURL",600,350,"No");  
   allPopups[8] = new Array("tijdbalkURL",1024,700,"Yes");   
   allPopups[9] = new Array("tijdCircleURL",1024,700,"Yes");   
   // nu 20 namen reserveren voor popups die gestart worden vanuit blokjes met "content_rechts"
   for (q=10;q<30;q++) {
     strURLname = 'contentrechts' + q + 'URL';
     allPopups[q] = new Array(strURLname,600,350,"No");
     // allPopups[q] = new Array("contentrechtsURL",600,350,"No");
   }
   // nu weg , worden volgens mij (wdz) niet gebruikt
   allPopups[30] = new Array("tijdbalk_tekstURL",1024,700,"Yes");   
   allPopups[31] = new Array("tijdbalk_circleURL",1024,700,"Yes");
   
   for (q=0;q<allPopups.length;q++) {
      if (is.ie) {
         if (document.all[allPopups[q][0]]) {
            tempObj = document.all[allPopups[q][0]]
            tempObj.target = '';
            tempURL = tempObj.href;
            if ((q==8)||(q==9)||(q==30)||(q==31)){
              tempObj.href = 'javascript:popUpWinTijdbalkNormaal('+allPopups[q][1]+','+allPopups[q][2]+',"'+tempURL+'","'+allPopups[q][3]+'")';
            } else {
              tempObj.href = 'javascript:popUpWin('+allPopups[q][1]+','+allPopups[q][2]+',"'+tempURL+'","'+allPopups[q][3]+'")';
            }
         }
      }
      else if (!is.ns4) {
         if (document.links[allPopups[q][0]]) {
            tempObj = document.links[allPopups[q][0]]
            tempObj.target = '';
            tempURL = tempObj.href;
            if ((q==8)||(q==9)||(q==30)||(q==31)){
              tempObj.href = 'javascript:popUpWinTijdbalkNormaal('+allPopups[q][1]+','+allPopups[q][2]+',"'+tempURL+'","'+allPopups[q][3]+'")';
            } else {
              tempObj.href = 'javascript:popUpWin('+allPopups[q][1]+','+allPopups[q][2]+',"'+tempURL+'","'+allPopups[q][3]+'")';
            }
         }
      }
   }
}

//
//
//
function popUpWin (childWidth,childHeight,thisPage,tb) {

if (is.ie) {
   parentWidth = document.body.clientWidth;
   parentX = window.screenLeft;
   parentY = window.screenTop;
   childX = ((parentWidth - childWidth)/2) + parentX;
   childY = parentY;
}
else {
   parentWidth = window.outerWidth ;
   childX = ((parentWidth - childWidth)/2);
   childY = parentY = 0;
}

strFeatures = 'height='+childHeight+',width='+childWidth+',left='+childX+',top='+childY+',status=no,hotkeys=no,toolbar='+tb+',scrollbars=yes,resizable=yes'
window.open(thisPage,'',strFeatures);

}


// --------------------------------------------------------------------------
// Tijdbalk NIET vauit de SiteMap openen maar vanuit de zwarte balk 
// Onderstaande functie popUpWinTijdbalkNormaal is exact gelijk aan bovenstaande
// functie popUpWin afgezien van scrollbars=no nu !!!!
// --------------------------------------------------------------------------
function popUpWinTijdbalkNormaal(childWidth,childHeight,thisPage,tb) {

if (is.ie) {
   parentWidth = document.body.clientWidth;
   parentX = window.screenLeft;
   parentY = window.screenTop;
   childX = ((parentWidth - childWidth)/2) + parentX;
   childY = parentY;
}
else {
   parentWidth = window.outerWidth ;
   childX = ((parentWidth - childWidth)/2);
   childY = parentY = 0;
}

strFeatures = 'height='+childHeight+',width='+childWidth+',left='+childX+',top='+childY+',status=no,hotkeys=no,toolbar='+tb+',scrollbars=yes,resizable=yes'
window.open(thisPage,'',strFeatures);

}


//////////////////////////////////////////
// Einde customizing tbv PopUp window
/////////////////////////////////////////

// Einde nieuws.js

