<!--
//===========================================================================
//=  
//= 
	function jsIFC_IHM_AutoRecherchePlus( sValeurRecherche, sUrlRecherchePlus )
	{
		AffichageOuvreFenetre( sUrlRecherchePlus,'' );
	}
	
	function jsIFC_IHM_AutoRecherche_Cherche( sValeurRecherche, sNomObjet, sUrlAjax )
	{				
		IFC_JS_Ajax();

		sValeurRecherche = sValeurRecherche.replace( /\*/,'%');
		sUrl = sUrlAjax+'&sValeurRecherche_p='+escape(sValeurRecherche);
		sIdHtml = sNomObjet+'_MultiSelection';

		document.getElementById( sIdHtml ).innerHTML = '';
		document.getElementById( sIdHtml ).style.display = 'none';

		if( sValeurRecherche != '')
		{
			IFC_JS_Ajax_Ajouter( sUrl, sIdHtml, '' );
			IFC_JS_Ajax_SendPostRequest( 0 );				
		}
		else
		{
			jsIFC_IHM_NiqueLesCombosFin();
		}
	}

	function jsIFC_IHM_AutoRecherche_AfficheMulti( sNomObjet )
	{		
		sIdHtml = sNomObjet+'_MultiSelection';
		document.getElementById( sIdHtml ).style.display = 'block';
		document.getElementById( sIdHtml ).focus();
		jsIFC_IHM_NiqueLesCombos( sIdHtml );		
	} 

	function jsIFC_IHM_AutoRecherche_FinMulti( sNomObjet )
	{
		sIdHtml = sNomObjet+'_MultiSelection';
		document.getElementById( sIdHtml ).style.display = 'none';	
		jsIFC_IHM_NiqueLesCombosFin( );
	}

	function jsIFC_IHm_AutoRecherche_Selection( sNomObjet, nId, sLibelle )
	{
		document.getElementById( sNomObjet+'_Libelle' ).innerHTML = sLibelle;
		document.getElementById( sNomObjet+'_Libelle' ).style.display = 'block';
		document.getElementById( sNomObjet+'_ZoneRecherche' ).style.display = 'none';
		document.getElementById( sNomObjet ).value = nId;
	}

	function jsIFC_IHM_AutoRecherche_ModifierRecherche( sNomObjet )
	{
		document.getElementById( sNomObjet ).value = '';
		sVal = document.getElementById( sNomObjet+'_Libelle' ).innerHTML;
		document.getElementById( sNomObjet+'_Critere' ).value = sVal.replace(/-/,'%');
		document.getElementById( sNomObjet+'_Libelle' ).innerHTML = '';
		document.getElementById( sNomObjet+'_Libelle' ).style.display = 'none';
		document.getElementById( sNomObjet+'_ZoneRecherche' ).style.display = 'block';
		document.getElementById( sNomObjet+'_Critere' ).focus();
	}

//=
//===========================================================================


function jsIFC_IHM_NiqueLesCombos( oObjetReference )
{
	nMonX1 = document.getElementById( oObjetReference ).offsetLeft;
	nMonY1 = document.getElementById( oObjetReference ).offsetTop;
	nMonX2 = nMonX1 + document.getElementById( oObjetReference ).offsetWidth;
	nMonY2 = nMonY1 + document.getElementById( oObjetReference ).offsetHeight;
	
	for( i=0; i<oForm.all.length; i++)
	{
		if( typeof(oForm.all[i].type) != 'undefined' )
		{
			if( oForm.all[i].type == 'select-one')
			{		
				nX1 = getOffsetPosition( oForm.all[i].id, 'Left');
				nY1 = getOffsetPosition( oForm.all[i].id, 'Top');
				nX2 = nX1 + oForm.all[i].offsetWidth;
				nY2 = nY1 + oForm.all[i].offsetHeight;
				
				if(( nMonX1 < nX2) && ( nMonX2 > nX1 ) && (nMonY1 < nY2) && (nMonY2 > nY1 ))
				{
					oForm.all[i].style.display = 'none';
					oForm.all[i].bIFC_IHM_NiqueLesCombos = true;
				}					
			}
		}
	}
}

