	function ajaxTrier(ct, st){
		$('ct').value = ct;
		$('st').value = st;
	}
	function ajaxGoTo(pg_cour){
		$('pg_cour').value = pg_cour;
	}
	function setLinkTitle(){
		$$('#ajaxContentGlobal a').each(function(link) {
			if(link.getAttribute("TITLE1") == null && link.getAttribute("TITLE") != null && link.getAttribute("TITLE") != ""){
				link.setAttribute('TITLE1', link.getAttribute("TITLE"));
				link.removeAttribute("title");
				link.onmouseover = function(){$('infos').innerHTML = link.getAttribute("TITLE1"); return false; };
				link.onmouseout = function(){$('infos').innerHTML = ''; return false; };
			}
		});
	}
	function setBtn(){
		var dur = .5;
		$$('.btnBlue div.ajax-glow-button').each(function(btn) {
			btn.onmouseover = function(){new Effect.Morph(btn,{style:{backgroundColor:'#3399ff'},duration:dur})};
			btn.onmouseout = function(){new Effect.Morph(btn,{style:{backgroundColor:'#016BBD'},duration:dur})};
		});
		$$('.btnBlack div.ajax-glow-button').each(function(btn) {
			btn.onmouseover = function(){new Effect.Morph(btn,{style:{backgroundColor:'#555555'},duration:dur})};
			btn.onmouseout = function(){new Effect.Morph(btn,{style:{backgroundColor:'#111111'},duration:dur})};
		});
		$$('.btnGreen div.ajax-glow-button').each(function(btn) {
			btn.onmouseover = function(){new Effect.Morph(btn,{style:{backgroundColor:'#99cc33'},duration:dur})};
			btn.onmouseout = function(){new Effect.Morph(btn,{style:{backgroundColor:'#70b027'},duration:dur})};
		});
		$$('.btnRed div.ajax-glow-button').each(function(btn) {
			btn.onmouseover = function(){new Effect.Morph(btn,{style:{backgroundColor:'#cc3333'},duration:dur})};
			btn.onmouseout = function(){new Effect.Morph(btn,{style:{backgroundColor:'#9C0000'},duration:dur})};
		});
	}
	function GereChkbox(conteneur, toDo){
		try {
			$$('input[id^='+conteneur+'_]').each(function(check) {
				check.checked= ((toDo=='0') ? false : (toDo=='1') ? true : (check.checked) ? false : true);
			});
		} catch (e) { /* alert(e); */ }
	}
/* TinyMCE */
	function prepareContenuForTinyMCEEdit(id){

		try{
			if(mcImageManager) mcImageManager.settings.iframe = null;
			if(mcFileManager) mcFileManager.settings.iframe = null;
			if(tinyMCE.getInstanceById(id))
				tinyMCE.remove(tinyMCE.getInstanceById(id));
		} catch (e){}

		var tm = setTimeout(	function(){
			try {
				tinyMCE.idCounter=0; // prevent this.geDoc() error with ajax
				tinyMCE.execCommand("mceAddControl", false, id);
				tinyMCE.execCommand('mceFocus', true, id );
				window.clearTimeout(tm);
			} catch(e) {
				// Ignore
			}
	//		tinyMCE.execCommand("mceRemoveControl", false, 'contenu');
		},	200);
	}
	function removeContenuForTinyMCEEdit(id){

		try{
			tinyMCE.execCommand("mceRemoveControl", false, id);
		} catch (e){}
	}
	function getContenu(elem){
		try{
			if($(elem) && tinyMCE && tinyMCE.getInstanceById(elem))
				$(elem).value = tinyMCE.getInstanceById(elem).getContent();
		} catch (e) {}
	}
