<!--
// constantes
var chiffres	= "0123456789";
var espace	= ' ';
var underscore	= '_';
var slash		= '/';
var point		= '.';
var tiret		= '-';
var alphaMin 	= "abcdefghijklmnopqrstuvwxyz";
var alphaMax 	= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var operateur 	= "*+,-./";
var likeSql		= "[]@%_";
var caracSpec 	= "!?¿#%&'():;=@[\]^_{|}~¡¢ƒˆßµ÷¦§¨©ª­®¯°±²³·¸";
var carFormBDL = "'#%&():;=@[]^_{}|~¦";
var caracSpecDangereux = "\\\\\"\"'`´<>";
var monetaire	= "£¤¥€$";
var accent	= "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÐŠšŸŽž";
var sepEmail = "@.-";
var sep_decimal_EN = '.';
var sep_decimal_FR = ',';
var sep_decimal;
var select_empty = "-";
var min_Year	= 1900;
var max_Year	= 3000;
var annee_charniere = 50;
var max_Int 	= 2147483647;
var semicolumn = ';';


function submitForm () {
	if (typeof (document.creationEnveloppe) == "object") 
		document.creationEnveloppe.submit();
}
	
function redo() {
	window.location.reload();
}
function checkExtension (object, amsg) {
/*.doc, .xls, .pdf, .txt, .ppt*/
var object_value = new String(object.value);	
var taille = object_value.length;

var extension = object_value.substring(taille-4,taille);
	if (! (extension == '.xls' || extension == '.doc' || extension == '.pdf' || extension == '.txt' || extension == '.ppt' || extension == '.XSL' || extension == '.DOC' || extension == '.PDF' || extension == '.TXT' || extension == '.PPT')) {
		object.focus ();
		alert(amsg);
		return false;
		}
	return true;
}
	
function checkMultipleCssf (object, amsg, focus) {
var object_value = new String(trim(object.value));
var sep;
var tmp;

	sep = object_value.indexOf (';');
	if (sep == -1) {
		/* pas de séparateur */
		if (object_value.length > 6 || object_value.length <= 0) {
			if (focus) object.focus ();
			alert(amsg);
			return false;	
		}
	}
	else {
		/* séparateur interdit */
		if (focus) object.focus ();
		alert(amsg);
		return false;	
		
		/* un ou des séparateurs */
		while (sep != -1) {
			tmp = object_value.substring (0, sep);
			if (tmp.length > 6 || tmp.length <= 0) {
				object.focus ();
				alert(amsg);
				return false;	
				}
			object_value = object_value.substring (sep +1, object_value.length);
			sep = object_value.indexOf (';');
			}
		/* on n'oublie pas le dernier élément */
		if (object_value.length > 6) {
			object.focus ();
			alert(amsg);
			return false;	
		}
	}
	
	return true;
}

function checkDownloadCSV (aCodePage, aurl, amsg) {
	if (aCodePage == 'PP_SearchResult' || aCodePage == 'PP_MarcheLux' || aCodePage == 'PP_NouvellesAdmissions' || aCodePage == 'PP_DerniersRetraits') {
	    window.open(aurl,"");
		/*return true;*/
		}
	else {
		alert(amsg);	
		/*return false;*/
		}
	}
	
function checkDownload (aCodePage, aurl, amsg, amsg1, amsg2) {
	if (aCodePage == 'PP_ConsultWatchlist' || aCodePage == 'DP_HistoPrix') {
		if (aCodePage == 'PP_ConsultWatchlist'){
		    //alert(window.document.consultWatchlist.watchlist.options[window.document.consultWatchlist.watchlist.selectedIndex].text);
		    if (window.document.consultWatchlist.permissionDL.value == "false")
		    	alert(amsg1);
		    else{
			    if (window.document.consultWatchlist.download.value == "std" || window.document.consultWatchlist.download.value == "prm")
			    	window.open(aurl + "&typePage=watchlist&service=" + window.document.consultWatchlist.download.value + "&watchName=" + escape(window.document.consultWatchlist.watchlist.options[window.document.consultWatchlist.watchlist.selectedIndex].text) + "&idWl=" + window.document.consultWatchlist.watchlist.value,"");
			    else
			    	alert(amsg2);
			}
		}
		else if (aCodePage == 'DP_HistoPrix'){
			//alert(window.document.consultWatchlist.watchlist.options[window.document.consultWatchlist.watchlist.selectedIndex].text);
		    if (window.document.perm != null && window.document.perm.permissionDL != null && window.document.perm.permissionDL.value == "false")
		    	alert(amsg1);
		    else {
			    if ((window.document.histoPrixParams != null) && (window.document.histoPrixParams.download.value != null) && (window.document.histoPrixParams.download.value=="true"))
				    	window.open(aurl + "&typePage=histoprix&ISIN=" + window.document.infosCode.code.value + "&libelle=" + escape(window.document.infosCode.libelle.value) + "&libDevise=" + window.document.histoPrix.devise.options[window.document.histoPrix.devise.selectedIndex].text,"");
				else
					alert(amsg2);
			}
		}
		else
		  window.open(aurl,"");
		/*return true;*/
		}
	else {
		alert(amsg);	
		/*return false;*/
		}
	}
	
function checkPrint (aCodePage, aurl, amsg, amsg1, amsg2) {
	
		if (aCodePage == 'PP_ConsultWatchlist'){
		    if (window.document.consultWatchlist.permission.value == "false")
		    	alert(amsg1);
		    else {
			    //alert(window.document.consultWatchlist.watchlist.options[window.document.consultWatchlist.watchlist.selectedIndex].text);
			    if (window.document.consultWatchlist.print.value == "true")
			    	window.open(aurl + "&typePage=watchlist&watchName=" + escape(window.document.consultWatchlist.watchlist.options[window.document.consultWatchlist.watchlist.selectedIndex].text) + "&idWl=" + window.document.consultWatchlist.watchlist.value,"");
			    else
			    	alert(amsg2);
		    }
		}
		else if (aCodePage == 'DP_HistoPrix'){
			if (window.document.perm != null && window.document.perm.permission != null && window.document.perm.permission.value == "false")
		    	alert(amsg1);
		    else {
				if ((window.document.histoPrixParams != null) && (window.document.histoPrixParams.print.value != null) && (window.document.histoPrixParams.print.value=="true"))
				    	window.open(aurl + "&typePage=histoprix&ISIN=" + window.document.infosCode.code.value + "&libelle=" + escape(window.document.infosCode.libelle.value)  + "&libDevise=" + window.document.histoPrix.devise.options[window.document.histoPrix.devise.selectedIndex].text,"");
				else
					alert(amsg2);
			}
		}
		
	}

function setLocale (language) {
	if (language == 'FR') sep_decimal = sep_decimal_FR;
	if (language == 'EN') sep_decimal = sep_decimal_EN;
}
function setSelectEmpty (aStr) {
	select_empty = aStr;
}	
// vérifie qu'un champ, après suppression des espaces superflus, est renseigné ou pas
function checkRequired (object, msg) {
var object_value;

	if (object.type != "select-one") object_value = new String(object.value);
	else object_value = new String(object.options[object.selectedIndex].value);
	//alert(object_value);
	if ((object.type != "select-one") && (trim(object_value).length == 0)) {
		alert (msg);
		return false;
	}
	
	if (object.type == "select-one" && trim(object_value) == select_empty) {
		alert (msg);
		return false;
	}
	
	return true;
}

// suppression des espaces superflus
function trim(strText) {
var rse = new String (strText);
	
     	// this will get rid of leading spaces 
    	while (rse.substring(0,1) == ' ') 
        	rse = rse.substring(1, rse.length);
    	// this will get rid of trailing spaces 
    	while (rse.substring(rse.length-1, rse.length) == ' ')
        	rse = rse.substring(0, rse.length-1);   
	
	return rse;
}

// vérifie qu'un champ trimé, est un entier non signé (positif)
function checkInteger (object, msg, required, msgRequired, maximum){
var object_value = trim(object.value);

	// check required
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }
	if (!checkIntegerValue (object_value)) {
		object.focus ();
		alert(msg);
		return false;
	}
	return true;
}

// vérifie qu'une valeur est au format email 
function checkEmail (object, msg) {
	emailStr = object.value;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var atom=validChars + '+';
	var word="(" + atom + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null)	{object.focus();alert(msg); return false;}
	var user=matchArray[1];
	var domain=matchArray[2];
	for (i=0; i<user.length; i++)	{if (user.charCodeAt(i)>127) {object.focus();alert(msg); return false;}}
	for (i=0; i<domain.length; i++)	{if (domain.charCodeAt(i)>127) {object.focus();alert(msg); return false;}}
	if (user.match(userPat)==null) {object.focus();alert(msg); return false;}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {if (domArr[i].search(atomPat)==-1) {object.focus();alert(msg); return false;}}
	if (domArr[domArr.length-1].length<2) {object.focus();alert(msg); return false;} 
	if (len<2) {object.focus();alert(msg); return false;}
	return true;
}

function checkIntegerValue (object_value){
var check_char;

	// valeur max en DB
	if (object_value > max_Int) return false;
	
	for (var i = 0; i < object_value.length; i++) {
		check_char = chiffres.indexOf(object_value.charAt(i))
		if (check_char == -1) return false;
	}
	return true;
}

function checkNumeric (object, msg, size, decimal_size, required, msgRequired){
var object_value = new String(trim(object.value));
var partieDecimale;
var allowed = chiffres + sep_decimal;
var int_part = size - decimal_size;
var virgule;

	// check required
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }

    	// si on a le séparateur décimal en premiere position => erreur
	if (object_value.indexOf(sep_decimal) == 0) {
		object.focus();
		alert(msg);
		return false;
	}

	//si on a le séparateur decimal en dernière position => erreur
	if ((object_value.indexOf(sep_decimal)+1) == object_value.length) {
		object.focus();
		alert(msg);
		return false;
	}

	// si on a plusieurs séparateur decimal => erreur
	if (object_value.indexOf(sep_decimal) != -1) {
		partieDecimale = object_value.substring(object_value.indexOf(sep_decimal)+1, object_value.length);
		if (partieDecimale.indexOf(sep_decimal) != -1) {
			object.focus();
			alert(msg);
			return false;
		}
	}

	//on test si la chaque caractère appartient à l'ensemble des éléments autorisés
	for (var i = 0; i < object_value.length; i++) {
		check_char = allowed.indexOf(object_value.charAt(i))
		if (check_char == -1) {
			object.focus();
			alert(msg);
			return false;
		}	
	}
	
	// Recherche du séparateur
	virgule = object_value.indexOf('.');
	// Si virgule = -1 c'est que il n'y a pas de valeur dans l'input ou un entier
	if (virgule != -1) {
		// Partie entiere
		var entiere = object_value.substring(0, virgule);
		// Partie flottante
		var decimale = object_value.substring(virgule+1, object_value.length);
		// La partie decimale doit etre inferieure ou egale à float_part
		if (decimale.length > float_part) {
			alert(msg);
			return false;
		}
		// On compte le nombre de chiffres dans la partie entiere
		var nb = 0;
		for (i=0; i<entiere.length; i++) {
			if (chiffres.indexOf(entiere.charAt(i)) != -1) {nb++;}
		}
		// La partie entiere doit etre inferieure ou egale à int_part
		if (nb > int_part) {
			alert(msg);
			return false;
		}
	} else {
		if (object_value.length > int_part) {
			alert(msg);
			return false;
		}
	}
	return true;
}

