function navigateToSelectedPage( selectID )
{
	var selectObj = document.getElementById(selectID);
	var selectIndex = selectObj.selectedIndex;
	if( selectIndex > 0 )
	{
		window.location.href = 'index.php?id='+selectObj.options[selectIndex].value;
	}
}

function repositionRightLeaves() {
	newPosition = Math.floor((document.body.clientWidth - $("#mainContent").width())/2);
	if(newPosition<82){
		$("#rightLeaf").css("right","-"+newPosition+"px");
		$("#topTree").css("right","-"+newPosition+"px");
		} 

	if(newPosition<16){
		$("#innerBottomTree").css("right","-"+newPosition+"px");
	}
}		

/*function repositionBgHeader() {
	newPosition = Math.floor((document.body.clientWidth - $("#mainContent").width())/2);
	if(document.body.clientWidth<=1007){
		newPosition=newPosition-200;
	} else {
		newPosition=Math.floor(newPosition/2);
		}
		$("#header").css("margin-left",newPosition+"px");
		$("#header").css("width",document.body.clientWidth-newPosition+"px");
}	*/
	
function boxImage(){
	if( $(".boxImage img").length > 0 ){
		$(".boxImage").css("width",$(".boxImage img").width()+ $(".boxImageRight").width()+"px")
		$(".boxImage").css("height",$(".boxImage img").height()+"px").css("visibility","visible"); 
		$(".boxImageRight").css("height",$(".boxImage img").height()+20 +$(".boxImageCornerTopLeft").height()+"px").css("visibility","visible");
		$(".boxImageCornerTopLeft").css("width",$(".boxImage img").width() + $(".boxImageRight").width()+20+"px").css("visibility","visible");
		$(".boxImageCornerBottomLeft").css("width",$(".boxImage img").width()+ 20+"px").css("visibility","visible");
		$(".boxImageCornerTopRight").css("visibility","visible");
		$(".boxImageCornerBottomRight").css("visibility","visible");
		if(navigator.appVersion.indexOf('6.0') >0){	
			$(".boxImage").css("width",$(".boxImage img").width()+ $(".boxImageRight").width()-3+"px");
			$(".boxImageCornerTopLeft").css("width",$(".boxImage img").width() + $(".boxImageRight").width()+10+"px");
			$(".boxImageCornerBottomLeft").css("width",$(".boxImage img").width()+ 15+"px");
			$(".boxImageCornerBottomLeft").css("margin-top","-2px");
			$(".boxImageCornerBottomRight").css("margin-top","-2px");
		}
	}
	if( $(".boxImageRight").length > 0 )
	{
		$(".event_image").css("width",$(".boxImage img").width() + $(".boxImageRight").width()+20+"px");
	}
	
	$(".event_image").each(function(){
		if( $(this).find("img").length <= 0 )
		{
			$(this).css("visibility", "hidden");
		}
	});
}

function NextImage(pas){
	pasId = parseInt(pas);
	if($("#s4 img").length>5){
		$(".btnNextImage").css("display","block");
		if(pasId >=1){
			pasId = pasId + 1;
			} else {
				pasId = 1;
		}
		$(".btnPrevImage").attr("id",pasId);
		$(".btnNextImage").attr("id",pasId);
		if(pasId>=1 && $("#s4 img").length-pasId*5 >=1){
			$(".btnPrevImage").css("display","block");
			leftPosition = document.getElementById("navImage").offsetLeft-105;
			paddingRightPosition = 105;
			if(navigator.appVersion.indexOf('7.0') >0){
				leftPosition = document.getElementById("navImage").offsetLeft-130;
				paddingRightPosition = 130;
			}
			$("#navImage").css("left",leftPosition);
			$("#navImage").css("padding-right",paddingRightPosition);
			$("#navImage").css("padding-left","0");
		}
		if($("#s4 img").length-pasId*5 <5){
			$(".btnNextImage").css("display","none");
			}
	}
}

