//Hvideo Scrollable

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
local_var = "/"
// mettre en favoris

 function favorit() {

		if (browserName == "Microsoft Internet Explorer" & browserVer >= 4) {
			window.external.AddFavorite('http://www.elmoujahid.com', 'El MOUDJAHID.COM : Quotidien national d\'information');
		}else{
			window.sidebar.addPanel('El MOUDJAHID.COM : Quotidien national d\'information', 'http://www.elmoudjahid.com',"");
		}

   }

function HomePage() {
	if(browserName == "Microsoft Internet Explorer" & browserVer >= 4){
   		document.body.style.behavior='url(#default#homepage)';
  	 	document.body.setHomePage('http://www.elmoudjahid.com');
	}else{
		alert("Utilisateur de Firefox, glissez l'icone \340 gauche de l'adresse url dans la petite maison de d\351marrage.");
	}
}


$(function() {
   // initialize scrollable
    $("div.scrollable").scrollable({size: 2}).mousewheel();

    // setup ul.tabs to work as tabs for each div directly under div.panes
    $("ul..table").tabs("div.panes > div");
    $("ul..ctable").tabs("div.cpanes > div");



    $("#chained").scrollable({hoverClass: 'hover'}).circular().navigator(".navi").autoscroll({
	steps: 5,
	interval: 4000
    });

    $("div.FlArt_scrollable").scrollable({
        vertical:true,
        size: 9

    // use mousewheel plugin
    }).mousewheel();

    $("#UneArtile").scrollable({size: 1}).circular().navigator(".naviBar").autoscroll({
	steps: 1,
	interval: 6000
    });

    $("div.SilM_scrollable").scrollable({size: 2}).mousewheel();


      $("#On").click(function(){
      if($('#On').attr('class') != 'AgZone AgZoneBis'){

          $("#sidebar").hide();
          $("#article").animate({width: "780px"}, 150 );
          $("a.AgZone").addClass("AgZoneBis");

      } else {
          $("#article").css({width: "460px"});
          $("#sidebar").fadeIn("fast");
          $("a.AgZone").removeClass("AgZoneBis");

      }
    });



    function limitChars(textid, limit, infodiv){
    var text = $('#'+textid).val();
    var textlength = text.length;
      if(textlength > limit){
      $('#' + infodiv).html('Vous ne pouvez pas écrire plus de <b style=\'color:#FF0000\'> '+limit+' </b> caractères !');
      $('#'+textid).val(text.substr(0,limit));
      return false;
      }
     else {
      $('#' + infodiv).html('<b style=\'color:#FF0000\'>'+(limit - textlength) +'</b> Caractères restants.');
      return true;
       }
    }

    $(function(){
      $('#comment').keyup(function(){
      limitChars('comment', 500, 'charlimitinfo');
      })
    });

      $(".MbsetComOn").hide();
      $(".ComOn").click(function(){
          $(".MbsetComOn").slideToggle("slow");
     });

     $(".MbComLog").hide();
     $(".ComLog").click(function(){
           $(".MbComLog").slideToggle("slow");
    });


     $(function(){
      var triggers = $("a.login").overlay({

              // some expose tweaks suitable for modal dialogs
              expose: {
                  color: '#000',
                  loadSpeed: 200,
                  opacity: 0.8
              },

              closeOnClick: false
          });
       });


      $(".feedback").click(function(){
    		$(".panel").toggle("fast");
    		$(this).toggleClass("active");
    		return false;
      });

      $(".Pafermer").click(function(){
    		$(".panel").toggle("fast");
    		$(".feedback").toggleClass("active");
    		return false;
      });


});


    /*  $(".MbsetComOn").hide();
      $(".ComOn").click(function(){
          $(".MbsetComOn").html('<form action=""><fieldset><textarea name="comment" id="comment"></textarea><div><label class="left"><strong>AntiSpam :</strong>  Somme de 5 et 3 ? &nbsp;&nbsp;<input type="text" size="13" /></label><span class="right" id="charlimitinfo">Le commentaire est limité à <strong>500</strong> caractères</span></div><div style="padding-top:10px;" class="cbot"><a class="button" href="#" onclick="this.blur(); return false;"><span>COMMENTAIRE</span></a></div></fieldset></form>');
          $(".MbsetComOn").slideToggle("slow");
    });

     $(".MbComLog").hide();
     $(".ComLog").click(function(){
           $(".MbComLog").html('<h6>DONNEZ VOTRE AVIS</h6><p>Souhaitez-vous poster un commentaire? Pour ce faire s\'il vous plaît veuillez vous inscrire ou vous Identifier</p><a href="" class="resetbutton">Identifiez-vous</a><a class="button" href="#" onclick="this.blur(); return false;"><span>EXPRIMEZ-VOUS</span></a><div class="cbot"></div>');
           $(".MbComLog").slideToggle("slow");
    });*/



//plugin
jQuery.fn.topLink = function(settings) {
	settings = jQuery.extend({
		min: 1,
		fadeSpeed: 200
	}, settings);
	return this.each(function() {
		//listen for scroll
		var el = $(this);
		el.hide(); //in case the user forgot
		$(window).scroll(function() {
			if($(window).scrollTop() >= settings.min)
			{
				el.fadeIn(settings.fadeSpeed);
			}
			else
			{
				el.fadeOut(settings.fadeSpeed);
			}
		});
	});
};

//usage w/ smoothscroll
$(document).ready(function() {
	//set the link
	$('#top-link').topLink({
		min: 400,
		fadeSpeed: 500
	});
	//smoothscroll
	$('#top-link').click(function(e) {
		e.preventDefault();
	   	$.scrollTo(0,300);
	});
});


//plugin
/*jQuery.fn.topLink = function(settings) {
		settings = jQuery.extend({
			min: 1,
			fadeSpeed: 200,
			ieOffset: 50
		}, settings);
		return this.each(function() {
			//listen for scroll
			var el = $(this);
			el.css('display','none'); //in case the user forgot
			$(window).scroll(function() {
				//stupid IE hack
				if(!jQuery.support.hrefNormalized) {
					el.css({
						'position': 'absolute',
						'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
					});
				}
				if($(window).scrollTop() >= settings.min)
				{
					el.fadeIn(settings.fadeSpeed);
				}
				else
				{
					el.fadeOut(settings.fadeSpeed);
				}
			});
		});
	};


*/

