var undefine;var oldnode;var newnode;var lastColor = "#000000";var oldColor;var selectedPhase = 0;var refShowPalette = "CHECK";var currentPhase = 0;ToolUtl = {	submitAddPage : function( max )	{				var nbpage = document.getElementById('pagenumber').value		var nmax = parseInt(nbpage , 10 ) + max		if( 18 <  nmax )		{			alert( CUSTOMCHECK_MAX_NUMBER_PAGE );			return;		} 		for( ipage = 1 ; ipage <= nbpage ; ipage++ )		{			if( document.getElementById('title'+ipage).value == '')			{				alert( CUSTOMCHECK_PHASE_TITLE );				document.getElementById('title'+ipage).focus();				return;			}		}						document.getElementById('frm_new_page_action').value = 1;		document.getElementById('frm_new_page').submit();	}	,	showHideAddPhase : function() 	{		if( document.getElementById('toolFiltre').style.display == 'none')		{		    document.getElementById('toolFiltre').style.display = ''		    document.getElementById('toolFiltre').style.zIndex = 1002		    document.getElementById('addPhase').style.display = ''		    document.getElementById('addPhase').style.zIndex = 1002		}		else		{			document.getElementById('toolFiltre').style.display = 'none'		    document.getElementById('addPhase').style.display = 'none'		}	},	changenbPagePage : function()	{		var nbpage = document.getElementById('pagenumber').value;				if( nbpage == 2 )		{			document.getElementById('tr_type_1').style.display = '';			document.getElementById('tr_type_2').style.display = '';			document.getElementById('tr_type_3').style.display = 'none';			document.getElementById('tr_type_4').style.display = 'none';		}		else if( nbpage == 4 )		{			document.getElementById('tr_type_1').style.display = '';			document.getElementById('tr_type_2').style.display = '';			document.getElementById('tr_type_3').style.display = '';			document.getElementById('tr_type_4').style.display = '';		}			},	showHideToolCol : function() 	{		if( document.getElementById('toolFiltre').style.display == 'none')		{		    document.getElementById('toolFiltre').style.display = ''		    document.getElementById('toolFiltre').style.zIndex = 1002		    document.getElementById('addchecklist').style.display = ''		    document.getElementById('addchecklist').style.zIndex = 1002		}		else		{			document.getElementById('toolFiltre').style.display = 'none'		    document.getElementById('addchecklist').style.display = 'none'		}	},		showHideToolColByCode : function() 	{		if( document.getElementById('toolFiltre').style.display == 'none')		{		    document.getElementById('toolFiltre').style.display = ''		    document.getElementById('toolFiltre').style.zIndex = 1002		    document.getElementById('addchecklistcode').style.display = ''		    document.getElementById('addchecklistcode').style.zIndex = 1002		}		else		{			document.getElementById('toolFiltre').style.display = 'none'		    document.getElementById('addchecklistcode').style.display = 'none'		}	},			showHideInscriptionLog : function( target ) 	{		if( document.getElementById('tr_inscription').style.display == 'none' && target =='tr_inscription' )		{			document.getElementById('tr_inscription').style.display = ''			document.getElementById('tr_login').style.display = 'none'			document.getElementById('tr_sendpass').style.display = 'none'						document.getElementById('img_inscription').src = '_img/folderopen.gif'			document.getElementById('img_login').src = '_img/folder.gif'			document.getElementById('img_sendpass').src = '_img/folder.gif'		}		else if ( document.getElementById('tr_login').style.display == 'none' && target =='tr_login' )		{			document.getElementById('tr_inscription').style.display = 'none'			document.getElementById('tr_login').style.display = ''			document.getElementById('tr_sendpass').style.display = 'none'						document.getElementById('img_inscription').src = '_img/folder.gif'			document.getElementById('img_login').src = '_img/folderopen.gif'			document.getElementById('img_sendpass').src = '_img/folder.gif'		}		else if ( document.getElementById('tr_sendpass').style.display == 'none' && target =='tr_sendpass' )		{			document.getElementById('tr_inscription').style.display = 'none'			document.getElementById('tr_login').style.display = 'none'			document.getElementById('tr_sendpass').style.display = ''									document.getElementById('img_inscription').src = '_img/folder.gif'			document.getElementById('img_login').src = '_img/folder.gif'			document.getElementById('img_sendpass').src = '_img/folderopen.gif'		}	}	,	showHideProfil : function( target ) 	{		if( document.getElementById('tr_inscription').style.display == 'none' && target =='tr_inscription' )		{			document.getElementById('tr_inscription').style.display = ''			document.getElementById('tr_updatepass').style.display = 'none'						document.getElementById('img_inscription').src = '_img/folderopen.gif'			document.getElementById('img_updatepass').src = '_img/folder.gif'		}		else if ( document.getElementById('tr_updatepass').style.display == 'none' && target =='tr_updatepass' )		{			document.getElementById('tr_inscription').style.display = 'none'			document.getElementById('tr_updatepass').style.display = ''						document.getElementById('img_inscription').src = '_img/folder.gif'			document.getElementById('img_updatepass').src = '_img/folderopen.gif'		}	}	,	ChangeStep : function()	{		var param = new Array();		document.getElementById('check_before').innerHTML = '';		param[0] = ['id_step', document.getElementById('step_check').value ];		_AJAX.GetXmlResponse('includes/listCheck.php' , 'POST' , 'text' , 'ToolUtl.listCheck' ,  param );	}	,	verifCheck : function() 	{		if( document.getElementById('step_check').value == 0 )		{			alert( CUSTOMCHECK_SELECT_CHECK );			return false;		}		document.getElementById('addCheck').submit();	},		listCheck : function ( response ) 	{		document.getElementById('check_before_div').innerHTML  = response;	}	,	verifCheckList : function() 	{		if( document.getElementById('sc_checklist_member') && document.getElementById('sc_checklist_member').value != -1 )		{			document.getElementById('sc_checklist').value = document.getElementById('sc_checklist_member').value;		}				if( document.getElementById('sc_checklist_gene').value != -1 )		{			document.getElementById('sc_checklist').value = document.getElementById('sc_checklist_gene').value;		}				if( document.getElementById('sc_checklist').value == 0 )		{			alert( CUSTOMCHECK_SELECT_MODELE );			return false;		}						if( document.getElementById('sc_appareil').value == '' )		{			alert(CUSTOMCHECK_TYPE_APPAREIL);			return false;		}		/*if( document.getElementById('sc_code').value == '' )		{			alert('Renseigner une immatriculation !');			return false;		}*/		/*		if( document.getElementById('sc_pilote').value == '' )		{			alert('Renseigner un pilote !');			return false;		}*/		/*if( document.getElementById('sc_puissance').value == '' )		{			alert('Renseigner une puissance !');			return false;		}*/				document.getElementById('selectCheck').submit();	}	,	ConfirmDelete: function ( url )	{		if( confirm(CUSTOMCHECK_CONFIRM_DELETE) )		{ 			document.location.href= url;		}	}	,	ConfirmDeleteCheck: function ( url , event )	{		if( confirm( CUSTOMCHECK_CONFIRM_DELETE ) )		{ 			document.location.href= url + "&x="+event.clientX +"&y="+event.clientY;		}	}	,	ConfirmCommande: function ( url )	{		if( confirm( CUSTOMCHECK_CONFIRM_VALID_CL ) )		{ 			document.location.href= url;		}	}	,	AddCheck : function ( idcheckbefore , idphase , isStep )	{				if( document.getElementById("lstcheck").childNodes.length >= 52 )		{			alert( CUSTOMCHECK_LIMIT_NBLINE );			return;		}		//Si un check était en modification		if( oldnode !=  undefine )		{			document.getElementById("lstcheck").replaceChild( oldnode , document.getElementById( oldnode.id ) );		}		//Si un check était en Creation		if( document.getElementById("ck_add") )		{			document.getElementById("lstcheck").removeChild( document.getElementById("ck_add") );		}			var tr_node = document.createElement("tr");		tr_node.setAttribute('id' , "ck_add" );		tr_node.setAttribute('class' , "trRow");		tr_node.className="trRow";		var td_valid = document.createElement("td");		td_valid.setAttribute('align' , "left");		td_valid.setAttribute("colspan" , "7");		td_valid.setAttribute("nowrap" , "true");		td_valid.setAttribute("width" , "100%");		td_valid.colSpan = "7";		td_valid.nowrap="true";		td_valid.align="left";		td_valid.width="100%"; 		td_valid.innerHTML = 		"<INPUT TYPE=\"text\" onkeypress=\"ToolUtl.ValidWidth(this , event , 'ToolUtl.ValidAddCheck(" + idcheckbefore + " , " + idphase + " , event )' );\" name=\"order\" MAXLENGTH=\"100\" size=\"40\" id=\"order\" value=\"\"/>&nbsp;\		<INPUT TYPE=\"text\" name=\"lock\" onkeypress=\"ToolUtl.ValidWidth(this, event, 'ToolUtl.ValidAddCheck(" + idcheckbefore + " , " + idphase + " , event )' );\" id=\"lock\" MAXLENGTH=\"100\" size=\"25\" value=\"\"/>&nbsp;\		<select class=\"selectStyle\" name=\"style\" id=\"style\">\			<option value='2'>Txt. std</option>\			<option value='1'>Titre</option>\		</select>\		<img align=\"absmiddle\" title=\"Couleur du texte\" alt=\"Couleur du texte\" src=\"_img/textcolor.gif\" style=\"cursor:pointer\" onclick=\"ToolUtl.ShowPalette(this , 'backcolor' , 'CHECK' );\"/>\		<img src='_img/Editer_20.gif' onclick='ToolUtl.ValidAddCheck(" + idcheckbefore + " , " + idphase + " , event )' align=\"absmiddle\" style=\"cursor:pointer\" border=\"0\"/>\		&nbsp;<img src='_img/Supprimer_20.gif' align=\"absmiddle\" style=\"cursor:pointer\" border=\"0\" onclick='ToolUtl.AnnulCheck()'/>";				tr_node.appendChild(td_valid);				var before;		if( isStep )			before = document.getElementById("st_" + idphase ).nextSibling;		else			before = document.getElementById("ck_" + idcheckbefore ).nextSibling;					document.getElementById("lstcheck").insertBefore( tr_node , before );		document.getElementById("order").focus();				ToolUtl.fctHide();		ToolUtl.fctHideBG();		ToolUtl.AnnulPhase();	}	,	UpdateCheck : function ( idcheck , color )	{		//alert( "color =" +color );		if( oldnode !=  undefine )		{			document.getElementById("lstcheck").replaceChild( oldnode , document.getElementById( oldnode.id ) );		}		if( document.getElementById("ck_add") )		{			document.getElementById("lstcheck").removeChild( document.getElementById("ck_add") );		}		oldnode = document.getElementById("ck_" + idcheck );				var tr_node = document.createElement("tr");		tr_node.setAttribute('id' , "ck_" + idcheck );		tr_node.setAttribute('class' , "trRow");		tr_node.className="trRow";		var td_valid = document.createElement("td");		td_valid.setAttribute('align' , "left");		td_valid.setAttribute("colspan" , "7");		td_valid.setAttribute("nowrap" , "true");		td_valid.setAttribute("width" ,"100%" );		td_valid.width="100%";		td_valid.colSpan = "7"; 		td_valid.nowrap ="true";		td_valid.align="left";				lastColor = color;				//alert( oldnode.innerHTML );				if( oldnode.childNodes[1].className == 'Step' || oldnode.childNodes[1].getAttribute("class") == 'Step' )			td_valid.innerHTML = 			"<INPUT TYPE=\"text\" style=\"color:"+color+"\" onkeypress=\"ToolUtl.ValidWidth(this, event , 'ToolUtl.ValidCheck("+idcheck+")'  );\" name=\"order\" MAXLENGTH=\"100\" size=\"40\" id=\"order\" value=\"\"/>&nbsp;\			<INPUT TYPE=\"text\" style=\"color:"+color+"\" name=\"lock\" onkeypress=\"ToolUtl.ValidWidth(this, event , 'ToolUtl.ValidCheck("+idcheck+")' );\" id=\"lock\" MAXLENGTH=\"100\" size=\"25\" value=\"\"/>&nbsp;\			<select class=\"selectStyle\" name=\"style\" id=\"style\">\				<option value='2' >Txt. std</option>\				<option value='1' selected='true'>Titre</option>\			</select>\			<img align=\"absmiddle\" title=\"Couleur du texte\" alt=\"Couleur du texte\" src=\"_img/textcolor.gif\" style=\"cursor:pointer\" onclick=\"ToolUtl.ShowPalette(this , 'backcolor' , 'CHECK');\"/>\			<img src='_img/Editer_20.gif' align='absmiddle' style=\"cursor:pointer\" onclick='ToolUtl.ValidCheck("+idcheck+")' border=\"0\"/>&nbsp;\			<img src='_img/Supprimer_20.gif' style=\"cursor:pointer\" onclick='ToolUtl.AnnulCheck()' align='absmiddle' border=\"0\"/>";		else			td_valid.innerHTML = 			"<INPUT TYPE=\"text\" style=\"color:"+color+"\" onkeypress=\"ToolUtl.ValidWidth(this, event , 'ToolUtl.ValidCheck("+idcheck+")' );\" name=\"order\" MAXLENGTH=\"100\" size=\"40\" id=\"order\" value=\"\"/>&nbsp;\			<INPUT TYPE=\"text\" style=\"color:"+color+"\" name=\"lock\" onkeypress=\"ToolUtl.ValidWidth(this, event , 'ToolUtl.ValidCheck("+idcheck+")'  );\" id=\"lock\" MAXLENGTH=\"100\" size=\"25\" value=\"\"/>&nbsp;\			<select class=\"selectStyle\" name=\"style\" id=\"style\">\				<option value='2'  selected='true'>Txt. std</option>\				<option value='1'>Titre</option>\			</select>\			<img align=\"absmiddle\" title=\"Couleur du texte\" alt=\"Couleur du texte\" src=\"_img/textcolor.gif\" style=\"cursor:pointer\" onclick=\"ToolUtl.ShowPalette(this , 'backcolor' , 'CHECK');\"/>\			<img src='_img/Editer_20.gif' style=\"cursor:pointer\" align=\"absmiddle\" onclick='ToolUtl.ValidCheck("+idcheck+")' border=\"0\"/>&nbsp;\			<img src='_img/Supprimer_20.gif' align=\"absmiddle\" style=\"cursor:pointer\" onclick='ToolUtl.AnnulCheck()' border=\"0\"/>";		tr_node.appendChild(td_valid);				document.getElementById("lstcheck").replaceChild( tr_node , document.getElementById("ck_" + idcheck ) );				//IE		if(document.all)		{			document.getElementById('order').value = oldnode.childNodes[0].innerText;		}		else //Fire fox		{			document.getElementById('order').value = oldnode.childNodes[0].textContent;		}		 		if( oldnode.childNodes.length >= 6 )		{			//IE			if(document.all)			{				document.getElementById('lock').value= oldnode.childNodes[1].innerText;			}			else //Fire fox			{				document.getElementById('lock').value = oldnode.childNodes[1].textContent;			}		}				document.getElementById("order").focus();				ToolUtl.fctHide();		ToolUtl.fctHideBG();		ToolUtl.AnnulPhase();	}	,	UpdatePhase : function( idphasecustom , color )	{		currentPhase = idphasecustom;		var strPhase;		//IE		if(document.all)		{			strPhase = document.getElementById('phase_'+idphasecustom).innerText;		}		else //Fire fox 		{			strPhase = document.getElementById('phase_'+idphasecustom).textContent;		}		lastColor = color;		oldColor = color;		/*alert( "lastColor = "+lastColor );		alert( "oldColor = "+oldColor );*/		document.getElementById('phase_'+idphasecustom).innerHTML =  			"<FORM id=\"frm_upd_phase\" action=\"index.php?page=phase&phase="+idphasecustom+"\" method=\"POST\"> \				<INPUT TYPE=\"hidden\" name=\"frm_updatephase\" value=\"" + idphasecustom + "\">\				<INPUT TYPE=\"hidden\" name=\"frm_updatephase_idphase\" value=\"" + idphasecustom + "\">\				<INPUT TYPE=\"hidden\" id=\"frm_updatephase_phaseName\" name=\"frm_updatephase_phaseName\" value=\"" + strPhase + "\">\				<INPUT TYPE=\"hidden\" name=\"frm_updatephase_color\" id=\"frm_updatephase_color\" value=\"" + color + "\">\			</FORM>\				<INPUT TYPE=\"text\" onkeypress=\"ToolUtl.ValidWidthPhase(this, event );\" MAXLENGTH=\"100\" size=\"40\" name=\"phaseName\" id=\"phaseName\" value=\""+strPhase+"\"/>&nbsp;\				<img align=\"absmiddle\" title=\"Changer la couleur du fond\" alt=\"Changer la couleur du fond\" src=\"_img/bgcolor.gif\" style=\"cursor:pointer\" onclick=\"ToolUtl.ShowPalette( this , 'backcolor' , 'PHASE');\"/>\				<img src='_img/Editer_20_trans.gif' align='absmiddle' style=\"cursor:pointer\" onclick='ToolUtl.SubmitPhase()' border=\"0\"/>&nbsp;\				<img src='_img/Supprimer_20_trans.gif' style=\"cursor:pointer\" onclick='ToolUtl.AnnulUpdatePhase( "+idphasecustom+" , event )' align='absmiddle' border=\"0\"/>\			";					document.getElementById('phase_'+idphasecustom).onclick=""; 		document.getElementById('phaseName').focus();				selectedPhase = 'phase_'+idphasecustom;		ToolUtl.fctHide();		ToolUtl.fctHideBG();		ToolUtl.AnnulCheck();	}	,	SubmitPhase : function()	{		if( ToolUtl.ValidWidthPhase( document.getElementById("phaseName") ) )		{					document.getElementById("frm_updatephase_phaseName").value = document.getElementById("phaseName").value;			document.getElementById("frm_updatephase_color").value = lastColor;			document.getElementById("frm_upd_phase").submit();		}			}	,	ValidWidthPhase : function( obj ,event )	{					strPhase = obj.value;		width = ToolUtl.FontWidth( strPhase );						//alert( width);		if( width > 134 ) 		{			alert( CUSTOMCHECK_PHASE_TITLE_LENGHT );			str = obj.value;			obj.value =  str.substring(0, str.length - 3 );			obj.focus();			return false;		}				if( event && event.keyCode == 13 )		{			if( strPhase == "" || strPhase == undefined )			{				alert( CUSTOMCHECK_PHASE_TITLE );				obj.focus();				return false;			}			document.getElementById("frm_updatephase_phaseName").value = document.getElementById("phaseName").value;			document.getElementById('frm_upd_phase').submit();			//alert("GO" + func);		}		return true;	}	,	AnnulUpdatePhase : function( idphasecustom , event ) 	{		var strphase = document.getElementById("frm_updatephase_phaseName").value; 		document.getElementById('phase_'+idphasecustom).innerHTML = strphase;		// event est l'objet Event		if (event.stopPropagation) event.stopPropagation();		event.cancelBubble = true;				document.getElementById( selectedPhase ).style.backgroundColor ='';		document.getElementById('phase_'+idphasecustom).onclick = function(){ ToolUtl.UpdatePhase(idphasecustom , oldColor ) };		//alert(document.getElementById('phase_'+idphasecustom).onclick );	}	,	AnnulPhase : function() 	{		if( document.getElementById("frm_updatephase_phaseName") )		{			var strphase = document.getElementById("frm_updatephase_phaseName").value; 			document.getElementById('phase_'+currentPhase).innerHTML = strphase;			document.getElementById( selectedPhase ).style.backgroundColor ='';			document.getElementById('phase_'+currentPhase).onclick = function(){ ToolUtl.UpdatePhase( currentPhase , oldColor ) };		}	}	,	AnnulCheck : function ()	{		if( oldnode !=  undefine )		{			document.getElementById("lstcheck").replaceChild( oldnode , document.getElementById( oldnode.id ) );			oldnode = undefine;		}				if( document.getElementById("ck_add") )		{			document.getElementById("lstcheck").removeChild( document.getElementById("ck_add") );		}		ToolUtl.fctHide();		ToolUtl.fctHideBG();			}	,	ValidCheck : function( idcheck )	{						if( ToolUtl.ValidWidth() )		{			var param = new Array();			var style = 0;			var cls ="Step";			if( document.getElementById('style').value == 1 )			{				cls = "Step";				style = 1;			}			else			{				cls = "";				style = 2;			}												param[0] = ['order', document.getElementById('order').value ];			param[1] = ['lock', document.getElementById('lock').value ];			param[2] = ['idcheck', idcheck ];			param[3] = ['style', style ];			param[4] = ['color',  lastColor ];						oldnode.childNodes[0].setAttribute('class' , cls );			oldnode.childNodes[1].setAttribute('class' , cls );						oldnode.childNodes[0].className = cls;			oldnode.childNodes[1].className = cls;						oldnode.childNodes[0].style.color = lastColor;			oldnode.childNodes[1].style.color = lastColor;						//alert( oldnode.childNodes[3].onclick ); 						eval("var locColor_"+ idcheck+" = lastColor");			//alert( eval("locColor_"+ idcheck ) );			oldnode.childNodes[0].onclick = function onclick(event) {				ToolUtl.UpdateCheck( idcheck , eval("locColor_"+ idcheck ) );			}			oldnode.childNodes[1].onclick = function onclick(event) {				ToolUtl.UpdateCheck( idcheck , eval("locColor_"+ idcheck ) );			}			oldnode.childNodes[3].onclick = function onclick(event) {				ToolUtl.UpdateCheck( idcheck , eval("locColor_"+ idcheck ) );			}						oldnode.childNodes[0].innerHTML = document.getElementById('order').value;			oldnode.childNodes[1].innerHTML = document.getElementById('lock').value;			//alert(lastColor);			//alert(oldnode.innerHTML);						document.getElementById("lstcheck").replaceChild( oldnode , document.getElementById( oldnode.id ) );			_AJAX.GetXmlResponse('includes/UpdateCheck.php' , 'POST' , 'text' , '' ,  param );						oldnode = undefined;			ToolUtl.fctHide();			ToolUtl.fctHideBG();		}	}	,	ValidAddCheck : function ( idcheckBefore ,  idphase , event )	{				if( ToolUtl.ValidWidth() )		{			document.getElementById("ic_idphase").value =idphase;			document.getElementById("ic_checkbefore").value = idcheckBefore; 			document.getElementById('ic_order').value = ToolUtl.trim( document.getElementById('order').value );			document.getElementById('ic_lock').value = ToolUtl.trim( document.getElementById('lock').value );			document.getElementById('ic_x').value = event.clientX;			document.getElementById('ic_y').value = event.clientY;			document.getElementById('ic_scto').value = 'ck_'+ idcheckBefore; 			//alert( lastColor ); 			document.getElementById('ic_color').value = lastColor;			//document.getElementById('order').style.color;						if( document.getElementById('style').value == 1 ) document.getElementById('ic_style').value =1;			if( document.getElementById('style').value == 2 ) document.getElementById('ic_style').value =2;						document.getElementById('addCheck').submit();		}		ToolUtl.fctHide();		ToolUtl.fctHideBG();			}	,	ValidWidth : function( obj ,event , func )	{		strOrder = document.getElementById('order').value;		strLock =  document.getElementById('lock').value ;		width = ToolUtl.FontWidth( strOrder ) + ToolUtl.FontWidth( strLock );				if( width > 301 )		{			alert( CUSTOMCHECK_CHECK_LENGHT );			if( obj ) id = obj.id;						if( obj && obj.value )			{				str = obj.value;				obj.value =  str.substring(0, str.length - 3 );				obj.focus();			}			else if( strOrder != "" )			{				document.getElementById('order').value = strOrder.substring(0, strOrder.length - 3 );				document.getElementById('order').focus();			}			else if ( strLock != "" )			{				document.getElementById('lock').value = strLock.substring(0, strLock.length - 3 );				document.getElementById('lock').focus();			}			return false;		}		if( event && event.keyCode == 13 )		{			eval(func);		}						/*strOrder = ToolUtl.trim( document.getElementById('order').value );			if( ToolUtl.FontWidth( strOrder ) > 170 )			{				alert('Le texte de l\'instruction est trop long il ne pourra être éditer !');				document.getElementById('order').value = strOrder.substring(0, strOrder.length - 3 );				document.getElementById('order').focus();				return false;			}						strLock = ToolUtl.trim( document.getElementById('lock').value );			if( ToolUtl.FontWidth( strLock ) > 103 )			{				alert('Le texte de validation est trop long il ne pourra être éditer !');				document.getElementById('lock').value = strLock.substring(0, strLock.length - 3 );				document.getElementById('lock').focus();				return false;			}		if(  ToolUtl.trim(document.getElementById('lock').value) != ''  )		{		}		else		{			strOrder = ToolUtl.trim( document.getElementById('order').value );			if( ToolUtl.FontWidth( strOrder ) > 270 )			{				alert('Le texte de l\'instruction est trop long il ne pourra être éditer !');				document.getElementById('order').value = strOrder.substring(0, strOrder.length - 3 );				document.getElementById('order').focus();				return false;			}		}*/		return true;	}	,	ValidContact : function ()	{		if( document.getElementById("c_nom").value =='' )		{			alert( CUSTOMCHECK_NAME_MAND );			return false;		}					if( document.getElementById("c_mail").value =='' )		{			alert( CUSTOMCHECK_MAIL_MAND );			return false;		}				if( document.getElementById("c_objet").value =='' )		{			alert( CUSTOMCHECK_OBJECT_MAND );			return false;		}				if( document.getElementById("c_text").value =='' )		{			alert( CUSTOMCHECK_MESSAGE_MAND );			return false;		}		document.getElementById('frm_contact').submit();	}	,	ValidCommandStep1 : function ()	{		if( document.getElementById("cmd_checklist").value == '0' )		{			alert( CUSTOMCHECK_SELECT_CL );			return false;		}		var quantity = document.getElementById("cmd_quantity").value;		if( ! this.IsNumeric( quantity ) || quantity == '' )		{			document.getElementById("cmd_quantity").value='';			document.getElementById("cmd_quantity").focus();			alert( CUSTOMCHECK_QUANTITY_FORMAT );			return false;		}		document.getElementById('frm_cmdstep1').submit();	}	,	ValidPreCommandStep1 : function ()	{		if( document.getElementById("cmdpre_checklist").value == '0' )		{			alert( CUSTOMCHECK_SELECT_CL );			return false;		}				if( confirm( CUSTOMCHECK_VALID_COMMAND ) )			document.getElementById('frm_precmdstep1').submit();		else			return false;			}	,	IsNumeric : function(sText)	{		var ValidChars = "0123456789";		for (i = 0; i < sText.length; i++) 		{ 			if (ValidChars.indexOf( sText.charAt(i) ) == -1) 			{				return false;			}		}		return true;	}	,	FontWidth : function( text )	{		var h = document.getElementsByTagName("BODY")[0];		var d = document.createElement("DIV");		var s = document.createElement("SPAN");		d.appendChild(s);		d.style.fontFamily = "verdana";		//font for the parent element DIV.		s.style.fontFamily = "verdana";		//arial font used as a comparator.		s.style.fontSize   = "8pt";			//we test using 72px font size, we may use any size. I guess larger the better.		text1 = text.replace(/ /g , "v");		//s.innerHTML = text;		s.innerHTML        = text1;	//ToolUtl.trim()	//we use m or w because these two characters take up the maximum width. And we use a L so that the same matching fonts can get separated		h.appendChild(d);		var defaultWidth   = s.offsetWidth;		//now we have the defaultWidth		var defaultHeight  = s.offsetHeight;	//and the defaultHeight, we compare other fonts with these.		h.removeChild(d);				return defaultWidth;	}	,	trim : function (str)	{		if(! str || typeof str != 'string')	        return '';	    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');	}	,	validCondVente : function()	{		if( ! document.getElementById('ck_cond_vente').checked )		{			alert( CUSTOMCHECK_VALID_CG );			return false;		}		document.getElementById('frm_pay').submit();	}	, 	open_cgv : function(url) 	{       var w = window.open(url,"nom_popup","top=150, left=150, menubar=no, status=no, scrollbars=yes, menubar=no,location=no, width=500, height=500");	   w.focus();	}	,	ScrollToElement: function( idElement , x , y ) 	{				theElement = document.getElementById(idElement);		var selectedPosX = 0;		var selectedPosY = 0;              		while(theElement != null)		{			selectedPosX += theElement.offsetLeft;			selectedPosY += theElement.offsetTop;			theElement = theElement.offsetParent;					} 		//alert( event);		//alert("Y="+event.pageX );		window.scrollTo(selectedPosX - x ,selectedPosY - y );			}	,	goUrlPos:function (url, event )	{		document.location.href = url + "&x="+event.clientX +"&y="+event.clientY;	},		checkS : function (event)	{		alert("Y="+event.clientX );	}		,printScroll : function( idElement ) 	{		theElement = document.getElementById(idElement);		alert( "clientheight"+ theElement.clientHeight );		alert( "offsetHeight "+ theElement.offsetHeight );		alert( "mouseX  "+ ToolUtl.mouseX() );		alert( "mouseY  "+ ToolUtl.mouseY() );		alert( "clientX  "+ window.event.clientX );		alert( "clientY  "+ window.event.clientY );	}	,	mouseX : function ()    {	    return window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft	}	,    mouseY : function ()    {	    return window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop    }	,	addInput : function()	{		var val = parseInt( document.getElementById("nbmail").value);				if( val > 9 )		{			alert("Le nombre maximun d'email est atteind !");			return;		}		var tabLib = new Array();		for( cptlib = 1 ; cptlib <= val  ; cptlib++ ) 		{			if( document.getElementById('email_' + cptlib ).value != undefined && document.getElementById('email_' + cptlib ).value != '' )				tabLib[cptlib] = document.getElementById('email_' + cptlib ).value; 			else			{				tabLib[cptlib] = '';  			}		}				document.getElementById("td_emaillist").innerHTML += '<br/><br/>Email '+ (val + 1) +' <input type="text" name="email_' + ( val + 1 ) + '"  id="email_' + ( val + 1 ) + '" style="width:250px" value="">';				document.getElementById("nbmail").value = val + 1;				for( cptlib = 1 ; cptlib <= val ; cptlib++ )		{			document.getElementById('email_' + cptlib).value = tabLib[cptlib];		}			}	,	ShowPalette : function ( obj , actionColor , ref )	{		refShowPalette = ref;				var objGlobal = document.getElementById( 'IF_PALETTE' );		if ( refShowPalette == 'PHASE') 			objGlobal = document.getElementById('IF_PALETTE_BG');				var iLeftPos = ToolUtl.getOffsetLeft(obj);		var iTopPos =  ToolUtl.getOffsetTop(obj) + (obj.offsetHeight);				objGlobal.style.left = (iLeftPos) + "px";		objGlobal.style.top = (iTopPos) + "px";				if (objGlobal.style.display != 'block') 		{				objGlobal.style.display = 'block';		} 	}	,	fctOk : function ( color )	{		ToolUtl.setContent( color );		ToolUtl.fctHide();	}	,	fctHide : function ()	{		document.getElementById( 'IF_PALETTE' ).style.display = 'none';	}	,		setContent : function ( value )	{			lastColor = value;		if( refShowPalette == 'CHECK' )		{			document.getElementById('order').style.color=value;			document.getElementById('lock').style.color=value;		}	}	,	fctOkBG : function ( color )	{		ToolUtl.setContentBG( color );		ToolUtl.fctHideBG();	}	,	setContentBG : function ( value )	{			lastColor = value; 		document.getElementById( selectedPhase ).style.backgroundColor = lastColor;	}	,	fctHideBG : function ()	{		document.getElementById( 'IF_PALETTE_BG' ).style.display = 'none';	}	,	getOffsetTop : function (elm) 	{		var mOffsetTop = elm.offsetTop;		var mOffsetParent = elm.offsetParent;		var nan;				while( mOffsetParent != nan )		{			mOffsetTop += mOffsetParent.offsetTop;			mOffsetParent = mOffsetParent.offsetParent;		}				return mOffsetTop;	}	,	getOffsetLeft : function (elm)	{		var mOffsetLeft = elm.offsetLeft;		var mOffsetParent = elm.offsetParent;		var nan;				while(mOffsetParent != nan) 		{			mOffsetLeft += mOffsetParent.offsetLeft;			mOffsetParent = mOffsetParent.offsetParent;		}				return mOffsetLeft;	}}