function PrevImage(pas){
	var pasId = parseInt(pas);
	if($("#s4 img").length>5){
		if(pasId >=1){
			pasId = pasId - 1;
			} else {
				pasId = 0;
		}	
		$(".btnPrevImage").attr("id",pasId);
		$(".btnNextImage").attr("id",pasId);
		if(pasId>=0 && $("#s4 img").length-pasId*5>=1){
			leftPosition = document.getElementById("navImage").offsetLeft+105;
			$("#navImage").css("padding-right","0");
			if(navigator.appVersion.indexOf('7.0') >0){
				leftPosition = document.getElementById("navImage").offsetLeft+82;
				$("#navImage").css("padding-right",paddingRightPosition);
			}
			$("#navImage").css("left",leftPosition);
			$(".btnNextImage").css("display","block");
		} 
		if(pasId<1){
			$(".btnPrevImage").css("display","none");
		}
	}
}

function resizeColumns(){
		document.getElementById('centerColumn').style.width = 476+"px";
		document.getElementById('leftColumn').style.height = "";
		document.getElementById('centerColumn').style.height = "";
		document.getElementById('leftColumnInner').style.height = "";
		document.getElementById('centerColumnInner').style.height = "";
		document.getElementById('centerColumn').style.padding = "0 20px";
		
        if (document.getElementById('leftColumn'))
        {
            heightContent = document.getElementById('leftColumn').offsetHeight;
        }
        if (document.getElementById('centerColumn'))
        {
            heightContent = document.getElementById('centerColumn').offsetHeight > heightContent ? document.getElementById('centerColumn').offsetHeight : heightContent;
        }
        if (document.getElementById('rightColumn'))
        {
            heightContent = document.getElementById('rightColumn').offsetHeight > heightContent ? document.getElementById('rightColumn').offsetHeight : heightContent;
        }	
		
		if (document.getElementById('rightColumn')) {
			document.getElementById('rightColumn').style.height = heightContent + "px";
		} else {
			$(".centerColumnInner").css("background","#ffffff");
			$("#centerColumn").css("background","none");			
			$("#centerColumn").css("background-position","right top");
			$("#centerColumn").css("background-image","url(fileadmin/templates/vmr_jeunesse/images/bgRightColumn.gif)");
			//$("#centerColumn").css("background-repeat","repeat-y");
			
			if(navigator.appVersion.indexOf('6.0') > 0){
				$("#leftColumn").css("width","200px");
				$("#centerColumn").css("padding","0");
				$(".centerColumnInner").css("padding","0 0 0 24px");
				$("#centerColumnInner").css("width","710px");
				$("#centerColumn").css("width","740px");
				

			} else {
				
				document.getElementById('centerColumnInner').style.width = 200 - 24 + document.getElementById('centerColumn').offsetWidth + "px";
				document.getElementById('centerColumn').style.width = 200+ document.getElementById('centerColumn').offsetWidth + "px";			
				$("#centerColumn").css("padding","0 24px 0 0");
				$(".centerColumnInner").css("padding","0 0 0 24px");
			}
			
				
			
		}
		document.getElementById('leftColumn').style.height = heightContent + "px";
		document.getElementById('centerColumn').style.height = heightContent + "px";
		document.getElementById('leftColumnInner').style.height = heightContent + "px";
		document.getElementById('centerColumnInner').style.height = heightContent + "px";
		var numSpans = $(".tx-jppageteaser-pi1-browsebox-browse-links").children("span").length;
		$(".mainMenu li li:last").addClass(" last");
		$(".tx-jppageteaser-pi1-browsebox-browse-links span:first").addClass(' first');
		$(".tx-jppageteaser-pi1-browsebox-browse-links span:nth-child(2)").addClass(' second');
		$(".tx-jppageteaser-pi1-browsebox-browse-links span:last").prev().addClass(' secondLast');
		$(".tx-jppageteaser-pi1-browsebox-browse-links span:last").addClass(' last');
		
	}


function equalizeListCol(obj){
	cr=0;
	pas=0;
	heightM=0;
	heightMax = 0;
	$(obj).each(function(){
		heightMax = $(this).height();
		if(heightMax>heightM){
			heightM = heightMax;
		} 
	});
	$(obj).each(function(){
		$(this).css("height",heightM);
		if(pas==1){
			$(this).css("margin-right","0px");
			pas=0;
		} else {
			pas=1;
		}
		if(cr==0 || cr==1){
			$(this).css("background","none");
		}
		cr++;
	});
}

