function doToggle(type, value, loopcount){
	if(!loopcount) loopcount = 1;
	var display_setting = value ? "none" : "block";
	var x = document.getElementById(type);
	for(var i=0;i<loopcount;i++){
		while(x.nodeType != 1) x = x.nextSibling;
		x.style.display = display_setting;
		x = x.nextSibling;
	}
}

function mOn(o){
	o.src = o.src.replace(/_off/, "_on");
	if(o.className == "navitem"){
		o.parentNode.previousSibling.src = "images/nav_arrow.gif";
		o.style.marginLeft = "5px";
	}
}

function mOff(o){
	if(o.getAttribute("current")) return;
	
	o.src = o.src.replace(/_on/, "_off");
	if(o.className == "navitem"){
		o.parentNode.previousSibling.src = "images/nav_line.gif";
		o.style.marginLeft = "10px";
	}
}

function resetForm(o){
	for(var i=0;i<o.elements.length;i++){
		if(o.elements[i].type.match(/button|reset|submit/) || o.elements[i].name=='action' || o.elements[i].name=='HHSID' || o.elements[i].getAttribute("exclude")) continue;
		o.elements[i].value = "";
	}
}

function validate(o){
	if(!o.elements.name.value || !o.elements.ttl.value || !o.elements.rdtype.value || !o.elements.rdata.value){
		alert("Een of meerdere velden zijn niet volledig ingevuld");
		return false;
	}
}

function cOn(o){
	o.style.backgroundColor = "#F3D241";
}

function cOff(o){
	if(o.getAttribute("current")) return;
	
	o.style.backgroundColor = "transparent";
}

function callAhref(o){
	if(event.srcElement == o)
		location.href = o.firstChild.href;
}

function goto(o){
	location.href = o.value;
}

function setAllChecked(name, checked){
	var el = document.getElementsByTagName("input");
	for(var i=0;i<el.length;i++){
		if(el[i].className == name) el[i].checked = checked;
	}
}


var IFRAME = null;

function Init_Frame(oHTML){
        if(IFRAME) return IFRAME;

        var oExt = document.createElement("iframe");
        document.body.appendChild(oExt);
        oExt.style.display = "none";
        oExt.style.position = "absolute";
        oExt.contentWindow.document.write("<head><style>@import url(skins/default/hh_controlpanel.css);</style></head><body><div class='frmPopup' id='frmPopup'><div><a href='javascript:void(0);' onclick='top.IFRAME.oExt.style.display=\"none\"'><span>X</span></a>Hulp bij dit onderdeel</div><blockquote></blockquote></div></body>");
        oExt.contentWindow.document.body.style.border = "thin";
        oExt.contentWindow.document.body.style.margin = "0px";

        IFRAME = {
                oExt : oExt,
                doc : oExt.contentWindow.document,
                body : oExt.contentWindow.document.body,

                setBody : function(strBody){
                        this.body.getElementsByTagName("BLOCKQUOTE")[0].innerHTML = strBody;
                }
        }

        return IFRAME;
}

function popupMenu(oLoc, body, type){
        var frame = Init_Frame();
        frame.setBody(body);

        //oLoc.parentNode.insertBefore(frame.oExt, oLoc);
        oLoc.appendChild(frame.oExt);
        frame.oExt.style.marginLeft = type == 3 ? "-360px" : "-150px";
        frame.oExt.style.visibility = "hidden";
        frame.oExt.style.display = "block";
        setTimeout("IFRAME.oExt.style.height = IFRAME.doc.getElementById('frmPopup').offsetHeight + 'px';IFRAME.oExt.style.marginTop = '-' + (" + type + "==3 ? IFRAME.oExt.offsetHeight + 30 : IFRAME.oExt.offsetHeight/2) + 'px';IFRAME.oExt.style.visibility = 'visible';");
}
