
if (uid>0) {

//	CSS
	var css_lnk=document.createElement("link");
	css_lnk.setAttribute("rel", "stylesheet");
	css_lnk.setAttribute("type", "text/css");
	css_lnk.setAttribute("href", "css/edit.css");
	document.getElementsByTagName("head")[0].appendChild(css_lnk);

	var css_lnk=document.createElement("link");
	css_lnk.setAttribute("rel", "stylesheet");
	css_lnk.setAttribute("type", "text/css");
	css_lnk.setAttribute("href", "admin/css/menu.css");
	document.getElementsByTagName("head")[0].appendChild(css_lnk);
	
	var css_lnk=document.createElement("link");
	css_lnk.setAttribute("rel", "stylesheet");
	css_lnk.setAttribute("type", "text/css");
	css_lnk.setAttribute("href", "http://yui.yahooapis.com/2.9.0/build/menu/assets/skins/sam/menu.css");
	document.getElementsByTagName("head")[0].appendChild(css_lnk);		

	(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);

	$(document).ready(function(){

		$("body").attr("class", "yui-skin-sam");
			
		$(".mod_action_edit").click(function(){			
			var id = $(this).closest(".sortable_mod").attr("id");
			id = id.substring(1);
			window.location = "admin/cms_newscontent_preview.php?load&ARTICLE_ID="+ARTICLE_ID+"&mid="+id;
			return false;
		});
		
		$(".inline_editor_con").click(function(){	
			window.location = "admin/cms_newscontent_preview.php?load&ARTICLE_ID="+ARTICLE_ID;
			return false;
		});
		
		$(".mod_action_edit_content").live("click", function(){				
			var id = $(this).closest(".sortable_mod").attr("id");
			id = id.substring(1);
			var href="cms_module_editor.php?mid="+id;				
			window.open("admin/"+href,'window_editwindow'+Math.round(Math.random()),'height=605,width=800,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=130,left=160');
			return false;
		});
		
		var menu_config = {    
		     over: function(){
				$(".menu_trigger_closed").css("height", "0px").addClass("menu_trigger_open").animate({
					height: "42px"
				}, 200, function(){
					

				});
		     },
		     timeout: 500, // number = milliseconds delay before onMouseOut    
		     out:  function(){
				$(".menu_trigger_closed").animate({
					height: "0px"
				}, 200, function(){
					$(this).removeClass("menu_trigger_open").css("height", "25px");
				});
		     }
		};

//		$(".sortable").hoverIntent(menu_config);			
								
		var menu_trigger = $("<div></div>").load("admin/cms_newscontent_preview.php?menu&ARTICLE_ID="+ARTICLE_ID, function(){
	
			var oMenu = new YAHOO.widget.Menu("menuwithgroups_admin", { 
				context:["header_user_lnk","tl","bl", ["beforeShow", "windowResize"], [-5,5]], zindex: 1002
			});
			oMenu.render();
			YAHOO.util.Event.addListener("header_user_lnk", "click", oMenu.show, null, oMenu);

//			$(this).animate({
//				height: "30px"
//			}, 200);
			
		}).attr("class", "menu_trigger_closed").hoverIntent(menu_config);
		
		menu_trigger.className = "menu_trigger_closed";				
		$("#wrapper").prepend(menu_trigger);		
	});
}
