
 /**
  * Open a window popup
  * @Author: Francesco Rabottini <dev@webzone.it>
  *
  * @param	(String) url	the url to be opened
  * @param	(int) width		the width of the window
  * @param	(int) height	the height of the window
  * @param	(String) mode	"[stlmrS]" default: ""
  *				possible values:
  *				o	s: status
  *				o	t: toolbar
  *				o	l: location
  *				o	m: menubar
  *				o	r: resizable
  *				o	S: scrollbars=yes
  *
  * @return	(Void)	focus the last opened window popup
  */
 function openpopup(url, w, h, mode)
 {
 	_top  = (screen.height - h) / 2
 	_left = (screen.width  - w) / 2;
 	option = "top="+_top+",left="+_left+",width="+w+",height="+h;
 	if (! mode) { mode = ""; }
 	opt = new Array("status","toolbar","menubar","location","resizable", "Scrollbars");
 	for (i=0; i< opt.length;i++) {
 		if (mode.indexOf(opt[i].substring(0,1)) < 0) {
 			option += ","+opt[i]+"=no";
 		} else {
 			option += ","+opt[i]+"=yes";
 		}
 	}
 	win = window.open(url, null, option.toLowerCase());
 	win.focus();
 }

