if (!listEmoticon) {
	var listEmoticon = new Array();        
    listEmoticon[listEmoticon.length] = new Array(":)","http://storage.canalblog.com/34/40/507883/32940309.gif");
    listEmoticon[listEmoticon.length] = new Array(":(","http://storage.canalblog.com/82/71/507883/32894038.gif");
    listEmoticon[listEmoticon.length] = new Array(":s","http://storage.canalblog.com/49/72/507883/32893957.gif");
    listEmoticon[listEmoticon.length] = new Array("niark","http://storage.canalblog.com/32/79/507883/32893006.gif");
    listEmoticon[listEmoticon.length] = new Array(";)","http://storage.canalblog.com/63/99/507883/32892988.gif");
    listEmoticon[listEmoticon.length] = new Array("onviva","http://storage.canalblog.com/58/57/507883/32892947.gif");
    listEmoticon[listEmoticon.length] = new Array("onlove","http://storage.canalblog.com/29/23/507883/32892999.gif");
    listEmoticon[listEmoticon.length] = new Array("chercheee","http://storage.canalblog.com/35/06/507883/32893483.gif");
    listEmoticon[listEmoticon.length] = new Array("byeee","http://storage.canalblog.com/56/77/507883/32893693.gif");
    listEmoticon[listEmoticon.length] = new Array("bravoo","http://storage.canalblog.com/73/27/507883/32893683.gif");
    listEmoticon[listEmoticon.length] = new Array("merciii","http://storage.canalblog.com/37/54/507883/32893758.gif");
    listEmoticon[listEmoticon.length] = new Array("jeveux","http://storage.canalblog.com/56/18/507883/32893886.gif");
    listEmoticon[listEmoticon.length] = new Array("faace","http://storage.canalblog.com/40/13/507883/32892961.gif");
    listEmoticon[listEmoticon.length] = new Array("miam","http://storage.canalblog.com/05/84/507883/32893022.gif");
    listEmoticon[listEmoticon.length] = new Array("endorsbulle","http://storage.canalblog.com/62/97/507883/32893033.gif");
    listEmoticon[listEmoticon.length] = new Array("rhaaa","http://storage.canalblog.com/10/28/507883/32893053.gif");  
    listEmoticon[listEmoticon.length] = new Array("colere1","http://storage.canalblog.com/88/87/507883/32893062.gif");
    listEmoticon[listEmoticon.length] = new Array("ben heu","http://storage.canalblog.com/72/03/507883/32893069.gif");  
    listEmoticon[listEmoticon.length] = new Array("imdead","http://storage.canalblog.com/00/48/507883/32893075.gif");
    listEmoticon[listEmoticon.length] = new Array("j ai peur","http://storage.canalblog.com/57/26/507883/32893495.gif");   
    listEmoticon[listEmoticon.length] = new Array("carton rouge","http://storage.canalblog.com/11/93/507883/32893501.gif");
    listEmoticon[listEmoticon.length] = new Array("putain d ordi","http://storage.canalblog.com/51/58/507883/32893521.gif");
    listEmoticon[listEmoticon.length] = new Array("Happy birthday","http://storage.canalblog.com/66/97/507883/32893531.gif"); 
    listEmoticon[listEmoticon.length] = new Array("onautomne","http://storage.canalblog.com/41/15/507883/32893539.gif");
    listEmoticon[listEmoticon.length] = new Array("onpitie","http://storage.canalblog.com/63/88/507883/32893555.gif");
    listEmoticon[listEmoticon.length] = new Array("X D","http://storage.canalblog.com/08/58/507883/32893572.gif");
    listEmoticon[listEmoticon.length] = new Array("carton jaune","http://storage.canalblog.com/96/66/507883/32893605.gif");
    listEmoticon[listEmoticon.length] = new Array("deprime","http://storage.canalblog.com/38/33/507883/32893619.gif");
    listEmoticon[listEmoticon.length] = new Array("viens","http://storage.canalblog.com/60/60/507883/32893625.gif");
    listEmoticon[listEmoticon.length] = new Array("j me la pete","http://storage.canalblog.com/41/86/507883/32893629.gif");
    listEmoticon[listEmoticon.length] = new Array("ahhhh","http://storage.canalblog.com/44/76/507883/32893653.gif");
    listEmoticon[listEmoticon.length] = new Array("happynewyear1","http://storage.canalblog.com/75/47/507883/32894114.gif"); 
    listEmoticon[listEmoticon.length] = new Array("happynewyear2","http://storage.canalblog.com/88/14/507883/32893960.gif");
    listEmoticon[listEmoticon.length] = new Array("happynewyear3","http://storage.canalblog.com/23/41/507883/32893527.gif");
    listEmoticon[listEmoticon.length] = new Array("happynewyear4","http://storage.canalblog.com/39/90/507883/32893658.gif");
    listEmoticon[listEmoticon.length] = new Array("effraye","http://storage.canalblog.com/68/61/507883/32893672.gif");
    listEmoticon[listEmoticon.length] = new Array("stress","http://storage.canalblog.com/67/94/507883/32893699.gif");
    listEmoticon[listEmoticon.length] = new Array("j suis arrive","http://storage.canalblog.com/75/64/507883/32893707.gif");
    listEmoticon[listEmoticon.length] = new Array("rien entendu","http://storage.canalblog.com/30/80/507883/32893716.gif");    
    listEmoticon[listEmoticon.length] = new Array("peur","http://storage.canalblog.com/76/46/507883/32893784.gif");
    listEmoticon[listEmoticon.length] = new Array("envie de meurtre","http://storage.canalblog.com/94/15/507883/32893803.gif");
    listEmoticon[listEmoticon.length] = new Array("zuuuut","http://storage.canalblog.com/02/12/507883/32893824.gif");
    listEmoticon[listEmoticon.length] = new Array("besoin d une cigarette","http://storage.canalblog.com/56/52/507883/32893845.gif");
    listEmoticon[listEmoticon.length] = new Array("gelee","http://storage.canalblog.com/43/69/507883/32893888.gif");
    listEmoticon[listEmoticon.length] = new Array("bain chaud","http://storage.canalblog.com/24/27/507883/32893898.gif");
    listEmoticon[listEmoticon.length] = new Array("dodo","http://storage.canalblog.com/48/26/507883/32893906.gif");
    listEmoticon[listEmoticon.length] = new Array("bisouxx","http://storage.canalblog.com/91/19/507883/32893953.gif");
    listEmoticon[listEmoticon.length] = new Array("sans voix","http://storage.canalblog.com/48/67/507883/32893954.gif");
    listEmoticon[listEmoticon.length] = new Array("bonne feteeee","http://storage.canalblog.com/23/43/507883/32893928.gif");
    listEmoticon[listEmoticon.length] = new Array("malade","http://storage.canalblog.com/77/02/507883/32893926.gif");
    listEmoticon[listEmoticon.length] = new Array("emue","http://storage.canalblog.com/85/32/507883/32893919.gif");
    listEmoticon[listEmoticon.length] = new Array("big kiss","http://storage.canalblog.com/08/83/507883/32893913.gif");
    listEmoticon[listEmoticon.length] = new Array("christmas1","http://storage.canalblog.com/06/69/507883/32893849.gif");
    listEmoticon[listEmoticon.length] = new Array("christmas2","http://storage.canalblog.com/54/30/507883/32894088.gif");
    listEmoticon[listEmoticon.length] = new Array("christams3","http://storage.canalblog.com/73/39/507883/32893994.gif");
    listEmoticon[listEmoticon.length] = new Array("christmas4","http://storage.canalblog.com/10/70/507883/32893986.gif");
    listEmoticon[listEmoticon.length] = new Array("me laver","http://storage.canalblog.com/11/62/507883/32894005.gif");
    listEmoticon[listEmoticon.length] = new Array("ko ko","http://storage.canalblog.com/52/57/507883/32894008.gif");
    listEmoticon[listEmoticon.length] = new Array("j arriiivvvee","http://storage.canalblog.com/66/39/507883/32894012.gif");
    listEmoticon[listEmoticon.length] = new Array("colere2","http://storage.canalblog.com/48/95/507883/32894018.gif");
    listEmoticon[listEmoticon.length] = new Array("sic","http://storage.canalblog.com/13/26/507883/32894022.gif");
    listEmoticon[listEmoticon.length] = new Array("fouet","http://storage.canalblog.com/30/02/507883/32894027.gif");

    listEmoticon[listEmoticon.length] = new Array("unthe","http://storage.canalblog.com/17/55/507883/32894041.gif");
    listEmoticon[listEmoticon.length] = new Array("yesss","http://storage.canalblog.com/35/72/507883/32894044.gif");
    listEmoticon[listEmoticon.length] = new Array("kestionn","http://storage.canalblog.com/18/17/507883/32894045.gif");
    listEmoticon[listEmoticon.length] = new Array("Rhaaa","http://storage.canalblog.com/70/48/507883/32894048.gif");
    listEmoticon[listEmoticon.length] = new Array("hypnotiseee","http://storage.canalblog.com/11/36/507883/32894055.gif");
    listEmoticon[listEmoticon.length] = new Array("doigts ds nez","http://storage.canalblog.com/42/12/507883/32894061.gif");
    listEmoticon[listEmoticon.length] = new Array("discrettt","http://storage.canalblog.com/05/13/507883/32894064.gif");
    listEmoticon[listEmoticon.length] = new Array("Repooos","http://storage.canalblog.com/07/69/507883/32894068.gif");
    listEmoticon[listEmoticon.length] = new Array("heureuzzz","http://storage.canalblog.com/89/10/507883/32894073.gif");
    listEmoticon[listEmoticon.length] = new Array("superrr","http://storage.canalblog.com/60/56/507883/32894075.gif");
    listEmoticon[listEmoticon.length] = new Array("temptation","http://storage.canalblog.com/51/16/507883/32894093.gif");

    listEmoticon[listEmoticon.length] = new Array("Salut","http://storage.canalblog.com/05/96/108589/9712768.gif");
    listEmoticon[listEmoticon.length] = new Array("Trinquer","http://storage.canalblog.com/37/37/108589/9712786.gif");
    listEmoticon[listEmoticon.length] = new Array("Victoire","http://storage.canalblog.com/93/09/108589/9712796.gif");
    listEmoticon[listEmoticon.length] = new Array("YoupYoup","http://storage.canalblog.com/51/36/108589/9712807.gif");
    listEmoticon[listEmoticon.length] = new Array("dingding","http://storage.canalblog.com/51/24/108589/9712815.gif");
    listEmoticon[listEmoticon.length] = new Array("Chaud","http://storage.canalblog.com/37/64/198257/9669546.gif");    
    listEmoticon[listEmoticon.length] = new Array("grrrmmmphffff","http://contes-de-web.fr/img/broienoir.gif");
    listEmoticon[listEmoticon.length] = new Array("Ordi casser","http://contes-de-web.fr/img/ordiprovoc.gif");
    listEmoticon[listEmoticon.length] = new Array("Ordi secouer","http://contes-de-web.fr/img/ordisecouer.gif");
    listEmoticon[listEmoticon.length] = new Array("Aimer Ordi","http://contes-de-web.fr/img/ordilove.gif");
    listEmoticon[listEmoticon.length] = new Array("Ordi par fenetre","http://contes-de-web.fr/img/ordifenetre.gif");
    listEmoticon[listEmoticon.length] = new Array("Casse-tete","http://contes-de-web.fr/img/cassetete.gif");
    listEmoticon[listEmoticon.length] = new Array("ca Bug","http://contes-de-web.fr/img/cabug.gif");
    listEmoticon[listEmoticon.length] = new Array("boxe","http://contes-de-web.fr/img/boxe.gif");
    listEmoticon[listEmoticon.length] = new Array("manif","http://contes-de-web.fr/img/manif.gif");
    listEmoticon[listEmoticon.length] = new Array("colere","http://contes-de-web.fr/img/colere.gif");
    listEmoticon[listEmoticon.length] = new Array("bouillir","http://contes-de-web.fr/img/bouillir.gif");
    listEmoticon[listEmoticon.length] = new Array("grr bouillir","http://contes-de-web.fr/img/bouillir-2.gif");
    listEmoticon[listEmoticon.length] = new Array("Exploser","http://contes-de-web.fr/img/exploser.gif");
    listEmoticon[listEmoticon.length] = new Array("rire moqueur","http://contes-de-web.fr/img/rire_moqueur.gif");
    listEmoticon[listEmoticon.length] = new Array("mdr saoul","http://contes-de-web.fr/img/mdrsaoul.gif");
    listEmoticon[listEmoticon.length] = new Array("dodoooo","http://contes-de-web.fr/img/ronron.gif");
    listEmoticon[listEmoticon.length] = new Array("Merci","http://contes-de-web.fr/img/merci.gif");
    listEmoticon[listEmoticon.length] = new Array("Merci merci","http://contes-de-web.fr/img/mercimerci.gif");
    listEmoticon[listEmoticon.length] = new Array("Vive moi","http://contes-de-web.fr/img/vivemoi.gif");
    listEmoticon[listEmoticon.length] = new Array("woo hoo","http://contes-de-web.fr/img/woohoo.gif");
    listEmoticon[listEmoticon.length] = new Array("conseilles","http://contes-de-web.fr/img/conseilles.gif");
    listEmoticon[listEmoticon.length] = new Array("venerf","http://contes-de-web.fr/img/nrv.gif");
    listEmoticon[listEmoticon.length] = new Array("malade au lit","http://contes-de-web.fr/img/malade-lit.gif");
    listEmoticon[listEmoticon.length] = new Array("lisez ca","http://contes-de-web.fr/img/lisezceci.gif");
    listEmoticon[listEmoticon.length] = new Array("Fee","http://contes-de-web.fr/img/fee-clochette.gif");
    listEmoticon[listEmoticon.length] = new Array("Momie","http://contes-de-web.fr/img/momie.gif");
    listEmoticon[listEmoticon.length] = new Array("Sorcière en balais","http://contes-de-web.fr/img/sorcierebalais.gif");
    listEmoticon[listEmoticon.length] = new Array("Repassage","http://contes-de-web.fr/img/repassage.gif"); 

	}

	var BOutils = new Array();    
    BOutils[BOutils.length] = new Array("URL","http://storage.canalblog.com/41/37/507883/32913459.jpg","Ins&egrave;re un lien","[URL]","[/URL]","<a href=\'","\' target='_blank'>Aller là</a>");
    BOutils[BOutils.length] = new Array("Img","http://storage.canalblog.com/89/84/507883/32913674.jpg","Ins&egrave;re une image","[Img]","[/Img]","<br /><img src=\'","\' /><br />");
    BOutils[BOutils.length] = new Array("I","http://storage.canalblog.com/54/40/507883/32914212.jpg","Texte Italic","[I]","[/I]","<I>","</I>");
    BOutils[BOutils.length] = new Array("G","http://storage.canalblog.com/43/00/507883/32913911.jpg","Texte Gras","[G]","[/G]","<B>","</B>");
    BOutils[BOutils.length] = new Array("S","http://storage.canalblog.com/38/86/507883/32914610.jpg","Texte Soulign&eacute;","[U]","[/U]","<U>","</U>");
    BOutils[BOutils.length] = new Array("B","http://storage.canalblog.com/77/30/507883/32914773.jpg","Texte Barr&eacute;","[S]","[/S]","<STRIKE>","</STRIKE>");


    var att = " style='vertical-align:middle; border:0;margin-left: 2px;'";
	var listActionOutils = new Array();    
    listActionOutils[listActionOutils.length] = new Array("[Img]","<br /><img src=\'");
    listActionOutils[listActionOutils.length] = new Array("[/Img]","\' /><br />");
    listActionOutils[listActionOutils.length] = new Array("[I]","<I>");
    listActionOutils[listActionOutils.length] = new Array("[/I]","</I>");
    listActionOutils[listActionOutils.length] = new Array("[U]","<U>");
    listActionOutils[listActionOutils.length] = new Array("[/U]","</U>");
    listActionOutils[listActionOutils.length] = new Array("[G]","<B>");
    listActionOutils[listActionOutils.length] = new Array("[/G]","</B>");
    listActionOutils[listActionOutils.length] = new Array("[S]","<STRIKE>");
    listActionOutils[listActionOutils.length] = new Array("[/S]","</STRIKE>");
    listActionOutils[listActionOutils.length] = new Array(":url:","http://");
	listActionOutils[listActionOutils.length] = new Array("[URL]","<a href=\'");
	listActionOutils[listActionOutils.length] = new Array("[NAME]","\' target='_blank'>");
	listActionOutils[listActionOutils.length] = new Array("[/URL]","</a>");
    listActionOutils[listActionOutils.length] = new Array("[Sur]","<span style='background-color : #3EE735'>");
    listActionOutils[listActionOutils.length] = new Array("[/Sur]","</span>");
    listActionOutils[listActionOutils.length] = new Array("[Sur col=\'","<span style=\'background-color : ");
    listActionOutils[listActionOutils.length] = new Array("[Font col=\'","<font color=\'");
    listActionOutils[listActionOutils.length] = new Array("[Size=\'","<span style=\'font-size: ");
    listActionOutils[listActionOutils.length] = new Array("[/Size]","</span>");
    listActionOutils[listActionOutils.length] = new Array("[/Font]","</font>");
    listActionOutils[listActionOutils.length] = new Array(":]:",">");




