window.addEvent('load', function(){
	$$('.admin').each(	function(	item,	index	){
		var type	=	item.getProperty(	'type'	);
		//console.log(	type	);
		var html	=	'';
		if(	type	==	'code'	){
			html	=	edit_code(	item	);
		}
		if(	type	==	'history'	){
			html	=	edit_history(	item	);
		}
		if(	type	==	'map'	){
			html	=	edit_operation_com(	item	);
		}
		if(	type	==	'activities'	){
			html	=	edit_activities(	item	);
		}
		if(	type	==	'bulletin'	){
			html	=	edit_bulletin(	item	);
		}
		if(	type	==	'reports'	){
			html	=	edit_reports(	item	);
		}
		if(	type	==	'news'	){
			html	=	edit_news(	item	);
		}
		var pos		=	item.getCoordinates();
		var view = new Element(	'div', {
			'styles': {
				'position'	:	'absolute',
				'border'	:	'1px solid #FFCC99',
				'background':	'#FFCCFF',
				'padding'	:	'5px',
				'left'		:	pos.left	+	pos.width	+	'px',
				'top'		:	pos.top		+	'px'
				
			},
			'html'	:	html,
			'events': {
					'mouseenter': function(){
						item.setStyle(	'background',	'#FFFFCC'	);
					},
					'mouseleave': function(){
						item.setStyle(	'background',	''	);
					}
				}

		});
		view.inject(	document.body	);
	});
});
var win	=	{};
function show_win(	url	){
	win	=	new Nuit_modle_window	(	{	'mask_classname'		:	'mask_div',
												'center_div_classname'	:	'center_div',
												'height'				:	200,
												'width'					:	200
											}
										);
	win.create_complete	=	function(){
		var req	=	new Request.HTML(	{'url': url,	'evalScripts':true,	'update':win.center_div	}).get();
		req.addEvent(	'complete',	function(){
			var childrens		=	win.center_div.getChildren();
			win.center_div_resize();
			
		});
	}
	
	win.mask_div.addEvent(	'click',	function(e){
		//console.log(	win.center_div.clicked	);
		if(	win.center_div.clicked	==	'0'	){
			//win.hidden();
			win.center_div.clicked	=	'1'
		}else{
			
		}
	});
}
function edit_code(	item	){
	var did		=	item.getProperty(	'did'	);
	var html	=	'<a href="javascript:show_win(\'/code/edit/id/'+did+'\')">修改</a>';
	return html;
}
function edit_history(	item	){
	var html	=	'<a href="javascript:show_win(\'/history/ls\')">管理</a>';
	return html;
}
function edit_operation_com(	item	){
	var did		=	item.getProperty(	'did'	);
	var html	=	'<a href="javascript:show_win(\'/operation/coms/ls/'+did+'\')">管理</a>';
	return html;
}
function edit_activities(	item	){
	var html	=	'<a href="javascript:show_win(\'/activities/ls\')">管理</a>';
	return html;
}
function edit_bulletin(	item	){
	var html	=	'<a href="javascript:show_win(\'/bulletin/ls\')">管理</a>';
	return html;
}
function edit_reports(	item	){
	var html	=	'<a href="javascript:show_win(\'/reports/ls\')">管理</a>';
	return html;
}
function edit_news(	item	){
	var html	=	'<a href="javascript:show_win(\'/news/top\')">管理</a>';
	return html;
}
function add_value(	id,	value	){
	$(id).value	=	value;
}