function affiche_cadre (cadre) {
	document.getElementById("site_News").style.display='none';
	document.getElementById("site_Blog").style.display='none';
	document.getElementById("site_Podcast").style.display='none';
	document.getElementById("site_Forum").style.display='none';
	document.getElementById("site_"+cadre).style.display='block';
}

function agrandirtxt() {
	var fSize = document.getElementById('texte_article').style.fontSize;
	var taille = parseFloat(fSize.substring(0,fSize.length-2));
//alert(taille);
	taille += 0.2;
	if (taille > 2 ) taille = 2;
	document.getElementById('texte_article').style.fontSize = taille+"em";
	return false;
}
function reduiretxt() {
	var fSize = document.getElementById('texte_article').style.fontSize;
	var taille = parseFloat(fSize.substring(0,fSize.length-2));
//alert(taille);
	taille -= 0.2;
	if (taille < 1 ) taille = 1;
	document.getElementById('texte_article').style.fontSize = taille+"em";
	return false;
}

function captureMouse (e) {
  posx = pointeurY(e);
  posy = pointeurX(e);
}
function pointeurX(e) {
  //alert(e);
  if (window.event)
    return (window.event.clientX);
  else
    return(e.pageX);
} // fin pointeurX(e)

// retourne la position verticale sur la page du pointeur de la souris
function pointeurY(e) {
  if (window.event)
    return (window.event.clientY);
  else
    return(e.pageY);
} // fin pointeurY(e)

function showDiv(nr, vis_state)
{
	var decalagex = 10;
	var decalagey = 0;

	if (document.getElementById)
        {
                display = (document.getElementById(nr).style.display == 'none' || document.getElementById(nr).style.display == '') ? vis_state : 'none';
                document.getElementById(nr).style.display = display;
		document.getElementById(nr).style.top = posx+decalagex+"px";
		document.getElementById(nr).style.left = posy+decalagey+"px";
        }
}

function imprimer(page) {
  window.open(page,"imprime", "width=500, height=500, menubar=1, directories=0, toolbar=1, location=0, status=0, scrollbars=1, resizable=1, copyhistory=0, fullscreen=0");
}

/*
    This piece of code is for tag "Cloud" implementation.

    Copyright (c) 2006 Gopalarathnam Venkatesan

    Version History
    --------------------------------------------------------------------------

    2.0     Use namespacing to avoid possible conflicts with other scripts
    
    1.0     Initial version

    This works with the category list like Wordpress.  See wp_list_cats for
    more info.

    To use this:

      1. use the "categories" id for the category list "UL"
      2. include this script in footer.php

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

var TagCloud = {
    draw: function(elem) {
        var c = document.getElementById(elem);
        if (c && c.hasChildNodes()) {
            var maxPosts = 0,
                numCategories = 0,
                categoryNode = [], // the category nodes
                //categoryCount = [], // count of posts in each category
                //categoryText = [], // text node in the list
                child, i, j, n, s, sz;

            /*
              This loop is for caching the list data and for getting the
              maximum posts in a category.
            */
            for (i = 0, n = c.childNodes.length; i < n; i++) {
                child = c.childNodes[i];
		if (child.tagName && child.tagName.toUpperCase() == "LI") {
                    // Cache the list data
                    categoryNode[numCategories] = child;
                    //categoryText[numCategories] = TagCloud.getTextContent(
                    //    categoryNode[numCategories]);
                    //j = parseInt(categoryText[numCategories].replace(
                    //        /.*?\(([^\)]*)\)/, "$1"), 10);
                    //categoryCount[numCategories] = j;
                    //if (j > maxPosts)
                    //    maxPosts = j;
                    s = categoryNode[numCategories].innerHTML;
                    categoryNode[numCategories].innerHTML = s.replace(
                        /(<\/a>).*/, "$1");
                    numCategories++;
		}
            }

            // This is the actual "cloud" loop (apply relative font sizes).
            for (i = 0; i < numCategories; i++) {
		//s = categoryText[i];
		//sz = Math.round(categoryCount[i] / maxPosts * 100);
		sz = Math.random()*100;
		// it becomes too unreadable below this
		if (sz < 50) {
                    sz = 50;
                }
		categoryNode[i].style.fontSize = sz + "%";
            }
        }
    },
    
    init: function(elem, rule) {
	var ds;
        
	if (ds = document.styleSheets[document.styleSheets.length-1]) {
            if (ds.insertRule) // for Mozilla-based browsers
                ds.insertRule(elem + "{" + rule + "}",
                        ds.cssRules.length);
            else if (ds.addRule) // for IE-based browsers
                ds.addRule(elem, rule);
	}
    },

    getTextContent: function(node) {
	if (node.textContent) {
            return node.textContent;
        }
	if (node.innerText) {
            return node.innerText;
        }
	return "";              // no other choice
    }
}
