/* -------------------------------------------------
Document JavaScript  MAD
Auteur	:	Keyrus
Date	:	Octobre 2009
------------------------------------------------- */

function tailleCols() {

	var margeHeader = document.getElementById('header').offsetLeft;
	var hauteurGlobal = document.getElementById('global').offsetHeight;
	 
	document.getElementById('contenu').style.marginLeft = margeHeader + 'px'; 

	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		document.getElementById('contenu').style.height = Math.ceil(hauteurGlobal - 831) + 'px' ;
		document.getElementById('right').style.height = Math.ceil(hauteurGlobal - 400) + 'px';
	}

	else {
		document.getElementById('contenu').style.minHeight = Math.ceil(hauteurGlobal - 831) + 'px' ;
		document.getElementById('right').style.minHeight = Math.ceil(hauteurGlobal - 400) + 'px';
	}
}


function general() {	
	$("#accordionArchives").accordion();
	
	$('.titre-offre').click(function() {
	    if($(this).next().css("display") != "block") {
    	    $(".contentoffre").hide();
    		$(this).next().toggle('slow');
	    }
		return false;
	});
	var etat = 0;
	$('.sharethis_wid').hide();
	$('.sharethis_button').click(function(){
	        if ( etat ) {
	           $('div.sharethis_button a img').attr("src","/wp-content/themes/wp-spikly/images/sharethis/share_this_off.png");
	           etat = 0;
			} else {
	           $('div.sharethis_button a img').attr("src","/wp-content/themes/wp-spikly/images/sharethis/share_this.png");
	           etat = 1;
			}
			$(this).prev().toggle('fast');
			return false;
		});
	$("#header").hover(function() {
        $(this).css('cursor', 'pointer');
    }, function() {
       $(this).css('cursor', '');
    }).click(function(){
        location.href="/";
    });
}

$(document).ready(function() { general(); tailleCols(); });

$(window).resize(function(){ tailleCols(); });