function checkString (object, msg, required, msgRequired, restriction, showmsg) {
var object_value = trim(object.value);
var toucheEnter = false;
var allowed;
var resultat = "ok";

	// check required
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }
	
	if (restriction.toUpperCase() == "ALPHA"){
		allowed = alphaMin + alphaMax + espace;
		toucheEnter = true;
		}
	else if (restriction.toUpperCase() == "PASSWORD"){
		allowed = alphaMin + alphaMax + chiffres;
		}	
	else if (restriction.toUpperCase() == "ALPHANUMSTRICT"){
		allowed = alphaMin + alphaMax + chiffres + espace;
		toucheEnter = true;
		}
	else if (restriction.toUpperCase() == "ALPHANUM"){
		allowed = alphaMin + alphaMax + chiffres + operateur + espace + accent + carFormBDL + underscore + slash + likeSql + caracSpec + caracSpecDangereux + monetaire;
		}
	else if (restriction.toUpperCase() == "LISTENUM"){
		allowed = chiffres + semicolumn;
		}
	else if (restriction.toUpperCase() == "ALPHANUMETENDU"){
		allowed = alphaMin + alphaMax + chiffres + operateur + accent + espace;
		}
	else if (restriction.toUpperCase() == "ALPHAACCENT"){
		allowed = alphaMin + alphaMax + chiffres + operateur + accent + espace;
		}
	else if (restriction.toUpperCase() == "ALPHAACCENTENTER"){
		allowed = alphaMin + alphaMax + chiffres + operateur + accent + espace + underscore + slash + caracSpec + monetaire;
		toucheEnter = true;
	}
	else if (restriction.toUpperCase() == "EMAIL"){
		allowed = alphaMin + alphaMax + chiffres + accent + underscore + sepEmail;
	}
	else if (restriction.toUpperCase() == "NUMERIC"){
		allowed = chiffres;
	}
	else if (restriction.toUpperCase() == "NUMERIC4DATE"){
		allowed = chiffres + slash;
		toucheEnter = true;
		}
	else if (restriction.toUpperCase() == "CODEISIN"){
		// les chiffres et les caractères majuscules et minuscules seulement
		allowed = chiffres + alphaMax + alphaMin;
		}	
	else if (restriction.toUpperCase() == "CODECSSF"){
		// caractères autorisés pour la validation d'un code CSSF
		allowed = chiffres;
		}				
	else if (restriction.toUpperCase() == "LIBELLE"){
		// libellé d'un fond, d'un type de part
		allowed = chiffres + alphaMax + alphaMin + espace + underscore + slash + accent + operateur + likeSql;
		}		
	else{
		allowed = alphaMin + alphaMax + chiffres + operateur + underscore + espace;
		//toucheEnter = true;		//si on veut autoriser la touche enter, on décommente
		}
	
	for (var i=0; i<object_value.length; i++) {
		//si on autorise la touche enter
		if ((toucheEnter == true) && (i+1 < object_value.length) && (resultat != "arret")) {
			if ((object_value.charCodeAt(i)==13) && (object_value.charCodeAt(i+1)==10)) {
				resultat = "enter";
			}
		}		
		//si le caractère n'est pas enter et qu'on n'a pas encore rencontré de caractère interdit
		if (resultat == "ok") {	
			if (allowed.indexOf(object_value.charAt(i))==-1) {
				resultat = "arret";
			}
		}		
		//sinon on remet à ok pour tester la suite : le enter et codé sur deux caractère donc il faut passer deux tours			
		if ((object_value.charCodeAt(i)==10)&& (toucheEnter==true)){
			resultat = "ok";
		}
	}	
	if (resultat == "ok") return true;
	else {
		object.focus();
		if (showmsg == true) {
			alert(msg);
		}
		return false;
	}
}

function checkRange(object_value, min_value, max_value) {

    // check minimum
    if (min_value != null) {
        if (object_value < min_value) return false;
	}

    // check maximum
    if (max_value != null) {
		if (object_value > max_value) return false;
	}
	
    //All tests passed, so...
    return true;
}
	

function checkDate(object, msg, required, msgRequired) {
var object_value = new String (trim(object.value));
var isplit;

    	// check required
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }
        
    	//Returns true if value is a date in the dd/mm/yyyy format
    if (object_value.length != 10) {
        	object.focus ();
        	alert(msg);
        	return false;
        }

        isplit = object_value.indexOf(slash);

        if (isplit != 2) {
        	object.focus ();
        	alert(msg);
        	return false;
        }

    	sDay = object_value.substring(0, isplit);
        isplit = object_value.indexOf(slash, isplit + 1);

        if (isplit != 5) {
        	object.focus ();
        	alert(msg);
        	return false;
        }

    	sMonth = object_value.substring((sDay.length + 1), isplit);

        sYear = object_value.substring(isplit + 1);

        if (!checkIntegerValue(sMonth)) {
        	//check month
        	object.focus ();
        	alert(msg);
                return false;
               }
        else 
        if (!checkRange(sMonth, 1, 12)) {
        	//check month
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkIntegerValue(sYear)) {
        	//check year
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkRange(sYear, min_Year, max_Year)) {
        	//check year
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkIntegerValue(sDay)) {
        	//check day
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkDay(sYear, sMonth, sDay)) {
        	// check day
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
                return true;
}

/*
Vérifie qu'une date est au format jour_mois_année avec :
 - jour = j ou jj
 - mois = m ou mm
 - année = aa ou aaaa
 - _ = - ou / ou .
*/
function checkComplexDate(object, msg, required, msgRequired) {

var object_value = new String (trim(object.value));
var position;
var separateur = ' ';
var jour = '';
var mois = '';
var annee = '';
var reste = '';

    	/* check required */
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }
        
        /* On détermine quel est le séparateur utilisé */
    if (object_value.indexOf(slash) >= 0) {
		separateur = slash;
    	}
    if (object_value.indexOf(tiret) >= 0) {
		if (separateur != ' ') {
        	object.focus ();
        	alert(msg);
        	return false;
			}
		separateur = tiret;
    	}
    if (object_value.indexOf(point) >= 0) {
		if (separateur != ' ') {
        	object.focus ();
        	alert(msg);
        	return false;
			}
		separateur = point;
    	}
    if (separateur == ' ') {
    	object.focus ();
    	alert(msg);
    	return false;
    }
    
    position = object_value.indexOf(separateur);
    if (position != 1 && position != 2) {
    	object.focus ();
    	alert(msg);
    	return false;
    	}

   	jour = object_value.substring(0, position);
	reste = object_value.substring(position+1);

    position = reste.indexOf(separateur);
    if (position != 1 && position != 2) {
    	object.focus ();
    	alert(msg);
    	return false;
    	}
	
   	mois = reste.substring(0, position);
	annee = reste.substring(position+1);

	if (!checkIntegerValue(jour)) {
		object.focus ();
		alert(msg);
		return false;
	}

	if (!checkIntegerValue(mois)) {
		object.focus ();
		alert(msg);
		return false;
	}

	if (!checkIntegerValue(annee)) {
		object.focus ();
		alert(msg);
		return false;
	}


	if (annee.length != 2 && annee.length != 4) {
    	object.focus ();
    	alert(msg);
    	return false;
	}
	else
	{
		if (annee.length == 2)
		{
			if (annee > annee_charniere)
			{
				annee = 19+annee
			}
			else
			{
				annee = 20+annee;
			}
		}
	}

    if (!checkRange(annee, min_Year, max_Year)) {
        object.focus ();
        alert(msg);
        return false;
    }

	if (!checkRange(mois, 1, 12)) {
		object.focus ();
		alert(msg);
		return false;
	}

    if (!checkDay(annee, mois, jour)) {
        object.focus ();
        alert(msg);
        return false;
    }
	return true;
}

function checkDate2(object, msg, required, msgRequired) {
var object_value = new String (trim(object.value));
var isplit;

    	// check required
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }
        
    	//Returns true if value is a date in the dd/mm/yyyy format
    if (object_value.length != 10) {
        	object.focus ();
        	alert(msg);
        	return false;
        }

        isplit = object_value.indexOf(slash);

        if (isplit != 2) {
        	object.focus ();
        	alert(msg);
        	return false;
        }

    	sDay = object_value.substring(0, isplit);
        isplit = object_value.indexOf(slash, isplit + 1);

        if (isplit != 5) {
        	object.focus ();
        	alert(msg);
        	return false;
        }

    	sMonth = object_value.substring((sDay.length + 1), isplit);

        sYear = object_value.substring(isplit + 1);

        if (!checkIntegerValue(sMonth)) {
        	//check month
        	object.focus ();
        	alert(msg);
                return false;
               }
        else 
        if (!checkRange(sMonth, 1, 12)) {
        	//check month
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkIntegerValue(sYear)) {
        	//check year
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkRange(sYear, min_Year, max_Year)) {
        	//check year
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkIntegerValue(sDay)) {
        	//check day
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
        if (!checkDay(sYear, sMonth, sDay)) {
        	// check day
        	object.focus ();
        	alert(msg);
                return false;
               }
        else
                return true;
}

// vérifie que la date object1 est plus petite que la date object2
// les dates doivent être au format jj/mm/yyy  
function checkTwoDates (object1, object2, amsg) {
var isplit;
var sDay, sMonth, sYear;
var sDay2, sMonth2, sYear2;
	
	isplit = object1.value.indexOf (slash);
   	sDay = object1.value.substring (0, isplit);
	isplit = object1.value.indexOf(slash, isplit + 1);
   	sMonth = object1.value.substring((sDay.length + 1), isplit);
	sYear = object1.value.substring(isplit + 1);
        	   	
     	isplit = object2.value.indexOf (slash);
   	sDay2 = object2.value.substring (0, isplit);
	isplit = object2.value.indexOf(slash, isplit + 1);
   	sMonth2 = object2.value.substring((sDay2.length + 1), isplit);
	sYear2 = object2.value.substring(isplit + 1);
       
     date=sYear+sMonth+sDay;
     date2=sYear2+sMonth2+sDay2;
     if (date <= date2) return true;
     else {
     		alert(amsg);
     		return false;
     	}
}

// vérifie que la date object1 est plus petite que la date du jour
// la date doit être au format jj/mm/yyyy
function checkWithToday (object1, amsg) {
var isplit;
var sDay, sMonth, sYear;
var sDay2, sMonth2, sYear2;
	
	isplit = object1.value.indexOf (slash);
   	sDay = object1.value.substring (0, isplit);
	isplit = object1.value.indexOf(slash, isplit + 1);
   	sMonth = object1.value.substring((sDay.length + 1), isplit);
	sYear = object1.value.substring(isplit + 1);
        	   	
     	var date = new Date();
	var d  = date.getDate();
	var day = (d < 10) ? '0' + d : d;
	var m = date.getMonth() + 1;
	var month = (m < 10) ? '0' + m : m;
	var yy = date.getYear();
	var year = (yy < 1000) ? yy + 1900 : yy;
	
     	
     	
     date=sYear+sMonth+sDay; 
     date2=year+""+month+""+day;
     if (date <= date2) return true;
     else {
     		alert(amsg);
     		return false;
     	}
}

//************************************************************
function checkDay(checkYear, checkMonth, checkDay) {

        maxDay = 31;

        if (checkMonth == 4 || checkMonth == 6 ||
                        checkMonth == 9 || checkMonth == 11)
                maxDay = 30;
        else
        if (checkMonth == 2)
        {
                if (checkYear % 4 > 0)
                        maxDay =28;
                else
                if (checkYear % 100 == 0 && checkYear % 400 > 0)
                        maxDay = 28;
                else
                        maxDay = 29;
        }

        return checkRange(checkDay, 1, maxDay); //check day
    } 

function checkTextArea (object, msg, required, msgRequired, maxChar) {
var object_value;	
	
	// check required
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }
	
	object_value = new String(object.value);
	if (object_value.length <= maxChar) {
		return true;
	}
	else {
		object.focus();
		alert (msg);				
		return false;	
	}
}