function noBgImage(object){
	$(object).each(function(){
		if(!$(this).find("img").attr("src")){
			$(this).css("display","none");
			
			}							
		;
	});	
}

function pager(){
	widthPage =0;
	$(".tx-jppageteaser-pi1-browsebox-browse-links span.tx-jppageteaser-pi1-browsebox-active-link").each(function(){
		widthPage = widthPage + $(this).width();	
	});
	$(".tx-jppageteaser-pi1-browsebox-browse-links span.tx-jppageteaser-pi1-browsebox-inactive-link").each(function(){
		widthPage = widthPage + $(this).width();	
	});
	if(widthPage<249){
		var paddingLeft = ($(".tx-jppageteaser-pi1-browsebox-browse-links").width()-widthPage)/2 - $(".tx-jppageteaser-pi1-browsebox-browse-links .first").width() - $(".tx-jppageteaser-pi1-browsebox-browse-links .second").width() -100 +"px";
		var paddingRight = ($(".tx-jppageteaser-pi1-browsebox-browse-links").width()-widthPage)/2 - $(".tx-jppageteaser-pi1-browsebox-browse-links .last").width() - $(".tx-jppageteaser-pi1-browsebox-browse-links .secondLast").width() -100 +"px";	
		$(".tx-jppageteaser-pi1-browsebox-browse-links .secondLast").css("padding-left",paddingRight);
		$(".tx-jppageteaser-pi1-browsebox-browse-links .second").css("padding-right",paddingLeft);	
	}
}

function selectMenuTab()
{
	$(".csc-menu-def li").each(function(){
		if( window.location.href.indexOf( $(this).find("a").attr("href") ) >= 0 )
		{
			$(this).addClass(" selected");
			$(this).find("a").wrap("<span></span>");
		}
		$(this).find("a").removeAttr("target");
	});	
	$(".csc-menu li").each(function(){
		if( window.location.href.indexOf( $(this).find("a").attr("href") ) >= 0 )
		{
			$(this).addClass(" selected");
			$(this).find("a").wrap("<span></span>");
		}
		$(this).find("a").removeAttr("target");
	});	
}

function centerLink(object){
	$(object).each(function(){
		if($(this).find("a").attr("href")){
			$(this).children("div").css("text-align","center");
		};
	});	
}

function addClassToContent(obj, header){
	$(obj+":contains('"+header+"')").parent().css("display","none");
	return $(obj+":contains('"+header+"')").parent().next();
}

function attrId(){
	objId = 1;
	firstObjId = objId;
	nextObjId = objId+3; 
	$(".blocLoisirs").each(function(){
		$(this).attr("id",objId);
		lastObjId = objId;
		objId = objId + 1;
	});	
	$(".pagerLoisirs div:last").attr("id",nextObjId);
	$(".pagerLoisirs div:first").attr("id",firstObjId);
	
	var colHeight = 0;
	var titleHeight = 0;
	var contentHeight = 0;
	$("#sectionPage .blocLoisirs").each( function(){
		titleHeight = Math.max( $(this).find('.csc-header').height(), titleHeight );
		contentHeight = Math.max( $(this).find('.event_image').height()+$(this).find('.articleTitle').height(), contentHeight );
	});
	
	$("#sectionPage .blocLoisirs").each( function(){
		$(this).find('.csc-header').css('height',titleHeight+'px');		
		$(this).find('.articleTitle').css('height',(contentHeight-$(this).find('.event_image').height())+'px');
	});
	
	$("#sectionPage .blocLoisirs").each( function(){
		colHeight = Math.max( $(this).height(), colHeight );
	});
	colHeight += 100;
	$("#sectionPagepager").css('top',colHeight+'px');
	
	$(".blocLoisirs").css("display","none");
	
	$('div.blocLoisirs').each(function(){
		 if( parseInt($(this).attr("id"))<4 ){
			$(this).css("display","block");
			equalizeListCol(".blocLoisirs");
			if( $("#scrollLoisirs").height() != null ) {
			$(".pagerLoisirs").css("top",$("#scrollLoisirs").height()+"px");
			}
		 }
	});
	if( $('div.blocLoisirs').size() > 3 )
	{
		$("#sectionPagepager .prec").css('display','none');
		$("#sectionPagepager").css('display','block');
	}	
	$('div.blocLoisirs:nth-child(3)').css('padding-right','0');
}
	
