function loadPopUp( url, title, width, height ) {
	x = (640 - width)/2, y = (480 - height)/2;

  if (screen) {
    y = (screen.availHeight - height)/2;
    x = (screen.availWidth - width)/2;
  }

	/* Open window */
	chldwin = open( url, title, "scrollbars=yes,resizable=yes,statusbar=yes,width="+width+",height="+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x);
	if (!chldwin.opener) {
		chldwin.opener = self;
	}
	chldwin.focus();
}

function checkNumeric( field ) {
	/* Get value */
	value = field.value;
	
	/* Check if value is numeric */
	if ( !isNaN( value ) ) {
		/* Is a number */

		/* Return value */
		return true;
	} else {
		/* Not a number */
		
		/* Send message */
	  alert("De duur van een bericht dient een numerieke waarde te bevatten");
		/* Return value */
		return false;
	}
}

function loadEditPopUp( url, title, width, height ) {
	/* Open window */
	chldwin = open( url, title, "width="+width+",height="+height);
	chldwin.focus();
	
	chldwin.opener = window.opener;
	
	closeAndUpdateParent( window.opener.parent.mainFrame.document.location.href );
}

function closeAndUpdateParent( href ) {
	window.close();
	window.opener.parent.mainFrame.document.location.replace( href );
	window.opener.parent.mainFrame.document.location.reload( true );
}

function adpCloseAndUpdateParent( href ) {
	window.close();
	window.opener.parent.opener.parent.mainFrame.document.location.replace( href );
	window.opener.parent.opener.parent.mainFrame.document.location.reload( true );
}

function closeAndUpdate( href ) {
	window.close();
	window.opener.document.location.replace( href );
	window.opener.document.location.reload( true );
}

function switchPages( main, top ) {
	parent.topFrame.location.href = top;
	parent.mainFrame.location.href = main;
}

function checkPeriodeEnable( state ) {
	mform = this.document.forms["msgPeriode"];

	mform.startyear.disabled = !state;
	mform.startmonth.disabled = !state;
	mform.startday.disabled = !state;
	mform.starthour.disabled = !state;
	mform.startmin.disabled = !state;

	mform.endyear.disabled = !state;
	mform.endmonth.disabled = !state;
	mform.endday.disabled = !state;
	mform.endhour.disabled = !state;
	mform.endmin.disabled = !state;
}

function checkTimeSeqEnable( state ) {
	mform = this.document.forms["msgPeriode"];

	mform.starthour_time.disabled = !state;
	mform.startmin_time.disabled = !state;

	mform.endhour_time.disabled = !state;
	mform.endmin_time.disabled = !state;
}

function stateSelectMessage( state ) {
	mform = this.document.forms["msgPosition"];
	
	mform.dest_msg.disabled = !state;
}

function setToolbar( url ) {
	parent.topFrame.location.replace( url );
} 

function testFont() {
	cols = document.all.test.style.color;

	document.msgEdit.maxcols.value = cols;
	document.msgEdit.maxrows.value = "max";
}
