/* <!-- show hide --> */

function show_hide_pan(param1,param2)
{
	elt=document.getElementById(param1);
	if (elt.style.display == 'none') {
		document.getElementById(param1).style.display='block';
		document.getElementById(param2).className='open';
	}
	else {
		document.getElementById(param1).style.display='none';
		document.getElementById(param2).className='';
	}
}

function show_hide_menu_a(param1,param2)
{
	elt=document.getElementById(param2);
	if (elt.style.display == 'none') {
		document.getElementById(param2).style.display='block';
		document.getElementById(param1).className='open';
	}
	else {
		document.getElementById(param2).style.display='none';
		document.getElementById(param1).className='';
	}
}
/***********************************************************************************************/
function fixColumns(){
	var c1 = document.getElementById("colonneA");
	var c2 = document.getElementById("colonneB");

	var maxheight = 0;
	if($('#publicite').height() > 0) {
		maxheight = parseInt($('#publicite').height())+3;
	} else {
		maxheight=Math.max($("#home_gauche_bottom").height(),$("#home_gauche_centre").height());
	}
	if (c1 && c2){
		if(c1.offsetHeight && c2.offsetHeight ){
			maxheight=Math.max(c1.offsetHeight,c2.offsetHeight)+'px';
		}
	
		c1.style.height = maxheight;
	c2.style.height = maxheight;	
	}
}
		
function fixColumns2(){
	var c1 = $("#colonne1").height();
	var c2 = $("#colonne2").height();
	var c3 = $("#colonne3").height();

	if (c1 && c2 && c3){
		var maxheight=Math.max(c1,c2,c3)+'px';
		var max2 = Math.max(c1,c2,c3)+'px';
		
		$("#colonne1").css('height', max2);
		$("#colonne2").css('height', max2);
		$("#colonne3").css('height', maxheight);
	}
} 
function resizeHomeBottom()
{
    //Reinit height already fixed
    $('#home_gauche_bottom').css('height','auto');
    $('#home_gauche_centre').css('height','auto');
    $("#home_gauche_centre").children('.item_block').each(function (){
        $(this).css('height','auto');
        $(this).children('.inside').each(function (){
           $(this).css('height','auto');
        });  
    });
   
    $("#home_gauche_centre").children('.offres').each(function (){
        $(this).children('.inside').each(function (){
           $(this).css('height','auto');
        });  
    });
   
	
	var temp=0;
	var maxheight = 0;
	if($('#publicite').height() > 0) {
		maxheight = $('#publicite').height()+3;
	} else {

	//maxheight=$("#home_gauche_bottom").height();
	maxheight=$("#home_gauche_centre").height();
	}

	////add the absolute positionned link height for ie except when the publications are the 1st column
	if ($.browser.msie && $.browser.version>=7 && !($('#home_gauche_bottom  #colonneB').length)){ 
		maxheight+=25;
	}
	$("#home_gauche_bottom").css('height', maxheight+"px");
	$("#home_gauche_centre").css('height', maxheight+"px");
    $("#home_gauche_centre").children('.item_block').each(function (){
    	$(this).height(maxheight+"px");
    	$(this).children('.inside').each(function (){
    		temp = maxheight - parseInt($(this).css('padding-top')) - parseInt($(this).css('padding-bottom')) - parseInt($(this).parent('.item_block').children('.top').height());
    		temp = temp + 'px';
    	$(this).height(temp);
       });
    	
    });
    
    $("#home_gauche_centre").children('.offres').each(function (){
    	$(this).height(maxheight+"px");
    	$(this).children('.inside').each(function (){
    		temp = maxheight - parseInt($(this).css('padding-top')) - parseInt($(this).css('padding-bottom')) - parseInt($(this).parent('.offres').children('h2').height()) - parseInt($(this).parent('.offres').children('h2').css('margin-bottom')) - parseInt($(this).parent('.offres').children('h2').css('padding-top'));
    		temp = temp + 'px';
    	$(this).height(temp);
       });
    	
    });
    
    $("#home_gauche_centre").children('.bloc_sgr').each(function (){
    	$(this).height(maxheight+"px");
    	$(this).children('.inside').each(function (){
    		temp = maxheight - parseInt($(this).css('padding-top')) - parseInt($(this).css('padding-bottom'));
    		temp = temp + 'px';
    	$(this).height(temp);
       });
    	
    });
    
    if ($.browser.msie && $.browser.version < 8 && $.browser.version >6){ 
	    $('.home #conteneur').css('position','relative');
	    var topPos=parseInt($('.home #conteneur .gauche').height())+parseInt($('.home #conteneur').css('padding-top'));
	    $('#home_gauche_bottom').css('position','relative');
	    $('#home_gauche_bottom').css('top','0px');
	    $('#home_gauche_centre').css('position','absolute');
	    $('#home_gauche_centre').css('top',topPos+'px');
	    var leftPos=parseInt($('#home_gauche_bottom').css('width'))+parseInt($('#home_gauche_bottom').css('margin-right'))+parseInt($('.gauche').css('margin-right'))+'px';
	    $('#home_gauche_centre').css('left',leftPos);
	    $('.home #conteneur').css('height',topPos-parseInt($('.home #conteneur').css('padding-top'))+parseInt($('.home #conteneur').css('padding-bottom')    )+maxheight+2+'px');
   
    }
}