function PrecSuiv(IdLoisirs,sens){
	nextObj = 0;
	precObj = 0;
	if(sens == "prec" && parseInt(IdLoisirs)>1){
		nextObj = IdLoisirs;
		precObj = parseInt(IdLoisirs)-3;
		}
	if(sens == "suiv" && parseInt(IdLoisirs)<=parseInt($(".blocLoisirs").length)){
		nextObj = parseInt(IdLoisirs)+3;
		precObj = IdLoisirs;
		}
	if(nextObj>0 && precObj>0){
			$(".pagerLoisirs div:last").attr("id",nextObj);
			$(".pagerLoisirs div:first").attr("id",precObj);
			//$("#scrollLoisirs").find('div.blocLoisirs').each(function(){
			$('div.blocLoisirs').each(function(){
				 if( $(this).attr("id")>=parseInt(precObj) &&   $(this).attr("id")<nextObj){
					$(this).css("display","block");
			
				 } else {
					 
					 $(this).css("display","none");
					 }
			});				
		
		}	
	
	if( parseInt(precObj) == 1 )
	{
		$("#sectionPagepager .prec").css('display','none');
		$("#sectionPagepager .suiv").css('display','block');
	}
	else if( nextObj >= $('div.blocLoisirs').size() )
	{
		$("#sectionPagepager .prec").css('display','block');
		$("#sectionPagepager .suiv").css('display','none');
	}
}	

function noBgPadding(object){
	cr=0;
	pas=0;
	$(object).each(function(){
		if(cr==0 || cr==1)	{
			$(this).css("background","none");
			$(this).css("padding-top","0");
		}
		if(pas==1) {
			$(this).css("margin-right","0");
			pas=0;
		} else {
			pas=1;
		}
		cr++;
	});	
}

function hideIfNoTopLinks(){
	if($(".footerInner .footer_topLinks li").length==0){
		$(".footerInner .footer_topLinks").css("display","none");
		$(".footerInner .footer_extLinks").css("background","none");
		$(".footerInner .footer_extLinks").css("margin-left","15px");
		$(".footerInner .footer_extLinks").css("padding-left","0");
	}
}

function alignTopLinks(){
	var h;
	var maxH = 40;
	$(".footerInner .footer_topLinks li img").each(function(){
		h = ( maxH - $(this).height() )/2;
		$(this).css('margin-top',h+'px');
	});	
	
}

function checkIfBookCategory()
{
	if($("ul.csc-menu").length>0){
		$(".centerColumnContent div.livre").removeClass('livre');
	}	
}

function makeExternalLinksTargetBlank()
{
	if($("#externalLinksPage #liensExternes").length>0){
		$(".tx-jppageteaser-pi1 a").attr({target : "_blank"});
	}
}

function replaceFirstTab()
{
	var frLabel = "Tous";
	var enLabel = "All";
	var currentLabel = frLabel;
	if ($("#flash embed").size()>0)
	{
		if ( $("#flash embed").attr('flashvars:contains("&L")') || $("#flash embed").attr('flashvars:contains("?L")') || window.location.href.indexOf("kids.town.mount-royal") >= 0)
		{
			currentLabel = enLabel;
		}
	}
	
	if(window.location.href.indexOf("kids.town.mount-royal") >= 0)
	{
		currentLabel = enLabel;
	}

	if($("ul.csc-menu").size()>0)
	{
		$("ul.csc-menu li:first a").html( currentLabel );
	}
}

function addAvatarIfMsgFromUlysse()
{
	$(".tx-wecdiscussion-mainContent .author").each(function(){
		if( $(this).html() == "Ulysse" || $(this).html() == "Ulysses" )
		{
			$(this).parent().find(".avatar").css("display","block");
			$(this).parent().find(".message").css("width","520px");
		}
	});
}

