var xCurrentItem=0;

function xOpenItem(xId,xTitre,xImage,xText) {
	if (xCurrentItem != 0) {
		xMouseOut("itemImg"+xCurrentItem);
	}
	xCurrentItem = xId;
	xContenu = xGetObject('divContenu');
	xPreFooter = xGetObject('divPreFooter');
	xContenu.innerHTML = "<img src='" + xImage + "' alt='" + xTitre + "' width='650' border='0'/>";
	xPreFooter.innerHTML = xText;
}

function xMenuThumbOver(xMenuItem) {
	xId = xGetNumByName(xMenuItem.id,"itemImg");
	if (xId != xCurrentItem) {
		xMouseOver(xMenuItem);
	}
}
function xMenuThumbOut(xMenuItem) {
	if (xId != xCurrentItem) {
		xMouseOut(xMenuItem);
	}
}

function xItemsOut() {

}

function xGetNumByName(xString,xName)
{
	var xRegExp = new RegExp("^"+xName, "i") 
	var xNum = xString.replace(xRegExp,"");
	return xNum;
}

// Keep user from entering more than maxLength characters
function doKeypress(control){
    maxLength = control.attributes["maxLength"].value;
    value = control.value;
     if(maxLength && value.length > maxLength-1){
          event.returnValue = false;
          maxLength = parseInt(maxLength);
     }
}
// Cancel default behavior
function doBeforePaste(control){
    maxLength = control.attributes["maxLength"].value;
     if(maxLength)
     {
          event.returnValue = false;
     }
}
// Cancel default behavior and create a new paste routine
function doPaste(control){
    maxLength = control.attributes["maxLength"].value;
    value = control.value;
     if(maxLength){
          event.returnValue = false;
          maxLength = parseInt(maxLength);
          var oTR = control.document.selection.createRange();
          var iInsertLength = maxLength - value.length + oTR.text.length;
          var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
          oTR.text = sData;
     }
}