function fn_win_open(url, name, width, height) {
	var loc1 = screen.availWidth;
	var loc2 = screen.availHeight;

	var left = (loc1-width)/2;
	var top = (loc2-height)/2;

	win = window.open(url, name, "status=0,menubar=0,scrollbars=yes,resizable=yes,width="+width+",height="+height+",align=left,left="+left+",top="+top);
}

function fn_win_open_scroll(url, name, width, height) {
	var loc1 = screen.availWidth;
	var loc2 = screen.availHeight;

	var left = (loc1-width)/2;
	var top = (loc2-height)/2;

	win = window.open(url, name, "status=0,menubar=0,scrollbars=yes,resizable=0,width="+width+",height="+height+",align=left,left="+left+",top="+top);
}

function fn_win_open_resize(url, name, width, height) {
	var loc1 = screen.availWidth;
	var loc2 = screen.availHeight;

	var left = (loc1-width)/2;
	var top = (loc2-height)/2;

	win = window.open(url, name, "status=0,menubar=0,scrollbars=0,resizable=yes,width="+width+",height="+height+",align=left,left="+left+",top="+top);
}

function fn_win_open_no(url, name, width, height) {
	var loc1 = screen.availWidth;
	var loc2 = screen.availHeight;

	var left = (loc1-width)/2;
	var top = (loc2-height)/2;

	win = window.open(url, name, "status=0,menubar=0,scrollbars=0,resizable=0,width="+width+",height="+height+",align=left,left="+left+",top="+top);
}

function fn_close() {
	window.close();
}

function fn_close_parent() {
	parent.close();
}

function fn_focus(frm) {
	for(var i = 1; i < frm.elements.length; i++) {	
		var field = frm.elements[i];

		if(field.type == 'text') {
			field.focus();
			break;
		}
	}
}