function jsIFC_IHM_NiqueLesCombosFin( )
{
	for( i=0; i<oForm.all.length; i++)
	{
		if( typeof(oForm.all[i].type) != 'undefined' )
		{
			if( oForm.all[i].type == 'select-one')
			{		
				if( typeof( oForm.all[i].bIFC_IHM_NiqueLesCombos ) != 'undefined')				
				{
					if( oForm.all[i].bIFC_IHM_NiqueLesCombos )
					{

						oForm.all[i].bIFC_IHM_NiqueLesCombos = false;
						oForm.all[i].style.display = 'block';
					}
				}				
			}
		}	
	}	
}

function getOffsetPosition (oObjet, inTYPE)
{
	var iVal = 0;
	var oObj = document.getElementById(oObjet);
	var sType = 'oObj.offset' + inTYPE;
	while (oObj && oObj.tagName != 'BODY') 
	{
		iVal += eval(sType);
		oObj = oObj.offsetParent;
	}
 	return iVal;
}



//===========================================================================
//=  TRAITEMENT DU FORMULAIRE (ACTIVATION/DESACTIVATION DES BOUTONS
//= 
//---------------------------------------------------------------------------
//- ATTENTION LES BOUTONS DOIVENT ETRE NOMMEE oBtEnregistrer et oBtAnnuler
//---------------------------------------------------------------------------
var tbIFC_IHM_ObjetFormulaire = new Array();

function jsIFC_IHM_TemplateGererFormulaire()
{
	bBouton = false;
	// --- D?sactive les boutons si bouton enrefistrer et/ou bouton annuler
	if(document.getElementById('oBtEnregistrer'))
	{		
		document.getElementById('oBtEnregistrer').disabled = true;
		document.getElementById('oBtEnregistrer').className='Style_Objet_Bouton_Disabled';
		bBouton = true;
	}

	if( document.getElementById('oBtAnnuler'))
	{
		document.getElementById('oBtAnnuler').disabled = true;	
		document.getElementById('oBtAnnuler').className='Style_Objet_Bouton_Disabled';
		bBouton = true;
	}

	// --- Si bouton alors attache les ?v?nements
	if( bBouton )
	{
		for( i=0; i<oForm.all.length; i++)
		{
			if( typeof(oForm.all[i].type) != 'undefined' )
			{
				if( ( oForm.all[i].type != 'text/javascript' )
					&& ( oForm.all[i].type != '' ) 
					&& ( oForm.all[i].type != 'button' )
					&& ( oForm.all[i].type != 'submit' )
					&& ( oForm.all[i].type != 'hidden' )
					&& ( oForm.all[i].id != 'SYSTEM_VERROUS_TIMESTAMP')
					&& ( oForm.all[i].id != '')
				  )
				{
					nIndice = tbIFC_IHM_ObjetFormulaire.length;
					tbIFC_IHM_ObjetFormulaire[ nIndice ] = new Array();
					tbIFC_IHM_ObjetFormulaire[ nIndice ].name 	= oForm.all[i].id;
					if(oForm.all[i].id.substr(0,7)=='oEditor')
					{
					 	tbIFC_IHM_ObjetFormulaire[ nIndice ].valeur = IFCEditeurHTML_Contenu();
					}
					else
					{
						tbIFC_IHM_ObjetFormulaire[ nIndice ].valeur = oForm.all[i].value;
					}
					
					oForm.all[i].attachEvent('onchange',jsIFC_IHM_TemplateGererFormulaire_ChangeDonnee);
				}
			}
		}
	}
}//fin fonction


