/**
* Main javascript file
* 
**/


function ShowHideChildItems(listItem, state){
  if(listItem){
    if(listItem.tagName == "LI"){
      var item_id = listItem.id.substr(4);
      var child_ul = document.getElementById('subnavigatie'+item_id);
      var current_li = '';
      
      //collapse all items in corresponding menu
      var parent_node = listItem.parentNode;
      for(i=0;i<=parent_node.childNodes.length-1;i++){
        current_li = parent_node.childNodes[i];
        for(j=0;j<=current_li.childNodes.length-1;j++){
          //console.log(current_li.childNodes[j].tagName);
          if(current_li.childNodes[j].tagName == "UL"){
            current_li.childNodes[j].style.display = 'none'
          }
        }
      }
      
      if(typeof state != 'undefined'){
        if(state == 'block' || state == 'none'){
          child_ul.style.display = state;
        }
      }else{
        if(child_ul.style.display == '' || child_ul.style.display == 'block'){
          child_ul.style.display = 'none';
          return;
        }else{
          child_ul.style.display = 'block';
          return;
        }
      }
    }
  }
}

function popitup(url, w, h, scrolling)
{
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
	
        newwindow=window.open(url, 'AURA','height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scrolling);
        if (window.focus) {newwindow.focus()}
        return false;
}
