var NS = (document.layers);
var IE = (document.all);

function PreInit() {
	/*var p1 = document.URL.lastIndexOf('\\');
	var p2 = document.URL.lastIndexOf('/');

	var p  = (p1 > p2) ? p1 : p2;
	if (top == self) location.replace("http://" + document.domain +"/redirect.php?url=" + document.URL.substring(p));*/
}

function OpenWindow(URL,NAME,WIDTH,HEIGHT)
	{	
		URL = URL.replace('+','%2B')
		window.open(URL);
	}

function OpenWindowVarMenu(URL,NAME,WIDTH,HEIGHT)
	{	
		if (!WIDTH)	 {WIDTH=600;}
		if (!HEIGHT) {(navigator.appName == "Netscape") ?  HEIGHT=500 : HEIGHT=500;}
		URL = URL.replace('+','%2B')
		return window.open(URL,NAME,'width='+WIDTH+',height='+HEIGHT+',toolbar=yes,dependent=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,menubar=yes,location=yes');
	}
		
function OpenWindowVar(URL,NAME,WIDTH,HEIGHT)
	{	
		if (!WIDTH)	 {WIDTH=350;}
		if (!HEIGHT) {(navigator.appName == "Netscape") ?  HEIGHT=180 : HEIGHT=150;}
		URL = URL.replace('+','%2B')
		//alert(URL);
		return window.open(URL,NAME,'width='+WIDTH+',height='+HEIGHT+',toolbar=no,dependent=yes,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no');
	}
	
function OpenWindowFix(URL,NAME,WIDTH,HEIGHT)
	{	
		if (!WIDTH)	 {WIDTH=350;}
		if (!HEIGHT) {(navigator.appName == "Netscape") ?  HEIGHT=180 : HEIGHT=150;}
		return window.open(URL,NAME,'width='+WIDTH+',height='+HEIGHT+',toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no');
	}

function OpenWindowFixScroll(URL,NAME,WIDTH,HEIGHT)
	{	
		if (!WIDTH)	 {WIDTH=350;}
		if (!HEIGHT) {(navigator.appName == "Netscape") ?  HEIGHT=180 : HEIGHT=150;}
		window.open(URL,NAME,'width='+WIDTH+',height='+HEIGHT+',toolbar=no,directories=no,status=no,scrollbars=yes,resizable=no,menubar=no');
	}
/**************** OUVERTURE DE FENETRE PRE-DETERMINER ********************************/
var WinErrorList;
var WinLight;
var WinLiquide;
var WinMembre;
var WinAide;
var WinCmd;
var WinMap;
			
			
			function PopupLight(URL)
			{	
				if (!WinLight) {WinLight = OpenWindowFix(URL,'WinLight',316,178);}
				else		
				{
					if (!WinLight.closed)
					{
						WinLight.location.replace(URL);
						WinLight.focus();
					}
					else
					{WinLight = OpenWindowFix(URL,'WinLight',316,178);}
				}
				WinLight.moveTo(200,200);
			}

			function PopupCmd(URL)
			{	
				if (!WinCmd) {WinCmd = OpenWindowFix(URL,'WinCmd',316,307);}
				else		
				{
					if (!WinCmd.closed)
					{
						WinCmd.location.replace(URL);
						WinCmd.focus();
					}
					else
					{WinCmd = OpenWindowFix(URL,'WinCmd',316,307);}
				}
				WinCmd.moveTo(500,400);
			}

			function PopupMap(URL)
			{	
				if (!WinMap) {WinMap = OpenWindowFix(URL,'WinMap',500,498);}
				else		
				{
					if (!WinMap.closed)
					{
						WinMap.location.replace(URL);
						WinMap.focus();
					}
					else
					{WinMap = OpenWindowFix(URL,'WinMap',500,498);}
				}
				WinMap.moveTo(500,100);
			}

			function PopupAide(URL)
			{	
				if (!WinAide) {WinAide = OpenWindowVar(URL,'WinAide',330,597);}
				else		
				{
					if (!WinAide.closed)
					{
						WinAide.location.replace(URL);
						WinAide.focus();
					}
					else
					{WinAide = OpenWindowVar(URL,'WinAide',330,597);}
				}
				WinAide.moveTo(500,0);
			}

			function PopupMembre(URL)
			{	
				if (!WinMembre) {WinMembre = OpenWindowFix(URL,'WinMembre',316,132);}
				else		
				{
					if (!WinMembre.closed)
					{
						WinMembre.location.replace(URL);
						WinMembre.focus();
					}
					else
					{WinMembre = OpenWindowFix(URL,'WinMembre',316,132);}
				}
				WinMembre.moveTo(200,200);
			}

			function PopupLiquide(URL)
			{	
				if (!WinLiquide) {WinLiquide = OpenWindowFix(URL,'WinLiquide',316,460);}
				else		
				{
					if (!WinLiquide.closed)
					{
						WinLiquide.location.replace(URL);
						WinLiquide.focus();
					}
					else
					{WinLiquide = OpenWindowFix(URL,'WinLiquide',316,460);}
				}
				WinLiquide.moveTo(500,200);
			}


			function ErrorList(URL)
			{	
				if (!WinErrorList) {WinErrorList = OpenWindowFix(URL,'WinErrorList',320,200);}
				else		
				{
					if (!WinErrorList.closed)
					{
						WinErrorList.location.replace(URL);
						WinErrorList.focus();
					}
					else
					{WinErrorList = OpenWindowFix(URL,'WinErrorList',320,200);}
				}
				WinErrorList.moveTo(500,400);
			}

		
	
		function FocusWindow(URL)
		{
			if (!WinAddItem) {
					WinAddItem = OpenWindowFix(URL,'WinAddItem',340,200);
					WinAddItem.moveTo(50,0);
				}
			
			if (!WinAddItem.closed)
				{
					URL = URL.replace('+','%2B')
					WinAddItem.location.replace(URL);
					WinAddItem.focus();
				}
				else
				{
					{WinAddItem = OpenWindowFix(URL,'WinAddItem',340,200);}
				}
		}


	function MM_openBrWindow(theURL,winName,features) { //v2.0
		window.open(theURL,winName,"top=100,left=200,"+features);
	}

	function RollOver(himg,imgName)
		{
			if(eval("window." + imgName +  "_on"))
			if(himg) 
				himg.src =  eval("window." + imgName + "_on.src");
		}

	function RollOut(himg,imgName) 
		{
			if(himg)
			if(eval("window." + imgName +  "_off"))
			himg.src = eval("window." + imgName +  "_off.src");
		}

	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  
	  if(!d) d=document;
	  //alert(window.ZONE1);
	  if(!d) alert('ici');

	  if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; 
			n=n.substring(0,p);
		}
	  if(!(x=d[n])&&d.all) x=d.all[n]; 
	  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n);
	  return x;
	}

	function MM_showHideLayers() { //v6.0

		var i,p,v,obj,args = MM_showHideLayers.arguments;

		for (i=0; i<(args.length-2); i+=3) 
			if ((obj = MM_findObj(args[i]))!=null) { 
				v = args[i+2];
				if (obj.style) { 
					obj=obj.style; 
					v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
				}
				obj.visibility=v; 
			}
	}