/* TinyMCE (fin) */
/* Wheel Login */
	function initScrollLayerLogin() {
	  var wndo = new dw_scrollObj('wnLogin', 'lyr1', null);
	  dw_scrollObj.GeckoTableBugFix('wnLogin');
	}
	/** This is high-level function.
	 * It must react to delta being more/less than zero.
	 */
	function handleLogin(delta) {
		if (delta < 0)
			dw_scrollObj.scrollBy('wnLogin',0,-100)
		else
			dw_scrollObj.scrollBy('wnLogin',0,100)
	}

	/** Event handler for mouse wheel event.
	 */
	function wheelLogin(event){
			var delta = 0;
			if (!event) /* For IE. */
					event = window.event;
			if (event.wheelDelta) { /* IE/Opera. */
					delta = event.wheelDelta/120;
					/** In Opera 9, delta differs in sign as compared to IE.
					 */
					if (window.opera)
							delta = -delta;
			} else if (event.detail) { /** Mozilla case. */
					/** In Mozilla, sign of delta is different than in IE.
					 * Also, delta is multiple of 3.
					 */
					delta = -event.detail/3;
			}
			/** If delta is nonzero, handle it.
			 * Basically, delta is now positive if wheel was scrolled up,
			 * and negative, if wheel was scrolled down.
			 */
			if (delta)
					handleLogin(delta);
			/** Prevent default actions caused by mouse wheel.
			 * That might be ugly, but we handle scrolls somehow
			 * anyway, so don't bother here..
			 */
			if (event.preventDefault)
					event.preventDefault();
		event.returnValue = false;
	}
/* Wheel Login (fin) */
/* Gestion des Hints */
	function prepareInputsForHints() {
		var inputs = document.getElementsByTagName("input");
		for (var i=0; i<inputs.length; i++){
			// test to see if the hint span exists first
			if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
				// the span exists!  on focus, show the hint
				inputs[i].onfocus = function () {
					this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
				}
				// when the cursor moves away from the field, hide the hint
				inputs[i].onblur = function () {
					this.parentNode.getElementsByTagName("span")[0].style.display = "none";
				}
			}
		}
		var inputs = document.getElementsByTagName("textarea");
		for (var i=0; i<inputs.length; i++){
			// test to see if the hint span exists first
			if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
				inputs[i].parentNode.getElementsByTagName("span")[0].style.bottom = (parseInt((inputs[i].style.height).replace(/px/,""))+15)+"px";
				// the span exists!  on focus, show the hint
				inputs[i].onfocus = function () {
					this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
				}
				// when the cursor moves away from the field, hide the hint
				inputs[i].onblur = function () {
					this.parentNode.getElementsByTagName("span")[0].style.display = "none";
				}
			}
		}

		// repeat the same tests as above for selects
		var selects = document.getElementsByTagName("select");
		for (var k=0; k<selects.length; k++){
			if (selects[k].parentNode.getElementsByTagName("span")[0]) {
				selects[k].onfocus = function () {
					this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
				}
				selects[k].onblur = function () {
					this.parentNode.getElementsByTagName("span")[0].style.display = "none";
				}
			}
		}
	}
/* Gestion des Hints (fin) */
/* MouseMove */
	function mouseX(evt) {
		if (evt.pageX) return evt.pageX;
		else if (evt.clientX)
		   return evt.clientX + (document.documentElement.scrollLeft ?
		   document.documentElement.scrollLeft :
		   document.body.scrollLeft);
		else return null;
	}
	function mouseY(evt) {
		if (evt.pageY) return evt.pageY;
		else if (evt.clientY)
		   return evt.clientY + (document.documentElement.scrollTop ?
		   document.documentElement.scrollTop :
		   document.body.scrollTop);
		else return null;
	}
/* MouseMove (fin) */
function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;

//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth;
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = xScroll;
	} else {
		pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}
String.prototype.strReverse = function() {
	var newstring = "";
	for (var s=0; s < this.length; s++) {
		newstring = this.charAt(s) + newstring;
	}
	return newstring;
	//strOrig = ' texttotrim ';
	//strReversed = strOrig.revstring();
};

