//线路对比
function route_cbx_click(o)
{
		
		route_cbx = document.getElementsByName('route_id');
		checked_sum = 0;
		for(i=0;i<route_cbx.length;i++)
		{
			if(route_cbx[i].checked)
				checked_sum++;
		}
		
		if(checked_sum>1 && checked_sum<4)
		{
				remove_node($_('btn_compare'));
				btn = document.createElement("Button");
				btn.value = "对比线路";
				btn.id = "btn_compare";
				btn.onclick = compare_route;
				o.parentNode.appendChild(btn);
		}
		else if(checked_sum <2 )
		{
			remove_node($_('btn_compare'));
		}
		else if(checked_sum>3)
		{
			alert('最多允许对比3条线路');
			o.checked = false;
		}	
}
function compare_route()
{
	route_cbx = document.getElementsByName('route_id');
	ids = "";	
	for(i=0;i<route_cbx.length;i++)
	{
		if(route_cbx[i].checked)
		{
			ids += (ids=='')?'':',';
			ids += route_cbx[i].value;
		}
	}
	url = "/web/php/route_compare.php?id="+ids;
	win_compare = window.open(url,"win_compare");
	win_compare.focus();
}
function remove_node(o)
{
	if(o == undefined || o==null)
		return ;
	while(o.hasChildNodes())
		o.childNodes[0].removeNode();
	o.removeNode();
}