function checkSelect (object, required, msgRequired) {
var object_value;	
	
	// check required
	if (required) {
    		if (!checkRequired (object, msgRequired)) {
    			object.focus ();
    			return false;
    		}
        }
      return true;
}

//************************************************************
var sep = "%%£*¨P";

// affecte les valeurs des selects dans les input de type hidden : right_select et left_select
function SetValues (frmObj, quotes, sep){
if((typeof(frmObj) == "object") && (typeof(frmObj.sel_right) == "object") && (typeof(frmObj.sel_left) == "object")){
	var right = frmObj.sel_right.options.length;
	var left = frmObj.sel_left.options.length;
	vr = "";
	tr = "";
	
	for(r = 0; r<right; r++){
		if(quotes) vr += "'";
		vr += frmObj.sel_right.options[r].value;
		if(quotes) vr += "'";
		tr += frmObj.sel_right.options[r].text;
		if(r < right -1){
			vr += sep;
			tr += sep;
		}
	}
	vl = "";
	tl = "";
	for(l=0;l<left;l++){
		if(quotes) vl += "'";
		vl += frmObj.sel_left.options[l].value;
		if(quotes) vl += "'";
		tl += frmObj.sel_left.options[l].text;
		if(l < left -1){
			vl += sep;
			tl += sep;
		}
	}
	frmObj.right_select.value = vr;
	frmObj.left_select.value = vl;
	
	frmObj.right_select_text.value = tr;
	frmObj.left_select_text.value = tl;
	
	frmObj.left_right_sep.value = sep;	
}
}

// For moving selected strings from source to destination
function MoveSelected (frmObj, src, tgt){
if(typeof(frmObj) == "object"){
	var source = frmObj.elements[src].options.length;
	var target = frmObj.elements[tgt].options.length;
	for(i=0; i<source; i++){
		if(frmObj.elements[src].options[i].selected){
			t = frmObj.elements[src].options[i].text;
			v = frmObj.elements[src].options[i].value;
			var newOpt = new Option(t, v, false, false);
			frmObj.elements[tgt].options[target] = newOpt;
			frmObj.elements[src].options[i] = null;
			source = source -1;
			target = target + 1;
			i = i - 1;
		}
	}
	SetValues(frmObj, false, sep);
  }
}

// For moving all strings from source to destination
function MoveAll (frmObj, src, tgt){
if(typeof(frmObj) == "object"){
	// taille des input de type select
	var source = frmObj.elements[src].options.length;
	var target = frmObj.elements[tgt].options.length;
	// transfert des éléments de la source vers la destination
	for( i=0; i<source; i++){
		var vl = frmObj.elements[src].options[0].value;
		var tl = frmObj.elements[src].options[0].text;
		var newOpt = new Option(tl, vl, false, false);
		frmObj.elements[tgt].options[target + i] = newOpt;
		frmObj.elements[src].options[0] = null;
	}
	SetValues (frmObj, false, sep);
   	}
}
	
// Check if something is selected in the right part of the CrossSelect object
function checkRightSelection (frmObj, tgt, alertMsg){
if(typeof(frmObj) == "object"){
	var target = frmObj.elements[tgt].options.length;
	if(target <= 0){
		frmObj.elements[tgt].focus();
		alert(alertMsg);
		return false;
	}
	else {
		return true;
	}
  }
}
//************************************************************
// vérifie que les valeurs d'une colonne d'un formulaire sont supérieures à une valeur seuil
function checkColonneValeur (aform, acolname, aval, amsg) {
var size = aform.elements.length;
var i = 0;
var j = 0;
var result = false;

while (i < size) {
			var e = aform.elements[i];
			if (e.name == acolname+j) {
				j++;
				// valider le type de donnée
				if (checkIntegerValue (e.value)) {
					// valider la valeur
					if (e.value > aval) result = true;
				}else {
					alert(amsg);
					return false;
				}
			}
			i++;
		}
		
		if (result == false) alert(amsg);
		return result;
}


//************************************************************
// Fonction utilisée pour vérifier que les deux mots de passe saisis
// par l'utilisateur sont identiques.
// -> vérifie que les valeurs de deux colonnes "acolname1" et "acolname2" sont identiques
// et affiche le message passé en paramètre dans une fenêtre d'alerte.
function checkDeuxValeurs (acolname1, acolname2, amsg) {

if (acolname1.value == acolname2.value) return true;
else 
{
	acolname1.focus();
	alert(amsg);
	return false;
}
}
//************************************************************
// vérifie qu'une des deux colonnes est renseignée et pas les deux
// exemple le code et pas le libellé
function checkUnChampParmisDeux (object1, object2, amsg) {
var object_value1;
var object_value2;
var object1_filled = false;
var object2_filled = false;

	// récupération des valeurs des deux objets en fonction de leur type HTML
	if (object1.type != "select-one") object_value1 = new String(object1.value);
	else object_value1 = new String(object1.options[object1.selectedIndex].value);
	if (object2.type != "select-one") object_value2 = new String(object2.value);
	else object_value2 = new String(object2.options[object2.selectedIndex].value);
	
	// mémorisation pour chaque objet si il est rempli ou vide
	if ((object1.type != "select-one") && (trim(object_value1).length > 0)) {
		// le premier objet de type autre que select HTML est rempli
		object1_filled = true;
	}
	if (object1.type == "select-one" && trim(object_value1) != select_empty) {
		// le premier objet de type select HTML est rempli
		object1_filled = true;
	}
	if ((object2.type != "select-one") && (trim(object_value2).length > 0)) {
		// le deuxième objet de type autre que select HTML est rempli
		object2_filled = true;
	}
	if (object2.type == "select-one" && trim(object_value2) != select_empty) {
		// le deuxième objet de type select HTML est rempli
		object2_filled = true;
	}
	// fin de la mémorisation
	
	if ((!object1_filled && !object2_filled) || (object1_filled && object2_filled)) {
		// les deux champs ne sont pas remplis ou les deux champs sont remplis : Erreur
		object1.focus();
		alert(amsg);
		return false;
	}
	return true;
}

