function classChange(elementid,newclass) {
	document.getElementById(elementid).className = newclass;
	}


function insertion(repdeb, repfin, formname, txtareaname) {
  var input = document.forms[formname].elements[txtareaname];
  input.focus();
  /* pour l'Explorer Internet */
  if(typeof document.selection != 'undefined') {
    /* Insertion du code de formatage */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = repdeb + insText + repfin;
    /* Ajustement de la position du curseur */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -repfin.length);
    } else {
      range.moveStart('character', repdeb.length + insText.length + repfin.length);
    }
    range.select();
  }
  /* pour navigateurs plus récents basés sur Gecko*/
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Insertion du code de formatage */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + repdeb + insText + repfin + input.value.substr(end);
    /* Ajustement de la position du curseur */
    var pos;
    if (insText.length == 0) {
      pos = start + repdeb.length;
    } else {
      pos = start + repdeb.length + insText.length + repfin.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
}


String.prototype.trim = function() {
	var a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
	};
	
	
var timeoutID;
function resizeImage(image,size,pixStep,timeStep)
	{
	clearTimeout(timeoutID);
	timeoutID = setTimeout("increaseSize(" + image.id + ", " + size + ", " + pixStep + ", " + timeStep + ")",timeStep);
	}

function increaseSize(image,size,pixStep,timeStep)
	{
	if (image.width != size)		// Tant que l'image n'a pas la bonne taille...
		{
		if (image.width > size)	// Si l'image est plus grande que voulu, on diminue la taille
			{
			if ((image.width - size) < pixStep) pixStep = (image.width - size);
			image.width = image.width - pixStep;
			}
		else						// Si l'image est plus petite que voulu, on augmente la taille
			{
			if ((size - image.width) < pixStep) pixStep = (size - image.width);
			image.width = image.width + pixStep;
			}
		timeoutID = setTimeout("increaseSize(" + image.id + ", " + size + ", " + pixStep + ", " + timeStep + ")",timeStep);
		}
	}			