function jsIFC_IHM_TemplateGererFormulaire_ChangeDonnee()
{
	
	// --- Regarde si des changements dans le formulaire
	// par rapport aux donn?es initale
	bChangement = false;
	
	for(i=0;i<tbIFC_IHM_ObjetFormulaire.length;i++)
	{
		if( tbIFC_IHM_ObjetFormulaire[i].name.substr(0,7)=='oEditor')
		{
			if(document.getElementById( tbIFC_IHM_ObjetFormulaire[i].name ).value!=IFCEditeurHTML_Contenu() )
			{
				bChangement = true;
				break;
			}
		}
		else if( document.getElementById( tbIFC_IHM_ObjetFormulaire[i].name ).value != tbIFC_IHM_ObjetFormulaire[i].valeur )
		{
			bChangement = true;
			break;
		}		
	}
	
	if( bChangement )
	{
		// --- Active les boutons Enr. + Annuler.
		if( document.getElementById('oBtEnregistrer') )
		{
			document.getElementById('oBtEnregistrer').disabled = false;
			document.getElementById('oBtEnregistrer').className='Style_Objet_Bouton';
		}
		if( document.getElementById('oBtAnnuler') )
		{	
			document.getElementById('oBtAnnuler').disabled = false;			
			document.getElementById('oBtAnnuler').className='Style_Objet_Bouton';
		}
	}
	else
	{
		if(document.getElementById('oBtEnregistrer'))
		{		
			document.getElementById('oBtEnregistrer').disabled = true;
			document.getElementById('oBtEnregistrer').className='Style_Objet_Bouton_Disabled';
		}

		if( document.getElementById('oBtAnnuler'))
		{
			document.getElementById('oBtAnnuler').disabled = true;	
			document.getElementById('oBtAnnuler').className='Style_Objet_Bouton_Disabled';		
		}
	}
}//fin fonction

function jsIFC_IHM_TemplateGererFormulaire_AnnuleChangeDonnee()
{
	oForm.reset();
	/*
	for(i=0;i<tbIFC_IHM_ObjetFormulaire.length;i++)
	{
		if( tbIFC_IHM_ObjetFormulaire[i].name.substr(0,7)=='oEditor')
		{
			if(document.getElementById( tbIFC_IHM_ObjetFormulaire[i].name ).value!=IFCEditeurHTML_Contenu() )
			{
				bChangement = true;
				break;
			}
		}
		else
		{
			document.getElementById( tbIFC_IHM_ObjetFormulaire[i].name ).value = tbIFC_IHM_ObjetFormulaire[i].valeur;
		}
	}
	*/
}//fin fonction


// =
// ===============================================================================






function ClipClapV( sNom, sObjet)
{
	if( document.getElementById( sNom ).className == 'Style_ClipClap_V1')
	{
		document.getElementById( sNom ).className = 'Style_ClipClap_V2';
	}
	else
	{
		document.getElementById( sNom ).className = 'Style_ClipClap_V1';
	}
	
	ClipClap( sObjet );	
}

function ClipClapH( sNom, sObjet)
{
	if( document.getElementById( sNom ).className == 'Style_ClipClap_H1')
	{
		document.getElementById( sNom ).className = 'Style_ClipClap_H2';
	}
	else
	{
		document.getElementById( sNom ).className = 'Style_ClipClap_H1';
	}	

	ClipClap( sObjet );	
}


window.onload=function()
{
	IFC_IHM_TableauLoad();	
	//document.getElementById('aymeric').style.overflow = 'scroll';	
} 


function IFC_IHM_PageLoad()
{
	IFC_IHM_TableauLoad();
	
	document.getElementById('aymeric').style.overflow = 'scroll';	
}

function IFC_IHM_IframeLoad()
{
	//IFC_IHM_TableauLoad();
}


/* ======================================================
= AJAX
=======================================================*/

var tbAjaxLoad = new Array();
var xhr_object = null;
var xhr_idcourrant = 0;

function IFC_JS_Ajax(  )
{
	tbAjaxLoad = new Array();
	xhr_object = null;
	xhr_idcourrant = 0;
}

function IFC_JS_Ajax_FormulaireEncode( sObjetId )
{	
	return sObjetId+"=" + encodeURI( document.getElementById(sObjetId).value )
}

function IFC_JS_Ajax_Ajouter( sUrl, sDestination, tbParameter )
{
	nIndice = tbAjaxLoad.length;
	tbAjaxLoad[ nIndice ] = new Array();
	tbAjaxLoad[ nIndice ][0] = sUrl;
	tbAjaxLoad[ nIndice ][1] = sDestination;
	tbAjaxLoad[ nIndice ][2] = tbParameter;

}
function IFC_JS_Ajax_SendPostRequest( nId )
{
	if( nId < tbAjaxLoad.length )
	{
		IFC_JS_Ajax_Init();

		// Pour tous mes objets en attente
		xhr_url = tbAjaxLoad[nId][0];

		// On ouvre la requete vers la page d?sir?e
		xhr_object.open( 'GET', xhr_url, false );
		// On lui donne le pointeur de fonction de retour
		xhr_idcourrant = nId;
		xhr_object.onreadystatechange = IFC_JS_Ajax_CallBackRequest;
		xhr_object.setRequestHeader ("Content-type",   "application/x-www-form-urlencoded");
		xhr_object.setRequestHeader("Content-length", tbAjaxLoad[nId][2].length);

		// On envoi la requete
		xhr_object.send( tbAjaxLoad[nId][2] );				
	}
}

