function axome_flash2(swf,l,h,remplace) {
	var html = '<object type="application/x-shockwave-flash" data="'+ swf +'" width="'+ l +'" height="'+ h +'">'+
	'<param name="movie" value="'+ swf +'" />'+
	'<param name="wmode" value="transparent" />'+
	remplace +
	'</object>';
	document.write(html);
}

$(function() { 
	
	
	var aAsc = [];
	function sortTable(nr) {
		aAsc[nr] = aAsc[nr]=="asc"?"desc":"asc";
		$("table>tbody>tr").tsort("td:eq("+nr+")[abbr]",{order:aAsc[nr]});
	}


	
	$(".next").click(function() {
		$("#prog ul").animate({marginLeft: "-100px"}, 1000);
		alert("ok");
		return false;
	});

	$('a.spip_out').attr("target", "_blank");
	
	$("#documents_portfolio a").fancybox();
	
	$("#lire_mention").click(function() {
		$("#mention").toggle();
	});
	
	


	$('.texte_article a').each(function() {
		var url = $(this).attr('href');
		var extension = url.substr(url.length-3, url.length);
		if(extension == "pdf") {$(this).attr("target", "_blank");} 
	});

        var $pub_mg = $('#publicite_mg');
        $('#publicite_mg_legend span', $pub_mg).text($('> ul >li:first a', $pub_mg).attr('rel'));


        if ($('> ul > li', $pub_mg).length > 1) {
            var carrousel_mg = $('> ul', $pub_mg).carrousel({
                api: true,
                dispTimeout: 5000,
                speed: 500,
                callbacks: [legend]
            });


            $('#publicite_mg_fleche_gauche', $pub_mg).bind('click', function () {
               carrousel_mg.prev();
               return false;
            });

            $('#publicite_mg_fleche_droite', $pub_mg).bind('click', function () {
               carrousel_mg.next();
               return false;
            });

        }
        
        function legend() {
            $('#publicite_mg_legend span', $pub_mg).text($('a', $('li:first',$pub_mg)).attr('rel'));
        }

        $('#publicite_mp ul, #publicite_dp ul').innerfade({
           animationtype: 'fade',
           speed : 'slow',
           timeout: 4000
        });

        if ($('#pied ul li').length > 9)
            $('#pied ul').carrousel();


        jQuery('#sous_categories ul li:last').addClass("last");
        jQuery('#sous_categories ul li').each(function () {
            var $this = jQuery(this);
            if (!$this.hasClass('last')) $this.append('&nbsp;|&nbsp;');
        });


        jQuery('.add_basket').bind('click', function () {
			
			var id_produit =jQuery(this).attr('rel');
			
			for(i = 0; i < trackers.length; i++){
				trackers[i]._trackPageview('/br/br' +id_produit);
			}
			
			var param = "";
			if( jQuery(this).find('.delete').length  > 0) { param = "&remove=1"; }

            jQuery.ajax({
                url: 'spip.php',
                data : 'page=add_basket&id_produit=' +id_produit +param,
                success : function (msg) {
                    alert(msg);
                    window.location = refreshPage;
                }
            });
            return false;
        });
        

       jQuery('.article_dossier').each(function () {
          var $this = jQuery(this);
          if (jQuery('> a > .spip_logos', $this).length) {
              //jQuery('.lire_suite', $this).width('516px').css('margin-left', '163px');
          }
       });

       jQuery('.unavailable').fadeTo("quick", 0.33);

       jQuery('.point_ola').bind('click', function () {
            window.location = url_ola;
            return false;
       });

       // animation point ola
       jQuery('input#avatar, input#optin').bind('change', function () {
            var id = jQuery(this).attr('id');
            jQuery('label[for=' + id + '] .point_ola').stop().animate({
                'font-size' : '1em',
                'opacity' : 0.5
            }, 500, function () {
                jQuery('label[for=' + id + '] .point_ola').stop().animate({
                    'font-size' : '0.75em'
                }, 500);
            });
       });
       
       
       
       

	$("#droite .print a").click(function() {
		if($("#droite .tableau_bloc").length==0) {
			alert('Avant d\'imprimer vos coupons, vous devez auparavant choisir vos coupons en allant dans la rubrique "Ma liste de Coupon"');
			return false;
		}
	});


/*
       if (jQuery.browser.msie) {
           jQuery('.bloc_rond').corner('keep');
           jQuery('.bloc_rond_haut').corner('top');
           jQuery('.bloc_rond_bas').corner('bottom');
           jQuery('div#menu_principal ul.principal').corner('left');
           jQuery('div#menu_principal .login_front').corner('right');
           jQuery('.point_ola').corner();
           jQuery('#centre #sous_cat li').corner();
       }
       * 
       jQuery('.boutons .submit').corner('5px keep');
       */
       
    // Opé Vaccin UNICEF
	/*
	$(".print_unicef").click(function() {

		var id_product = $(".ope_unicef_id_product").val();
		var id_secteur = $(".ope_unicef_id_secteur").val();

		$.post("spip.php?page=ajax", { ope_unicef_id_product: id_product, ope_unicef_id_secteur: id_secteur },
		   function(data){
			 if(data) {
				alert(data);
				return false;
			 } else {
				udpadte_nb_vaccin(id_secteur);
			 }
		   }
		);
   
		return false;
   
	});
	*/
				
       

});


/*

		setInterval(function(){
			var id_secteur = $(".ope_unicef_id_secteur").val();
			var currentTime = new Date ( );
			var currentHours = currentTime.getHours ( );
			var currentMinutes = currentTime.getMinutes ( );
			var currentSeconds = currentTime.getSeconds ( );
			var currentDays = currentTime.getDate ( );
			currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
			currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
			var currentTimeString = currentDays + " Novembre 2010 - " + currentHours + ":" + currentMinutes + ":" + currentSeconds;
			$(".chrono").html(currentTimeString);
			
			
			if(currentSeconds%5 == 0)  {
				udpadte_nb_vaccin(id_secteur);
			}
			  
		},1000);
		
		*/


		/*
		function udpadte_nb_vaccin(id_secteur) {
		
			$.post("spip.php?page=ajax", { nb_unicef_id_secteur: id_secteur },
			   function(data){
					if($(".nb_vaccin").html() != data) {
						$(".nb_vaccin").fadeOut("slow").html(data).fadeIn("slow");
					}
			   }
			);
		
		}
		*/

