
// get all DIVs with style xxxx'
mfsct = {
      check:function(oElm, strClassName){
          strClassName = strClassName.replace(/\-/g, "\\-");
          var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
            return oRegExp.test(oElm.className);
      },
      add:function(oElm, strClassName){
            if(!mfsct.check(oElm, strClassName)){
                  oElm.className+=oElm.className?' '+strClassName:strClassName;
            }
      },
      remove:function(oElm, strClassName){
            var rep=oElm.className.match(' '+strClassName)?' '+strClassName:strClassName;
          oElm.className=oElm.className.replace(rep,'');
          oElm.className.replace(/^\s./,'');
      },
      display:function(o){
            if(o.className){o = o.className;}
            if(window.console){
                  window.console.log(o);
            } else {
                  alert(o);
            }
      },
      getElements:function(oElm, strTagName, strClassName){
          var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
          var arrReturnElements = [];
          for(var i=0; i<arrElements.length; i++){
              var temp = arrElements[i];      
                  if(mfsct.check(temp, strClassName)){
                        arrReturnElements.push(temp);
                  }
          }
          return (arrReturnElements)
      }
}      

// Close all divs faq_antwoord
function closeDivs(className){
      allNodes = mfsct.getElements(document,'*',''+className+'');
      for(i = 0; i < allNodes.length; i++) {
		//alert(allNodes[i].innerHTML);
		allNodes[i].style.display = 'none';
      }
}

// Open all divs faq_antwoord
function openDivs(className){
      allNodes = mfsct.getElements(document,'*',''+className+'');
      for(i = 0; i < allNodes.length; i++) {
		//alert(allNodes[i].innerHTML);
		allNodes[i].style.display = 'block';
      }
}

// Collapsable DIV
function toggleDiv(divid){

	v = divid;
	vraag = "vraag" + v;  // maak variable vraag1, vraag2, vraag3 etc niet nodig indien geen colorchange
	
	if(document.getElementById(divid).style.display == 'none'){
		closeDivs('faq_antwoord');
		document.getElementById(divid).style.display = 'block';
//		document.getElementById(vraag).style.color = '#122947';  // set new color van vraagX		
	}else{
		document.getElementById(divid).style.display = 'none';
//		document.getElementById(vraag).style.color = '#404040';  // set new color van vraagX	

	}
}

/*
gebruik deze tags voor changing by class-name:
<a href="#" onClick="closeDivs('faq_antwoord')">Close All Divs with Class 'faq_antwoord'</a>
<a href="#" onClick="openDivs('faq_antwoord')">Open All Divs with Class 'faq_antwoord'</a>
<a href="#" onclick="mfsct.add(getElements(document,'div','zwart')[0],'new-color-class')">Add new-color-class to All Divs with Class 'zwart'</a>
*/


// Collapsable DIV Producten
function toggle2Div(idname) {
  var e = document.getElementById(idname);
  var head = 'A'+idname;
  var f = document.getElementById(head);
  if(e.style.display == 'block') {
    e.style.display = 'none';
	if (typeof f != 'undefined' && f != null) f.className = 'normal';
//	document['pijl'].src = 'images/pijl_down.gif';
  } else {
    e.style.display = 'block';
    if (typeof f != 'undefined' && f != null) f.className = 'active';
//	document['pijl'].src = 'images/pijl_up.gif';
  }  
}

function print(url,title) {
	var a = window.open(url,'TitelvanWebsite','scrollbars=yes,width=500,height=350');
	a.document.open("text/html");
	a.document.write('<html><head><title>'+title+'</title></head>');
	a.document.write('<body style="background-image:none;background-color:#FFFFFF;">');
	a.document.write(document.getElementById('printdiv').innerHTML);
	a.document.write('</body></html>');
	a.document.close();
	a.print();
}