function addEvent(ou, eventName, quoi) {
if (ou.addEventListener)
ou.addEventListener(eventName, quoi, false);
else if (ou.attachEvent)
ou.attachEvent('on'+eventName, quoi);
}
	
	function RemplacerTagEmoticon(ObjetComs) {
	var speEmoticon = new Array();        
    speEmoticon[speEmoticon.length] = new Array(":)","http://storage.canalblog.com/34/40/507883/32940309.gif");
    speEmoticon[speEmoticon.length] = new Array(" :(","http://storage.canalblog.com/82/71/507883/32894038.gif");
    speEmoticon[speEmoticon.length] = new Array(" :s","http://storage.canalblog.com/49/72/507883/32893957.gif");
    speEmoticon[speEmoticon.length] = new Array("niark","http://storage.canalblog.com/32/79/507883/32893006.gif");
    speEmoticon[speEmoticon.length] = new Array(" ;)","http://storage.canalblog.com/63/99/507883/32892988.gif");
    for (var i = 0; i < listEmoticon.length; i++) {
        ObjetComs = ObjetComs.split('[' + listEmoticon[i][0] + ']').join('<img src="' + listEmoticon[i][1] + '"' + att + ' alt="' + listEmoticon[i][0] + '" />');
    }
    for (var i = 0; i < speEmoticon.length; i++) {
        ObjetComs = ObjetComs.split(speEmoticon[i][0]).join('<img src="' + speEmoticon[i][1] + '"' + att + ' alt="' + speEmoticon[i][0] + '" />');
    }
    
    return ObjetComs;
}

