var P21 = new Class({
	windowOpen: function(url, win, width, height, args) {
		var popWin;
		var args;
		 
		width = (width) ? width : 640;
		height = (height) ? height : 480;
		args = (args) ? args : 'resizable=yes,scrollbars=yes,status=no,help=no,center=yes,';
		
		popWin = window.open(url,win,args+',width='+width+',height='+height);
		popWin.focus();
		
		return popWin;
	},
	handleKeyPressEvent: function(oEvent, regex) {
		var iKeyCode = (oEvent.which) ? oEvent.which : oEvent.keyCode;
			
		if((iKeyCode < 32) || (iKeyCode > 126)) {
			// backspace, delete, escape, etc. -> do nothing
		} else if(regex.exec(String.fromCharCode(iKeyCode)) == null) {
			// invalid -> prevent character;
			return false;
		}
		return true;
	},
	handleKeyPressEventTrapEnter: function(oEvent, func) {
		var iKeyCode = (oEvent.which) ? oEvent.which : oEvent.keyCode;
			
		if(iKeyCode == 13) {
			func();
			return false;
		}
		return true;
	},
	setSelectValue: function(id, value) {
		$(id).value = value;
	}	
});
P21 = new P21();
