/**
* Toggles the value of an input field
* needs Mootools
*/
function toggleText(element, text)
{
	if (element.get('value') == '' && !element.hasClass('error')) {
		element.set('value', text);
	}
	else if (element.get('value') == text) {
		element.set('value', '');
	}
}

/**
* Submit a form via "enter"
*/
function entsub(myevent, myform)
{
	if (myevent && myevent.which) {
		characterCode = myevent.which;
	}
	else {
	characterCode = myevent.keyCode
	}

	if (characterCode == 13) {
		myform.submit();
		return false;
	}
	else {
		return true;
	}
}

/**
* Pops up a new window in the middle of the screen
*/
function popupWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function boxConfirm(boxtext)
{
	if (window.confirm(boxtext)) {
		return true;
	}
	
	return false;
}