
  String.prototype.trim = function () {
  	return this.replace(/^\s+|\s+$/g, '');
  }

  Array.prototype.contains = function (el) {
	for (var i=0; i<this.length; i++)
	{
		if (this[i] == el)
			return true;
	}
	return false;
  }

  Array.prototype.add = function (el) {
  	this[this.length] = el;
  }

  Array.prototype.set = function (el, val) {
	for (var i=0; i<this.length; i++)
	{
		if (this[i] == el)
		{
			this[i] = val;
			return;
		}
	}
  }

  Array.prototype.remove = function (el) {
  	this[this.length] = el;
  }

  function Utils()
  {
  }

  Utils.trim = function(s)
  {
    s = "" + s;
    return s.trim();
  }

  Utils.open_popup = function(this_win, win_url, win_name, win_width, win_height)
  {
    Utils.open_win(this_win, win_url, win_name, win_width, win_height, 'scrollbars');
  }

  Utils.open_win = function(this_win, win_url, win_name, win_width, win_height, win_options)
  {
    var s = "";
    s += "height=" + win_height;
    s += ", width=" + win_width;
    s += ", top=" + ((screen.height - 100 - win_height)/2);
    s += ", left=" + ((screen.width - win_width)/2);
    if ("" != win_options) s += ", " + win_options;
    var win_ref = this_win.window.open(win_url, win_name, s);
    if ("undefined" != typeof(win_ref)) win_ref.focus();
  }
  
	Utils.is_enter_key = function(e)
	{	
		if (!e) e = window.event;
		var key = e.keyCode;
		if (!key) key = e.which;
		return (13 == key);
	}


  function SelectUtils()
  {
  }

  SelectUtils.get_selected = function(opt)
  {
    var arr_sel = new Array();
    count = 0;
    for(var i=0; i<opt.length; i++)
    {
      if (opt[i].selected)
      {
        arr_sel[count] = i;
        count++;
      }
    }
    return arr_sel;
  }

  
  
  
  