function showOneOfEachPromoActivities()
{
	var activityURLs = new Array();
	var found;
	var parent;
	var link;
	$(".promo_single_event").each(function(){
		if($("#formulaire").size() > 0)
		{
			$(this).css('display','block');
			return;
		}

		if( parent != null )
		{
			if( parent.html() != $(this).parent().html() )
			{
				activityURLs = new Array();
			}
		}
		parent = $(this).parent();
		found = false;
		link = $(this).find(".event_text a");
		if( link.length > 0 )
		{
			for( var i = 0; i < activityURLs.length; i++ )
			{
				if( link.attr('href') == activityURLs[i] )
				{
					found = true;
				}
			}
			if( !found )
			{
				activityURLs.push(link.attr('href'));
				$(this).css('display','block');
			}
		}
	});
}

function showOneOfEachTodayActivities()
{
	var activityURLs = new Array();
	var found;
	var parent;
	var link;
	$(".upcoming_events li").each(function(){
		if( parent != null )
		{
			if( parent.html() != $(this).parent().html() )
			{
				activityURLs = new Array();
			}
		}
		parent = $(this).parent();
		found = false;
		link = $(this).find("a");
		if( link.length > 0 )
		{
			for( var i = 0; i < activityURLs.length; i++ )
			{
				if( link.attr('href') == activityURLs[i] )
				{
					found = true;
				}
			}
			if( !found )
			{
				activityURLs.push(link.attr('href'));
				$(this).css('display','block');
			}
		}
	});
}

function relocateSearchForm()
{
	if( $('.centerColumnContent #mailform').size() > 0 )
	{
		$('.mainMenu').after('<div class="leftColumnBox" id="searchBox"><div class="leftColumnBoxInner"></div></div>');
		$('#mailform').appendTo('#searchBox .leftColumnBoxInner');
	}
}

function relocateSectionPageLinks()
{
	$('.articleLoisirs').each(function(){
		if( $(this).find('.upcoming_events').size() > 0 )
		{
			$(this).find('.upcoming_events').append( $(this).find('.articleTitle a') );
			$(this).find('.upcoming_events a').wrap("<li></li>");
			$(this).find('.upcoming_events br').remove();
		}
	});
}

function initImagePager()
{
	var startY = 35;
	if( $.browser.msie && $.browser.version.indexOf('6.') >= 0 )
	{
		startY = 150;
	}
	var maxImageHeight = 0;
	$('#s4 img').each(function(){
		maxImageHeight = Math.max( maxImageHeight,$(this).attr('height') );
		$(this).css('left',((230-$(this).width())/2)+'px');			   
	});
	
	$('#s4 img').each(function(){
		$(this).css('top',((maxImageHeight-$(this).height())/2)+'px');			   
	});
	
	$('#navImage').css('top', maxImageHeight + startY + 10 + 'px');	
	$('.pagerImage').css('top', maxImageHeight + startY + 0 + 'px');
	$('.bottomImage').css('top', maxImageHeight + startY + 10 + 'px');
	$('.btnNextImage').css('top', maxImageHeight + startY + 8 + 'px');
	$('.btnPrevImage').css('top', maxImageHeight + startY + 8 + 'px');
	$('#s4').css('height', maxImageHeight + startY + 10 + 'px');
	$('#s4').parent().prependTo( $('#s4').parent().next() );
	$('#s4').parent().parent().css('margin-left','0');
}

function showActivityDetail()
{
	if( $('#blocActivite .event_title').html() != '' )
	{
		$('#blocActivite').css('display','block');
	}
	else
	{
		$('.tx-powermail-pi1').prev().css('background','none');
		$('.tx-powermail-pi1').prev().css('padding-top','0');
	}
}