function chkPass(pwd, scorebar, score) {
	var oScorebar = $(scorebar);
	var oScore = $(score);
	var oComplexity = null;
	var nScore = 0;
	var nLength = 0;
	var nAlphaUC = 0;
	var nAlphaLC = 0;
	var nNumber = 0;
	var nSymbol = 0;
	var nMidChar = 0;
	var nRequirements = 0;
	var nAlphasOnly = 0;
	var nNumbersOnly = 0;
	var nRepChar = 0;
	var nConsecAlphaUC = 0;
	var nConsecAlphaLC = 0;
	var nConsecNumber = 0;
	var nConsecSymbol = 0;
	var nConsecCharType = 0;
	var nSeqAlpha = 0;
	var nSeqNumber = 0;
	var nSeqChar = 0;
	var nReqChar = 0;
	var nReqCharType = 3;
	var nMultLength = 4;
	var nMultAlphaUC = 3;
	var nMultAlphaLC = 3;
	var nMultNumber = 4;
	var nMultSymbol = 6;
	var nMultMidChar = 2;
	var nMultRequirements = 2;
	var nMultRepChar = 1;
	var nMultConsecAlphaUC = 2;
	var nMultConsecAlphaLC = 2;
	var nMultConsecNumber = 2;
	var nMultConsecSymbol = 1;
	var nMultConsecCharType = 0;
	var nMultSeqAlpha = 3;
	var nMultSeqNumber = 3;
	var nTmpAlphaUC = "";
	var nTmpAlphaLC = "";
	var nTmpNumber = "";
	var nTmpSymbol = "";
	var sAlphaUC = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sAlphaLC = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sNumber = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sSymbol = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sMidChar = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sRequirements = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sAlphasOnly = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sNumbersOnly = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sRepChar = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sConsecAlphaUC = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sConsecAlphaLC = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sConsecNumber = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sSeqAlpha = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sSeqNumber = "&nbsp;&nbsp;&nbsp;&nbsp;0";
	var sAlphas = "abcdefghijklmnopqrstuvwxyz";
	var sNumerics = "01234567890";
	var sComplexity = "Too Short";
	var sStandards = "Below";
	var nMinPwdLen = 8;
	if (document.all) { var nd = 0; } else { var nd = 1; }
	if (pwd) {
		nScore = parseInt(pwd.length * nMultLength);
		nLength = pwd.length;
		var arrPwd = pwd.replace (/\s+/g,"").split(/\s*/);
		var arrPwdLen = arrPwd.length;

		/* Loop through password to check for Symbol, Numeric, Lowercase and Uppercase pattern matches */
		for (var a=0; a < arrPwdLen; a++) {
			if (arrPwd[a].match(new RegExp(/[A-Z]/g))) {
				if (nTmpAlphaUC !== "") { if ((nTmpAlphaUC + 1) == a) { nConsecAlphaUC++; nConsecCharType++; } }
				nTmpAlphaUC = a;
				nAlphaUC++;
			}
			else if (arrPwd[a].match(new RegExp(/[a-z]/g))) {
				if (nTmpAlphaLC !== "") { if ((nTmpAlphaLC + 1) == a) { nConsecAlphaLC++; nConsecCharType++; } }
				nTmpAlphaLC = a;
				nAlphaLC++;
			}
			else if (arrPwd[a].match(new RegExp(/[0-9]/g))) {
				if (a > 0 && a < (arrPwdLen - 1)) { nMidChar++; }
				if (nTmpNumber !== "") { if ((nTmpNumber + 1) == a) { nConsecNumber++; nConsecCharType++; } }
				nTmpNumber = a;
				nNumber++;
			}
			else if (arrPwd[a].match(new RegExp(/[^a-zA-Z0-9_]/g))) {
				if (a > 0 && a < (arrPwdLen - 1)) { nMidChar++; }
				if (nTmpSymbol !== "") { if ((nTmpSymbol + 1) == a) { nConsecSymbol++; nConsecCharType++; } }
				nTmpSymbol = a;
				nSymbol++;
			}
			/* Internal loop through password to check for repeated characters */
			for (var b=0; b < arrPwdLen; b++) {
				if (arrPwd[a].toLowerCase() == arrPwd[b].toLowerCase() && a != b) { nRepChar++; }
			}
		}

		/* Check for sequential alpha string patterns (forward and reverse) */
		for (var s=0; s < 23; s++) {
			var sFwd = sAlphas.substring(s,parseInt(s+3));
			var sRev = sFwd.strReverse();
			if (pwd.toLowerCase().indexOf(sFwd) != -1 || pwd.toLowerCase().indexOf(sRev) != -1) { nSeqAlpha++; nSeqChar++;}
		}

		/* Check for sequential numeric string patterns (forward and reverse) */
		for (var s=0; s < 8; s++) {
			var sFwd = sNumerics.substring(s,parseInt(s+3));
			var sRev = sFwd.strReverse();
			if (pwd.toLowerCase().indexOf(sFwd) != -1 || pwd.toLowerCase().indexOf(sRev) != -1) { nSeqNumber++; nSeqChar++;}
		}

	/* Modify overall score value based on usage vs requirements */

		/* General point assignment */
		if (nAlphaUC > 0 && nAlphaUC < nLength) {
			nScore = parseInt(nScore + ((nLength - nAlphaUC) * 2));
			sAlphaUC = "+ " + parseInt((nLength - nAlphaUC) * 2);
		}
		if (nAlphaLC > 0 && nAlphaLC < nLength) {
			nScore = parseInt(nScore + ((nLength - nAlphaLC) * 2));
			sAlphaLC = "+ " + parseInt((nLength - nAlphaLC) * 2);
		}
		if (nNumber > 0 && nNumber < nLength) {
			nScore = parseInt(nScore + (nNumber * nMultNumber));
			sNumber = "+ " + parseInt(nNumber * nMultNumber);
		}
		if (nSymbol > 0) {
			nScore = parseInt(nScore + (nSymbol * nMultSymbol));
			sSymbol = "+ " + parseInt(nSymbol * nMultSymbol);
		}
		if (nMidChar > 0) {
			nScore = parseInt(nScore + (nMidChar * nMultMidChar));
			sMidChar = "+ " + parseInt(nMidChar * nMultMidChar);
		}
		/* Point deductions for poor practices */
		if ((nAlphaLC > 0 || nAlphaUC > 0) && nSymbol === 0 && nNumber === 0) {  // Only Letters
			nScore = parseInt(nScore - nLength);
			nAlphasOnly = nLength;
			sAlphasOnly = "- " + nLength;
		}
		if (nAlphaLC === 0 && nAlphaUC === 0 && nSymbol === 0 && nNumber > 0) {  // Only Numbers
			nScore = parseInt(nScore - nLength);
			nNumbersOnly = nLength;
			sNumbersOnly = "- " + nLength;
		}
		if (nRepChar > 0) {  // Same character exists more than once
			nScore = parseInt(nScore - (nRepChar * nRepChar));
			sRepChar = "- " + nRepChar;
		}
		if (nConsecAlphaUC > 0) {  // Consecutive Uppercase Letters exist
			nScore = parseInt(nScore - (nConsecAlphaUC * nMultConsecAlphaUC));
			sConsecAlphaUC = "- " + parseInt(nConsecAlphaUC * nMultConsecAlphaUC);
		}
		if (nConsecAlphaLC > 0) {  // Consecutive Lowercase Letters exist
			nScore = parseInt(nScore - (nConsecAlphaLC * nMultConsecAlphaLC));
			sConsecAlphaLC = "- " + parseInt(nConsecAlphaLC * nMultConsecAlphaLC);
		}
		if (nConsecNumber > 0) {  // Consecutive Numbers exist
			nScore = parseInt(nScore - (nConsecNumber * nMultConsecNumber));
			sConsecNumber = "- " + parseInt(nConsecNumber * nMultConsecNumber);
		}
		if (nSeqAlpha > 0) {  // Sequential alpha strings exist (3 characters or more)
			nScore = parseInt(nScore - (nSeqAlpha * nMultSeqAlpha));
			sSeqAlpha = "- " + parseInt(nSeqAlpha * nMultSeqAlpha);
		}
		if (nSeqNumber > 0) {  // Sequential numeric strings exist (3 characters or more)
			nScore = parseInt(nScore - (nSeqNumber * nMultSeqNumber));
			sSeqNumber = "- " + parseInt(nSeqNumber * nMultSeqNumber);
		}
		/* Determine if mandatory requirements have been met and set image indicators accordingly */
		var arrChars = [nLength,nAlphaUC,nAlphaLC,nNumber,nSymbol];
		var arrCharsIds = ["nLength","nAlphaUC","nAlphaLC","nNumber","nSymbol"];
		var arrCharsLen = arrChars.length;
		nRequirements = nReqChar;
		if (pwd.length >= nMinPwdLen) { var nMinReqChars = 3; } else { var nMinReqChars = 4; }
		if (nRequirements > nMinReqChars) {  // One or more required characters exist
			nScore = parseInt(nScore + (nRequirements * 2));
			sRequirements = "+ " + parseInt(nRequirements * 2);
		}
		/* Determine complexity based on overall score */
		if (nScore > 100) { nScore = 100; } else if (nScore < 0) { nScore = 0; }
		if (nScore >= 0 && nScore < 20) { sComplexity = "Very Weak"; }
		else if (nScore >= 20 && nScore < 40) { sComplexity = "Weak"; }
		else if (nScore >= 40 && nScore < 60) { sComplexity = "Good"; }
		else if (nScore >= 60 && nScore < 80) { sComplexity = "Strong"; }
		else if (nScore >= 80 && nScore <= 100) { sComplexity = "Very Strong"; }

		/* Display updated score criteria to client */
		oScorebar.style.backgroundPosition = "-" + parseInt(nScore * 4) + "px";
		oScore.innerHTML = nScore + "%";
		$('sec_mdp').value = nScore;
	}
	else {
		/* Display default score criteria to client */
		oScore.innerHTML = nScore + "%";
		$('sec_mdp').value = nScore;
		oScorebar.style.backgroundPosition = "-" + parseInt(nScore * 4) + "px";
	}
}
function DonneNombreHasard(Minimum, Maximum) {
	return (Math.floor(Math.random() * (Maximum - Minimum)) + Minimum);
}
function DonneCaractereHasard(Nombres, Minuscules, Majuscules, Autres){
	var LesChiffres 		= "0123456789";
	var LesMinuscules 		= "abcdefghijklmnopqrstuvwxyz";
	var LesMajuscules 		= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var LesAutres 			= "!@#$%&*()-_=+;:,.?";
	var ChaineCaracteres 	= ""

	if (Nombres == true)	  	ChaineCaracteres += LesChiffres;
	if (Nombres == true)	  	ChaineCaracteres += LesChiffres;
	if (Nombres == true)	  	ChaineCaracteres += LesChiffres;
	if (Autres == true)     	ChaineCaracteres += LesAutres;
	if (Minuscules == true) 	ChaineCaracteres += LesMinuscules;
	if (Minuscules == true) 	ChaineCaracteres += LesMinuscules;
	if (Minuscules == true) 	ChaineCaracteres += LesMinuscules;
	if (Majuscules == true) 	ChaineCaracteres += LesMajuscules;
	if (Majuscules == true) 	ChaineCaracteres += LesMajuscules;
	if (Majuscules == true) 	ChaineCaracteres += LesMajuscules;
	if (Autres == true)     	ChaineCaracteres += LesAutres;

	return ChaineCaracteres.charAt(DonneNombreHasard(0, ChaineCaracteres.length));
}
function ComposerMotPasse(Longueur, input, input2){
	var Resultat = "";
	if (Longueur > 0) Resultat = Resultat + DonneCaractereHasard(true, true, true, true);
	for (var i = 1; i < Longueur; ++i) {
		Resultat = Resultat + DonneCaractereHasard(true, true, true, true);
	}
	$(input).value = Resultat;
	$(input2).value = Resultat;
	alert(Resultat);
	return false;
}
