
function mainmenu(menuid){
	$(menuid+" ul ul ").css({display: "none"}); // Opera Fix
	$(menuid+" li").hover(
		function(){
			$(this).find('ul:first').css({visibility: "visible",display: "none"}).show();
		},
		function(){
			$(this).find('ul:first').hide();
		}
	);

}
// plugin definition
$.fn.tiptop = function(options) {
	return this.each(function() {
		var rel=$(this).attr('rel');
		$(this).tooltip({tip:rel,position:'top center'});
	});
};

// info plugin definition
$.fn.info = function(options) {
	return this.each(function() {
		$(this).css('opacity',0.85);
		$(this).slideDown('slow',goBack(this));
	});
	function goBack(obj){
		$(obj).slideUp('slow');	
	}
};

$(document).ready(function() {
	$('.telecharger').jDownload();
//	$('.telecharger').click(function(){
//		var t=$(this);
//		$.get('includes/download.php',{dwnld:t.attr('href')},function(data){});		
//		return false;
//	});
	
	mainmenu('#navigation');
	// TOOLTIPS
	//$('img[alt]').tooltip('#produit19');
	//$('a[title]').tooltip('#tip');
	
	// OVERLAYS / EXPOSE
	$('a[rel="#overlay"]').hover(
		function(){
			$("#overlay").attr('src',$(this).attr('href'));
			$('a[rel="#overlay"]').overlay({expose:'#000'});
		}
	);
	
	$("a.fancybox_diapo").fancybox({'hideOnContentClick': false,'overlayShow': true,'overlayOpacity': 0.9,'autoSlide':true, 'padding':0,'continuous':true });

// ADMIN
	$(".insert").hover(
		function(){
			var lk=$(this).find('.tool');
			lk.css({display:"block"});
			if(lk.attr('href') && lk.attr('href').indexOf('&w=')==-1){
				lk.attr('href',$(this).find('.tool').attr('href')+'&w='+$(this).width());
			}
		},
		function(){
			$(this).find('.tool').css({display:"none"});
		}
	);
	
	$('.FileManager a').click(
		function(){
			window.open($(this).attr('href'),'FileManager');
			return false;
		}
	);

	// FORMS
	$('input').focus(
		function(){
			$(this).select();	
		}
	);
});

