function myToggleClass(fieldId, fieldClass){
	document.getElementById(fieldId).className = fieldClass;
}

function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function imposeMaxLength(Object, MaxLen) {
	var iCharLength = Object.value.length;
	var iRemainChars = MaxLen - iCharLength;
	var oChars = document.getElementById(Object.name + '_chars');
	if (oChars) {
		oChars.innerHTML = ((iRemainChars < 0) ? 0 : iRemainChars);
	}

	if (iRemainChars <= 0) {
		Object.value = Object.value.substr(0, MaxLen);
	}
	return true;
}

function submitForm(id) {
	if(id == 'searchForm'){
		if(document.getElementById('query').value == 'Uw zoekopdracht'){
			document.getElementById('query').value = '';
		}
	} 
	document.forms[id].submit();	
}

function printwindow(mypage, myname, w, h){
    LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
    TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
    settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
    win = window.open(mypage, myname, settings);
}

function updateDatePullDownMenu(objForm, fieldName) {
  var pdmDays = fieldName + "_days";
  var pdmMonths = fieldName + "_months";
  var pdmYears = fieldName + "_years";

  time = new Date(objForm[pdmYears].options[objForm[pdmYears].selectedIndex].text, objForm[pdmMonths].options[objForm[pdmMonths].selectedIndex].value, 1);

  time = new Date(time - 86400000);

  var selectedDay = objForm[pdmDays].options[objForm[pdmDays].selectedIndex].text;
  var daysInMonth = time.getDate();

  for (var i=0; i<objForm[pdmDays].length; i++) {
    objForm[pdmDays].options[0] = null;
  }

  for (var i=0; i<daysInMonth; i++) {
    objForm[pdmDays].options[i] = new Option(i+1);
  }

  if (selectedDay <= daysInMonth) {
    objForm[pdmDays].options[selectedDay-1].selected = true;
  } else {
    objForm[pdmDays].options[daysInMonth-1].selected = true;
  }
}

//BOOKMARK FUNCTION
function addToFavorites(obj, url, title) {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url, "");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title);
	} else if(window.opera && window.print){
		//Opera Hotlist
		obj.setAttribute('href',url);
		obj.setAttribute('title',title);
		obj.setAttribute('rel','sidebar');
		obj.click();
	}
	return false;
}