function changeSubscriptionBackButton()
{
	var label = $('.tx_powermail_pi1_formconfirmation_back input').attr('value');
	$('.tx_powermail_pi1_formconfirmation_back input').remove();
	$('.tx_powermail_pi1_formconfirmation_back').append('<input type="button" value="'+label+'" onclick="history.go(-1)" />');

	$('.powermail_text').wrap('<div class="powermail_wrapper"></div>');
	$('.powermail_textarea').wrap('<div class="powermail_wrapper"></div>');
	$('.powermail_wrapper').each(function(){
		if( $(this).find('.powermail_textarea').size() > 0 )
		{
			$(this).css('width',($(this).find('.powermail_textarea').width()+22)+'px');
		}
		else if( $(this).find('.powermail_text').attr('size') == null || $(this).find('.powermail_text').attr('size') == 0 )
		{
			$(this).css('width','250px');
			$(this).find('.powermail_text').css('width','228px');
		}
		else
		{
			$(this).css('width',($(this).find('.powermail_text').width()+24)+'px');
		}
	});
	$('.powermail_radio').each(function(){
		$(this).prev().before($(this));
	});
	if( $('.tx-powermail-pi1_confirmation').size() > 0 )
	{
		$('#print_buttons').css('display','none');
        $('a[href="#formulaire"]').css('display','none');
	}
}

function initSubscription()
{
    if( $('.tx-powermail-pi1_confirmation').size() == 0 )
	{
		$('#print_buttons').css('display','none');
	    $('.tx-powermail-pi1').prev().css('display','none');
        
        $('a[href="#formulaire"]').click(function() {
        	showSubscriptionForm();
            changeSubscriptionBackButton();
            resizeColumns();
            $(this).css('display','none');
        });
        $('a[href="#form"]').click(function() {
        	showSubscriptionForm();
            changeSubscriptionBackButton();
            resizeColumns();
            $(this).css('display','none');
        });
	}
}

function showSubscriptionForm()
{
	$('#print_buttons').css('display','block');
    $('.tx-powermail-pi1').prev().css('display','block');
    $('.tx-powermail-pi1').css('display','block');
}

function adjustPollBars()
{
	$('.quiz_results').each(function(){
		if( $(this).find('img').attr('width') == '1' )
		{
			$(this).find('img').css('visibility','hidden');
			$(this).next().css('color','#000000');
			$(this).find('.quiz_countLabel').css('padding-left','40px');
		}
	});
}

function removeCalendarTipIfNoEvent()
{
	$(".rightColumnBox .monthview .day").each(function(){
		if( $(this).find('.event_today').size() <= 0 )
		{
			$(this).find('.dayTitle a').attr('onmouseover','');	
		}
	});
}

function gup( name, _default )
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return _default;
	else
		return results[1];
}


function prevMonth()
{
	var symbol = (window.location.href.indexOf('?id') >= 0) ? "&" : "?";
	var url = window.location.href;
	if(url.indexOf('#') >= 1)
		url = url.substring(0,window.location.href.indexOf('#'));
	if(url.indexOf('&') >= 1)
		url = url.substring(0,window.location.href.indexOf('&'));
	if(url.indexOf('?') >= 1 && symbol == "?")
		url = url.substring(0,window.location.href.indexOf('?'));
	url = url + symbol + "calendar_month=" + Math.max((parseInt(gup('calendar_month',0))-1),0);	
	window.location.href = url;
}

function nextMonth()
{
	var symbol = (window.location.href.indexOf('?id') >= 0) ? "&" : "?";
	var url = window.location.href;
	if(url.indexOf('#') >= 1)
		url = url.substring(0,window.location.href.indexOf('#'));
	if(url.indexOf('&') >= 1)
		url = url.substring(0,window.location.href.indexOf('&'));
	if(url.indexOf('?') >= 1 && symbol == "?")
		url = url.substring(0,window.location.href.indexOf('?'));
	url = url + symbol + "calendar_month=" + (parseInt(gup('calendar_month',0))+1);
	window.location.href = url;
}

function repositionBookThumbs()
{
	var maxWidth = 94;
	var maxHeight = 94;
	var img;
	var padding;
	var ratio;
	
	if($("#externalLinksPage").size() == 0 && $("#liensExternes").size() > 0)
	{
		$('.tx-jppageteaser-pi1-list-entry').each(function(){
			if( $(this).find('.tx-jppageteaser-pi1-list-entry-image img').size() > 0 )
			{
				img = $(this).find('.tx-jppageteaser-pi1-list-entry-image img');
				if (img.height() > maxHeight || img.width() > maxWidth)
				{
					ratio = (img.height() / img.width());
					if (ratio > 1)
					{
						img.css('height', maxHeight+'px');
						img.css('width', (maxWidth/ratio)+'px');
					}
					else
					{
						img.css('height', (maxHeight*ratio)+'px');
						img.css('width', maxWidth+'px'); 
					}
				}
				else
				{
					if (img.height() < maxHeight)
					{
						padding = (maxHeight - img.height()) / 2;
						img.css('padding-top',padding +'px');
					}
				}
			}
		});
	}
}

