// -------------------------------------------------------------------------
// Popup Window
// -------------------------------------------------------------------------
function openWindow(theURL,winName,winWidth,winHeight,sb) {
	var winLeft = ((screen.availWidth - winWidth) / 2);
	var winTop = ((screen.availHeight - winHeight) / 2);
	if(sb == "yes") {
		sb_string = ",scrollbars=yes";
	}
	else {
		sb_string = ",scrollbars=no";
	}
	window.open(theURL,winName,'toolbar=no' + sb_string + ',status=no,menubar=no,resizable=no,location=no,dependent=yes,width=' + winWidth + ',height=' + winHeight + ',left=' + winLeft + ',top=' + winTop);
}

// -------------------------------------------------------------------------
// Check Input
// -------------------------------------------------------------------------
function numbersonly(myfield, e, dec) {
	var key;
	var keychar;

	if (window.event) {
	   key = window.event.keyCode;
	}
	else if (e) {
	   key = e.which;
	}
	else {
	   return true;
	}
	
	keychar = String.fromCharCode(key);

	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27)) {
	   return true;
	}
	else if ((("0123456789.").indexOf(keychar) > -1)) {
		return true;
	}
	else if (dec && (keychar == ".")) {
		myfield.form.elements[dec].focus();
		return false;
	}
	else {
		return false;
	}
}
// <input type='text' name='bla' size='20' onKeyPress="return numbersonly(this, event)">

// -------------------------------------------------------------------------
// Closer
// -------------------------------------------------------------------------
function closer() {
   opener.location.reload();
   self.close();
}

// -------------------------------------------------------------------------
// Delete Entry
// -------------------------------------------------------------------------
function del_entry(DEST) {
	if (confirm("Klicke auf OK um den Eintrag endgültig zu löschen!")== true) {
		window.location.href = DEST;
	}
}

// -------------------------------------------------------------------------
// Lock Entry
// -------------------------------------------------------------------------
function lock_entry(DEST) {
	if (confirm("Klicke auf OK um den Eintrag zu [ent]sperren!")== true) {
		window.location.href = DEST;
	}
}

// -------------------------------------------------------------------------
// Hide Entry (Outbox only)
// -------------------------------------------------------------------------
function hide_entry(DEST) {
	if (confirm("Klicke auf OK um den Eintrag endgültig zu löschen!\nDie Mail wird beim Empfänger nicht gelöscht!")== true) {
		window.location.href = DEST;
	}
}

	w_openwindow = null;
	function open_window(nurl,windowname,width,height, leftPos, topPos) {
		if (typeof leftPos == 'undefined')
			leftPos = (self.screen.width-width)/2;
		if (typeof topPos == 'undefined')
			topPos = (self.screen.height-height)/2;	
	 	w_openwindow = window.open(nurl,windowname,'width='+width+',height='+height+',left='+leftPos+',top='+topPos+',directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
	}