function Zoom(ID,WidthImg,HeightImg)	{var width = ((WidthImg + 35) > screen.width) ? screen.width - 35: WidthImg + 35;var height = ((HeightImg + 60) > screen.height) ? screen.height - 60: HeightImg + 60;open("viewimg.asp?tt=article&ID=" + ID, "", "toolbar=0,location=0,directories=0,scrollbars=1,resizable=1, status=0,menubar=0,width=" + width + ",height=" + height +",left=5,top=5");}
function View(ID)						{open( "View.aspx?ID=" + ID, "", "toolbar=0,location=0,directories=0,scrollbars=0,resizable=0, status=0,menubar=0,width=250,height=230,left=5,top=5");}
function ViewImg(ID)					{open("ViewImg.aspx?ID=" + ID, "", "toolbar=0,location=0,directories=0,scrollbars=1,resizable=1, status=0,menubar=0,width=400,height=320,left=5,top=5");}
function ViewArticle(ID)				{open( "View.aspx?tt=article&ID=" + ID, "", "toolbar=0,location=0,directories=0,scrollbars=0,resizable=0, status=0,menubar=0,width=250,height=230,left=5,top=5");}
function ViewImgContenu(ID) 			{open("ViewImg.aspx?tt=article&ID=" + ID, "", "toolbar=0,location=0,directories=0,scrollbars=1,resizable=1, status=0,menubar=0,width=400,height=320,left=5,top=5");}
function ShowAssistant(url, width, height)	{open(url, "", "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=2,resizable=1,width=" + width + ",height=" + height + ",left=15,top=15");}
function ShowForm(url, width, height)	{open(url, "", "toolbar=1,location=1,directories=1,status=0,menubar=1,scrollbars=2,resizable=1,width=" + width + ",height=" + height + ",left=15,top=15");}
function tabover(e)						{document.getElementById(e).className= "tabHover";}
function tabout(idx, e)					{if(e != activeTab[activeIdx[idx]])	document.getElementById(e).className= "tab";}	
function tabdown(idx, e,i,v)			{document.getElementById(activeTab[idx]).className= "tab"; document.getElementById("str" + activeTab[idx]).value = document.frm[v].value; activeTab[idx] = e; activeIdx[idx] = i; document.getElementById(e).className= "tabActive"; document.frm[v].value = document.getElementById("str" + activeTab[idx]).value;}
function GetDay(strVal)					{return parseInt(strVal.substring(0, 2), 10);}
function GetMonth(strVal)				{return parseInt(strVal.substring(3, 5), 10);}
function GetYear(strVal)				{return parseInt(strVal.substring(6, strVal.length), 10);}
function IsMin(strVal, strZone, iSize)	{if(strVal == null || strVal.length == 0)return false; if(strVal.length < iSize) {strMsg += strZone + " : La zone doit contenir au moins " + iSize + " caracteres\r\n";return true;}return false;}
function IsFloat(strVal, strZone)		{if(strVal == null || strVal.length == 0)return false; var str = strVal.toString();var Decimal = false;for(var i = 0; i < str.length; i++){var c = str.charAt(i);if (c == "." && !Decimal){Decimal = true;continue;}if(c < "0" || c > "9"){strMsg += strZone + " : La zone contient des caracteres alphabetiques\r\n";return false;}}return true;}
function IsMax(strVal, strZone, iSize)	{if(strVal == null || strVal.length == 0)return false; if(strVal.length > iSize){strMsg += strZone + " : La zone doit contenir au plus " + iSize + " caracteres\r\n";return true;}return false;}
function IsNull(strVal)					{if(strVal == null ||strVal.length == 0)return true;else return false;}
function IsDate(strVal, strZone)		{if(strVal == null || strVal.length == 0)return false;var	Delim = strVal.indexOf("/");var	Delim1= strVal.lastIndexOf("/");var	iValDD = 0;var	iValMM = 0;var	iValYYYY = 0;if (strVal.length != 10 && strVal.length != 8){strMsg += strZone + " : La zone contient une date erronnee (Format JJ/MM/AAAA)\r\n";return false;}if(Delim != -1 && Delim1 == Delim){strMsg += strZone + " : La zone contient des separateurs invalide\r\n";return false;}iValDD 	= parseInt(strVal.substring(0, 2), 10);iValMM 	= parseInt(strVal.substring(3, 5), 10);iValYYYY 	= parseInt(strVal.substring(6, strVal.length), 10);if(isNaN(iValDD) || isNaN(iValMM) || isNaN(iValYYYY)){strMsg += strZone + " : La zone contient une date erronnee (Format JJ/MM/AAAA)\r\n";return false;}if(iValDD <= 0 || iValDD > 31){strMsg += strZone + " : La zone contient une plage de date invalide\r\n";return false;}if(iValMM <= 0 || iValMM > 13){strMsg += strZone + " : La zone contient une plage de date invalide\r\n";return false;}if(strVal.length == 10){if(iValYYYY <= 1950 || iValYYYY > 9999){strMsg += strZone + " : La zone contient une plage de date invalide\r\n";return false;}}else{if(iValYYYY > 99){strMsg += strZone + " : La zone contient une plage de date invalide\r\n";return false;}}return true;}
function IsNumber(strVal, strZone)		{if(strVal == null || strVal.length == 0)return false; var str = strVal.toString();for(var i = 0; i < str.length; i++){var c = str.charAt(i);if(c < "0" || c > "9"){strMsg += strZone + " : La zone contient des caracteres alphabetiques\r\n";return false;}}return true;}
function IsEmpty(strVal, strZone)		{if(strVal == null ||strVal.length == 0){strMsg += strZone + " : La zone est obligatoire\r\n";return true;}return false;}
function IsEmail(strVal, strZone)
{
	if(strVal == null || strVal.length == 0)return false;
	var emailPat		= /^(.+)@(.+)$/;
	var specialChars	= "\\(\\)<>@,;:ùéèçà\\\\\\\"\\.\\[\\]";
	var validChars		= "\[^\\s" + specialChars + "\]";
	var firstChars		= validChars;
	var quotedUser		= "(\"[^\"]*\")";
	var ipDomainPat		= /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom			= "(" + firstChars + validChars + "*" + ")";
	var word			= "(" + atom + "|" + quotedUser + ")";
	var userPat			= new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat		= new RegExp("^" + atom + "(\\." + atom +")*$");

	var matchArray		= strVal.match(emailPat);
	if (matchArray == null)
	{
		strMsg += strZone + " : 1 - L'adresse email est incorrect\r\n";
		return true;	
	}
	var user = matchArray[1];
	var domain = matchArray[2];
	if (user.match(userPat) == null)
	{
		strMsg += strZone + " : 2 - L'adresse email est incorrect\r\n";
		return false;	
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray != null)
	{
		for (var i = 1; i <= 4; i++)
		{
			if (IPArray[i] > 255)
			{
				strMsg += strZone + " : 3 - L'adresse email est incorrect\r\n";
				return false;	
			}
		}
		strMsg += strZone + " : 4 - L'adresse email est incorrect\r\n";
		return false;	
	}

	var domainArray = domain.match(domainPat);
	if (domainArray == null)
	{
		strMsg += strZone + " : 5 - L'adresse email est incorrect\r\n";
		return false;	
	}
	var atomPat = new RegExp(atom, "g");
	var domArr = domain.match(atomPat)
	var len = domArr.length 
	if (domArr[domArr.length - 1].length < 2 || domArr[domArr.length - 1].length > 4)
	{	
		strMsg += strZone + " : 6 - L'adresse email est incorrect\r\n";
		return false;	
	}
	return true;
}
