/**
 * Tidbit : window.openCentered
 */

Object.extend(window,{	
	openedWindows: {},
	openCentered: function(location,name,params){
		this.openedWindows[name] = window.open(location,name,$H({
			width: 800,
			height: 600,
			left: (screen.width ? (screen.width - (params && params.width ? params.width : 800)) / 2 : 0),
			top: (screen.height ? (screen.height - (params && params.height ? params.height : 600)) / 4 : 0),
			dependent: true,
			directories: true,
			fullscreen: false,
			location: true,
			menubar: true,
			resizable: true,
			scrollbars: true,
			status: true,
			toolbar: true
		}).merge(params || {}).inject('',function(str,item){
			if(item[1] == true)
				value = 'yes';
			else if(item[1] == false)
				value = 'no';
			else
				value = item[1];
			return str + item[0] + '=' + value + ',';
		}).replace(/\,$/,''));
		this.openedWindows[name].focus();
		return this.openedWindows[name];
	}
});


function popup(url, w, h) { 

  if(!w) w = 300;
  if(!h) h = 300;

  window.openCentered(url,'popup',{
      width : w,
      height : h,
      status : false,
      toolbar : false,
      menubar : false,
      location : false      
  });
  return false;
} 