function RemplacerCodeStyle(ObjetComs) {
    for (var i = 0; i < listActionOutils.length; i++) {
        ObjetComs = ObjetComs.split(listActionOutils[i][0]).join(listActionOutils[i][1]);
    }
    return ObjetComs;
}
function SupprimerCodeStyle(ObjetComs) {
    for (var i = 0; i < listActionOutils.length; i++) {
        ObjetComs = ObjetComs.split(listActionOutils[i][0]).join("");
    }
    return ObjetComs;
}



function SwapCodeStyle1(namediv,nameclass) {

    var objComArea;
    var classComArea;
    var objComBody = new Array();
    if (namediv != '') {
        objComArea = document.getElementById(namediv);
        if (!objComArea || !objComArea.innerHTML) return;
        classComArea = objComArea.getElementsByTagName("div");
    } else {
        classComArea = document.getElementsByTagName("*");
    }
    for (var i = 0; i < classComArea.length; i++) {
        if (classComArea[i].className == nameclass) objComBody[objComBody.length] = classComArea[i];
    }
    for (var i = 0; i < objComBody.length; i++) {


        objComBody[i].innerHTML = RemplacerCodeStyle(objComBody[i].innerHTML);
    }
}
function SwapCodeStyle2(namediv,nameclass) {

    var objComArea;
    var classComArea;
    var objComBody = new Array();
    if (namediv != '') {
        objComArea = document.getElementById(namediv);
        if (!objComArea || !objComArea.innerHTML) return;
        classComArea = objComArea.getElementsByTagName("div");
    } else {
        classComArea = document.getElementsByTagName("*");
    }
    for (var i = 0; i < classComArea.length; i++) {
        if (classComArea[i].className == nameclass) objComBody[objComBody.length] = classComArea[i];
    }
    for (var i = 0; i < objComBody.length; i++) {


        objComBody[i].innerHTML = SupprimerCodeStyle(objComBody[i].innerHTML);
    }
}

