$(function(){
    $("a[rel~='external']").click( function() {
    	window.open( $(this).attr('href') );
    	return false;
    });
    $('#nav ul li a span').each(function(){
    	var s=$(this).html();
   
    	if (s.length<15 || s.match(/Offres d'emploi/)){
    		//console.log(s+" lgt=>"+s.length);
    		$(this).css('padding-top', "12px");
    	}
    	
    });
    $("a[rel^='prettyPhoto']").prettyPhoto();
    
    $('#content a').each(function(){
    		var lnk=$(this).attr('href');
//  		if (lnk.substring( 0)
    		var ext=lnk.substring((lnk.length-3),lnk.length);
    		if (ext=="pdf"){
    			$(this).addClass('pdf-link');
				$(this).attr('target', '_blank'); 
    		}
			else if (ext=="doc"){
				$(this).addClass('doc-link');
				$(this).attr('target', '_blank'); 
			}
//  		console.log();
    });

	jQuery.each(jQuery.browser, function(i) {
	   if($.browser.msie){
	      //$("#div ul li").css("display","inline");
			 if($.browser.version==6){
				// nothing
			}
			else{
				//	PEPS.rollover.init();
			}
	
	   }else{
	   	  $('#nav-footer li:last-child').css('border-right', "hidden");
		  $('#top_links li:last-child').css('border-right', "hidden");

		//	PEPS.rollover.init();
	   }
	 });


 
 //  $('a').click(function(){
 //  	var lnk=$(this).attr('href');
 //  	
 //  	if (lnk.match(/code-carriere.html/)){
 //  	//	alert("here it is");
 //  		return false;
 //  	}
 //  	
 //  });
    

	
	
		  // Increase Font Size
		  $(".text-more").click(function(){
		  	var currentFontSize = $('#content').css('font-size');
			var currentLineHeight=$('#content').css('line-height');
		 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var currentLineHeightNum = parseFloat(currentLineHeight, 10);
			
		    var newFontSize = currentFontSizeNum*1.2;
			var newLineHeight = currentLineHeightNum*1.2;
			$('#content').css('font-size', newFontSize);
			// $('#content').css('line-height', newLineHeight);
			return false;
		  });
		  // Decrease Font Size
		  $(".text-less").click(function(){
		  	var currentFontSize = $('#content').css('font-size');
			var currentLineHeight=$('#content').css('line-height');
		 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var currentLineHeightNum = parseFloat(currentLineHeight, 10);
		
		    var newFontSize = currentFontSizeNum*0.8;
			var newLineHeight = currentLineHeightNum*0.8;
			// $('#content').css('line-height', newLineHeight);
			$('#content').css('font-size', newFontSize);
			return false;
		  });
	
			$("#mde_home_image_right, #mde_home_image_left").click(function(){

				var url=$(this).children("a").attr("href");
				window.location.href=url;
				//console.log($(this).next("a").attr("href"));


			})	;
});



//PEPS = {};
//PEPS.rollover =
//{
//   init: function(){
//      this.preload();
//      $(".ro").hover(
//         function () { $(this).attr( 'src', PEPS.rollover.newimage($(this).attr('src')) ); },
//         function () { $(this).attr( 'src', PEPS.rollover.oldimage($(this).attr('src')) ); }
//      );
//   },
//   preload: function(){
//      $(window).bind('load', function() {
//         $('.ro').each( function( key, elm ) { $('<img>').attr( 'src', PEPS.rollover.newimage( $(this).attr('src') ) ); });
//      });
//   },
//   newimage: function( src ){
//      return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_o' + src.match(/(\.[a-z]+)$/)[0];
//   },
//   oldimage: function( src ){
//      return src.replace(/_o\./, '.');
//   }
//};
