function addbookmark()
{
var bookmarkurl="http://www.centreequestrebelleriviere.com"
var bookmarktitle="Centre équestre Belle-rivière -- Favoriser l'harmonie entre le cavalier et le cheval"
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function NewWindow(u,n,w,h,f,p,x,y){var	ws=window.screen?1:0,m=Math,C='center',R='random',M='custom',sw=screen.availWidth,sh=screen.availHeight,T=(p==C&&ws)?(sh-h)/2:(p==R&&ws)?(m.floor(m.random()*(sh-h))):(p==M)?y:100,L=(p==C&&ws)?(sw-w)/2:(p==R&&ws)?(m.floor(m.random()*(sw-w))):(p==M)?x:100,s='width='+w+',height='+h+',top='+T+',left='+L;s+=(!f||f=='')?'':','+f;win=window.open(u,n,s);if(win.focus)win.focus();}


function Modifier_onclick(parametre)
{
 var parametreName = parametre.name;
 var effet = parametreName.charAt(0);
 var numero = parametreName.charAt(1);
   
 var range =  document.selection.createRange(); 
 var notreSelection = range.htmlText; 
 var sTextSelect = notreSelection;
 
 
 maDivisionNom = "Division" + numero;
 maDivision = document.getElementById(maDivisionNom);
 
 var sTextComplet = maDivision.innerHTML;

 var sFindTextSelect;
 var sFindTextSelect2;
 
 var cmptSelect;
 var cmptSelect2;
 
 var bFind = false;
 	
 if(notreSelection)
 {
  switch (effet)
  {
   case "B":
      maDivision.document.execCommand('bold', false, null);
	  break;
   case "I":
      maDivision.document.execCommand('italic', false, null);
	  break;
   case "U":
      maDivision.document.execCommand('underline', false, null);
	  break;
   case "P":      	   
	  maDivision.document.execCommand('InsertUnorderedList', false);       	
	 break;
   case "N":    
      maDivision.document.execCommand('ForeColor', false, '#000000');
	 break;
   case "R": 
      maDivision.document.execCommand('ForeColor', false, '#C0CDCB');
     break;	   
   case "V": 
      maDivision.document.execCommand('ForeColor', false, '#D6CE7B');
     break;	   
   case "L":
      maDivision.document.execCommand("CreateLink");
	  break;
  }
 }
 else
 {
  alert("Vous devez souligner une partie du texte.");
 }
}

function doCopDiv(cmpt,objet)
{
 var num;
 for (num = 1; num <= cmpt; num++)
 {     
	 maDivisionNom = "Division" + num;
	 maDivision = document.getElementById(maDivisionNom);
     maCopDivNom = "CopDiv" + num;
	 maCopDiv = document.getElementById(maCopDivNom);
	 strText = maDivision.innerHTML;
	 strText = FormaterText(strText);
	 maCopDiv.value = strText;
 }
 if (objet.value == "Soumettre")
 {
  if (confirm("Voulez-vous vraiment enregistrer les changements?"))
  {
   return true;
  }
 }
 else
 {
  if (confirm("Are you sure you want to save changes?"))
  {
   return true;
  }
 } 
 return false;
}

function FormaterText(strText)
{
 var maChaine = strText
 var monExpReg = /(<[/]P>\r\n<P>)/gi;
 maChaine = maChaine.replace(monExpReg, "<BR><BR>");
 monExpReg = /(<P>)/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(<[/]P>)/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(<STRONG>)/gi;
 maChaine = maChaine.replace(monExpReg, "<B>");
 monExpReg = /(<[/]STRONG>)/gi;
 maChaine = maChaine.replace(monExpReg, "</B>");
 monExpReg = /(<EM>)/gi;
 maChaine = maChaine.replace(monExpReg, "<I>");
 monExpReg = /(<[/]EM>)/gi;
 maChaine = maChaine.replace(monExpReg, "</I>");
 monExpReg = /([&]nbsp[;]|nbsp[;])/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(\r\n)/gi;
 maChaine = maChaine.replace(monExpReg, "");
 monExpReg = /(<A href)/gi;
 maChaine = maChaine.replace(monExpReg, "<A style='margin-left: 0px; margin-right: 0px; font-weight: bold' href"); 
 var OK = true;
 while (OK == true)
 {
  var longueur = maChaine.length;
  if (maChaine.substring(longueur - 4,longueur)=="<BR>")
  {
   maChaine = maChaine.substring(0,longueur - 4);
  }
  else
  {
   OK = false;  
  } 
 } 
 return maChaine; 
}

