<!--

function FBremoveModule(q,a,idM,idZ)
{

   resultat = confirm(q);
        if(resultat=="1")
        {
        window.document.formP.FB_ACTION_PROG.value  = a;
		window.document.formP.FB_ID_MODULE.value    = idM;
        window.document.formP.FB_ID_ZONE.value = idZ;
		
        window.document.formP.submit();
        }
}



function FBEtatFiche(q,idM,el,etat)
{  

		resultat = confirm(q);
        if(resultat=="1")
        {
        window.document.formP.FB_ACTION_PROG.value   = 'change_etat_fiche';
        window.document.formP.FB_ID.value        = el;
		window.document.formP.FB_ID_MODULE.value = idM;
        window.document.formP.FB_STATUS.value    = etat;

        window.document.formP.submit();
		 }
}

function FBEtatModule(q,idM,el,etat)
{  

		resultat = confirm(q);
        if(resultat=="1")
        {
        window.document.formP.FB_ACTION_PROG.value   = 'change_etat_module';
        window.document.formP.FB_ID.value        = el;
		window.document.formP.FB_ID_MODULE.value = idM;
        window.document.formP.FB_STATUS.value    = etat;

        window.document.formP.submit();
		 }
}

function FBEtatRubrique(q,idR,etat)
{  

		resultat = confirm(q);
        if(resultat=="1")
        {
        window.document.formP.FB_ACTION_PROG_OUTILS.value   = 'etat-rub';
        window.document.formP.FB_ID.value        = idR;
        window.document.formP.FB_STATUS.value    = etat;

        window.document.formP.submit();
		 }
}

