var selections = [];

function selection(obj_target) {

	// assing methods
	this.popup      = sel_popup;

	// validate input parameters
	if (!obj_target)
		return cal_error("Error calling the selection: no target control specified");
	if (obj_target.value == null)
		return cal_error("Error calling the selection: parameter specified is not valid tardet control");
	this.target = obj_target;
	
	// register in global collections
	this.id = selections.length;
	selections[this.id] = this;
}

function sel_popup ( url, query_string, name, pix_width, pix_height ) {
	var obj_selwindow = window.open(
		url + '?id=' + this.id + "&" + query_string,
		'Selection', 'width='+pix_width+',height='+pix_height+
		',status=no,scrollbars=1,resizable=yes,top=200,left=200,dependent=yes,alwaysRaised=yes'
	);
	obj_selwindow.opener = window;
	obj_selwindow.focus();
}

function sel_error (str_message) {
	alert (str_message);
	return null;
}