function IFC_JS_Ajax_SendGetRequest( nId ) 
{
	if( nId < tbAjaxLoad.length )
	{
		IFC_JS_Ajax_Init();
		
		// Pour tous mes objets en attente
		xhr_url = tbAjaxLoad[nId][0];
		
		// On ouvre la requete vers la page d?sir?e
		xhr_object.open( 'GET', xhr_url, false );
		// On lui donne le pointeur de fonction de retour
		xhr_idcourrant = nId;
		xhr_object.onreadystatechange = IFC_JS_Ajax_CallBackRequest;
		//xhr_object.setRequestHeader ("Content-type",   "application/x-www-form-urlencoded");
		
		// On envoi la requete
		xhr_object.send( null );
	}
}

function IFC_JS_Ajax_Init()
{
	if ( window.XMLHttpRequest ) 
	{
		// Objet XmlHttpRequest pour les moteurs GECKO
		xhr_object = new XMLHttpRequest();   
	} 
	else if ( window.ActiveXObject ) 
	{
		// Objet XmlHttpRequest pour Internet Explorer
		xhr_object = new ActiveXObject( 'Microsoft.XMLHTTP' );   
	} 
	else 
	{
		// Navigateur non-compatible
		alert( 'Votre navigateur ne supporte pas les objets XMLHTTPRequest...' );   
		return;
	}
}

function IFC_JS_Ajax_CallBackRequest() 
{
	// Sur le retour de la requete, on teste son status
	if ( xhr_object.readyState == 4 ) 
	{				
		var js='';
		var html = '';
		// --- on recup?re le js
		oXmlReponse = xhr_object.responseXML.getElementsByTagName("js");
		if( oXmlReponse.length == 1 ) 
		{			
			if( oXmlReponse.item(0).firstChild != null ) js = oXmlReponse.item(0).firstChild.data;
		}
		
		// --- on recup?re le html		
		oXmlReponse = xhr_object.responseXML.getElementsByTagName("html");
		if( oXmlReponse.length == 1 ) 
		{
			if( oXmlReponse.item(0).firstChild != null ) html = oXmlReponse.item(0).firstChild.data;
		}
				
		// --- on recup?re le xml
		oXmlReponse = xhr_object.responseXML.getElementsByTagName("xml");
		if( oXmlReponse.length == 1 ) 
		{
				oTemp = oXmlReponse[0];
				for( i=0;i<oTemp.childNodes.length;i++)
				{
					sNomObjet = oTemp.childNodes[i].nodeName;
					sValObjet = oTemp.childNodes[i].firstChild.nodeValue;
										
					oObjetForm = document.getElementById( sNomObjet );
					if( oObjetForm != null )
					{						
						// Traiter en fonction du type
						if( oObjetForm.type == 'select-one' )
						{
							for(j=0;j<oObjetForm.options.length;j++)
							{
								if( oObjetForm.options[j].value == sValObjet )
								{
									oObjetForm.options[j].selected = true;
									break;
								}
							}		
						}
						else
						{							
							oObjetForm.value = sValObjet;							
						}
					}

				}
		}


		if( JS_COMPLEMENT_trimAll(js) != '' ) eval( js );
		if( JS_COMPLEMENT_trimAll(html) != '' ) 
		{
			document.getElementById( tbAjaxLoad[ xhr_idcourrant ][1] ).innerHTML = html+document.getElementById( tbAjaxLoad[ xhr_idcourrant ][1] ).innerHTML;
		}

		// Appel SendRequest pour les autres chargements;
		IFC_JS_Ajax_SendGetRequest( xhr_idcourrant+1 );
	}
}


function JS_COMPLEMENT_trimAll(sString) 
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}


