function setAction(f) {
	f.action ="AjoutPriseEnCharge.html";
}

function go() {
	//alert(this.name);
	window.top.main.location.href = "../TdmEvt.html";
}

/* Variables et Fonctions pour la récupération des variables de l'URL */
var variables=new Array()

function clear(text)
{
	while (text.search(/%20/) != -1)
		text = text.replace(/%20/," ");
	return text;
}

function cutUrl()
{
	var str1 = document.location.search;
	var str2 = str1;
	var pos1 = 1;
	var pos2 = pos1;
	var pos3 = pos1;
	var count = 0;

	while ( (pos2 = str1.indexOf("&", pos1)) != -1 )
	{
		str2 = str1.substring(pos1,pos2);
		pos3 = str2.indexOf("=");
		variables[count] = new Array();
		variables[count]["name"] = str2.substring(0,pos3);
		variables[count]["value"] = clear(str2.substring(pos3+1,str2.length));
		pos1 = pos2+1;
		count++;
	}

	pos2 = str1.length;
	str2 = str1.substring(pos1,pos2);
	pos3 = str2.indexOf("=");
	variables[count] = new Array();
	variables[count]["name"] = str2.substring(0,pos3);
	variables[count]["value"] = clear(str2.substring(pos3+1,str2.length));
}

function getEcran()
{	ecran='';
	cutUrl();

	var hiddens = new Array();
	for (var i=0; i < variables.length; i++)
		//hiddens[i] = "<input type=\"hidden\" name=\"" + variables[i]["name"] + "\" value=\"" + variables[i]["value"] + "\">";
		if (variables[i]["name"]=="ecran")
			{
				ecran=variables[i]["value"];
				//alert(ecran);
			}
	return ecran;	
}

function checkNum(entree)
{
	var int_format = /^\d+$/;
	if (!int_format.test(entree.value))
	{
		alert('Ce champ doit etre numerique');
		entree.focus();
		return false
	}
	return true
}
function setEvents(domElements /* Array */, aClassName /* Optional */) {
		if (!aClassName)
			aClassName = "focus";

		for (i = 0; i < domElements.length; i++) {
			domElements[i].onfocus = inputFocus;
			domElements[i].onblur = inputBlur;
			domElements[i].setAttribute("focusClassName", aClassName);
		}
	}
function inputFocus(e) {
		this.setAttribute("oldFocusClassName", this.className);
		this.className = this.getAttribute("focusClassName");
	}
	
function inputBlur(e) {
		this.className = this.getAttribute("oldFocusClassName");
	}
	
function recup_ecran(id,msg,error)
		{
		getEcran();
		if (ecran==2)
		{
			document.getElementById(id).innerHTML=msg;
		}
		
		if (ecran==3)
		{
			document.getElementById(id).innerHTML=error;	
		}
		else
		{
			setEvents(document.getElementsByTagName("input"));
			setEvents(document.getElementsByTagName("textarea"));
			/*setEvents(Array(document.getElementById("email")), "important");*/
		}
		}