function CleanWord( html )
{
	var bIgnoreFont = 1 ;
	var bRemoveStyles = 0 ;

	html = html.replace(/<o:p>\s*<\/o:p>/g, "") ;
	html = html.replace(/<o:p>.*?<\/o:p>/g, "&nbsp;") ;
	
	// Remove mso-xxx styles.
	html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ;

	// Remove margin styles.
	html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ;
	html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ;

	html = html.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ;
	html = html.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ;

	html = html.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ;

	html = html.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ;

	html = html.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ;

	html = html.replace( /\s*tab-stops:[^;"]*;?/gi, "" ) ;
	html = html.replace( /\s*tab-stops:[^"]*/gi, "" ) ;

	// Remove FONT face attributes.
	if ( bIgnoreFont )
	{
		html = html.replace( /\s*face="[^"]*"/gi, "" ) ;
		html = html.replace( /\s*face=[^ >]*/gi, "" ) ;

		html = html.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, "" ) ;
	}
	
	// Remove Class attributes
	html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;

	// Remove styles.
	if ( bRemoveStyles )
		html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ;

	// Remove empty styles.
	html =  html.replace( /\s*style="\s*"/gi, '' ) ;
	
	html = html.replace( /<SPAN\s*[^>]*>\s*&nbsp;\s*<\/SPAN>/gi, '&nbsp;' ) ;
	
	html = html.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ;
	
	// Remove Lang attributes
	html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
	
	html = html.replace( /<SPAN\s*>(.*?)<\/SPAN>/gi, '$1' ) ;
	
	html = html.replace( /<FONT\s*>(.*?)<\/FONT>/gi, '$1' ) ;

	// Remove XML elements and declarations
	html = html.replace(/<\\?\?xml[^>]*>/gi, "") ;
	
	// Remove Tags with XML namespace declarations: <o:p></o:p>
	html = html.replace(/<\/?\w+:[^>]*>/gi, "") ;
	
	html = html.replace( /<H\d>\s*<\/H\d>/gi, '' ) ;

	html = html.replace( /<H1([^>]*)>/gi, '<div$1><b><font size="6">' ) ;
	html = html.replace( /<H2([^>]*)>/gi, '<div$1><b><font size="5">' ) ;
	html = html.replace( /<H3([^>]*)>/gi, '<div$1><b><font size="4">' ) ;
	html = html.replace( /<H4([^>]*)>/gi, '<div$1><b><font size="3">' ) ;
	html = html.replace( /<H5([^>]*)>/gi, '<div$1><b><font size="2">' ) ;
	html = html.replace( /<H6([^>]*)>/gi, '<div$1><b><font size="1">' ) ;

	html = html.replace( /<\/H\d>/gi, '</font></b></div>' ) ;
	
	html = html.replace( /<(U|I|STRIKE)>&nbsp;<\/\1>/g, '&nbsp;' ) ;

	// Remove empty tags (three times, just to be sure).
	html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
	html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;
	html = html.replace( /<([^\s>]+)[^>]*>\s*<\/\1>/g, '' ) ;

	// Transform <P> to <DIV>
	var re = new RegExp("(<P)([^>]*>.*?)(<\/P>)","gi") ;	// Different because of a IE 5.0 error
	html = html.replace( re, "<div$2</div>" ) ;

	return html ;
} 
 
 
 
 
 
 
 
  // Retourne objet image
  function FBGetImg() {
    if (document.selection.type == "Control")
    {
      var tControl = document.selection.createRange();
      if (tControl(0).tagName == 'IMG' || (tControl(0).tagName == 'EMBED'))
        return(tControl(0));
      else
        return(null);
    }
    else
    {
      return(null);
    }
  }


function getImageHtml()
{
        var sHTML ;

              sHTML = '<IMG' ;
              sHTML = sHTML
                                + attr("src", "images/spacer.gif")
								+ attr("id", 'imgPreview')
								
                              //  + ((txtWidth.value)  ? attr("width" , txtWidth.value)  : "")
                              //  + ((txtHeight.value) ? attr("height", txtHeight.value) : "")
                              //  + ((txtVSpace.value) ? attr("vspace", txtVSpace.value) : "")
                              //  + ((txtHSpace.value) ? attr("hspace", txtHSpace.value) : "")
                              //  + ((txtBorder.value) ? attr("border", txtBorder.value) : attr("border",0))
                                + '/>' ;

       

	    return sHTML ;
}



  // Retourne objet IMG
  function FBGetImg() {
    if (document.selection.type == "Control")
    {
      var tControl = document.selection.createRange();
      if (tControl(0).tagName == 'IMG' || (tControl(0).tagName == 'EMBED'))
        return(tControl(0));
      else
        return(null);
    }
    else
    {
      return(null);
    }
  }
 
  // Retourne objet A 
   function FBGetA()
  {
          var aControl = document.selection.createRange();
    if (document.selection.type != "Control")
    {
            aControl = aControl.parentElement();
    }
    else
    {
            aControl = aControl(0);
    }

        while ((aControl.tagName != 'A') && (aControl.tagName != 'BODY'))
    {
      aControl = aControl.parentElement;
    }
    if (aControl.tagName == 'A')
      return(aControl);
    else
      return(null);
  }
 
	function attr(name, value)
	{
			if ( ( !value || value.length == 0 ) && name != 'alt' ) return '' ;
			return ' ' + name + '="' + value + '"' ;
	} 
	
	
	
function FBAddTextWord(r, w, h)
{

		 var FBValTmp = FBShowDialog("?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=6&RUBRIQUE_SLCT=" + r, window, w, h);
          
	
           if (FBValTmp)
        {
			
 		 tmpHtml = CleanWord( FBValTmp['CONTENU-WORD'] );
		 document.selection.createRange().pasteHTML(tmpHtml);
        window.focus();  
		
        }	

} 
 
 
 
 
 
 
 
 
 
  
function FBInsererImage(id, nom, l, h)
{ 


window.document.formulaire.IMG_URL.value = 0;
window.document.formulaire.IMG_ALT.value = '';
window.document.formulaire.IMG_ALIGN.value = '';


 if(FBGetImg()){
	 imgUrl = FBGetImg().src;
	 
	elUrl = imgUrl.match(/[\/]+([0-9]+[.]+[a-z]{2,4})/); 
		
		if(elUrl) P = elUrl[1];
		else P = 0;	
		
		window.document.formulaire.IMG_URL.value = P;
		window.document.formulaire.IMG_ALT.value = FBGetImg().alt;
		window.document.formulaire.IMG_ALIGN.value = FBGetImg().align;
		//FBGetImg().setAttribute("id" , 'imgPreview', 0) ;
       // FBGetImg().style.removeAttribute("height") ;
       // FBGetImg().style.removeAttribute("width") ;		
		
		 document.formulaire.INNER_HTML.value =  document.getElementById('TEXTE').innerHTML;  


}else{
	
   var saveHTML = document.getElementById('TEXTE').innerHTML;		
		
	
                //  sText.pasteHTML("654654654");

  

var sText = document.selection.createRange();



         if (sText != null) sText.pasteHTML(sText.htmlText + getImageHtml());

					
 
       
		
		
		    document.formulaire.INNER_HTML.value =  document.getElementById('TEXTE').innerHTML;   
	 document.getElementById('imgPreview').removeNode();
	
}


	hauteur=Math.round((screen.availHeight-h)/2);
    largeur=Math.round((screen.availWidth-l)/2);		
		
		

		window.open( "?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=5&ID_ZONE=" + id,nom, "scrollbars=no, height="+ h +",width="+ l  + ",top="+hauteur+",left="+largeur);
          
	
		

}




function FBSupprRubrique(q,a,idR)
{

   resultat = confirm(q);
        if(resultat=="1")
        {
        window.document.formP.FB_ACTION_PROG_OUTILS.value  = a;
		window.document.formP.FB_ID_RUBRIQUE.value  = idR;
		
        window.document.formP.submit();
        }
}

function FBRubrique(r, w, h)
{

		 var FBValTmp = FBShowDialog("?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=4&ID=" + r, window, w, h);
          
	
           if (FBValTmp)
        {
  
        document.formP.FB_ACTION_PROG_OUTILS.value         = FBValTmp['ACTION_PROG'];
        document.formP.FB_ID_RUBRIQUE_PARENT.value         = FBValTmp['ID_RUBRIQUE_PARENT'];		
		document.formP.FB_ID_CONFIGURATION.value           = FBValTmp['ID_CONFIGURATION'];			
        document.formP.FB_ID_RUBRIQUE.value                = FBValTmp['ID_RUBRIQUE'];
        document.formP.FB_TITRE.value                      = FBValTmp['TITRE'];
        document.formP.FB_META_KEYWORDS.value              = FBValTmp['META_KEYWORDS'];
        document.formP.FB_META_DESCRIPTION.value           = FBValTmp['META_DESCRIPTION'];
        document.formP.FB_ID_TEMPLATE.value                = FBValTmp['ID_TEMPLATE'];
        document.formP.FB_STATUS.value                     = FBValTmp['STATUS'];


        document.formP.submit();
        window.focus();  
		
        }	

}

function FBPlanDuSite(id, nom, format)
{



                        openWindow( "?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=3&ID_ZONE=" + id,nom,format);

}

function FBInsererLien(id, nom, l, h)
{ 
	
	 if(!FBGetImg()){

	
	         var r = document.selection.createRange();

        if (r != null) html = r.htmlText; 	   
		
        elUrl = html.match(/([http]+[/:/]+[\///])+(.+)?([/\./]+[a-z]{2,4})+([/?]+(VPID))+([=])+([0-9]{1,4})/);
		if(elUrl) P = elUrl[7];
		else P = 0;
		
	 
	hauteur=Math.round((screen.availHeight-h)/2);
    largeur=Math.round((screen.availWidth-l)/2);		
				window.open( "?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=3&ID_ZONE=" + id+ "&RUBRIQUE_SLCT=" + P,nom, "scrollbars=no, height="+ h +",width="+ l  + ",top="+hauteur+",left="+largeur);

	 }else{
		 
	 // A faire : Insérer lien sur une image
		 
	 }
		
          
	
		

}





function FBAjouterModule(id, nom, format)
{

                        openWindow( "?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=1&ID_ZONE=" + id,nom,format);

}


function FBAjouterTemplate(id, nom, format)
{

                        openWindow( "?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=6&ID_ZONE=" + id,nom,format);

}



function FBModifModule(idM, idZ, idR, idP, w, h)
{


            var FBValTmp = FBShowDialog("?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=2&ID_MODULE=" + idM + "&ID_Z=" + idZ + "&ID_R=" + idR + "&ID_PAGE=" + idP, window, w, h);


           if (FBValTmp)
        {

        document.formP.FB_ACTION_PROG.value                      = FBValTmp['ACTION_PROG'];
        document.formP.FB_ID_MODULE.value                          = idM;
        document.formP.FB_ID_ZONE.value                        = FBValTmp['ID_ZONE'];
        document.formP.FB_TITRE.value                                = FBValTmp['TITRE'];
        document.formP.FB_META_KEYWORDS.value              = FBValTmp['META_KEYWORDS'];
        document.formP.FB_META_DESCRIPTION.value           = FBValTmp['META_DESCRIPTION'];
        document.formP.FB_ACCES_RAPIDE_NBR_LIGNES.value    = FBValTmp['ACCES_RAPIDE_NBR_LIGNES'];
        document.formP.FB_NBR_RESULTAT_PAR_PAGE.value      = FBValTmp['NBR_RESULTAT_PAR_PAGE'];
        document.formP.FB_ID_TEMPLATE.value                = FBValTmp['ID_TEMPLATE'];
		document.formP.FB_ILLUSTRATION_RUBRIQUE.value                = FBValTmp['ILLUSTRATION_RUBRIQUE'];
        document.formP.FB_STATUS.value                               = FBValTmp['STATUS'];
        document.formP.FB_FIXE.value                               = FBValTmp['FIXE'];

        document.formP.submit();
        window.focus();
        }

}





function FBModifModuleNormal(idM, idZ, idR, idP, l, h, nom)
{



	hauteur=Math.round((screen.availHeight-h)/2);
    largeur=Math.round((screen.availWidth-l)/2);		

		window.open("?FB_TYPE_PAGE=outils&FB_P=outils&FENETRE=2&ID_MODULE=" + idM + "&ID_Z=" + idZ + "&ID_R=" + idR + "&ID_PAGE=" + idP, nom, "scrollbars=no, height="+ h +",width="+ l  + ",top="+hauteur+",left="+largeur);


}
//-->