/*
	Useful tools.
	Author: venom
	Date: 22.01.2009
*/

// Merging two objects
Object.prototype.extend = function(extended) {
	for (var key in (extended || {})) this[key] = extended[key];
	return this;
}

// Utilities object
var Utils = {

	// Show popup window
	popup: function(options) {
		var options = {
			url        : '/',
			width      : 630,
			height     : 330,
			name       : 'popup',
			location   : 1,
			status     : 0,
			scrollbars : 0,
		}.extend(options);

		options.x = (screen.width/2)-(options.width/2);
		options.y = (screen.height/2)-(options.height/2);

		var w = window.open(options.url, options.name,
			"location="+options.location+
			",status="+options.status+
			",scrollbars="+options.scrollbars+
			",width="+options.width+
			",height="+options.height+
			",top="+options.y+
			",left="+options.x);

		w.focus();
		return w;
	}
}


