function changeImages() {
	for (var i=0; i<changeImages.arguments.length; i+=2) {
		document.getElementById(changeImages.arguments[i]).src = changeImages.arguments[i+1];
	}
}

function codeTouche(evenement)
{
        for (prop in evenement)
        {
                if(prop == 'which') return(evenement.which);
        }
        return(evenement.keyCode);
}

function scanTouche(evenement)
{
        var reCarValides = /[\w-_]/;
		var reCarSpeciaux = /[\x00\x08\x0D]/;
		
        var codeDecimal  = codeTouche(evenement);
        var car = String.fromCharCode(codeDecimal);
        var autorisation = reCarValides.test(car) || reCarSpeciaux.test(car);

        return autorisation;
}

function resize(DeltaWidth, DeltaHeight){
	w = document.pic.width;
	h = document.pic.height;
	window.resizeTo(w+DeltaWidth,h+DeltaHeight);
	focus();
}

function showTR(obj)
{
  var currentRow = obj;
  var tbl =  currentRow.parentNode;
  var rIndex = currentRow.sectionRowIndex + 1;
  var nextRow = tbl.rows[rIndex];
  if(tbl.rows[rIndex].style.display == "")
       tbl.rows[rIndex].style.display = "none";
  else
       tbl.rows[rIndex].style.display = "";
}

function showThisTR(obj)
{
  var currentRow = obj;
  var tbl =  currentRow.parentNode;
  var rIndex = currentRow.sectionRowIndex;
  var nextRow = tbl.rows[rIndex];
  if(tbl.rows[rIndex].style.display == "")
       tbl.rows[rIndex].style.display = "none";
  else
       tbl.rows[rIndex].style.display = "";
}

function showAdresseLivraison(Etat, tr)
{
	if (Etat)
		{document.getElementById(tr).style.display='none';}
	else
		{document.getElementById(tr).style.display='';}
}


function storeCaret (textEl)
{
if (textEl.createTextRange) 
textEl.caretPos = document.selection.createRange().duplicate();
alert(document.selection.createRange().duplicate());
}
function insertAtCaret (textEl, text)
{
if (textEl.createTextRange && textEl.caretPos)
{
var caretPos = textEl.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
}
else
textEl.value  = text;
}
