function change_cible( id , cible ) {



	document.getElementById('thread').value = cible;

		

	document.getElementById('post_a_comment').innerHTML = "Répondre au commentaire #" + cible;



}



function change_adress(what) {



	if ( document.getElementById("adress_bar") ) {



		if ( document.getElementById("adress_bar").style.display == "block" ) {



		document.getElementById('adress').value = what;



		}



	}



}









function TogglePosition(block) {

	// Test IE à cleaner (Opera et d'autres répondent à document.all )

	if (!document.all) {

		blockposition = document.getElementById( block ).style.position;

		if ( blockposition == 'fixed')

			document.getElementById( block ).style.position = 'absolute';	

		else

			document.getElementById( block ).style.position = 'fixed';

	}

}



function ChangeAll() {



	snavDiv = document.getElementById( 'snav' );

	scanDiv = document.getElementById( 'scan' );

	sfavDiv = document.getElementById( 'sfav' );

	sconDiv = document.getElementById( 'scon' );



	if ( ( snavDiv.style.display == 'block' ) || ( scanDiv.style.display == 'block' ) || ( sfavDiv.style.display == 'block' ) || ( sconDiv.style.display == 'block' ) ) {

		snavDiv.style.display = 'none'; scanDiv.style.display = 'none';

		sfavDiv.style.display = 'none'; sconDiv.style.display = 'none';

	}

	else {

		snavDiv.style.display = 'block'; scanDiv.style.display = 'block';

		sfavDiv.style.display = 'block'; sconDiv.style.display = 'block';

	}

}





/* Affiche la barre d'adresse */



function DisplayAdressBar ( adress ) {



document.write ('<div id="adressbar">');

document.write ('<form method="post" target="contenu" action="../redirect.php">');

document.write ('<input onfocus="this.select();" type="text" id="adress" name="adress" value="' + adress + '" />');

document.write ('<input id="go" type="submit" value="Go" />');

document.write ('</form>');

document.write ('</div>');



}







/* Affiche ou Cache l'élément */





function toggle( targetId ){

  if ( (document.getElementById) && ( target = document.getElementById( targetId ) ) ){

  		target = document.getElementById( targetId );

  			if (target.style.display == "block"){

  				target.style.display = "none";

  			} else {

				 target.style.display = "block";			 

  			}

  	}

}









/*



New-Window Links in a Standards-Compliant World



Thanx Kevin !



http://www.sitepoint.com/article/1041/1



-------------------------------



*/



function externalLinks() {

	if ( top.document.getElementById("contenu") )  {

		if (!document.getElementsByTagName) return;

		var anchors = document.getElementsByTagName("a");

		for (var i=0; i<anchors.length; i++) {

		   var anchor = anchors[i];

		   if ( anchor.getAttribute("href") && anchor.getAttribute("rel") == "external" )   

		   anchor.target = "_blank";

		}

	}

}



window.onload = externalLinks;





/*



Style Sheet Switcher



Thanx Zeldman ! 



http://www.zeldman.com/j/nuj.js



-------------------------------



*/





function setActiveStyleSheet(title) {

  var i, a, main;

  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {

    if (a.getAttribute("rel") &&

        a.getAttribute("rel").indexOf("style") != -1 &&

        a.getAttribute("title")) {

      a.disabled = true;

      if(a.getAttribute("title") == title) a.disabled = false;

    }

  }

}



function getActiveStyleSheet() {

  var i, a;

  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {

    if (a.getAttribute("rel") &&

        a.getAttribute("rel").indexOf("style") != -1 &&

        a.getAttribute("title") &&

        !a.disabled

        ) return a.getAttribute("title");

  }

  return null;

}



function getPreferredStyleSheet() {

  var i, a;

  for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {

    if (a.getAttribute("rel") &&

        a.getAttribute("rel").indexOf("style") != -1 &&

        a.getAttribute("rel").indexOf("alt") == -1 &&

        a.getAttribute("title")

        ) return a.getAttribute("title");

  }

  return null;

}



function createCookie(name,value,days) {

  if (days) {

    var date = new Date();

    date.setTime(date.getTime()+(days*24*60*60*1000));

    var expires = "; expires="+date.toGMTString();

  }

  else expires = "";

  document.cookie = name+"="+value+expires+"; path=/";

}



function readCookie(name) {

  var nameEQ = name + "=";

  var ca = document.cookie.split(';');

  for(var i=0;i < ca.length;i++) {

    var c = ca[i];

    while (c.charAt(0)==' ') c = c.substring(1,c.length);

    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

  }

  return null;

}



window.onload = function(e) {

  var cookie = readCookie("style");

  var title = cookie ? cookie : getPreferredStyleSheet();

  setActiveStyleSheet(title);

}



window.onunload = function(e) {

  var title = getActiveStyleSheet();

  createCookie("style", title, 365);

}