/**
* @package			util.js
* @dependence		prototype.js - v1.5.1.1
* @version			0.1
* browser test		FF 2.0.0.x and IE 6.0
* @license			GNU GPL 2.0
* @author			Adenilson dos Santos <denixsi@gmail.com>
* @copyright		Adenilson dos Santos <http://static.com.br>
*/
if(typeof(Prototype) == 'undefined' || parseFloat(Prototype.Version) < 1.5)
	throw("util.js requires the Prototype JavaScript framework >= 1.5.0, get from prototypejs.org");

if (!window.UtilControls)
		var UtilControls = {};

var sub	= 'painel';

UtilControls.Methods = {
	getBaseURL : function() {
		return '';
	},

	setMask : function(element, mask, evento){
		var keyCode;
		keyCode = evento.which;
		if(keyCode != 47) {
			var i = element.value.length;
			var saida = mask.substring(0,1);
			var texto = mask.substring(i);
			if (texto.substring(0,1) != saida){
				element.value += texto.substring(0,1);
			}
		}
	},

	strPad : function(palavra, casas, carac, dir) {
	  //dir = 'R' => Right; dir = 'L' => Left;
	  if(palavra == null || palavra == '') palavra = 0;
	  var ret = '';
	  var nro = casas - (palavra.length);
	  for(var i = 0; i < nro; i++) ret += carac;
	  if(dir == 'R')
	    ret = palavra + ret;
	  else if(dir == 'L')
	    ret += palavra;
	  return ret;
	},
		
	abrirImagem : function(url, largura, altura) {
		var screenX = screen.availWidth;  
		var screenY = screen.availHeight;   
		var winConfig = "height=" + altura + ",width=" + largura;  
		var win = window.open(url, 'win', winConfig);  
		win.moveTo((screenX / 2) - (largura / 2), (screenY / 2) - (altura / 2));
	}
}

Object.extend(UtilControls, UtilControls.Methods);