/***************************************************************************/
/*  F O N C T I O N S   D E   G E S T I O N   D E S   C A L Q U E S  V 1.0 */
/*  Copyright 2004 Resonance Informatique                                  */
/*  www.resonance-informatique.fr                                          */
/*                                                                         */
/***************************************************************************/
/*                                                                         */
/*  Ce code peut etre re-utilise gratuitement sous reserve qu'il ne soit   */
/*  pas modifie et que cette notice ne soit pas retiree                    */
/*                                                                         */
/*  pour toute modification, suggestion, remarque ou bug                   */
/*  g.philippot@resonance-informatique.fr                                  */
/*                                                                         */									
/***************************************************************************/
/*                                                                         */
/*  This program can be used as needed freely if it stay unmodified and    */
/*  if this header is not overwrited                                       */
/*                                                                         */
/*  for update, suggestion, bugreport                                      */
/*  g.philippot@resonance-informatique.fr                                  */
/*                                                                         */									
/***************************************************************************/

/***************************************************************************/
/*  F O N C T I O N S   G E N E R A L E S                                  */
/***************************************************************************/

	/////////////////////////////////////////////////////////////////////////
	// Gestion des erreurs
	var msg = null
	function handleErrorsBase(errorMessage, url, line)
	{
		msg = "There was an error on this page.\n\n";
		msg += "An internal programming error may keep\n";
		msg += "this page from displaying properly.\n";
		msg += "Click OK to continue.\n\n";
		msg += "Error File: Basejs.js\n";
		msg += "Error message: " + errorMessage + "\n";
		msg += "URL: " + url + "\n";
		msg += "Line #: " + line;
		alert(msg);
		return true
	}
	/////////////////////////////////////////////////////////////////////////
	// Affichage des propriété d'un objet (pour débugage.

		function DisplayProperty(ParamObject)
		{
			onerror = handleErrorsBase;
			var property_list='';
			tmpdoc=window.open('blank.php','TempWin');
			tmpdoc.document.open();
			for(prop in ParamObject)
			{
				tmpdoc.document.write("<i>" + typeof(ParamObject[prop]) + " : </i><b>" + prop + "</b>=" + ParamObject[prop] + "<BR>");
				if (typeof(ParamObject[prop])=='object')
					for(prop2 in ParamObject[prop])
						tmpdoc.document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>" + typeof(ParamObject[prop2]) + " : </i><b>"+ prop +"." +  prop2 + "</b>=" + ParamObject[prop2] + "<BR>");
			
			}
			tmpdoc.document.close()
		onerror = null;
		}	

	/////////////////////////////////////////////////////////////////////////
	// 
		function insertIt(SourceName, TargetName) 
		{ 
			onerror = handleErrorsBase;
			var Id_Contenu;
			if (NavVersion()=="NS7")
			{
				Id_Contenu=document.getElementById(SourceName).contentDocument.body.Id_Contenu;
				document.getElementById(TargetName).innerHTML=document.getElementById(SourceName).contentDocument.body.innerHTML;
				document.getElementById(SourceName).contentDocument.body.innerHTML='';
				if (typeof(Id_Contenu)!='undefined')
				{
					var MenuName = 'MENU' + Id_Contenu;
					document.getElementById(MenuName).focus();
				}
			}
			else
			{
				Id_Contenu=document.getElementById(SourceName).Document.body.Id_Contenu;
				document.getElementById(TargetName).innerHTML=document.getElementById(SourceName).Document.body.outerHTML;
				//document.getElementById(SourceName).Document.body.outerHTML='';
				if (typeof(Id_Contenu)!='undefined')
				{
					var MenuName = 'MENU' + Id_Contenu;
					document.getElementById(MenuName).focus();
				}
			}
		onerror = null;
		} 

		function IFrameAutoResize(IFrameName)
		{
			onerror = handleErrorsBase;
			
				IF = document.getElementById(IFrameName);
				IF.style.display="block";
				//var IFBody = IF.contentDocument.body;
				//alert('contentWindow.document.body.scrollHeight=' + IF.contentWindow.document.body.scrollHeight); 
				//alert('document.documentElement.scrollHeight : ' + IF.document.documentElement.scrollHeight);
				//alert('document.documentElement.offsetHeight : ' + IF.document.documentElement.offsetHeight); 
				//alert('document.body.scrollHeight=' + IFBody.scrollHeight);
				//alert('document.body.offsetHeight=' + IFBody.offsetHeight); 
				//alert('document.body.clientHeight=' + IFBody.clientHeight);
			try
			{ 
				if (IF.contentWindow.document.body.scrollHeight<350)
				{
					IF.style.height='350px';
				}
				else
				{
					alert(NavVersion());
					if (NavVersion()=="NS7")
						alert("Netscape !!!");
					else
						IF.style.height=IF.contentWindow.document.body.scrollHeight;
				}
				//IF.style.height = IFBody.scrollHeight + (IFBody.offsetHeight - IFBody.clientHeight);
				//IF .style.width = IFBody.scrollWidth + (IFBody.offsetWidth - IFBody.clientWidth);
			}
			//An error is raised if the IFrame domain != its container's domain
			catch(e)
			{
				alert('GPH Java Script Error: ' + e.number + '; ' + e.description);			
			}
		onerror = null;
			return(true);
		}

	/////////////////////////////////////////////////////////////////////////
	// 
		
		function FrameContenuResize()
		{
			onerror = handleErrorsBase;
			IF = document.getElementById('FRAME_Contenu');
			try
			{ 
				if (IF.contentWindow.document.body.scrollHeight<350)
					IF.style.height='350px';
				else
					IF.style.height=IF.contentWindow.document.body.scrollHeight;
				Fter = document.getElementById('Footer');
				if (NavVersion()=="NS7")
					Fter.style.top=IF.style.height;
			}
			catch(e)
			{
				alert('JavaScript Error: ' + e.number + '; ' + e.description);			
			}
		onerror = null;
			return(true);
		}
		
		function IFrameReload(IFrameName, URL)
		
		{
			onerror = handleErrorsBase;
			IF = document.getElementById(IFrameName);
			IF.document.clear();
			//IF.document.location.href=URL;
		onerror = null;
		}
		function PopupWindows(Target)
		{
			onerror = handleErrorsBase;
			PopupWindowsPdt=window.open(Target,"PopupWindowsPdt","top=0, left=600, width=390, height=500, status=no, toolbar=no, scrollbars=no");
			PopupWindowsPdt.focus();
		onerror = null;
		} 
		function PopupWindowsScroll(Target)
		{
			onerror = handleErrorsBase;
			PopupWindowsPdt2=window.open(Target,"PopupWindowsPdt2","top=0, left=600, width=400, height=600, status=no, toolbar=no, scrollbars=yes");
			PopupWindowsPdt2.focus();
		onerror = null;
		} 
		function PopupGrandeWindows(Target)
		{
			onerror = handleErrorsBase;
			PopupWindowsPdt3=window.open(Target,"PopupWindowsPdt3","top=100, left=200, width=660, height=500, status=no, toolbar=no, scrollbars=no");
			PopupWindowsPdt3.focus();
		onerror = null;
		} 
		function PopupWindowsTableauBordMarche(Target)
		{
			onerror = handleErrorsBase;
			PopupWindowsPdt=window.open(Target,"PopupWindowsPdt4","top=0, left=600, width=390, height=450, status=no, toolbar=no, scrollbars=no");
			PopupWindowsPdt.focus();
		onerror = null;
		}
		function PopupImpression(Target)
		{
			onerror = handleErrorsBase;
			PopupWindowsPdt=window.open(Target,"PopupWindowsPdt5","top=10, left=200, width=680, height=800, status=no, toolbar=no, scrollbars=yes");
			PopupWindowsPdt.focus();
		onerror = null;
		}		
		