jQuery.extend({
	callModal : function(html, height, width, containerClass){
		$('<div class="'+containerClass+'">'+html+'</div>').modal({
			containerCss: {
			    height: height,
			    width: width,
			    
			    border: '3px solid #ccc'
			}
			, overlayCss: {
			    
			    cursor: 'wait'
			}
			, onOpen: function (dialog) {
				dialog.overlay.fadeIn('slow', function () {
					dialog.container.slideDown('slow', function () {
						dialog.data.fadeIn('slow');
					});
				});
			}
			, onClose: function (dialog) {
				dialog.data.fadeOut(200, function () {
				    dialog.container.slideUp(200, function () {
				      dialog.overlay.fadeOut(200, function () {
				        $.modal.close(); // must call this!
				      });
				    });
				});
			}
		});
	}
});




function slide(selecteur) {
	if ($(selecteur).length > 1) {
		$(selecteur+'.affiche')
		.animate({left:'-300px'}, 300, function() {
			$(this).remove().insertAfter(selecteur+'.hidden:last').addClass('hidden').removeClass('affiche');
		})
		.nextAll(selecteur+'.hidden:first').animate({left:'6px'}, 300, function() {
			$(this).addClass('affiche').removeClass('hidden');
		});
	}

		
}

$(document).ready(function(){	
	$('#simplemodal-overlay').live('click', function() {
		$.modal.close();
	});
	setTimeout("setInterval(\"slide('#contenuactu tr')\", 6000)", 1500);

	$('a[rel="simplemodal"], a.simplemodal').live('click', function() {
		$.modal.close();
		$('#loadingOverLay').animate({opacity:'.5'}, 500).slideDown('slow');
		$.ajax({
			data: {ajax: true}
			, dataType: 'html'
			, type: 'get'
			, url: $(this).attr('href')
			, complete : function() {
				$('#loadingOverLay').slideUp('slow');
			}
			, success: function(html) {
				$.callModal(html, 500, 750, "simplemodal-scroll-large");
				$('.simplemodal-scroll-large a.lightbox').lightBox();
			}
		});//fin $.ajax()
		return false;
	});	
});

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (selObj.selectedIndex!=0 && selObj.selectedIndex!=1 ){
	 //eval("window.open('"+selObj.options[selObj.selectedIndex].value+"')");
	    //eval("alert('test')");
		}
	  if (restore) selObj.selectedIndex=0;
	}
