function validateform(form) {
	var box = document.getElementById(form).elements;
	for (i=0;i<box.length;i++) {
		if ((!box[i].value) && (box[i].type != 'hidden' && box[i].type != 'select-one' && box[i].name != 'tekst') && box[i].name != 'url' && box[i].name != 'datumtot')	{
			alert('U heeft het veld: "' + box[i].name + '" niet ingevuld!');
			box.focus();
			return false;
		}
	}
	return true;

}

function MM_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
		obj.display=v; }
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function CMSdisplayTab(tab,panel,tablink) {

		// Set all div panels except current to display:none
    var divCollection = document.getElementsByTagName("div");
    for (var i=0; i<divCollection.length; i++) {
				if (divCollection[i].getAttribute("id")) {
						// Get length
						var iLen = divCollection[i].getAttribute("id").length;

						// Search for _panel
						if (iLen>6 && divCollection[i].getAttribute("id").substring(iLen, iLen-6)=="_panel") {

								// Set specified panel to display:block and all others panels to display:none
								if (divCollection[i].getAttribute("id")==panel) {				
										divCollection[i].style.display = 'block';
								} else {
										divCollection[i].style.display = 'none';
								}
						}

						// Search for _tab: remember we have 3 subtabs: left / center / right
						tab_left   = tab + "_left";
						tab_center = tab + "_center";
						tab_right  = tab + "_right";
						
						if (iLen>9 && divCollection[i].getAttribute("id").substring(iLen, iLen-9)=="_tab_left") {
								
								// Set specified tab to display:block and all others panels to display:none
								if (divCollection[i].getAttribute("id")==tab_left) {				
										divCollection[i].className = 'tab_page_left_selected';
								} else {
										divCollection[i].className = 'tab_page_left';
								}
						}
						if (iLen>11 && divCollection[i].getAttribute("id").substring(iLen, iLen-11)=="_tab_center") {
								
								// Set specified tab to display:block and all others panels to display:none
								if (divCollection[i].getAttribute("id")==tab_center) {				
										divCollection[i].className = 'tab_page_center_selected';
								} else {
										divCollection[i].className = 'tab_page_center';
								}
						}
						if (iLen>10 && divCollection[i].getAttribute("id").substring(iLen, iLen-10)=="_tab_right") {
								
								// Set specified tab to display:block and all others panels to display:none
								if (divCollection[i].getAttribute("id")==tab_right) {				
										divCollection[i].className = 'tab_page_right_selected';
								} else {
										divCollection[i].className = 'tab_page_right';
								}
						}
				}
    }


    var linkCollection = document.getElementsByTagName("a");
		for (var i=0; i<linkCollection.length; i++) {
						if (linkCollection[i].getAttribute("id")) {
								// Get length
								var iLen = linkCollection[i].getAttribute("id").length;
								
								// Search for _link
								if (iLen>5 && linkCollection[i].getAttribute("id").substring(iLen, iLen-5)=="_link") {
		
										// Set specified panel to display:block and all others panels to display:none
										if (linkCollection[i].getAttribute("id")==tablink) {				
												linkCollection[i].style.color = '#F86C00';											
										} else {
												linkCollection[i].style.color = '#808080';
										}
								}
						}
		}
}

function CMScheckFormFields(formfields) {
		var result = true;
		var fields = formfields.split(',');
    for (var i=0; i<fields.length; i++) {
				field = fields[i];
				var elm = document.getElementById(field);
				if (elm.value=='') {
						result = false;
						elm.className = 'input2_req';
				} else {
						elm.className = 'input2';
				}		
		}
		
		// Error display
		if (result==false) {
    		var divCollection = document.getElementsByTagName("div");
		    for (var i=0; i<divCollection.length; i++) {
						if (divCollection[i].getAttribute("id")=='error_message') {
								divCollection[i].style.display = 'block';
						}
				}				
		}
		
		// Result
		return result;
}