$(document).ready(function(){	
	if(navigator.appVersion.indexOf('6.0') >0){
		document.getElementById("bottomGrass").style.width = document.body.clientWidth+"px";
	}
	
	if( $("#s4 img").length > 1 )
	{
		$(function() {
			$('#s4').before('<div id="navImage" class="navImage">').cycle({
				speed:  'fast',
				timeout: 0,
				pager:  '#navImage',
				next:   '#next2', 
				prev:   '#prev2' 		
			});
		});
		
		if($("#s4")){
			if($("#s4 img").length>5){
				$(".btnNextImage").css("display","block");
		
			}
		}
		initImagePager();
	}
	else
	{
		$("#s4 img").css("display","block");
		$(".pagerImage").css("display","none");
		$(".bottomImage").css("display","none");
	}
	$(".game h4").css("display","none");
	$('.tx-jppageteaser-pi1 .rightColumnBox .separator:last').css('clear','both');
	
	if( $(".3columns").size() > 0 )
	{
		$("#content").addClass("body3columns");
	}
	
	if(window.location.href.indexOf("tx_wecdiscussion") >= 0)
	{
		$('#ReplyForm0').css('display','block');
	}
	
	if($('.blocLoisirs').size() > 0 && $('#liensExternes').size() > 0)
	{
		//$('#liensExternes').css('clear','both');
		$('#liensExternes').parent().before('<div style="clear:both;"></div>');
		
		var padding = 40;
		if ($.browser.msie) {
			padding += 40;
			if ($.browser.version.indexOf('6.') >= 0) {
				padding -= 20;	
			}
		}
		$('#liensExternes').css('padding-top',padding+'px');
	}
	
	$('.csc-header').prependTo('.csc-textpic-text');
	
	
	showActivityDetail();
	relocateSearchForm();
	relocateSectionPageLinks();
	//equalizeListCol(".home div.promo_single_event");
	equalizeListCol("#articleOthers div.tx-jppageteaser-pi1-list-entry");
	noBgImage("#articleOthers div.tx-jppageteaser-pi1-list-entry-image");	
	centerLink(".game .tx-jppageteaser-pi1-list-entry");
	noBgPadding(".loisir .promo_single_event");
    initSubscription();
	$(".home div.promo_single_event:first").css('background','none');
	attrId();
	selectMenuTab();
	boxImage();
	hideIfNoTopLinks();
	checkIfBookCategory();
	makeExternalLinksTargetBlank();
	replaceFirstTab();
	addAvatarIfMsgFromUlysse();
	showOneOfEachPromoActivities();
	showOneOfEachTodayActivities();
	adjustPollBars();
    
	resizeColumns();
	repositionRightLeaves();
	repositionBookThumbs();
	pager();
	removeCalendarTipIfNoEvent();
	
	$(".footer_topLinks li").each(function(){
		$(this).find("a img").parent().attr("href", $(this).find("span a").attr("href"));
        $(this).find("a img").parent().attr("target", $(this).find("span a").attr("target"));
	});
	setTimeout('alignTopLinks();', 1000);
	
	$(".tx-wecdiscussion-forumMessage").each(function(){
		if( $(this).find(".message").size() <= 0 )
		{
			$(this).css('display','none');
		}
	});
	
	$(".enseignants .csc-header:first").css("background","none");
	$(".enseignants .csc-header:first").css("padding-top","0");
	
	addClassToContent(".livre .csc-header span", "itle").addClass("bookTitle");
	addClassToContent(".livre .csc-header span", "itre").addClass("bookTitle");
	$(".livre .csc-header br").remove();
	
	$('.bookTitle').prependTo('.livre');
	
	$(document).pngFix();	
});

msie4 = false;
function blurLink(){

}