function SwapCodeEmoticon(namediv,nameclass) {

if (nameclass != "navlinks") { SwapCodeStyle1(namediv,nameclass); }
else { SwapCodeStyle2(namediv,nameclass); }

    var objComArea;
    var classComArea;
    var objComBody = new Array();
    if (namediv != '') {
        objComArea = document.getElementById(namediv);
        if (!objComArea || !objComArea.innerHTML) return;
        classComArea = objComArea.getElementsByTagName("div");
    } else {
        classComArea = document.getElementsByTagName("*");
    }
    for (var i = 0; i < classComArea.length; i++) {
        if (classComArea[i].className == nameclass) objComBody[objComBody.length] = classComArea[i];
    }
    for (var i = 0; i < objComBody.length; i++) {
        objComBody[i].innerHTML = RemplacerTagEmoticon(objComBody[i].innerHTML);
    }
}

 if (document.forms.frmComment) {
 
function openPopupSmilleys() {
 var wpops = window.open("","PopSmileys","width=1000, height=1050, toolbars=no, scrollbars=yes");
 wpops.document.write('<');
 wpops.document.write('head><');
 wpops.document.write('title>Choisir un smiley<');
 wpops.document.write('/title><');
 wpops.document.write('/head><');
 wpops.document.write('body>');
 wpops.document.write('<');
 wpops.document.write('p>Cliquez sur l\'&eacute;motic&ocirc;ne pour l\'ajouter dans le texte du commentaire.<');
 wpops.document.write('/p><');
 wpops.document.write('hr />');
	    for (var i = 10; i < listEmoticon.length; i++) {
        wpops.document.write('<a onClick="window.opener.InsererEmoticon(\'' + listEmoticon[i][0] + '\');window.opener.visionner()"><img src="' + listEmoticon[i][1] + '"' + att + ' alt="' + listEmoticon[i][0] + '" title="' + listEmoticon[i][0] + '"  /></a>');
        }
 wpops.document.write('<');
 wpops.document.write('br /><');
 wpops.document.write('hr /><');
 wpops.document.write('input type="button" value="Bye bye" onclick="window.close();"/>');
 wpops.document.write('<');
 wpops.document.write('/body>');

	
 wpops.focus();
}

function remplacerducode(dici) {
  var objtextcom = dici.commentBody;
  var textcom = objtextcom.value;
  textcom = textcom.split("<").join("&lt;");
  textcom = textcom.split(">").join("&gt;");
  textcom = textcom.split("http://").join(":url:");
  objtextcom.value = textcom;
handleSubmit(dici);
}
function InsererEmoticon(tag) {
    var item = '[' + tag + ']';
    var obj = document.frmComment.commentBody;	
    if (document.selection) {
        obj.focus();
        sel = document.selection.createRange();
        sel.text = item;
    } else if (obj.selectionStart || obj.selectionStart == '0') {
        var startPos = obj.selectionStart;
        var endPos = obj.selectionEnd;
        obj.value = obj.value.substring(0, startPos) + item + obj.value.substring(endPos, obj.value.length);
    } else {
        obj.value += item;
    }
}

function getNbSaut(elementTxt){
  var Nbrsaut = 0;
  var PosCn = elementTxt.indexOf("\r\n");
  while( PosCn > -1){
    PosCn = elementTxt.indexOf("\r\n", PosCn+2);
    Nbrsaut ++;
  }
  return( Nbrsaut);
}
function collerTags(tagDeb, tagFin) {
  var Obj = document.frmComment.commentBody;
    Obj.focus();
    if (typeof Obj.selectionStart != 'undefined') {
      var PosDeb = Obj.selectionStart;
      var PosFin = Obj.selectionEnd;
      var Chaine  = Obj.value;
      var szAvant = Chaine.substring( 0 , PosDeb);
      var szApres = Chaine.substring( PosFin, Obj.textLength );
      var szSelect = Chaine.substring( PosDeb, PosFin);
      Obj.value = szAvant + tagDeb + szSelect + tagFin + szApres;
      PosDeb = szAvant.length + tagDeb.length +szSelect.length;
      PosFin = PosDeb;
      Obj.setSelectionRange( PosDeb, PosFin);
      Obj.focus();
    }
    else { 
      var Decal;
      var Chaine   = document.selection.createRange();
      var szSelect = Chaine.text;
      Chaine.text  = tagDeb + szSelect + tagFin;
      Chaine = document.selection.createRange();
      if ( szSelect.length > 0) {
        Decal = tagDeb.length + szSelect.length;
        Decal -= getNbSaut( szSelect);
      }
      else {
        Decal = -tagFin.length;
      }
      Chaine.move('character', Decal);
      Chaine.collapse();
      Chaine.select();
    }
}

function SurlignInText() {
           var  objcolorsel=document.getElementById("selectbkCol");
           var couleursurlignage = objcolorsel.options[objcolorsel.selectedIndex].value;
           var entetesurlignage ="[Sur col=\'" + couleursurlignage + "\':]:"; 
           var finsurlignage ="[/Sur]";
           collerTags(entetesurlignage,finsurlignage);
 }
 
function colorInText() {
           var  objcolorsel=document.getElementById("selectfontCol");
           var couleursurlignage = objcolorsel.options[objcolorsel.selectedIndex].value;
           var entetesurlignage ="[Font col=\'" + couleursurlignage + "\':]:"; 
           var finsurlignage ="[/Font]";
           collerTags(entetesurlignage,finsurlignage);
 }

function sizeInText() {

var obj = document.frmComment.commentBody;
           var  objcolorsel=document.getElementById("selectsizefont");
           var couleursurlignage = objcolorsel.options[objcolorsel.selectedIndex].value;
           var entetesurlignage ="[Size=\'" + couleursurlignage + "\':]:"; 
           var finsurlignage ="[/Size]";
           collerTags(entetesurlignage,finsurlignage);
 }


function insertURLInText() {
var obj = document.frmComment.commentBody;
           var  itemaddr = "";
           itemaddr = prompt("Entrer l'adresse http du lien", "http://");
		   itemaddr = itemaddr.split("http://").join(":url:");
    	   var 	itemname = "";
           itemname = prompt("Entrer le nom du lien", itemaddr);
           if (!itemaddr) itemname=itemaddr;
           itemaddr =  itemaddr.split("http://").join(":url:");
		   var item = "[URL]" + itemaddr + "[NAME]" + itemname + "[/URL]";
        if (document.selection) {
           obj.focus();
           sel = document.selection.createRange();
           sel.text = item;

      } else if (obj.selectionStart || obj.selectionStart == '0') {
            var startPos = obj.selectionStart;
            var endPos = obj.selectionEnd;
            obj.value = obj.value.substring(0, startPos) + item + obj.value.substring(endPos, obj.value.length);
            } else {
            obj.value += item;
      }
}
function inserImgInText() {
    var obj = document.frmComment.commentBody;
    var item = prompt("Entrer l'adresse http de l'image", "http://");
        item =  item.split("http://").join(":url:");
        item = BOutils[1][3] + item + BOutils[1][4]; 
	if (document.selection) {
      obj.focus();
      sel = document.selection.createRange();
      sel.text = item;
    } else if (obj.selectionStart || obj.selectionStart == '0') {
      var startPos = obj.selectionStart;
      var endPos = obj.selectionEnd;
      obj.value = obj.value.substring(0, startPos) + item + obj.value.substring(endPos, obj.value.length);
    } else {
      obj.value += item;
    }
 }

function inserTagInText(outil) {

           for (var i = 2; i < BOutils.length; i++) { 
              if (outil == BOutils[i][0]) {  collerTags(BOutils[i][3], BOutils[i][4]); }
           }
 }

function visionner() {
  var titrecom = document.frmComment.commentTitle.value;

  titrecom = RemplacerCodeStyle(titrecom);
  titrecom = RemplacerTagEmoticon(titrecom);
  titrecom = "<h3>" + titrecom + "</h3><p>";

  var textcom = document.frmComment.commentBody.value;
  textcom = textcom.split("<").join("&lt;");
  textcom = textcom.split(">").join("&gt;");
  textcom = textcom.split("\n").join("<br />");
  textcom = RemplacerCodeStyle(textcom);
  textcom = RemplacerTagEmoticon(textcom);

  var apercucom = titrecom + textcom +"</p>";
  var objvisu =  document.getElementById("visu");
  objvisu.innerHTML = apercucom;
}   	
}	
function modifierformulaire() {
 if (document.forms.frmComment) {
 var objselectfont = "<select name='selectfontCol' id='selectfontCol'  style='width: 35px; padding: 0;margin: 0'> title='Couleur de texte'";
	objselectfont += "<option value='#000000' style='background-color: #000000;'></option>";
	objselectfont += "<option value='#707070' style='background-color: #707070;'></option>";
	objselectfont += "<option value='#F0F0F0' style='background-color: #F0F0F0;'></option>";
	objselectfont += "<option value='#F00000' style='background-color: #F00000;'></option>";
	objselectfont += "<option value='#F07070' style='background-color: #F07070;'></option>";
	objselectfont += "<option value='#F0D0D0' style='background-color: #F0D0D0;'></option>";
	objselectfont += "<option value='#F05030' style='background-color: #F05030;'></option>";
	objselectfont += "<option value='#F06040' style='background-color: #F06040;'></option>";
	objselectfont += "<option value='#F08060' style='background-color: #F08060;'></option>";
	objselectfont += "<option value='#F000F0' style='background-color: #F000F0;'></option>";
	objselectfont += "<option value='#F070F0' style='background-color: #F070F0;'></option>";
	objselectfont += "<option value='#F0D0F0' style='background-color: #F0D0F0;'></option>";
	objselectfont += "<option value='#0000F0' style='background-color: #0000F0;'></option>";
	objselectfont += "<option value='#7070F0' style='background-color: #7070F0;'></option>";
	objselectfont += "<option value='#D0D0F0' style='background-color: #D0D0F0;'></option>";
	objselectfont += "<option value='#00F0F0' style='background-color: #00F0F0;'></option>";
	objselectfont += "<option value='#70F0F0' style='background-color: #70F0F0;'></option>";
	objselectfont += "<option value='#D0F0F0' style='background-color: #D0F0F0;'></option>";
	objselectfont += "<option value='#00F000' style='background-color: #00F000;'></option>";
	objselectfont += "<option value='#70F070' style='background-color: #70F070;'></option>";
	objselectfont += "<option value='#D0F0D0' style='background-color: #D0F0D0;'></option>";
	objselectfont += "<option value='#F0F000' style='background-color: #F0F000;'></option>";
	objselectfont += "<option value='#F0F070' style='background-color: #F0F070;'></option>";
	objselectfont += "<option value='#F0F0D0' style='background-color: #F0F0D0;'></option>";
	objselectfont += "</select>";

var objselectbkcol = "<select name='selectbkCol' id='selectbkCol'  style='width: 35px; padding: 0;margin: 0'> title='Couleur du surlignage'";
	objselectbkcol += "<option value='#CCF' style='background-color: #CCF; '></option>";
	objselectbkcol += "<option value='#CFC' style='background-color: #CFC; '></option>";
	objselectbkcol += "<option value='#FCC' style='background-color: #FCC; '></option>";
	objselectbkcol += "<option value='#FAC' style='background-color: #FAC; '></option>";
	objselectbkcol += "<option value='#FCF' style='background-color: #FCF; '></option>";
	objselectbkcol += "<option value='#FFC' style='background-color: #FFC; '></option>";
	objselectbkcol += "<option value='#CFF' style='background-color: #CFF; '></option>";
	objselectbkcol += "</select>";

var objselectsizefont ="<select name='selectsizefont' id='selectsizefont'  style='width: 45px; padding: 0;margin: 0'> title='Taille du texte'";
	objselectsizefont += "<option value='6pt' >06pt</option>";
	objselectsizefont += "<option value='8pt' >08pt</option>";
	objselectsizefont += "<option value='10pt' >10pt</option>";
	objselectsizefont += "<option value='12pt' >12pt</option>";
	objselectsizefont += "<option value='14pt' >14pt</option>";
	objselectsizefont += "<option value='16pt' >16pt</option>";
	objselectsizefont += "</select>";
	
	
 var formulaire = document.forms.frmComment;
   var valeurS=formulaire.elements.s.value;
    var valeurAuthorNickName= (formulaire.elements.authorNickName.value !=undefined ||formulaire.elements.authorNickName.value !="") ? (formulaire.elements.authorNickName.value) : "Visiteur";
    var valeurAuthorEmail= (formulaire.elements.authorEmail.value != undefined || formulaire.elements.authorEmail.value !="") ? (formulaire.elements.authorEmail.value) : ("visiteur@canalblog.com");
    var valeurAuthorWebsiteUrl= (formulaire.elements.authorWebsiteUrl.value != undefined || formulaire.elements.authorWebsiteUrl.value != "") ? (formulaire.elements.authorWebsiteUrl.value) : "";
    var valeurRememberInfo= formulaire.elements.rememberInfo.value ;
    var listeEmoticon = '';
	var textarea = 'document.frmComment.commentBody';
     for (var i = 0; i < 10; i++) {
     listeEmoticon +='<a href="javascript:;" onClick="InsererEmoticon(\'' + listEmoticon[i][0] + '\');visionner()"><img src="' + listEmoticon[i][1] + '"' + att + ' alt="' + listEmoticon[i][0] + '" title="' + listEmoticon[i][0] + '"  /></a>';
     }
	var outilPlusEmoticon = '<a onClick="openPopupSmilleys()"><img src="http://storage.canalblog.com/08/99/507883/32915690.jpg" alt="+ de smilleys" title="Autres Smileys" border="0" style="vertical-align: middle; margin-left: 10px;"  /></a>';
    var outilSurlign = '<a onClick="SurlignInText();visionner()"><img src="http://storage.canalblog.com/48/01/507883/32926469.jpg" alt="Surligner" title="Surligner le texte" border="0" style="vertical-align: middle; margin-left: 10px;"  /></a>';
    var outilColorText = '<a onClick="colorInText();visionner()"><img src="http://storage.canalblog.com/24/10/507883/32926893.jpg" alt="Couleur" title="Couleur du texte" border="0" style="vertical-align: middle; margin-left: 10px;"  /></a>';
    var outilSizeText = '<a onClick="sizeInText();visionner()"><img src="http://storage.canalblog.com/22/05/507883/32926904.jpg" alt="Taille" title="Taille du texte" border="0" style="vertical-align: middle; margin-left: 10px;"  /></a>';
     var listeBOutils ='<a  onClick="insertURLInText();visionner()"><img src="' + BOutils[0][1] + '"  alt="' + BOutils[0][2] + '" title="' + BOutils[0][2] + '" border="0" style="vertical-align: middle;margin-left: 2px;" /></a>';
     listeBOutils += '<a  onClick="inserImgInText();visionner()"><img src="' + BOutils[1][1] + '"  alt="' + BOutils[1][2] + '" title="' + BOutils[1][2] + '" border="0" style="vertical-align: middle;margin-left: 2px;" /></a>';
     for (var i = 2; i < BOutils.length; i++) {
     listeBOutils += '<a  onClick="inserTagInText( \'' + BOutils[i][0] + '\');visionner()"><img src="' + BOutils[i][1] + '"  alt="' + BOutils[i][2] + '" title="' + BOutils[i][2] + '" border="0" style="vertical-align: middle;margin-left: 2px;" /></a>';
     }


  var nodeformulairesup = document.getElementById("frmComment");
  var feuillecontent = nodeformulairesup.parentNode;
  feuillecontent.removeChild(nodeformulairesup);
	
    var newformulaire = "<hr /><h2>Poster un commentaire</h2><p>Aper&ccedil;u:<a onClick='visionner();'><img src='http://storage.canalblog.com/28/69/251752/19262613.gif' alt='Aper&ccedil;u du commentaire' title='Aper&ccedil;u du commentaire' border='0' style='vertical-align:middle' /></a><br />";
    newformulaire += "<div id='visu' style='width: 100%; border: solid 1px; padding: 3px'></div></p><form action='' method='post' name='frmComment' id='frmComment' onsubmit='remplacerducode(this)'>";
    newformulaire += "<input type='hidden' id='s' name='s' value='" + valeurS + "' /> <p> ";
    newformulaire += "<label for='authorNickName'>Nom ou pseudo :</label> ";
    newformulaire += "<input id='authorNickName' name='authorNickName' value='" + valeurAuthorNickName + "' maxlength='16' style='width:200px' onchange='handleChange(this)' /> <br /> ";
    newformulaire += "<label for='authorEmail'>Adresse email :</label>";
    newformulaire += "<input id='authorEmail' name='authorEmail' value='" + valeurAuthorEmail + "' maxlength='64' style='width:250px' onchange='handleChange(this)' /> <br /> ";
    newformulaire += "<label for='authorWebsiteUrl'>Site Web (URL) :</label>";
    newformulaire += "<input id='authorWebsiteUrl' name='authorWebsiteUrl' value='" + valeurAuthorWebsiteUrl + "' maxlength='128' style='width:300px' onchange='handleChange(this)' /> </p> <p> ";
    newformulaire += "<label for='commentTitle'>Titre du commentaire :</label> ";
    newformulaire += "<input id='commentTitle' name='commentTitle' value='' maxlength='128' style='width:250px' /> <br />";
    newformulaire += "<label for='commentBody'>Commentaire </label>";
	newformulaire += outilColorText + objselectfont;
	newformulaire += outilSizeText + objselectsizefont;
	newformulaire += outilSurlign + objselectbkcol;
	newformulaire += " <br />";
	newformulaire += listeBOutils;

	newformulaire += "<br /><textarea onKeyup='visionner()' id='commentBody' name='commentBody' rows='12' cols='58'></textarea> </p> <p>";
	newformulaire += listeEmoticon + outilPlusEmoticon;
    newformulaire += "</p><p><input onclick='handleCheck(this)' type='checkbox' id='rememberInfo' name='rememberInfo' value='1' /><label> ";
    newformulaire += "Se souvenir de mes informations personnelles</label> </p> <input  type='submit' name='submit' value='Envoyer' /> <br /></form> ";

feuillecontent.innerHTML = feuillecontent.innerHTML.replace("Poster un commentaire","<hr />") + newformulaire;
if (valeurAuthorNickName) document.frmComment.rememberInfo.checked = 1;
}
}

function remplacerSmileys() {
SwapCodeEmoticon("leftbar","navlinks");
SwapCodeEmoticon("content","blogbody");
SwapCodeEmoticon("rightbar","navlinks");
}

addEvent(window, "load", remplacerSmileys);
addEvent(window, "load", modifierformulaire);