//************************************************************
// vérifie qu'au moins une des deux colonnes est renseignée
// exemple le code et/ou le libellé
function checkAuMoinsUnChampParmisDeux (object1, object2, amsg) {
var object_value1;
var object_value2;
var object1_filled = false;
var object2_filled = false;

	// récupération des valeurs des deux objets en fonction de leur type HTML
	if (object1.type != "select-one") object_value1 = new String(object1.value);
	else object_value1 = new String(object1.options[object1.selectedIndex].value);
	if (object2.type != "select-one") object_value2 = new String(object2.value);
	else object_value2 = new String(object2.options[object2.selectedIndex].value);
	
	// mémorisation pour chaque objet si il est rempli ou vide
	if ((object1.type != "select-one") && (trim(object_value1).length > 0)) {
		// le premier objet de type autre que select HTML est rempli
		object1_filled = true;
	}
	if (object1.type == "select-one" && trim(object_value1) != select_empty) {
		// le premier objet de type select HTML est rempli
		object1_filled = true;
	}
	if ((object2.type != "select-one") && (trim(object_value2).length > 0)) {
		// le deuxième objet de type autre que select HTML est rempli
		object2_filled = true;
	}
	if (object2.type == "select-one" && trim(object_value2) != select_empty) {
		// le deuxième objet de type select HTML est rempli
		object2_filled = true;
	}
	// fin de la mémorisation
	
	if (!object1_filled && !object2_filled) {
		// les deux champs ne sont pas remplis : Erreur
		object1.focus();
		alert(amsg);
		return false;
	}
	return true;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (CCLUX).
// Vérifie la validité du formulaire
function checkSearchCriteria(object1, amsg) {
	var object_value1 = new String(object1.cdIsin.value);
	var object_value2 = new String(object1.cdCssfOpc.value);
	var object_value3 = new String(object1.cdCssfCompart.value);
	var object_value4 = new String(object1.cdCssfTypePart.value);
	var object_value5 = new String(object1.libelle.value);
	var object1_filled = (trim(object_value1).length > 0);
	var object2_filled = (trim(object_value2).length > 0);
	var object3_filled = (trim(object_value3).length > 0);
	var object4_filled = (trim(object_value4).length > 0);
	var object5_filled = (trim(object_value5).length > 0);
	var no_select = (object1.promoteur.value == -1) && (object1.fonds.value == -1) && (object1.compartiment.value == -1) && (object1.typeInvest.value == -1) && (object1.ssTypeInvest.value == -1) && (object1.secteurActivite.value == -1) && (object1.zoneGeo.value == -1) && (object1.typeRemun.value == -1) && (object1.devise.value == -1) && (object1.adminCentrale.value == -1) /*&& (object1.distributeur.value == -1)*/ && (object1.bqueDepo.value == -1) && (object1.bqueDepo.value == -1) /*&& (object1.gestionnaire.value == -1)*/ && (object1.teneurRegis.value == -1) && (object1.revEntr.value == -1) && (object1.typeOpc.value == -1);
	if (!object1_filled && !object2_filled && !object3_filled && !object4_filled && !object5_filled && no_select) {
		object1.cdIsin.focus();
		alert(amsg);
		return false;
	}
	
	return true;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (BDL).
// Vérifie la validité du formulaire
function checkSearchCriteriaBDL(object1, amsg) {
	var object_value1 = new String(object1.code.value);
	var object_value2 = new String(object1.libelle.value);
	var object_value3 = new String(object1.emetteur.value);
	var object1_filled = (trim(object_value1).length > 0);
	var object2_filled = (trim(object_value2).length > 0);
	var object3_filled = (trim(object_value3).length > 0);
	var no_select = (object1.typeValeur.value == -1) && (object1.devise.value == -1) && (object1.forme.value == -1) && (getSelectedRadioValue(object1.radiobutton) == "null") && (object1.paysEmet.value == -1) && (object1.categEmet.value == -1);
	if (!object1_filled && !object2_filled && !object3_filled && no_select) {
		object1.code.focus();
		alert(amsg);
		return false;
	}
	return true;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (CCLUX).
// Construit la chaine représentant les extra-paramètres nécessaires à l'URL générée lors de l'événement onChange du select "promoteur"
function extraParamProm (formulaire) {
 	chaine = 'promId='+escape(formulaire.promoteur.options[formulaire.promoteur.selectedIndex].value)+
		'&fondsId=-1'+
		'&compartId=-1'+
		'&typeInvestId='+formulaire.typeInvest.options[formulaire.typeInvest.selectedIndex].value+
		'&ssTypeInvestId='+formulaire.ssTypeInvest.options[formulaire.ssTypeInvest.selectedIndex].value;
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (CCLUX).
// Construit la chaine représentant les extra-paramètres nécessaires à l'URL générée lors de l'événement onChange du select "fonds"
function extraParamFonds (formulaire) {
 	chaine = 'promId='+formulaire.promoteur.options[formulaire.promoteur.selectedIndex].value+
		'&fondsId='+formulaire.fonds.options[formulaire.fonds.selectedIndex].value+
		'&compartId=-1'+
		'&typeInvestId='+formulaire.typeInvest.options[formulaire.typeInvest.selectedIndex].value+
		'&ssTypeInvestId='+formulaire.ssTypeInvest.options[formulaire.ssTypeInvest.selectedIndex].value;
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (CCLUX).
// Construit la chaine représentant les extra-paramètres nécessaires à l'URL générée lors de l'événement onChange du select "typeInvest"
function extraParamTypeInvest(formulaire) {
 	chaine = 'promId='+formulaire.promoteur.options[formulaire.promoteur.selectedIndex].value+
		'&fondsId='+formulaire.fonds.options[formulaire.fonds.selectedIndex].value+
		'&compartId='+formulaire.compartiment.options[formulaire.compartiment.selectedIndex].value+
 		'&typeInvestId='+formulaire.typeInvest.options[formulaire.typeInvest.selectedIndex].value+
		'&ssTypeInvestId=-1';
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (CCLUX).
// Construit la chaine représentant les extra-paramètres fixes de l'URL générée lors de l'enchainement en cascade des selects et lors du submit du formulaire
function extraParam1 (formulaire) {
 	chaine = 'cdIsin='+escape(formulaire.cdIsin.value)+
 		'&cdCssfOpc='+escape(formulaire.cdCssfOpc.value)+
 		'&cdCssfCompart='+escape(formulaire.cdCssfCompart.value)+
 		'&cdCssfTypePart='+escape(formulaire.cdCssfTypePart.value)+
		'&libelle='+escape(formulaire.libelle.value)+
		'&sectActId='+formulaire.secteurActivite.options[formulaire.secteurActivite.selectedIndex].value+
		'&zoneGeoId='+formulaire.zoneGeo.options[formulaire.zoneGeo.selectedIndex].value+
		'&typeRemunId='+formulaire.typeRemun.options[formulaire.typeRemun.selectedIndex].value+
		'&deviseId='+formulaire.devise.options[formulaire.devise.selectedIndex].value+
		'&triId='+formulaire.tri.options[formulaire.tri.selectedIndex].value+
		// Paramètres passés pour les critères de recherche détaillée
		'&adminId='+formulaire.adminCentrale.options[formulaire.adminCentrale.selectedIndex].value+
		//'&distribId='+formulaire.distributeur.options[formulaire.distributeur.selectedIndex].value+
		'&bqeDepId='+formulaire.bqueDepo.options[formulaire.bqueDepo.selectedIndex].value+
		//'&gestId='+formulaire.gestionnaire.options[formulaire.gestionnaire.selectedIndex].value+
		'&tenRegId='+formulaire.teneurRegis.options[formulaire.teneurRegis.selectedIndex].value+
		'&revEntrId='+formulaire.revEntr.options[formulaire.revEntr.selectedIndex].value+
		'&structLegId='+formulaire.typeOpc.options[formulaire.typeOpc.selectedIndex].value;
		if (formulaire.idWatchlist.value != '')
		{
			chaine += '&idWatchlist=' + formulaire.idWatchlist.value;
		}
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (CCLUX).
// Construit la chaine représentant les extra-paramètres fixes de l'URL générée lors du submit du formulaire
function extraParam2 (formulaire) {
 	chaine = 'promId='+formulaire.promoteur.options[formulaire.promoteur.selectedIndex].value+
		'&fondsId='+formulaire.fonds.options[formulaire.fonds.selectedIndex].value+
		'&compartId='+formulaire.compartiment.options[formulaire.compartiment.selectedIndex].value+
		'&typeInvestId='+formulaire.typeInvest.options[formulaire.typeInvest.selectedIndex].value+
		'&ssTypeInvestId='+formulaire.ssTypeInvest.options[formulaire.ssTypeInvest.selectedIndex].value;
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (SearchCriteria BDL).
// Construit la chaine représentant les extra-paramètres de l'URL générée lors du submit du formulaire
function extraParam3 (formulaire) {
 	chaine = 'typeValId='+formulaire.typeValeur.options[formulaire.typeValeur.selectedIndex].value+
		'&code='+escape(trim(formulaire.code.value))+
		'&libelle='+escape(formulaire.libelle.value)+
		'&deviseId='+formulaire.devise.options[formulaire.devise.selectedIndex].value+
		'&formeId='+formulaire.forme.options[formulaire.forme.selectedIndex].value+
		'&reservInstitId='+getSelectedRadioValue(formulaire.radiobutton)+
		'&paysEmetId='+formulaire.paysEmet.options[formulaire.paysEmet.selectedIndex].value+
		'&categEmetId='+formulaire.categEmet.options[formulaire.categEmet.selectedIndex].value+
		'&triId='+formulaire.tri.options[formulaire.tri.selectedIndex].value
	if (formulaire.emetteurId.value != '') {
		chaine += '&emetteurId='+formulaire.emetteurId.value;
	} else {
		chaine += '&emetteur='+escape(formulaire.emetteur.value);
	}
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche d'emetteurs (EmetCriteria BDL).
// Construit la chaine représentant les extra-paramètres de l'URL générée lors du submit du formulaire
function extraParam4 (formulaire) {
 	chaine = 'typeValIdEmet='+formulaire.typeValeur.options[formulaire.typeValeur.selectedIndex].value+
		'&paysEmetIdEmet='+formulaire.paysEmet.options[formulaire.paysEmet.selectedIndex].value+
		'&categEmetIdEmet='+formulaire.categEmet.options[formulaire.categEmet.selectedIndex].value+
		'&denomIdEmet='+formulaire.denomination.options[formulaire.denomination.selectedIndex].value+
		'&emetteurEmet='+escape(formulaire.emetteur.value);
	return chaine;
}
	
//************************************************************
// Fonction spécifique au formulaire de l'historique marche (BDL).
// Construit la chaine représentant les extra-paramètres de l'URL générée lors du submit du formulaire
function extraParam5 (formulaire) {
 	chaine = 'cdTypeCours='+formulaire.cdTypeCours.options[formulaire.cdTypeCours.selectedIndex].value+
		'&dateDebut='+escape(formulaire.dateDebut.value)+
		'&libelTypeCours='+escape(formulaire.cdTypeCours.options[formulaire.cdTypeCours.selectedIndex].text)+
		'&dateFin='+escape(formulaire.dateFin.value);
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de l'historique indice (BDL).
// Construit la chaine représentant les extra-paramètres de l'URL générée lors du submit du formulaire
function extraParam6 (formulaire) {
 	chaine = 'dateDebut='+escape(formulaire.dateDebut.value)+
		'&dateFin='+escape(formulaire.dateFin.value);
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de l'historique prix (CLX).
// Construit la chaine représentant les extra-paramètres de l'URL générée lors du submit du formulaire
function extraParam7 (formulaire) {
 	chaine = 'devise='+formulaire.devise.options[formulaire.devise.selectedIndex].value+
		'&dateDebut='+escape(formulaire.dateDebut.value)+
		'&dateFin='+escape(formulaire.dateFin.value);
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche.
// Variable représentant les extra-paramètres de l'URL appelé sur le bouton reset du formulaire
function extraParamReset (formulaire) {
	chaine = 'promId=-1&fondsId=-1&typeInvestId=-1';
	if (formulaire.idWatchlist.value != '')
	{
		chaine += '&idWatchlist=' + formulaire.idWatchlist.value;
	}
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (ECH).
// Construit la chaine représentant les extra-paramètres de l'URL générée lors de la validation du formulaire
function extraParamDossierSearchCriteria (formulaire) {
 	chaine = 'refPort='+escape(formulaire.refPort.value)+
		'&cdDoss='+escape(formulaire.cdDoss.value)+
		'&cdProc='+escape(formulaire.cdProc.value)+
		'&deposant='+formulaire.deposant.options[formulaire.deposant.selectedIndex].value+
		'&libDoss='+escape(formulaire.libDoss.value)+
		'&ETATDO='+formulaire.ETATDO.options[formulaire.ETATDO.selectedIndex].value;
	if (formulaire.isDeposant.value == 'true') {
		var myString = new String(formulaire.typeProc.options[formulaire.typeProc.selectedIndex].value);
		myString = myString.replace("*","");
		chaine += '&typeProc='+myString;
	} else {
		chaine += '&typeProc='+formulaire.typeProc.options[formulaire.typeProc.selectedIndex].value;
	}
	if (typeof(formulaire.gestResp) == "object")
		chaine += '&gestResp='+formulaire.gestResp.options[formulaire.gestResp.selectedIndex].value;
	else
		chaine += '&gestResp=-1'
	chaine += '&dateCreaMin='+escape(formulaire.dateCreaMin.value)+
		'&dateCreaMax='+escape(formulaire.dateCreaMax.value)+
		'&dateClotMin='+escape(formulaire.dateClotMin.value)+
		'&dateClotMax='+escape(formulaire.dateClotMax.value)+
		'&INSTR='+formulaire.INSTR.options[formulaire.INSTR.selectedIndex].value+
		'&codeCSSF='+escape(formulaire.codeCSSF.value)+
		'&codeISIN='+escape(formulaire.codeISIN.value)+
		'&libVal='+escape(formulaire.libVal.value);
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de recherche (ECH).
// Construit la chaine représentant les extra-paramètres de l'URL générée lors de la validation du formulaire
function extraParamSignaletiqueSearchCriteria (formulaire) {
 	chaine = 'cdCssfOpc='+escape(formulaire.cdCssfOpc.value)+
		'&numOpcBdl='+escape(formulaire.numOpcBdl.value)+
		'&dtInscrBorneInf='+escape(formulaire.dtInscrBorneInf.value)+
		'&dtInscrBorneSup='+escape(formulaire.dtInscrBorneSup.value)+
		'&dtPubliDocBorneInf='+escape(formulaire.dtPubliDocBorneInf.value)+
		'&dtPubliDocBorneSup='+escape(formulaire.dtPubliDocBorneSup.value)+
		'&ELOPC='+formulaire.ELOPC.options[formulaire.ELOPC.selectedIndex].value+
		'&cdCssfCompart='+escape(formulaire.cdCssfCompart.value)+
		'&dtAgrInscrBorneInf='+escape(formulaire.dtAgrInscrBorneInf.value)+
		'&dtAgrInscrBorneSup='+escape(formulaire.dtAgrInscrBorneSup.value)+
		'&cdCssfTypePart='+escape(formulaire.cdCssfTypePart.value)+
		'&cdIsin='+escape(formulaire.cdIsin.value)+
		'&numValBdl='+escape(formulaire.numValBdl.value)+
		'&STATUT='+formulaire.STATUT.options[formulaire.STATUT.selectedIndex].value;
	return chaine;
}

//************************************************************
// Fonction spécifique au formulaire de la fiche utilisateur.
// Vérifie que si un nouveau ou une confirmation de mot de passe est entrée, il faut alors
// renseigner l'ancien mot de passe
function checkPassword(object1, amsg) {
	var object_value1 = new String(object1.ancienMotPas.value);
	var object_value2 = new String(object1.motPas.value);
	var object_value3 = new String(object1.confirmation.value);
	var object1_filled = (trim(object_value1).length > 0);
	var object2_filled = (trim(object_value2).length > 0);
	var object3_filled = (trim(object_value3).length > 0);
	if (!object1_filled && (object2_filled || object3_filled)) {
		object1.ancienMotPas.focus();
		alert(amsg);
		return false;
	}
	return true;
}



//************************************************************
// retourne la valeur selectionnée d'un groupe de "radio boutons"
function getSelectedRadioValue(radioGroup) {
	var selectedRadioValue = "";
	var radIndex;
	for (radIndex = 0; radIndex < radioGroup.length; radIndex++) {
		if (radioGroup[radIndex].checked) {
			selectedRadioValue = radioGroup[radIndex].value;
			break;
		}
	}
	return selectedRadioValue;
}



//************************************************************
// vérifie qu'au moins une chexbox est cochée dans un formulaire qui ne contient que des checkboxs
function checkOneCheckBoxRequired (aform, amsg) {
var size = aform.elements.length;
var i = 0;
var result = false;

		while (i < size) {
			var e = aform.elements[i];
			if (e.type == "checkbox" && e.checked == true) result = true;
			i++;
		}

		if (result == false) alert(amsg);
		return result;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; 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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  return window.open(theURL,winName,features);
}

function redirectionLangue(pageEN, pageFR) {
	if (navigator.appName == 'Netscape')
    		var language = navigator.language;
	else
    		var language = navigator.browserLanguage;
    	var code = language.substring(0,2);
	if (code=='fr')
		window.location=pageFR;
	else
		window.location=pageEN;
}


function changeLangue(pageEN, pageFR, lang) {
	if (lang=='FR')
		this.window.location=pageEN;
	else
		this.window.location=pageFR;
}


var minX, minY;
var maxX, maxY;

var IE4 = (document.all) ? 1 : 0;
var NS4 = (document.layers) ? 1 : 0;
var IE5 = (document.all && document.getElementById) ? 1 : 0;
var NS6 = (!document.all && document.getElementById) ? 1 : 0;

function helpGetOffset(obj, coord) {
	var val = obj["offset"+coord];
	if (coord == "Top") val += obj.offsetHeight;
	while ((obj = obj.offsetParent )!=null) {
		val += obj["offset"+coord];
		if (obj.border && obj.border != 0) val++;
	}
	return val;
}

function helpDown () {
	if (IE4 || IE5) document.all.helpBox.style.visibility = "hidden";
	else if (NS6) document.getElementById("helpBox").style.visibility = "hidden";
	else if (NS4) document.helpBox.visibility = "hide";
}

function calcCoordVisible()
{
	var YClient;
	var XClient;
	var scrollTop;
	var scrollLeft;
	if (IE4 || IE5)	{
		YClient = document.body.clientHeight;
		XClient = document.body.clientWidth;
		scrollTop = document.body.scrollTop;
		scrollLeft = document.body.scrollLeft;
	}
	else if (NS6) {
		YClient = window.innerHeight;
		XClient = window.innerWidth;
		scrollTop = pageYOffset;
		scrollLeft = pageXOffset;
	}		
	else if (NS4) {
		YClient = window.innerHeight;
		XClient = window.innerWidth;
		scrollTop = pageYOffset;
		scrollLeft = pageXOffset;
	}		
//	alert( "X : "+XClient+" - Y : "+YClient+" - scrollTop : "+scrollTop+" - scrollLeft : "+scrollLeft);
	maxX = XClient + scrollLeft;
	maxY = YClient + scrollTop;
	minX = scrollTop;
	minY = scrollLeft;
}

function afficheBulle (event,texte,wid,hei) {
//	if (!VERSION4PLUS) return;

	calcCoordVisible();

	var ptrObj, ptrLayer;
	if (IE4 || IE5) {
		ptrObj = event.srcElement;
		ptrLayer = document.all.helpBox;
	}
	if (NS6) {
		ptrObj = event.currentTarget;
		ptrLayer = document.getElementById("helpBox");
	}
	if (NS4) {
		ptrObj = event.target;
		ptrLayer = document.helpBox;
	}

	if (!ptrObj.onmouseout) ptrObj.onmouseout = helpDown;


	if (IE4 || IE5 ) {
		ptrLayer.innerHTML = texte;
		var top  = helpGetOffset (ptrObj,"Top") + 2;
		var left = helpGetOffset (ptrObj,"Left");
		top  = (top + hei > maxY) ? top - hei - 20 : top;
		top = top < 0 ? 0 : top;
		left = (left + wid > maxX) ? left - wid : left;
		left = left < 0 ? 0 : left;
		ptrLayer.style.top  = top;
		ptrLayer.style.left = left;
		ptrLayer.style.visibility = "visible";
	}
	else if (NS6) {
		ptrLayer.innerHTML = texte;
		var top  = helpGetOffset (ptrObj,"Top") + 2;
		var left = helpGetOffset (ptrObj,"Left");
		top  = (top + hei > maxY) ? top - hei - 20 : top;
		top = top < 0 ? 0 : top;
		left = (left + wid > maxX) ? left - wid : left;
		left = left < 0 ? 0 : left;
		ptrLayer.style.top  = top;
		ptrLayer.style.left = left;
		ptrLayer.style.visibility = "visible";
	}
	else if (NS4) {
		ptrLayer.document.write (texte);
		ptrLayer.document.close ();
		ptrLayer.document.bgColor = "lightyellow";
		var top = ptrObj.y + 20;
		var left = ptrObj.x;
		top  = (top + hei > maxY) ? top - hei - 20 : top;
		top = top < 0 ? 0 : top;
		left = (left + wid > maxX) ? left - wid : left;
		left = left < 0 ? 0 : left;
		ptrLayer.top  = top
		ptrLayer.left = left;
		ptrLayer.visibility = "show";
	}
	return false;
}


var window_handle_1;
var window_handle_2;
var window_handle_3;
var max;

function affichePopup( lien, largeur, hauteur ) {
	var top = 10;
	var left = 10;
	if( typeof(window_handle_3) == "undefined" || window_handle_3.closed )
		window_handle_3 = MM_openBrWindow(lien,"aide","width="+largeur+",height="+hauteur+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top="+top+",left="+left);
	else
	{
		//window_handle_3.document.location.href=lien;
		window_handle_3.location=lien;
		window_handle_3.focus();
	}
}


// ouverture d'une popup avec prise de focus par celle-ci
function openNewURL(url, site, widthL, heightL, maxi) {
		max = maxi;
		var newWindowWidth = widthL;
		var newWindowHeight = heightL;
		var x = (window.screen.width - newWindowWidth)/2;
		var y = (window.screen.height - newWindowHeight)/2;
		// La fenetre n'existe pas ou a été fermée
		if (typeof(window_handle_2) == "undefined" || window_handle_2.closed) {
			window_handle_2 = MM_openBrWindow(url, "Portail" + site, "toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width="+newWindowWidth+",height="+newWindowHeight+",top="+y+",left="+x);
		// La fenetre est encore ouverte
		} else {
			//window_handle_2.document.location.href=url;
			window_handle_2.location = url;
		}
		if (max==true) {
			if (document.all || document.layers) {
				window_handle_2.moveTo(0,0);
				window_handle_2.resizeTo(screen.availWidth,screen.availHeight);
			}
		}
		window_handle_2.focus();
}

// fermeture de deuxième browser
function closeSecondBrowser (url, site) {
	
	if (site == "ECH") {
		}
	else {
		if (typeof(window_handle_2) == "object") {
			window_handle_2.close();
		}
		
		if (typeof(window_handle_2) == "undefined") {
			window_handle_2 = window.open("blank.htm", "Portail" + site, "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes");
			window_handle_2.close ();	
		}
	}
	if (url == '')
		window.document.location = window.document.location;
	else 
		window.document.location = url;
}

// fermeture de la fenetre actuelle et reprise de focus par la fenetre mere	
function closeWindow() {
	if(typeof(window.opener) == "object") {
		window.close();
		window.opener.focus();
	}
}

// fermeture du second browser par une page affichée par le second browser, et prise de focus OU ouverture du premier browser  
function closeSecondBrowserWithinSecondBrowser(site) {
	if(typeof(window.opener) == "object") {
		window.close();
		if (!window.opener.closed)
			window.opener.focus();
		else
			window.open("/"+site, "Corporate" + site, "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
	}
	
}


// fermeture du second browser par une page affichée par le second browser, et prise de focus OU ouverture du premier browser, et ouverture de l'url spécifiée  
function closeSecondBrowserWithinSecondBrowserAndRedirect(url) {
	if(typeof(window.opener) == "object") {
		if (!window.opener.closed) {
			window.opener.focus();
			window.opener.location=url;
		}
		else
			window.open(url, "Corporate", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
		window.close();
	}
	
}

// fermeture du second browser par une page affichée par le browser aide, et prise de focus OU ouverture du premier browser  
function closeSecondBrowserWithinAide (url) {
	
	if(typeof(window.opener) == "object") {
		/* fermeture du browser aide */
		window.close();
				
		/* activation ou ouverture du browser Corporate*/	
		if (typeof(window.opener.opener) == "object" && !window.opener.opener.closed) {
			window.opener.opener.focus();
			window.opener.opener.location = url;
			}
		else
			window.open(url, "Corporate", "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
			
		/* fermeture du browser Portail après le travail sur le browser corporate */
		if (typeof(window.opener) == "object" && typeof(window.opener.closed) != "unknown" && !window.opener.closed)
			window.opener.close();
	}
	
}

// cette fonction permet de rafraichir le contenu d'un navigateur à partir d'un tag <A
// exemple: <a href="#" onClick="return ahref (window.document, 'blank.htm');">Lien</a>
//
function ahref (aobject, aurl) {
	aobject.location = aurl;
	return false;
}

function isCSSF (object) { 
var isplit; 
var old_isplit; 
var OPCpart; 
var Compartimentpart; 
var Typepart;
var tailleOPC = 6;
var tailleCompartiment = 5;
var tailleTypepart = 2;

        isplit = object.value.indexOf (slash); 
        if (isplit == -1) {             
                // une seule partie, elle doit être de taille de 6 max 
                if (object.value.length <= 0 || object.value.length > tailleOPC) { 
                        return false; 
                    } 
                 // la partie OPC ne doit contenir que des chiffres
                 if (!checkIntegerValue  (object.value)) {               
                 		return false;
                 		}
                } 
        else { 
                // plusieurs parties 
                OPCpart = object.value.substring (0, isplit); 
                if (OPCpart.length <= 0 || OPCpart.length > tailleOPC) { 
                        return false; 
                    } 
                 // la partie OPC ne doit contenir que des chiffres
                 if (!checkIntegerValue  (OPCpart)) {             
                 		return false;
                 		}
                  
                	     old_isplit = isplit; 
                        isplit = object.value.indexOf (slash, isplit + 1); 
                        Compartimentpart = object.value.substring (old_isplit+1); 
                        
                        if (isplit == -1) {             
                                // une partie OPC et une partie compartiment 
                                if (Compartimentpart.length <= 0 || Compartimentpart.length > tailleCompartiment) { 
                        	        return false; 
                                		}
                                 // la partie Compartiment ne doit contenir que des chiffres
                 	               if (!checkIntegerValue  (Compartimentpart)) {             
                 			return false;
                 		}	 
                                } 
                        else { 
                                // une partie OPC, une partie compartiment et une partie type de part 
                                old_isplit = isplit; 
                                isplit = object.value.indexOf (slash, isplit + 1); 
                                Typepart = object.value.substring (old_isplit+1); 
                                if (Typepart.length <= 0 || Typepart.length > tailleTypepart) { 
                                	return false; 
                                	} 
                                 // la partie Typepart ne doit contenir que des chiffres
                 	               if (!checkIntegerValue  (Typepart)) {             
                 			return false;
                 		}	
                                } 
                } 
                
        return true; 
} 

function isISIN (value) {
var code;
var poids;
var total;
	
	if (value.length != 12) return false;
	code = '';
	// conversion des lettres
	for (i =0; i<value.length; i++) {
		
		if (value.toUpperCase().charAt(i) == 'A') code = code + '10';
		if (value.toUpperCase().charAt(i) == 'B') code = code + '11';
		if (value.toUpperCase().charAt(i) == 'C') code = code + '12';
		if (value.toUpperCase().charAt(i) == 'D') code = code + '13';
		if (value.toUpperCase().charAt(i) == 'E') code = code + '14';
		if (value.toUpperCase().charAt(i) == 'F') code = code + '15';
		if (value.toUpperCase().charAt(i) == 'G') code = code + '16';
		if (value.toUpperCase().charAt(i) == 'H') code = code + '17';
		if (value.toUpperCase().charAt(i) == 'I') code = code + '18';
		if (value.toUpperCase().charAt(i) == 'J') code = code + '19';
		if (value.toUpperCase().charAt(i) == 'K') code = code + '20';
		if (value.toUpperCase().charAt(i) == 'L') code = code + '21';
		if (value.toUpperCase().charAt(i) == 'M') code = code + '22';
		if (value.toUpperCase().charAt(i) == 'N') code = code + '23';
		if (value.toUpperCase().charAt(i) == 'O') code = code + '24';
		if (value.toUpperCase().charAt(i) == 'P') code = code + '25';
		if (value.toUpperCase().charAt(i) == 'Q') code = code + '26';
		if (value.toUpperCase().charAt(i) == 'R') code = code + '27';
		if (value.toUpperCase().charAt(i) == 'S') code = code + '28';
		if (value.toUpperCase().charAt(i) == 'T') code = code + '29';
		if (value.toUpperCase().charAt(i) == 'U') code = code + '30';
		if (value.toUpperCase().charAt(i) == 'V') code = code + '31';
		if (value.toUpperCase().charAt(i) == 'W') code = code + '32';
		if (value.toUpperCase().charAt(i) == 'X') code = code + '33';
		if (value.toUpperCase().charAt(i) == 'Y') code = code + '34';
		if (value.toUpperCase().charAt(i) == 'Z') code = code + '35';
		
		if (value.toUpperCase().charAt(i) == '0') code = code + '0';
		if (value.toUpperCase().charAt(i) == '1') code = code + '1';
		if (value.toUpperCase().charAt(i) == '2') code = code + '2';
		if (value.toUpperCase().charAt(i) == '3') code = code + '3';
		if (value.toUpperCase().charAt(i) == '4') code = code + '4';
		if (value.toUpperCase().charAt(i) == '5') code = code + '5';
		if (value.toUpperCase().charAt(i) == '6') code = code + '6';
		if (value.toUpperCase().charAt(i) == '7') code = code + '7';
		if (value.toUpperCase().charAt(i) == '8') code = code + '8';
		if (value.toUpperCase().charAt(i) == '9') code = code + '9';
		}
	// calcul du total
	poids = 2;
	total = 0;
	for (i =1; i<code.length; i++) {
		if ((code.charAt(code.length - i - 1) * poids) >= 10) 
			total = total + 1 + ((code.charAt(code.length - i - 1) * poids) - 10);
		else
			total = total + (code.charAt(code.length - i - 1) * poids);
			
		if (poids == 2) poids = 1;
		else poids = 2;
		}
	
	if (Math.ceil(total/10) *10 - total == code.charAt(code.length - 1)) return true;
	else return false;
}

// return true si l'objet est un code commun
// return false sinon
function isCommun (value){
var check_char;
	value = trim(value);
	if (value.length > 9) {
		return false;
	}
	for (var i = 0; i < value.length; i++) {
		check_char = chiffres.indexOf(value.charAt(i))
		if (check_char == -1) return false;
	}
	return true;
}

// return true si l'objet à une valeur de plus de size de longueur
// return false sinon
function checkLength (object, msg, size) {
	if (trim(object.value).length >= size) return true;
	else {
		alert (msg);
		object.focus ();
		return false;
	}
}
//-->

function goToHome(ctxPath) {
	if (typeof(window.opener) == "object") {
		window.opener.focus(); 
		window.close(); 
		return ahref(window.opener.document, ctxPath + "/Accueil.jsp"); 
	} else {
		return ahref(window.document, ctxPath + "/Accueil.jsp"); 
	}
}
	
	
function BeforeStart(){return}
function AfterBuild(){return}
function BeforeFirstOpen(){return}
function AfterCloseAll(){return}
function Go(){return}


	
function Dummy(){return}

function CnclSlct(){return false}

function RePos(){
	FrstWinWdth=ExpYes?FrstLoc.document.body.clientWidth:FrstLoc.innerWidth;
	FrstWinHght=ExpYes?FrstLoc.document.body.clientHeight:FrstLoc.innerHeight;
	ScWinWdth=ExpYes?ScLoc.document.body.clientWidth:ScLoc.innerWidth;
	ScWinHght=ExpYes?ScLoc.document.body.clientHeight:ScLoc.innerHeight;
	if(MenuCentered=='justify'&&FirstLineHorizontal){
		FrstCntnr.style.width=FrstWinWdth;
		ClcJus();
		var P=FrstCntnr.FrstMbr,W=Menu1[5],i;
		for(i=0;i<NoOffFirstLineMenus;i++){P.style.width=W;P=P.PrvMbr}}
	StaticPos=-1;
	if(TargetLoc)ClcTrgt();
	if(MenuCentered)ClcLft();
	if(MenuVerticalCentered)ClcTp();
	PosMenu(FrstCntnr,StartTop,StartLeft)}

function UnLoaded(){
	if(CloseTmr)clearTimeout(CloseTmr);
	Loadd=0; Creatd=0;
	if(HideTop){
		var FCStyle=Nav4?FrstCntnr:FrstCntnr.style;
		FCStyle.visibility=M_Hide}}

function ReDoWhole(){
	if(ScWinWdth!=ScLoc.innerWidth||ScWinHght!=ScLoc.innerHeight||FrstWinWdth!=FrstLoc.innerWidth||FrstWinHght!=FrstLoc.innerHeight)Doc.location.reload()}

function Check(WMnu,NoOf){
	var i,array,ArrayLoc;
	ArrayLoc=parent.frames[0]?parent.frames[FirstLineFrame]:self;
	for(i=0;i<NoOf;i++){
		array=WMnu+eval(i+1);
		if(!ArrayLoc[array]){WbMstrAlrt(0,array); return false}
		if(i==0){	if(!ArrayLoc[array][4]){WbMstrAlrt(1,array); return false}
			if(!ArrayLoc[array][5]){WbMstrAlrt(2,array); return false}}
		if(ArrayLoc[array][3])if(!Check(array+'_',ArrayLoc[array][3])) return false}
	return true}

function WbMstrAlrt(No,Xtra){
	return confirm(WbMstrAlrts[No]+Xtra+'   ')}

function Go(){
	Dummy();
	if(Loadd||!PosStrt)return;
	BeforeStart();
	Creatd=0; Loadd=1;
	status='Building menu';
	if(FrstCreat){
		if(FirstLineFrame =="" || !parent.frames[FirstLineFrame]){
			FirstLineFrame=SecLineFrame;
			if(FirstLineFrame =="" || !parent.frames[FirstLineFrame]){
				FirstLineFrame=SecLineFrame=DocTargetFrame;
				if(FirstLineFrame =="" || !parent.frames[FirstLineFrame])FirstLineFrame=SecLineFrame=DocTargetFrame=''}}
		if(SecLineFrame =="" || !parent.frames[SecLineFrame]){
			SecLineFrame=DocTargetFrame;
			if(SecLineFrame =="" || !parent.frames[SecLineFrame])SecLineFrame=DocTargetFrame=FirstLineFrame}
		if(DocTargetFrame =="" || !parent.frames[DocTargetFrame])DocTargetFrame=SecLineFrame;
		if(WebMasterCheck){	if(!Check('Menu',NoOffFirstLineMenus)){status='build aborted';return}}
		FrstLoc=FirstLineFrame!=""?parent.frames[FirstLineFrame]:window;
		ScLoc=SecLineFrame!=""?parent.frames[SecLineFrame]:window;
		DcLoc=DocTargetFrame!=""?parent.frames[DocTargetFrame]:window;
		if (FrstLoc==ScLoc) AcrssFrms=0;
		if (AcrssFrms)FirstLineHorizontal=MenuFramesVertical?0:1;
		FrstWinWdth=ExpYes?FrstLoc.document.body.clientWidth:FrstLoc.innerWidth;
		FrstWinHght=ExpYes?FrstLoc.document.body.clientHeight:FrstLoc.innerHeight;
		ScWinWdth=ExpYes?ScLoc.document.body.clientWidth:ScLoc.innerWidth;
		ScWinHght=ExpYes?ScLoc.document.body.clientHeight:ScLoc.innerHeight;
		if(Nav4){	CntrTxt=MenuTextCentered!='left'?"<div align='"+MenuTextCentered+"'>":"";
			TxtClose="</font>"+MenuTextCentered!='left'?"</div>":""}}
	FirstColPos=Nav4?FrstLoc.document:FrstLoc.document.body;
	SecColPos=Nav4?ScLoc.document:ScLoc.document.body;
	DocColPos=Nav4?DcLoc.document:ScLoc.document.body;
	if (TakeOverBgColor)FirstColPos.bgColor=AcrssFrms?SecColPos.bgColor:DocColPos.bgColor;
	if(MenuCentered=='justify'&&FirstLineHorizontal)ClcJus();
	if(FrstCreat){
		FrstCntnr=CreateMenuStructure('Menu',NoOffFirstLineMenus);
		FrstCreat=AcrssFrms?0:1}
	else CreateMenuStructureAgain('Menu',NoOffFirstLineMenus);
	if(TargetLoc)ClcTrgt();
	if(MenuCentered)ClcLft();
	if(MenuVerticalCentered)ClcTp();
	PosMenu(FrstCntnr,StartTop,StartLeft);
	IniFlg=1;
	Initiate();
	Creatd=1;
	ScLdAgainWin=ExpYes?ScLoc.document.body:ScLoc;
	ScLdAgainWin.onunload=UnLoaded;
	Trigger.onresize=Nav4?ReDoWhole:RePos;
	AfterBuild();
	if(MenuVerticalCentered=='static'&&!AcrssFrms)setInterval('KeepPos()',250);
	status=''}

function KeepPos(){
	var TS=ExpYes?FrstLoc.document.body.scrollTop:FrstLoc.pageYOffset;
	if(TS!=StaticPos){
		var FCStyle=Nav4?FrstCntnr:FrstCntnr.style;
		FCStyle.top=FrstCntnr.OrgTop=StartTop+TS;StaticPos=TS}}

function ClcJus(){
	var a=BorderBtwnElmnts?1:2,b=BorderBtwnElmnts?BorderWidth:0;
	var Size=Math.round(((FrstWinWdth-a*BorderWidth)/NoOffFirstLineMenus)-b),i,j;
	for(i=1;i<NoOffFirstLineMenus+1;i++){j=eval('Menu'+i);j[5]=Size}
	StartLeft=0}

function ClcTrgt(){
	var TLoc=Nav4?FrstLoc.document.layers[TargetLoc]:DomYes?FrstLoc.document.getElementById(TargetLoc):FrstLoc.document.all[TargetLoc];
	StartTop=M_StrtTp;
	StartLeft=M_StrtLft;
	if(DomYes){
		while(TLoc){StartTop+=TLoc.offsetTop;StartLeft+=TLoc.offsetLeft;TLoc=TLoc.offsetParent}}
	else{	StartTop+=Nav4?TLoc.pageY:TLoc.offsetTop;StartLeft+=Nav4?TLoc.pageX:TLoc.offsetLeft}}

function ClcLft(){
	if(MenuCentered!='left'&&MenuCentered!='justify'){
		var Size=FrstWinWdth-(!Nav4?parseInt(FrstCntnr.style.width):FrstCntnr.clip.width);
		StartLeft=M_StrtLft;
		StartLeft+=MenuCentered=='right'?Size:Size/2}}

function ClcTp(){
	if(MenuVerticalCentered!='top'&&MenuVerticalCentered!='static'){
		var Size=FrstWinHght-(!Nav4?parseInt(FrstCntnr.style.height):FrstCntnr.clip.height);
		StartTop=M_StrtTp;
		StartTop+=MenuVerticalCentered=='bottom'?Size:Size/2}}

function PosMenu(CntnrPntr,Tp,Lt){
	var Topi,Lefti,Hori;
	var Cntnr=CntnrPntr;
	var Mmbr=Cntnr.FrstMbr;
	var CntnrStyle=!Nav4?Cntnr.style:Cntnr;
	var MmbrStyle=!Nav4?Mmbr.style:Mmbr;
	var PadL=Mmbr.value.indexOf('<')==-1?LftXtra:0;
	var PadT=Mmbr.value.indexOf('<')==-1?TpXtra:0;
	var MmbrWt=!Nav4?parseInt(MmbrStyle.width)+PadL:MmbrStyle.clip.width;
	var MmbrHt=!Nav4?parseInt(MmbrStyle.height)+PadT:MmbrStyle.clip.height;
	var CntnrWt=!Nav4?parseInt(CntnrStyle.width):CntnrStyle.clip.width;
	var CntnrHt=!Nav4?parseInt(CntnrStyle.height):CntnrStyle.clip.height;
	var SubTp,SubLt;
	RcrsLvl++;
	if (RcrsLvl==1 && AcrssFrms)!MenuFramesVertical?Tp=FrstWinHght-CntnrHt+(Nav4?4:0):Lt=RightToLeft?0:FrstWinWdth-CntnrWt+(Nav4?4:0);
	if (RcrsLvl==2 && AcrssFrms)!MenuFramesVertical?Tp=0:Lt=RightToLeft?ScWinWdth-CntnrWt:0;
	if (RcrsLvl==2 && AcrssFrms){Tp+=VerCorrect;Lt+=HorCorrect}
	CntnrStyle.top=RcrsLvl==1?Tp:0;
	Cntnr.OrgTop=Tp;
	CntnrStyle.left=RcrsLvl==1?Lt:0;
	Cntnr.OrgLeft=Lt;
	if (RcrsLvl==1 && FirstLineHorizontal){
		Hori=1;Lefti=CntnrWt-MmbrWt-2*BorderWidth;Topi=0}
	else{	Hori=Lefti=0;Topi=CntnrHt-MmbrHt-2*BorderWidth}
	while(Mmbr!=null){
		MmbrStyle.left=Lefti+BorderWidth;
		MmbrStyle.top=Topi+BorderWidth;
		if(Nav4)Mmbr.CmdLyr.moveTo(Lefti+BorderWidth,Topi+BorderWidth);
		if(Mmbr.ChildCntnr){
			if(RightToLeft)ChldCntnrWdth=Nav4?Mmbr.ChildCntnr.clip.width:parseInt(Mmbr.ChildCntnr.style.width);
			if(Hori){	SubTp=Topi+MmbrHt+2*BorderWidth;
				SubLt=RightToLeft?Lefti+MmbrWt-ChldCntnrWdth:Lefti}
			else{	SubLt=RightToLeft?Lefti-ChldCntnrWdth+ChildOverlap*MmbrWt+BorderWidth:Lefti+(1-ChildOverlap)*MmbrWt+BorderWidth;
				SubTp=RcrsLvl==1&&AcrssFrms?Topi:Topi+ChildVerticalOverlap*MmbrHt}
			PosMenu(Mmbr.ChildCntnr,SubTp,SubLt)}
		Mmbr=Mmbr.PrvMbr;
		if(Mmbr){	MmbrStyle=!Nav4?Mmbr.style:Mmbr;
			PadL=Mmbr.value.indexOf('<')==-1?LftXtra:0;
			PadT=Mmbr.value.indexOf('<')==-1?TpXtra:0;
			MmbrWt=!Nav4?parseInt(MmbrStyle.width)+PadL:MmbrStyle.clip.width;
			MmbrHt=!Nav4?parseInt(MmbrStyle.height)+PadT:MmbrStyle.clip.height;
			Hori?Lefti-=BorderBtwnElmnts?(MmbrWt+BorderWidth):(MmbrWt):Topi-=BorderBtwnElmnts?(MmbrHt+BorderWidth):(MmbrHt)}}
	RcrsLvl--}

function Initiate(){
	if(IniFlg){	Init(FrstCntnr);IniFlg=0;
		if(ShwFlg)AfterCloseAll();ShwFlg=0}}

function Init(CntnrPntr){
	var Mmbr=CntnrPntr.FrstMbr;
	var MCStyle=Nav4?CntnrPntr:CntnrPntr.style;
	RcrsLvl++;
	MCStyle.visibility=RcrsLvl==1?M_Show:M_Hide;
	while(Mmbr!=null){
		if(Mmbr.Hilite){Mmbr.Hilite=0;if(KeepHilite)LowItem(Mmbr)}
		if(Mmbr.ChildCntnr) Init(Mmbr.ChildCntnr);
		Mmbr=Mmbr.PrvMbr}
	RcrsLvl--}

function ClearAllChilds(Pntr){
	var CPCCStyle;
	while (Pntr){
		if(Pntr.Hilite){
			Pntr.Hilite=0;
			if(KeepHilite)LowItem(Pntr);
			if(Pntr.ChildCntnr){
				CPCCStyle=Nav4?Pntr.ChildCntnr:Pntr.ChildCntnr.style;
				CPCCStyle.visibility=M_Hide;
				ClearAllChilds(Pntr.ChildCntnr.FrstMbr)}
			break}
		Pntr=Pntr.PrvMbr}}

function GoTo(){
	if(this.LinkTxt){
		status='';
		var HP=Nav4?this.LowLyr:this;
		LowItem(HP);
		this.LinkTxt.indexOf('javascript:')!=-1?eval(this.LinkTxt):DcLoc.location.href=this.LinkTxt}}

function HiliteItem(P){
	if(Nav4){
		if(P.ro)P.document.images[P.rid].src=P.ri2;
		else{	if(P.HiBck)P.bgColor=P.HiBck;
			if(P.value.indexOf('<img')==-1){
				P.document.write(P.Ovalue);
				P.document.close()}}}
	else{	if(P.ro){	var Lc=P.Level==1?FrstLoc:ScLoc;
			Lc.document.images[P.rid].src=P.ri2}
		else{	if(P.HiBck)P.style.backgroundColor=P.HiBck;
			if(P.HiFntClr)P.style.color=P.HiFntClr}}
	P.Hilite=1}

function LowItem(P){
	if(P.ro){	if(Nav4)P.document.images[P.rid].src=P.ri1;
		else{	var Lc=P.Level==1?FrstLoc:ScLoc;
			Lc.document.images[P.rid].src=P.ri1}}
	else{	if(Nav4){	if(P.LoBck)P.bgColor=P.LoBck;
			if(P.value.indexOf('<img')==-1){
				P.document.write(P.value);
				P.document.close()}}
		else{	if(P.LoBck)P.style.backgroundColor=P.LoBck;
			if(P.LwFntClr)P.style.color=P.LwFntClr}}}

function OpenMenu(){	
	if(!Loadd||!Creatd) return;
	var TpScrlld=ExpYes?ScLoc.document.body.scrollTop:ScLoc.pageYOffset;
	var LScrlld=ExpYes?ScLoc.document.body.scrollLeft:ScLoc.pageXOffset;
	var CCnt=Nav4?this.LowLyr.ChildCntnr:this.ChildCntnr;
	var ThisHt=Nav4?this.clip.height:parseInt(this.style.height);
	var ThisWt=Nav4?this.clip.width:parseInt(this.style.width);
	var ThisLft=AcrssFrms&&this.Level==1&&!FirstLineHorizontal?0:Nav4?this.Container.left:parseInt(this.Container.style.left);
	var ThisTp=AcrssFrms&&this.Level==1&&FirstLineHorizontal?0:Nav4?this.Container.top:parseInt(this.Container.style.top);
	var HP=Nav4?this.LowLyr:this;
	CurrntOvr=this;
	IniFlg=0;
	ClearAllChilds(this.Container.FrstMbr);
	HiliteItem(HP);
	if(CCnt!=null){
		if(!ShwFlg){ShwFlg=1;	BeforeFirstOpen()}
		var CCW=Nav4?this.LowLyr.ChildCntnr.clip.width:parseInt(this.ChildCntnr.style.width);
		var CCH=Nav4?this.LowLyr.ChildCntnr.clip.height:parseInt(this.ChildCntnr.style.height);
		var ChCntTL=Nav4?this.LowLyr.ChildCntnr:this.ChildCntnr.style;
		var SubLt=AcrssFrms&&this.Level==1?CCnt.OrgLeft+ThisLft+LScrlld:CCnt.OrgLeft+ThisLft;
		var SubTp=AcrssFrms&&this.Level==1?CCnt.OrgTop+ThisTp+TpScrlld:CCnt.OrgTop+ThisTp;
		if(MenuWrap){
			if(RightToLeft){
				if(SubLt<LScrlld)SubLt=this.Level==1?LScrlld:SubLt+(CCW+(1-2*ChildOverlap)*ThisWt);
				if(SubLt+CCW>ScWinWdth+LScrlld)SubLt=ScWinWdth+LScrlld-CCW}
			else{	if(SubLt+CCW>ScWinWdth+LScrlld)SubLt=this.Level==1?ScWinWdth+LScrlld-CCW:SubLt-(CCW+(1-2*ChildOverlap)*ThisWt);
				if(SubLt<LScrlld)SubLt=LScrlld}
			if(SubTp+CCH>TpScrlld+ScWinHght)SubTp=this.Level==1?SubTp=TpScrlld+ScWinHght-CCH:SubTp-CCH+(1-2*ChildVerticalOverlap)*ThisHt;
			if(SubTp<TpScrlld)SubTp=TpScrlld}
		ChCntTL.top=SubTp;ChCntTL.left=SubLt;ChCntTL.visibility=M_Show}
	status=this.LinkTxt}

function OpenMenuClick(){
	if(!Loadd||!Creatd) return;
	var HP=Nav4?this.LowLyr:this;
	CurrntOvr=this;
	IniFlg=0;
	ClearAllChilds(this.Container.FrstMbr);
	HiliteItem(HP);
	status=this.LinkTxt}

function CloseMenu(){
	if(!Loadd||!Creatd) return;
	if(!KeepHilite){
		var HP=Nav4?this.LowLyr:this;
		LowItem(HP)}
	status='';
	if(this==CurrntOvr){
		IniFlg=1;
		if(CloseTmr)clearTimeout(CloseTmr);
		CloseTmr=setTimeout('Initiate(CurrntOvr)',DissapearDelay)}}

function CntnrSetUp(Wdth,Hght,NoOff){
	var x=RcrsLvl==1?BorderColor:BorderSubColor;
	this.FrstMbr=null;
	this.OrgLeft=this.OrgTop=0;
	if(x)this.bgColor=x;
	if(Nav4){	this.visibility='hide';
		this.resizeTo(Wdth,Hght)}
	else{	if(x)this.style.backgroundColor=x;
		this.style.width=Wdth;
		this.style.height=Hght;
		this.style.fontFamily=FontFamily;
		this.style.fontWeight=FontBold?'bold':'normal';
		this.style.fontStyle=FontItalic?'italic':'normal';
		this.style.fontSize=FontSize+'pt';
		this.style.zIndex=RcrsLvl+Ztop}}

function MbrSetUp(MmbrCntnr,PrMmbr,WhatMenu,Wdth,Hght){
	var Location=RcrsLvl==1?FrstLoc:ScLoc;
	var MemVal=eval(WhatMenu+'[0]');
	var t,T,L,W,H,S;
	var a,b,c,d;
	this.PrvMbr=PrMmbr;
	this.Level=RcrsLvl;
	this.LinkTxt=eval(WhatMenu+'[1]');
	this.Container=MmbrCntnr;
	this.ChildCntnr=null;
	this.Hilite=0;
	this.style.overflow='hidden';
	this.style.cursor=ExpYes&&(this.LinkTxt||(RcrsLvl==1&&UnfoldsOnClick))?'hand':'default';
	this.ro=0;
	if(MemVal.indexOf('rollover')!=-1){
		this.ro=1;
		this.ri1=MemVal.substring(MemVal.indexOf(':')+1,MemVal.lastIndexOf(':'));
		this.ri2=MemVal.substring(MemVal.lastIndexOf(':')+1,MemVal.length);
		this.rid=WhatMenu+'i';MemVal="<img src='"+this.ri1+"' name='"+this.rid+"'>"}
	this.value=MemVal;
	if(RcrsLvl==1){
		a=LowBgColor;
		b=HighBgColor;
		c=FontLowColor;
		d=FontHighColor}
	else{	a=LowSubBgColor;
		b=HighSubBgColor;
		c=FontSubLowColor;
		d=FontSubHighColor}
	this.LoBck=a;
	this.LwFntClr=c;
	this.HiBck=b;
	this.HiFntClr=d;
	this.style.color=this.LwFntClr;
	if(this.LoBck)this.style.backgroundColor=this.LoBck;
	this.style.textAlign=MenuTextCentered;
	if(eval(WhatMenu+'[2]'))this.style.backgroundImage="url(\'"+eval(WhatMenu+'[2]')+"\')";
	if(MemVal.indexOf('<')==-1){
		this.style.width=Wdth-LftXtra;
		this.style.height=Hght-TpXtra;
		this.style.paddingLeft=LeftPaddng;
		this.style.paddingTop=TopPaddng}
	else{	this.style.width=Wdth;
		this.style.height=Hght}
	if(MemVal.indexOf('<')==-1&&DomYes){
		t=Location.document.createTextNode(MemVal);
		this.appendChild(t)}
	else this.innerHTML=MemVal;
	if(eval(WhatMenu+'[3]')&&ShowArrow){
		a=RcrsLvl==1&&FirstLineHorizontal?3:RightToLeft?6:0;
		S=Arrws[a];
		W=Arrws[a+1];
		H=Arrws[a+2];
		T=RcrsLvl==1&&FirstLineHorizontal?Hght-H-2:(Hght-H)/2;
		L=RightToLeft?2:Wdth-W-2;
		if(DomYes){
			t=Location.document.createElement('img');
			this.appendChild(t);
			t.style.position='absolute';
			t.src=S;
			t.style.width=W;
			t.style.height=H;
			t.style.top=T;
			t.style.left=L}
		else{	MemVal+="<div style='position:absolute; top:"+T+"; left:"+L+"; width:"+W+"; height:"+H+";visibility:inherit'><img src='"+S+"'></div>";
			this.innerHTML=MemVal}}
	if(ExpYes){this.onselectstart=CnclSlct;
		this.onmouseover=RcrsLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;
		this.onmouseout=CloseMenu;
		this.onclick=RcrsLvl==1&&UnfoldsOnClick&&eval(WhatMenu+'[3]')?OpenMenu:GoTo	}
	else{	RcrsLvl==1&&UnfoldsOnClick?this.addEventListener('mouseover',OpenMenuClick,false):this.addEventListener('mouseover',OpenMenu,false);
		this.addEventListener('mouseout',CloseMenu,false);
		RcrsLvl==1&&UnfoldsOnClick&&eval(WhatMenu+'[3]')?this.addEventListener('click',OpenMenu,false):this.addEventListener('click',GoTo,false)}}

function NavMbrSetUp(MmbrCntnr,PrMmbr,WhatMenu,Wdth,Hght){
	var a,b,c,d;
	if(RcrsLvl==1){
		a=LowBgColor;
		b=HighBgColor;
		c=FontLowColor;
		d=FontHighColor}
	else {	a=LowSubBgColor;
		b=HighSubBgColor;
		c=FontSubLowColor;
		d=FontSubHighColor	}
	this.value=eval(WhatMenu+'[0]');
	this.ro=0;
	if(this.value.indexOf('rollover')!=-1){
		this.ro=1;
		this.ri1=this.value.substring(this.value.indexOf(':')+1,this.value.lastIndexOf(':'));
		this.ri2=this.value.substring(this.value.lastIndexOf(':')+1,this.value.length);
		this.rid=WhatMenu+'i';this.value="<img src='"+this.ri1+"' name='"+this.rid+"'>"}
	if(LeftPaddng&&this.value.indexOf('<')==-1&&MenuTextCentered=='left')this.value='&nbsp\;'+this.value;
	if(FontBold)this.value=this.value.bold();
	if(FontItalic)this.value=this.value.italics();
	this.Ovalue=this.value;
	this.value=this.value.fontcolor(c);
	this.Ovalue=this.Ovalue.fontcolor(d);
	this.value=CntrTxt+"<font face='"+FontFamily+"' point-size='"+FontSize+"'>"+this.value+TxtClose;
	this.Ovalue=CntrTxt+"<font face='"+FontFamily+"' point-size='"+FontSize+"'>"+this.Ovalue+TxtClose;
	this.LoBck=a;
	this.HiBck=b;
	this.ChildCntnr=null;
	this.PrvMbr=PrMmbr;
	this.Hilite=0;
	this.visibility='inherit';
	if(this.LoBck)this.bgColor=this.LoBck;
	this.resizeTo(Wdth,Hght);
	if(!AcrssFrms&&eval(WhatMenu+'[2]'))this.background.src=eval(WhatMenu+'[2]');
	this.document.write(this.value);
	this.document.close();
	this.CmdLyr=new Layer(Wdth,MmbrCntnr);
	this.CmdLyr.Level=RcrsLvl;
	this.CmdLyr.LinkTxt=eval(WhatMenu+'[1]');
	this.CmdLyr.visibility='inherit';
	this.CmdLyr.onmouseover=RcrsLvl==1&&UnfoldsOnClick?OpenMenuClick:OpenMenu;
	this.CmdLyr.onmouseout=CloseMenu;
	this.CmdLyr.captureEvents(Event.MOUSEUP);
	this.CmdLyr.onmouseup=RcrsLvl==1&&UnfoldsOnClick&&eval(WhatMenu+'[3]')?OpenMenu:GoTo;
	this.CmdLyr.LowLyr=this;
	this.CmdLyr.resizeTo(Wdth,Hght);
	this.CmdLyr.Container=MmbrCntnr;
	if(eval(WhatMenu+'[3]')&&ShowArrow){
		a=RcrsLvl==1&&FirstLineHorizontal?3:RightToLeft?6:0;
		this.CmdLyr.ImgLyr=new Layer(Arrws[a+1],this.CmdLyr);
		this.CmdLyr.ImgLyr.visibility='inherit';
		this.CmdLyr.ImgLyr.top=RcrsLvl==1&&FirstLineHorizontal?Hght-Arrws[a+2]-2:(Hght-Arrws[a+2])/2;
		this.CmdLyr.ImgLyr.left=RightToLeft?2:Wdth-Arrws[a+1]-2;
		this.CmdLyr.ImgLyr.width=Arrws[a+1];
		this.CmdLyr.ImgLyr.height=Arrws[a+2];
		ImgStr="<img src='"+Arrws[a]+"' width='"+Arrws[a+1]+"' height='"+Arrws[a+2]+"'>";
		this.CmdLyr.ImgLyr.document.write(ImgStr);
		this.CmdLyr.ImgLyr.document.close()}}

function CreateMenuStructure(MName,NumberOf){
	RcrsLvl++;
	var i,NoOffSubs,Mbr,Wdth=0,Hght=0;
	var PrvMmbr=null;
	var WMnu=MName+'1';
	var MenuWidth=eval(WMnu+'[5]');
	var MenuHeight=eval(WMnu+'[4]');
	var Location=RcrsLvl==1?FrstLoc:ScLoc;
	if (RcrsLvl==1&&FirstLineHorizontal){
		for(i=1;i<NumberOf+1;i++){
			WMnu=MName+eval(i);
			Wdth=eval(WMnu+'[5]')?Wdth+eval(WMnu+'[5]'):Wdth+MenuWidth}
		Wdth=BorderBtwnElmnts?Wdth+(NumberOf+1)*BorderWidth:Wdth+2*BorderWidth;Hght=MenuHeight+2*BorderWidth}
	else{	for(i=1;i<NumberOf+1;i++){
			WMnu=MName+eval(i);
			Hght=eval(WMnu+'[4]')?Hght+eval(WMnu+'[4]'):Hght+MenuHeight}
		Hght=BorderBtwnElmnts?Hght+(NumberOf+1)*BorderWidth:Hght+2*BorderWidth;Wdth=MenuWidth+2*BorderWidth}
	if(DomYes){
		var MmbrCntnr=Location.document.createElement("div");
		MmbrCntnr.style.position='absolute';
		MmbrCntnr.style.visibility='hidden';
		Location.document.body.appendChild(MmbrCntnr)}
	else{	if(Nav4) var MmbrCntnr=new Layer(Wdth,Location)
		else{	WMnu+='c';
			Location.document.body.insertAdjacentHTML("AfterBegin","<div id='"+WMnu+"' style='visibility:hidden; position:absolute;'><\/div>");
			var MmbrCntnr=Location.document.all[WMnu]}}
	MmbrCntnr.SetUp=CntnrSetUp;
	MmbrCntnr.SetUp(Wdth,Hght,NumberOf);
	if(Exp4){	MmbrCntnr.InnerString='';
		for(i=1;i<NumberOf+1;i++){
			WMnu=MName+eval(i);
			MmbrCntnr.InnerString+="<div id='"+WMnu+"' style='position:absolute;'><\/div>"}
		MmbrCntnr.innerHTML=MmbrCntnr.InnerString}
	for(i=1;i<NumberOf+1;i++){
		WMnu=MName+eval(i);
		NoOffSubs=eval(WMnu+'[3]');
		Wdth=RcrsLvl==1&&FirstLineHorizontal?eval(WMnu+'[5]')?eval(WMnu+'[5]'):MenuWidth:MenuWidth;
		Hght=RcrsLvl==1&&FirstLineHorizontal?MenuHeight:eval(WMnu+'[4]')?eval(WMnu+'[4]'):MenuHeight;
		if(DomYes){
			Mbr=Location.document.createElement("div");
			Mbr.style.position='absolute';
			Mbr.style.visibility='inherit';
			MmbrCntnr.appendChild(Mbr)}
		else Mbr=Nav4?new Layer(Wdth,MmbrCntnr):Location.document.all[WMnu];
		Mbr.SetUp=Nav4?NavMbrSetUp:MbrSetUp;
		Mbr.SetUp(MmbrCntnr,PrvMmbr,WMnu,Wdth,Hght);
		if(NoOffSubs) Mbr.ChildCntnr=CreateMenuStructure(WMnu+'_',NoOffSubs);
		PrvMmbr=Mbr}
	MmbrCntnr.FrstMbr=Mbr;
	RcrsLvl--;
	return(MmbrCntnr)}

function CreateMenuStructureAgain(MName,NumberOf){
	var i,WMnu,NoOffSubs,PrvMmbr,Mbr=FrstCntnr.FrstMbr;
	RcrsLvl++;
	for(i=NumberOf;i>0;i--){
		WMnu=MName+eval(i);
		NoOffSubs=eval(WMnu+'[3]');
		PrvMmbr=Mbr;
		if(NoOffSubs)Mbr.ChildCntnr=CreateMenuStructure(WMnu+'_',NoOffSubs);
		Mbr=Mbr.PrvMbr}
	RcrsLvl--}

function trim(inputString) {
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") { // Check for spaces at the beginning of the string
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { // Check for spaces at the end of the string
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
		retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings
	}
	return retValue; // Return the trimmed string back to the user
} 

