function getSize(){
    var ns4up = (document.layers) ? 1 : 0;
    var ie4up = (document.all) ? 1 : 0;
    var nn6up = (document.getElementById) ? 1 : 0;

    if (ie4up) {
            doc_width = document.body.clientWidth;
            doc_height = document.body.clientHeight;
    } else if (nn6up || ns4up) {
            doc_width = self.innerWidth;
            doc_height = self.innerHeight;
    }
    return doc_height;
}


$(document).ready(function(){
		
	base_url = $('#homelink').attr("href");
	
	/*jQuery.each($("li.page_item a"),function() {
		$(this).click(function(){
						
			if( $(this).parent().children().length != 1 ){
				$(this).parent().children().slideDown("linear");
				return false;
			}else{
				return true;
			}
			
		});
	});*/
	
	/*jQuery.each($("li.cat-item a"),function() {
		$(this).click(function(){
						
			if( $(this).parent().children().length != 1 ){
				$(this).parent().children().slideDown("linear");
				return false;
			}else{
				return true;
			}
			
		});
	});*/
	
	jQuery.each($("span.says"),function() {
		$(this).html('::&nbsp;');
	});
	
	/* Rechercher */
	$("#s").val("Rechercher");
	$("#s").focus( function() { 
		$(this).val("");
	});
	$("#s").blur( function() { 
		if( $(this).val() == "" ){										
			$(this).val("Rechercher");
		}
	});
	
	/* hauteur sidebar */
	var doc_height = getSize();
	//console.log(doc_height);
	page_height = $('#content').height();
	sidebar_height = $('#sidebar').height();
	if( sidebar_height < page_height )
	$('#sidebar').css({height: (page_height) });
	
	/* premier post */
	$('.narrowcolumn .post:first h2').insertBefore('.narrowcolumn .post:first');
	$('.narrowcolumn h2:first').addClass('first');
	$('.narrowcolumn .post:first').addClass('first');
	
	/* couleurs années 
	firstpost =  $('.post:first').attr("id");
	
	if( $('#'+firstpost).hasClass('category-annee2') ){
		$('#header .wr').css({ background: '#1ca8ff' });
		$('.narrowcolumn h2:first a').css({ background: '#1ca8ff ' });
		$('.narrowcolumn h2:first').css({ background: '#1ca8ff ' });
		$('link[rel="icon"]').attr({href: base_url+'wp-content/themes/dida/images/Favicon-annee2.gif'});
	}
	if( $('#'+firstpost).hasClass('category-annee3') ){
		$('#header .wr').css({ background: '#fe0000' });
		$('.narrowcolumn h2:first a').css({ background: '#fe0000 ' });
		$('.narrowcolumn h2:first').css({ background: '#fe0000 ' });
		$('link[rel="icon"]').attr({href: base_url+'wp-content/themes/dida/images/Favicon-annee3.gif'});
	}
	if( $('#'+firstpost).hasClass('category-annee4') ){
		$('#header .wr').css({ background: '#f100ab' });
		$('.narrowcolumn h2:first a').css({ background: '#f100ab ' });
		$('.narrowcolumn h2:first').css({ background: '#f100ab ' });
		$('link[rel="icon"]').attr({href: base_url+'wp-content/themes/dida/images/Favicon-annee4.gif'});
	}
	if( $('#'+firstpost).hasClass('category-annee5') ){
		$('#header .wr').css({ background: '#00da0e' });
		$('.narrowcolumn h2:first a').css({ background: '#00da0e ' });
		$('.narrowcolumn h2:first').css({ background: '#00da0e ' });
		$('link[rel="icon"]').attr({href: base_url+'wp-content/themes/dida/images/Favicon-annee5.gif'});
	}*/
		
	/* login/logout*/
	$(".btnconnect a").click( function() { 
		$("#loginform").slideToggle("swing");
	});
	
});