/******************************** DEBUG */
function MM_showHideLayers2() { //v6.0
		
		var i,p,v,obj,args = MM_showHideLayers2.arguments;

		for (i=0; i<(args.length-2); i+=3) {
			//alert(args[0] + ' ' + args[2]);
			//alert(MM_findObj(args[i]));
			if ((obj = MM_findObj(args[i]))!=null) { 
				v = args[i+2];
				if (obj.style) { 
					obj=obj.style; 
					v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
				}
				obj.visibility=v; 
			}
		}
		//alert('FIN ' + args[0]);
	}
/******************************** DEBUG */

	function preload()
		{
			folder = arguments[0];
					
			for (var i = 1 ; i < arguments.length ; i++)
			{
				eval(arguments[i] + '_on = new Image()')
				eval(arguments[i] + '_on.src = "' + folder + arguments[i] + '_on.gif"')
				eval(arguments[i] + '_off = new Image()')
				eval(arguments[i] + '_off.src = "' + folder + arguments[i] + '_off.gif"')
			}
		}

	// Initialisation des images de navhaut
	//preload('<< rep_source >>','<< nom_image >>', ..., ..., ....)
//	preload('../images/','b_carre_forces','b_derudder_metier','b_muti_specialiste','b_espace','b_contact');


function FORM_SUBMIT(Name)
	{
		// Verification des parametre doivent etre renseignés.
		if(eval('document.' + Name + '.name'))
		if(eval('document.' + Name + '.name.value.length') < 3) {
			alert('Please type the last name or at least the 3 letters of your contact');
			eval('document.' + Name + '.name.focus()');
			return;
		}
				
		// Nom
		if(eval('document.' + Name + '.name'))
		for (i=0;i<eval('document.' + Name + '.name.value.length');i++)
			{
				if ((65 > eval('document.' + Name + '.name.value.charCodeAt(i)')) || ((eval('document.' + Name + '.name.value.charCodeAt(i)') > 90) && (97 > eval('document.' + Name + '.name.value.charCodeAt(i)'))) || ( eval('document.' + Name + '.name.value.charCodeAt(i)') > 122))
				if (eval('document.' + Name + '.name.value.charCodeAt(i)') != 45 && eval('document.' + Name + '.name.value.charCodeAt(i)') != 32) 
				{
					alert('Attention !\nVeuillez utiliser uniquement des caractères alphabétiques');
					eval('document.' + Name + '.name.focus()');
					return;
				}
			}
			
	
		eval('document.' + Name + '.action = \'\'');
		eval('document.' + Name + '.submit()');
	z=('/cgi-bin/trombiuk.html?'+eval('document.'+Name+'.name.value'));
	window.location = (z);
	}
