/*
	if (window.Event) // Only Netscape will have the CAPITAL E.
	document.captureEvents(Event.MOUSEUP); // catch the mouse up event
	 
	function nocontextmenu()  // this function only applies to IE4, ignored otherwise.
	{
		event.cancelBubble = true
		event.returnValue = false;
	 
		return false;
	}
	 
	function norightclick(e) // This function is used by all others
	{
		if (window.Event) // again, IE or NAV?
		{
			if (e.which == 2 || e.which == 3)
				return false;
		}
		else
			if (event.button == 2 || event.button == 3)
			{
				event.cancelBubble = true
				event.returnValue = false;
				return false;
			}
	}
	 
	document.oncontextmenu = nocontextmenu;  // for IE5+
	document.onmousedown = norightclick;  // for all others
*/				

	function getBrowser()
	{
		var appName = navigator.appName
		var appAgent = navigator.userAgent
		var fGetType = false
		
		if(appAgent.indexOf('Opera') != (-1)) {return(3)}
		
		if(appAgent.indexOf('MSIE') != (-1)) {return(1)}

		if(appAgent.indexOf('Netscape') != (-1)) {return(2)}
		
		if(appAgent.indexOf('Mozilla') != (-1)) {return(4)}		
	}

	//==============================================================================================
	
	function isDateDDMMRRRR(dateString)
	{
		syntax	=	true;
		if(dateString.length > 0)
		{
			abstr			=	".";
			firstDot		=	dateString.indexOf(abstr);
			lastDot			=	dateString.lastIndexOf(abstr);
				
			if(firstDot != (-1) && lastDot != (-1) && firstDot != lastDot)
			{
				day			=	dateString.substr(0,firstDot);
				month		=	dateString.substr(firstDot + 1, (lastDot - firstDot) - 1);
				year		=	dateString.substr(lastDot + 1,dateString.length);
					
				if(day.length == 2 && month.length == 2 && year.length == 4)
				{
					if(isComputeZero(day) && isComputeZero(month) && isComputeZero(year))
					{
						transMiss	=	(year % 4) == 0;
							
						_day	=	Math.abs(dateString.substr(0,firstDot));
						_month	=	Math.abs(dateString.substr(firstDot + 1, (lastDot - firstDot) - 1));
						_year	=	Math.abs(dateString.substr(lastDot + 1,dateString.length));
						
						__year	=	dateString.substr(lastDot + 1,dateString.length);
							
						if(_month	==	1)	{if(_day > 31)	{syntax	=	false;}}

						if(_month	==	2)	
						{
							if(transMiss)
							{
								if(_day > 29)	{syntax	=	false;}
							}
							else
							{
								if(_day > 28)	{syntax	=	false;}
							}
						}

						if(_month	==	3)	{if(_day > 31)	{syntax	=	false;}}
						if(_month	==	4)	{if(_day > 30)	{syntax	=	false;}}
						if(_month	==	5)	{if(_day > 31)	{syntax	=	false;}}
						if(_month	==	6)	{if(_day > 30)	{syntax	=	false;}}
						if(_month	==	7)	{if(_day > 31)	{syntax	=	false;}}
						if(_month	==	8)	{if(_day > 31)	{syntax	=	false;}}
						if(_month	==	9)	{if(_day > 30)	{syntax	=	false;}}
						if(_month	==	10)	{if(_day > 31)	{syntax	=	false;}}
						if(_month	==	11)	{if(_day > 30)	{syntax	=	false;}}
						if(_month	==	12)	{if(_day > 31)	{syntax	=	false;}}
						
						if(_day	>	31 || _month	>	12)										{syntax	=	false;}
						if(Math.abs(__year.substr(0,1))<1||Math.abs(__year.substr(0,1))>2)		{syntax	=	false;}
						if(Math.abs(__year.substr(0,1))==1&&Math.abs(__year.substr(1,1))!=9)	{syntax	=	false;}
						if(Math.abs(__year.substr(0,1))==2&&Math.abs(__year.substr(1,1))!=0)	{syntax	=	false;}
						
						return(syntax);							
					}
					else
					{
						return(false);
					}
				}
				else
				{
					return(false);
				}
			}
			else
			{
				return(false);
			}
		}
		else
		{
			return(false);
		}
	}
	
	function isDDMMRRRR( param )
	{
		ok	=	true;
		
		if(param.length==0)	{return(ok);}
			
		aParam	=	param.split(".");
			
		if(aParam.length!=3)	{ok	=	false;}
			
		if(param.length>0&&aParam.length==3)
		{
			DD		=	Math.abs(aParam[0]);
			MM		=	Math.abs(aParam[1]);
			RRRR	=	Math.abs(aParam[2]);

			if(MM<1||MM>12)
			{
				ok	=	false;
			}
			else
			{
				prestup	=	RRRR % 4;
			
				if(ok&&MM==1&&DD<1||DD>31)		{ok	=	false;}
				if(ok&&MM==2)
				{	
					if(prestup==0)
					{
						if(DD<1||DD>29)	{ok	=	false;}
					}
					else
					{
						if(DD<1||DD>28)	{ok	=	false;}
					}
				}
				
				if(ok&&MM==3&&(DD<1||DD>31))	{ok	=	false;}
				if(ok&&MM==4&&(DD<1||DD>30))	{ok	=	false;}
				if(ok&&MM==5&&(DD<1||DD>31))	{ok	=	false;}
				if(ok&&MM==6&&(DD<1||DD>30))	{ok	=	false;}
				if(ok&&MM==7&&(DD<1||DD>31))	{ok	=	false;}
				if(ok&&MM==8&&(DD<1||DD>31))	{ok	=	false;}
				if(ok&&MM==9&&(DD<1||DD>30))	{ok	=	false;}
				if(ok&&MM==10&&(DD<1||DD>31))	{ok	=	false;}
				if(ok&&MM==11&&(DD<1||DD>30))	{ok	=	false;}
				if(ok&&MM==12&&(DD<1||DD>31))	{ok	=	false;}
			
				if(RRRR<2007||RRRR>2020)	{ok	=	false;}
			}
		}
			
		return(ok);
	}

	//==============================================================================================

	function isHexZero(param)
	{
		for(i=0;i<param.length;++i)
		{
			ch = param.substr(i,1);
			if(ch=="0"||ch=="1"||ch=="2"||ch=="3"||ch=="4"||ch=="5"||ch=="6"||ch=="7"||ch=="8"||ch=="9"||ch=="A"||ch=="B"||ch=="C"||ch=="D"||ch=="E"||ch=="F"||ch=="a"||ch=="b"||ch=="c"||ch=="d"||ch=="e"||ch=="f")
				ok = true;
			else
				return(false);
		}
		return(true);
	}
	
	//==============================================================================================
	function isComputeOrPerZero(param)
	{
		for(i=0;i<param.length;++i)
		{
			ch = param.substr(i,1);
			if(ch==0||ch==1||ch==2||ch==3||ch==4||ch==5||ch==6||ch==7||ch==8||ch==9||(ch=="%"&&i==(param.length-1)))
				ok = true;
			else
				return(false);
		}
		
		
		
		return(true);	
	}
	
	
	//==============================================================================================
	
	function isComputeZero(param)
	{

		for(i=0;i<param.length;++i)
		{
			ch = param.substr(i,1);
			if(ch==0||ch==1||ch==2||ch==3||ch==4||ch==5||ch==6||ch==7||ch==8||ch==9)
				ok = true;
			else
				return(false);
		}
		return(true);
	}
	
	//==============================================================================================
	
	function webSyntax(address)
	{

		if(address.length > 0)
		{
			firstMask	=	address.indexOf("www.");
			dot			=	address.lastIndexOf(".");
			
			syntax	=	firstMask==0&&dot>(address.length-5)
			
			return(syntax);
		}
		else
			return(false);

		return(true);
	}
	
	//==============================================================================================
	
	function demoMsg( message )
	{
		alert(message);
	}
	
	//==============================================================================================
	
	function mailSyntax(mail)
	{
		if(mail.length > 0)
		{
			at			=	mail.indexOf("@");
			lastAt		=	mail.lastIndexOf("@");
				
			dot			=	mail.lastIndexOf(".");
			firstDot	=	mail.indexOf(".");
				
			syntax		=	at > 0 && dot > 0 && dot > at && dot < (mail.length - 2) && at > 1;
			
			// || Math.abs(dot) != Math.abs(firstDot)
				
			if(syntax)
				if(Math.abs(at) != Math.abs(lastAt))	{syntax	=	false;}
					
			return(syntax);
		}
		else
		{
			return(false);
		}
	}	
	


	//==============================================================================================

	function isComputeNonZero(param)
	{
		ok = false;
		for(i=0;i<param.length;++i)
		{
			ch = param.substr(i,1);
			if(ch==0||ch==1||ch==2||ch==3||ch==4||ch==5||ch==6||ch==7||ch==8||ch==9)
				ok = true;
			else
				return(false);
		}
			
		if(ok && param.length > 0)
		{
			isOnlyZero	= true;
			for(i=0;i<param.length;++i ) 
			{
				ch = param.substr(i,1);
				if(ch!=0) {isOnlyZero = false; break;}
			}
		}
			
		if(param.length > 0 && !isOnlyZero)
			return(true);
		else
			return(false);
	}
	
	//==============================================================================================

	function isHexNonZero(param)
	{
		ok = false;
		for(i=0;i<param.length;++i)
		{
			ch = param.substr(i,1);
			if(ch=="0"||ch=="1"||ch=="2"||ch=="3"||ch=="4"||ch=="5"||ch=="6"||ch=="7"||ch=="8"||ch=="9"||ch=="A"||ch=="B"||ch=="C"||ch=="D"||ch=="E"||ch=="F"||ch=="a"||ch=="b"||ch=="c"||ch=="d"||ch=="e"||ch=="f")
				ok = true;
			else
				return(false);
		}
			
		if(ok && param.length > 0)
		{
			isOnlyZero	= true;
			for(i=0;i<param.length;++i ) 
			{
				ch = param.substr(i,1);
				if(ch!=0) {isOnlyZero = false; break;}
			}
		}
			
		if(param.length > 0 && !isOnlyZero)
			return(true);
		else
			return(false);	
	}
	
	//==============================================================================================
	
	function allTrim(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 callEditor(ID, advTable, table, paramX, paramY, paramZ, paramS, from, lang, mask, refresh, font, reDescription)
	{
		var path;
		path = '_myHTMLEditor.php?ID=' + ID + '&advTable=' + advTable + '&table=' + table + '&paramX=' + paramX + '&paramY=' + paramY + '&paramZ=' + paramZ + '&paramS=' + paramS + '&from=' + from + '&lang=' + lang + '&mask=' + mask + '&back=' + '&font=' + font + '&redescr=' + reDescription;
		parametre = "top=10,left=0,height=700,width=1000,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no,resizable=yes";
		window.open(path,"MYEDITOR348573984573245",parametre,true);	
	}
	
	function callVisiwig(ID, advTable, table, paramX, paramY, paramZ, paramS, from, lang, mask, refresh, reDescription)
	{
		var path;
		path = '../visiwig/_visiwig.php?ID=' + ID + '&advTable=' + advTable  + '&table=' + table + '&paramX=' + paramX + '&paramY=' + paramY + '&paramZ=' + paramZ + '&paramS=' + paramS + '&from=' + from + '&lang=' + lang + '&mask=' + mask + '&redescr=' + reDescription;
		parametre = "top=10,left=0,height=700,width=1000,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no,resizable=yes";
		window.open(path,"MYEDITOR348573984573245",parametre,true);
		
		if(refresh==1)
		{
			document.FORMIX.OPENBIGEDITOR.value		=	ID;
			document.FORMIX.submit();				
		}
	}
	
	function stdMouseOverCore( x, over, under, current, color )
	{
		if(over)
		{
			if(under)	{x.style.textDecoration = 'underline';}
					
			if(gB == 1 || gB == 3) {x.style.cursor = 'hand';}
			if(gB == 2 || gB == 4) {x.style.cursor = 'pointer';}
			
			if(current.length > 0)
				x.style.color	=	current;
		}
		else
		{
			x.style.textDecoration = 'none';
			x.style.cursor = 'none';
				
			if(color.length > 0)
				x.style.color	=	color;
		}
	}
	
	function openUseServices( tag )
	{
		if(document.getElementById(tag).style.display == 'inline')
			document.getElementById(tag).style.display = 'none';
		else
			document.getElementById(tag).style.display = 'inline';		
	}
	
	//==============================================================================================
	function isTelNumber( inputName, message )
	{
		eval("param	=	document.FORMIX."+inputName+".value;");

		ok		=	true;
		buffer	=	"";

		for(i=0;i<param.length;++i)
		{
			ch = param.substr(i,1);

			if(ch==0||ch==1||ch==2||ch==3||ch==4||ch==5||ch==6||ch==7||ch==8||ch==9||ch==" "||ch=="/")
			{
				buffer	=	buffer	+	ch;
			}
			else
			{
				ok		=	false;
			}
		}
				
		if(!ok)
		{
			alert(message);
			eval("document.FORMIX."+inputName+".value=buffer;");
		}

	}

	function alfabetical( param )
	{
	
	}
	
	function test()
	{
		alert("TEST");
	}
