// JavaScript Document
sendmailError = unescape(sendmailGetCookie('sendmailError'));
if (sendmailError != false){
	fields = sendmailError.split(';');
	for (i=0; i<fields.length; i++){
		// alert (fields[i]);
		if ((fields[i] != '') && ($('form_' + fields[i]))){
			$('form_' + fields[i]).style.border="solid #f00 2px";
		}
	}
	// $$('input.file').each(function(e){e.style.border="solid #f00 2px"}); 

	document.cookie='sendmailError=""';
	formContent = unescape(sendmailGetCookie('formContent'));
	if (formContent != false){
		fields = formContent.split(';');
		for (i=0; i<fields.length; i++){
				// alert(fields[i]);
			if (fields[i] != ''){
				datas = fields[i].split("=",2);
				frmElem = $('form_' + datas[0]);
				if (frmElem) {
					// alert(datas[0] +':'+ frmElem.tagName + ':#' + unescape(datas[1]) +"#")
					switch(frmElem.tagName.toLowerCase()){ 
						case 'input':
							$(frmElem).value=unescape(datas[1]);
							break;
						case 'div': // select encapsul� dans un span (puisque ie ne veut pas de bordure sur les select !!!)
						case 'span':
							$(frmElem).cleanWhitespace();
							frmSelect=$(frmElem).firstChild;
							for(s=0; s<$(frmSelect).length; s++){
								if ($(frmSelect).options[s].value == unescape(datas[1])){
									$(frmSelect).selectedIndex = s;
									continue;
								}
							}
							break;
						case 'textarea': // select encapsul� dans un span (puisque ie ne veut pas de bordure sur les select !!!)
							$(frmElem).innerHTML=unescape(datas[1]);
							break;
						default:
							
					}
				}
			}
		}	
		document.cookie='formContent=""';
	}
}
function sendmailGetCookie(nom){
	var deb,fin
    deb = document.cookie.indexOf(nom + "=")
    if (deb >= 0) {
    	deb += nom.length + 1
        fin = document.cookie.indexOf(";",deb)
        if (fin < 0) fin = document.cookie.length
        return document.cookie.substring(deb,fin)
    }
    return false;
}