function popup_win($url, $win_w, $win_h, $title, $scroll, $resize)
{
	var $pos_x = (screen.availWidth/2)  - (($win_w/2)+10);
	var $pos_y = (screen.availHeight/2) - (($win_h/2)-10);

	if($pos_x<=0)$pos_x = 1;
	if($pos_y<=0)$pos_y = 1;
	if($scroll)$scroll  = 'yes'; else $scroll = 'no';
	if($resize)$resize  = 'yes'; else $resize = 'no';
	var $s   = ',top=' + $pos_y + ',left=' + $pos_x + ',width=' + $win_w + ',height=' + $win_h + ',scrollbars=' + $scroll + ',resizable=' + $resize;
	var $win = window.open($url, $title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no' + $s);
	$win.focus();

	return false;
}

function toggle_id($id, $show)
{
//	var $state = $show?'block':'none';
	var $state = $show?'':'none';

	if(document.getElementById)document.getElementById($id).style.display = $state; // DOM3 = IE5, NS6
	else
	{
		
		if(document.layers)document.$id.display = $state; // Netscape 4
		else document.all.$id.style.display = $state; // IE 4
	}
}

function fs($grid)
{
	$grid = $grid.split(',');
	
	document.getElementById('GridCol').value = $grid[0];
	document.getElementById('GridRow').value = $grid[1];
}

function limit_opt($opt, $num)
{
	for($i=0;$i<$num;$i++)
	{
		$curr_opt=document.getElementById('A2_'+$i);
		if($opt.selectedIndex==$curr_opt.options.selectedIndex && $curr_opt.id!=$opt.id)$curr_opt.selectedIndex=0;
	}
}

function other_input($opt, $num)
{
	$show = document.getElementById($opt).options.selectedIndex==$num;
	toggle_id($opt + '_Other', $show);
	if($show)document.getElementById($opt + '_Other').focus();
}