function AfficheReload()
{
	if( document.location.href != '')
	{
		var sVal = document.location.href;
		sVal.toString();
		sVal = sVal.replace( /#/, "");
		document.location.href = sVal;
	}
}




// --- Traite la dimention des tableaux
var tbIFC_IHM_Tableau = new Array();
function IFC_IHM_TableauLoad( )
{
	for( i=0;i<tbIFC_IHM_Tableau.length;i++)
	{
		if( this.name == '' ) 
		{
			//alert('ERREUR !!! - Il est obligatoire de nommer les objets : NAME + ID ');
			this.name = document.body.id;
		}
		
		sVal = 	document.getElementById( tbIFC_IHM_Tableau[i] ).style.width;
		if( sVal == '100%' )
		{								
			nTailleZone_l = parent.document.getElementById( this.name ).offsetWidth;
			document.getElementById( tbIFC_IHM_Tableau[i] ).style.width = (nTailleZone_l-20)+'px';			
		}	
			
		// --- Taille de mon entete
		nHauteurDepart = document.getElementById( tbIFC_IHM_Tableau[i] ).offsetTop+50;	
		nHauteurMaxTableau = parent.document.getElementById( this.name ).offsetHeight-nHauteurDepart;
		
		nHauteur = document.getElementById( tbIFC_IHM_Tableau[i]+'Contenu' ).offsetHeight
		if( nHauteur > nHauteurMaxTableau ) nHauteur = nHauteurMaxTableau;
		nHauteur = nHauteur+'px';
		document.getElementById( tbIFC_IHM_Tableau[i]+'InnerFrame' ).style.height = nHauteur;
	}
	return true;
}

// --- Traite la dimenstion des container
function IFC_JS_ContainerTailleFrame( oIdIFrame )
{		
	nTailleInterneX_l = document.getElementById(oIdIFrame).offsetWidth-10;
	nTailleInterneY_l = document.getElementById(oIdIFrame).offsetHeight-10;	
	document.getElementById(oIdIFrame).contentWindow.document.body.style.width = nTailleInterneX_l+'px';
	document.getElementById(oIdIFrame).contentWindow.document.body.style.height = nTailleInterneY_l+'px';	
		
	if( typeof(document.getElementById(oIdIFrame).contentWindow.document.getElementById('aymeric')) != 'undefined' )
	{
		document.getElementById(oIdIFrame).contentWindow.document.getElementById('aymeric').style.overflow = 'auto';
	}

	IFC_IHM_TableauLoad();
	//return true;
}




/* ======================================================
= VARIABLES GLOBALES DE LA PAGE
=======================================================*/

	// --- Liste des objet obligatoire du formulaire  
	tbFormulaireVerfierObligatoire_g = new Array();

	tbImageTransparence = new Array();  
	tbImageTransparence['oIdImage_MenuIcone_Imprimer'] = '';

	function FocusFly( nIndice )
	{
		AfficherFly( );
		if( parent.tbIfcJs_ModlessEnfant[ nIndice ][1].closed == false )
		{
			parent.tbIfcJs_ModlessEnfant[ nIndice ][1].focus();
		}
	}
	
	function AfficherFly( )
	{
		nNb=0;
		sRetour = '';
		tbTemp = parent.tbIfcJs_ModlessEnfant;
		
		for(i=0;i<tbTemp.length;i++)
		{
			if( typeof( tbTemp[i][1] ) != 'undefined' )
			{
				if( tbTemp[i][1].closed == false )
				{
					nNb++;
					sRetour += "<a href='#' onClick='javascript: FocusFly("+i+");'>.: "+tbTemp[i][0]+" :.</a><br>";
				}
			}			
		}
		if( nNb == 0 )
		{
			document.getElementById('oIdMenuListePopup').style.display = 'none';			
			document.getElementById('oIdMenuListePopupLink').innerHTML = '';
			MenuSize( 'oIdMenuSmall', 37, 200 );
		}
		else
		{
			document.getElementById('oIdMenuListePopupLink').innerHTML = sRetour;
			if( document.getElementById('oIdMenuListePopupLink').style.display == 'block' )
			{
				MenuSize( 'oIdMenuFull', 200, 37 );
			}
			else
			{
				MenuSize( 'oIdMenuSmall', 37, 200 );
			}
			
		}
	}


	function ChargerFly( sTitre, hWin )
	{		
		if( typeof( window.opener ) == 'undefined' )
		{
			if( typeof( parent.GestionPopupEnregistre ) == 'undefined' )
			{
				parent.parent.GestionPopupEnregistre( sTitre, hWin);
			}
			else
			{
				parent.GestionPopupEnregistre( sTitre, hWin);
			}
		}
		else
		{
			window.opener.ChargerFly( sTitre, hWin );
		}
	}
	
	function AffichageFlyAuto( sTitre )
	{		
		AfficheFly( window.location, sTitre );
	}

	function AfficheFly( sUrl, sTitre )	
	{
		hWin = AffichagePopup( sUrl, '' );			
		if((typeof(window.opener) != 'undefined') && ( typeof(window.opener.ChargerFly) == 'function' )) window.opener.ChargerFly( sTitre, hWin );
		else if( typeof(parent.ChargerFly) == 'function' ) 		parent.ChargerFly( sTitre, hWin );
		else ChargerFly( sTitre, hWin );		
	}

	function ClipClap( oObjet )
	{    
		if (document.getElementById( oObjet ).style.display == 'none') document.getElementById( oObjet ).style.display = 'block';
		else document.getElementById( oObjet ).style.display = 'none';
	}

	function AffichageMonPerePopup()
	{
		if( document.getElementById( 'oIFC_IHM_Popup' ) != null ) return document;
		else if( parent.document.getElementById( 'oIFC_IHM_Popup' ) != null ) return parent.document;
		else if (parent.parent.document.getElementById( 'oIFC_IHM_Popup' ) != null ) return parent.parent.document;
		else if (parent.parent.parent.document.getElementById( 'oIFC_IHM_Popup' ) != null ) return parent.parent.parent.document;
		else if (parent.parent.parent.parent.document.getElementById( 'oIFC_IHM_Popup' ) != null ) return parent.parent.parent.parent.document;
		else return window.document;
	}

	// Tente de Recharger le parent et ferme ou annule la fenetre courrante
	function AffichageFermeEtReload()
	{
		oMonPerePopup_l = AffichageMonPerePopup();		
		if( oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu') != null)
		{							
			// Regarde si possibilite de reactualiser la page parent
			if( oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageObjetReferer != '' )
			{						
				oFrameParent = RechercherFrames( oMonPerePopup_l, oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageObjetReferer );				
				// Reaffiche le parent
				if( oFrameParent != '')
				{										
					// Regarde si le parent a un formulaire
					if( oFrameParent.document.forms.length == 1 )
					{
						if( typeof(oFrameParent.document.forms[0].IfcIhmPageBloquerReload) == 'undefined' )
						{
							oFrameParent.document.forms[0].submit();
						}
					}
					else
					{					
						oFrameParent.location.href = oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageUrlReferer;								
					}
				}
				else
				{
					oMonPerePopup_l.location.href = oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageUrlReferer;
				}
			}
			// Ferme la fenetre
			AffichageFermeFenetre();
		}
		else
		{
			AffichageAnnuleFenetre();			
		}						
	}
	
	function RechercherFrames( oObjet, sRecherche )
	{
		for(var i=0;i<oObjet.frames.length;i++)
		{
			if( oObjet.frames[i].name == sRecherche ) return oObjet.frames[i];			
			oRetour_l = RechercherFrames( oObjet.frames[i], sRecherche );
			if( oRetour_l != '' ) return oRetour_l;
		}
		
		return '';
	}

	// Ferme ou Annule la fenetre courrante
	function AffichageFerme()
	{
		if( window.name != '')
		{
			name = window.name;
			// --- Si je suis une frame d'un onglet alors c'est mon p?re qui g?re la fermeture
			if( name.substr(0,22) == "oIFC_IHM_ONGLET_FRAME_" )
			{
				// Traite le document
				parent.AffichageFerme();
			}
			else
			{
				if( parent.name != '')
				{
					document.location.href = document.location.href;
				}
				else
				{
					window.close();
				}
			}
		}
		else
		{			
			// Traite le document	
			oMonPerePopup_l = AffichageMonPerePopup();		
			
			if( oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu') != null)
			{							
				// Ferme la fenetre
				AffichageFermeFenetre();
			}
			else
			{
				// Annule la fenetre
				AffichageAnnuleFenetre();			
			}						
		}
	}
	
	function AffichageFermeFenetre( )
	{  
		oMonPerePopup_l = AffichageMonPerePopup();
		oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').src 					= 'about:blank';
		oMonPerePopup_l.getElementById('oIFC_IHM_Popup').style.display 					= 'none';			
		//oMonPerePopup_l.getElementById('oIFC_IHM_PopupTitre').innerHTML 				= '&nbsp;';
		oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageObjetReferer 	= '';
		oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageUrlReferer 	= '';
	}
	
	// Marque tous les formulaire comme no RELOAD
	function AffichageNoReload()
	{
		for(i=0;i<document.forms.length;i++)
		{
			
			document.forms[i].IfcIhmPageBloquerReload = 'true';
		}
	}
	

	function AffichageAnnuleFenetre()
	{
		document.location.href='about:blank';
	}
	
	function AffichageRedirectFenetre( sUrl, sParametre )
	{	
		sRetour = window.confirm( "Vous allez etre redirige vers une autre fiche !");
		if( sRetour ) parent.document.location.href = sUrl+'?'+sParametre;
		else return '';			
	}
	
	function AffichageOuvreFenetreExterne( sUrl, sParametre )
	{
		window.open( sUrl+'?'+sParametre,'','');
	}
	
	function AffichagePopup( sUrl, sParametre )
	{
		if( sParametre != '' ) sParametre = '?'+sParametre
		
		// --- Creation du nom de la fenetre
		sVal = new Date();
		sFenNom = 'ISI'+sVal.getDay()+sVal.getFullYear()+sVal.getHours()+sVal.getMinutes()+sVal.getSeconds();

		hWin = window.open( sUrl+sParametre, sFenNom , 'menubar=no,resizable=no,status=no,titlebar=no,toolbar=no,top=0,left=0,location=no,scrollbars=no,width=1000,height=700' );
		hWin.focus();
		return hWin;
	}
	
	function AffichageOuvreFenetre( sUrl, sParametre )
	{		
		
		if( sParametre != '' ) sParametre = '?'+sParametre;
			
		// Cherche le pere
		oMonPerePopup_l = AffichageMonPerePopup();		

		// Charge le popup				
		oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageObjetReferer = this.name;
		oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').IfcIhmPageUrlReferer = document.URL;		
		oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').src = sUrl+sParametre;		

		// Affiche le popup
		oMonPerePopup_l.getElementById('oIFC_IHM_Popup').style.display = 'block';					
	}


	function AffichagePositionFenetre( sTitre, nX, nY )
	{
		// --- Si je suis en mode non modal
		if( window.name != '' )
		{
			window.resizeTo( nX, nY);
		}
		// --- Si je suis en mode modless
		else
		{		
			oMonPerePopup_l = AffichageMonPerePopup();

			// Valorise le titre du popup
			oMonPerePopup_l.getElementById('oIFC_IHM_PopupEntete').contentWindow.document.getElementById('oIFC_IHM_PopupTitre').innerHTML = '::&nbsp;'+sTitre+'&nbsp;::';

			// Resize le popup
			oMonPerePopup_l.getElementById('oIFC_IHM_Popup').style.width = nX+'px';
			oMonPerePopup_l.getElementById('oIFC_IHM_Popup').style.height = (nY*1+37)+'px';

			oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').style.width = nX+'px';
			oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').style.height = ((nY*1+37)-30-10)+'px';
	
				nTailleInterneX_l = oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').offsetWidth-10;
				nTailleInterneY_l = oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').offsetHeight-10;	
				oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').contentWindow.document.body.style.width = nTailleInterneX_l+'px';
				oMonPerePopup_l.getElementById('oIFC_IHM_PopupContenu').contentWindow.document.body.style.height = nTailleInterneY_l+'px';	
		}
	}

	function BoutonFermer()
	{		
		AffichageFerme();
	}

	function BoutonFermerParent()
	{
		parent.AffichageFermeFenetre();
	}

	function BoutonAnnuler()
	{
		sRetour = window.confirm( "Etes-vous sur de vouloir annuler les modifications ?" );
		if( sRetour ) jsIFC_IHM_TemplateGererFormulaire_AnnuleChangeDonnee(); //BoutonFermer();
		else return '';
	}
 

	function BoutonAide( sContexte )
	{    
		if ((sContexte == '') || (sContexte=='@@AIDE@@'))
		{
			alert( "Actuellement, aucune aide valide n'est disponible pour ce module." );
		}
		else
		{
			window.open("Aide.php?sContexte_p="+sContexte,'Aide','width=500px,height=500px,resizable=yes');   
		}  
	}

	function BoutonHistorique( nId, sTable )
	{
		AffichageOuvreFenetre( '../historique/VHistorique.php', 'nId_p='+nId+'&sTable_p='+sTable );
	}

	function BoutonSubmit()
	{      
		for(i=0;i<tbFormulaireVerfierObligatoire_g.length;i++)
		{      
			if( document.getElementById( tbFormulaireVerfierObligatoire_g[ i ] ).value == '')
			{
				if(document.getElementById( tbFormulaireVerfierObligatoire_g[ i ] ).type!="hidden")
				{
					document.getElementById( tbFormulaireVerfierObligatoire_g[ i ] ).className = 'Style_VerifierData_Erreur';
					document.getElementById( tbFormulaireVerfierObligatoire_g[ i ] ).focus();
				}
				
				alert('Cette information est obligatoire.'+tbFormulaireVerfierObligatoire_g[ i ]);
				
				
				return false;
			}   
		}   
		
		if( typeof( IFCEditeurHTML_Poster ) == 'function' )
		{
			IFCEditeurHTML_Poster();
		}
		
		return true;
	 }
 
	function BoutonImprimer( sServeur, oObjet, sChemin )
	{  
		hwin = window.open( sServeur+'source_global/impression/CImpression.php?sObjet_p='+oObjet,'fenImpression','');    
		  //hwin.document.write("<BODY onLoad=\"JavaScript: alert('e');\" style='margin-top:0px; margin-left:0px; margin-bottom: 0px; margin-right: 0px;'>" );  
		  //hwin.document.write("<script language="+"J"+"ava"+"Scri"+"pt>window.print();"+"<"+"/"+"script"+">");
		  //hwin.document.write("<link rel='stylesheet' type='text/css' href='"+sChemin+"styleAffichage.css'>");   
		  //hwin.document.write( document.getElementById( oObjet ).innerHTML );  
	}
	
 
/*==========================================================================================
= CHRONOMETRE
==========================================================================================*/  						  	
 							
var nDureeChronoHeure = 0;
var nDureeChronoMinute = 0;
var nDureeChronoSeconde = 0;
 													 						 							 	
function ActionChronometre( TimerID )
{						 								 								 								 								 		
	if( TimerID == '')
	{
		TimerID = ChronometreStart( );						 	
		document.getElementById( sChronometreObjetImage ).src=__CHEMIN_IMAGES_+'history.png';						 					
	}
	else
	{
		TimerID = ChronometreStop(  );
		document.getElementById( sChronometreObjetImage ).src=__CHEMIN_IMAGES_+'history_clear.png';						 			
	}						 		
	return TimerID;
}
						 	
function ChronometreStart(  )
{
	nDureeChronoHeure = 0;
 	nDureeChronoMinute = 0;
 	nDureeChronoSeconde = 0;								
	return setInterval( Chronometre, 1000 );
}
						 	
function ChronometreStop( )
{
	clearInterval( nTimerID );
	return '';
}						 

function Chronometre(  )
{  
	nDureeChronoSeconde++;  
  	if (nDureeChronoSeconde > 59)
  	{
  		nDureeChronoSeconde = 0;
  		nDureeChronoMinute++;
	}
  	if ( nDureeChronoMinute > 59 )
  	{
   		nDureeChronoHeure++;
   		nDureeChronoMinute=0;
	}
  	if (nDureeChronoHeure < 10) tempH = '0'+nDureeChronoHeure;
  	else tempH = nDureeChronoHeure;  
  	if (nDureeChronoMinute < 10) tempM = '0'+nDureeChronoMinute;
  	else tempM = nDureeChronoMinute;
  	if (nDureeChronoSeconde < 10) tempS = '0'+nDureeChronoSeconde;
  	else tempS = nDureeChronoSeconde;

	if( typeof( document.getElementById( sChronometreObjet ).value ) != 'undefined' )
	{
	  	document.getElementById( sChronometreObjet ).value = tempH+':'+tempM+':'+tempS;
	}
	else
	{
		document.getElementById( sChronometreObjet ).innerHTML = tempH+':'+tempM+':'+tempS;
	}
}

//-->
