function controlla_data(campo) /* ggmmaaaa deve essere in formato 'gg-mm-aaaa' 
										 con separatore qualsiasi*/
{
	ggmmaaaa=campo.value
//	alert("nome campo= "+campo.name+ "    valore campo= "+campo.value)
	if((ggmmaaaa=="__/__/____" && campo.name!="data_nascita") || ggmmaaaa=="00-00-0000")
		return true;

//	if(ggmmaaaa=="00-00-0000")
		
	var g=parseInt(ggmmaaaa.substr(0,2),10);
	var m=parseInt(ggmmaaaa.substr(3,2),10);
	var a=parseInt(ggmmaaaa.substr(6,4),10);
	if (isNaN(g)||isNaN(m)||isNaN(a))
		return false;
	if ((g>31||g<1||m>12||m<1|| (g==31 && (m==2||m==4||m==6||m==9||m==11)) || (g==30 && m==2)))
			return false;
	if (g==29 && m==2)
		{
		if ((a!=2000 && (a%4)>0) || ((a%100)==0 && a!=2000))
			return false;
		}
return true;
}

var nbclic=0
function okClic() {
	nbclic++; 
	if (nbclic>1) {
		alert("Vous avez déjà cliqué ce bouton.\nLe formulaire est en cours de traitement...\nMerci de patienter.");
		return false;
		}
	else {
		return true;
		}
	}

function setCookie (name, value) {
	var argv=setCookie.arguments;
	var argc=setCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function verifMail(a) {
testm = false ;
 for (var j=1 ; j<(a.length) ; j++) {
  if (a.charAt(j)=='@') {
   if (j<(a.length-4)){
    for (var k=j ; k<(a.length-2) ; k++) {
     if (a.charAt(k)=='.') testm = true;
    }
   }
  }
 }
if (testm==false) alert('Votre adresse e-mail est incorrecte.');
return testm ;
}

function returnVerifMail(a) {
testm = false ;
 for (var j=1 ; j<(a.length) ; j++) {
  if (a.charAt(j)=='@') {
   if (j<(a.length-4)){
    for (var k=j ; k<(a.length-2) ; k++) {
     if (a.charAt(k)=='.') testm = true;
    }
   }
  }
 }
return testm ;
}

/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_cell = new Array;


/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function changeCouleurCell(theCell, theCellNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    //var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theCell.style) == 'undefined') {
        return false;
    }
/*
    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
*/
    // 3. Gets the current color...
    //var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCell.getAttribute) != 'undefined') {
        currentColor = theCell.getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCell.style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_cell[theCellNum]) == 'undefined' || !marked_cell[theCellNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_cell[theCellNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_cell[theCellNum] = (typeof(marked_cell[theCellNum]) == 'undefined' || !marked_cell[theCellNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            /*for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for*/
			theCell.setAttribute('bgcolor', newColor, 0);
        }
        // 5.2 ... with other browsers
        else {
            /*for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }*/
			theCell.style.backgroundColor = newColor;
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


/**
 * This array is used to remember mark status of rows in browse mode
 */
var marked_row = new Array;


/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function changeCouleurRow(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function

var activeLayer2='liste0';

function swapStatus2(section) 
{
 if (!document.getElementById)
 {
  document.layers[activeLayer2].visibility = "hide";
  activeLayer2 = section;
  document.layers[activeLayer2].visibility = "show";
 }
 else if (document.getElementById)
 if (document.all)
 {
 eval(activeLayer2).style.visibility = "hidden";
 activeLayer2 = section;
 eval(activeLayer2).style.visibility = "visible";
 }
 else
 {
  document.getElementById(activeLayer2).style.visibility = "hidden";
  activeLayer2 = section;
  document.getElementById(activeLayer2).style.visibility = "visible";
 }
}

var activeLayer3="image0";

function swapStatus3(section) 
{
 if (!document.getElementById)
 {
  document.images[activeLayer3].src = "image/spacer.gif";
  activeLayer3 = section;
  document.images[activeLayer3].src = "image/home_tb.gif";
 }
 else if (document.getElementById)
 if (document.all)
 {
 document[activeLayer3].src = "image/spacer.gif";
 activeLayer3 = section;
 document[activeLayer3].src = "image/home_tb.gif";
 }
 else
 {
  document.getElementById(activeLayer3).src = "image/spacer.gif";
  activeLayer3 = section;
  document.getElementById(activeLayer3).src = "image/home_tb.gif";
 }
}

function getAnchorPosition2(anchorname){var useWindow=false;var coordinates=new Object();var x=0,y=0;var use_gebi=false, use_css=false, use_layers=false;if(document.getElementById){use_gebi=true;}else if(document.all){use_css=true;}else if(document.layers){use_layers=true;}if(use_gebi && document.all){x=AnchorPosition_getPageOffsetLeft2(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop2(document.all[anchorname]);}else if(use_gebi){var o=document.getElementById(anchorname);x=AnchorPosition_getPageOffsetLeft2(o);y=AnchorPosition_getPageOffsetTop2(o);}else if(use_css){x=AnchorPosition_getPageOffsetLeft2(document.all[anchorname]);y=AnchorPosition_getPageOffsetTop2(document.all[anchorname]);}else if(use_layers){var found=0;for(var i=0;i<document.anchors.length;i++){if(document.anchors[i].name==anchorname){found=1;break;}}if(found==0){coordinates.x=0;coordinates.y=0;return coordinates;}x=document.anchors[i].x;y=document.anchors[i].y;}else{coordinates.x=0;coordinates.y=0;return coordinates;}coordinates.x=x;coordinates.y=y;return coordinates;}
function getAnchorWindowPosition2(anchorname){var coordinates=getAnchorPosition2(anchorname);var x=0;var y=0;if(document.getElementById){if(isNaN(window.screenX)){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else{x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}}else if(document.all){x=coordinates.x-document.body.scrollLeft+window.screenLeft;y=coordinates.y-document.body.scrollTop+window.screenTop;}else if(document.layers){x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;}coordinates.x=x;coordinates.y=y;return coordinates;}
function AnchorPosition_getPageOffsetLeft2(el){var ol=el.offsetLeft;while((el=el.offsetParent) != null){ol += el.offsetLeft;}return ol;}
function AnchorPosition_getWindowOffsetLeft2(el){return AnchorPosition_getPageOffsetLeft2(el)-document.body.scrollLeft;}
function AnchorPosition_getPageOffsetTop2(el){var ot=el.offsetTop;while((el=el.offsetParent) != null){ot += el.offsetTop;}return ot;}
function AnchorPosition_getWindowOffsetTop2(el){return AnchorPosition_getPageOffsetTop2(el)-document.body.scrollTop;}


function position2(nom,ycorrection,k) {
 if (!document.getElementById)
 {
  resultat = new getAnchorPosition2("section");
  //document.layers[nom].visibility = "hide";
  document.layers[nom].top = resultat.y+25+ycorrection-(2*k)+2;
  document.layers[nom].left = resultat.x+140;
 }
 else if (document.getElementById)
 if (document.all)
 {
 resultat = new getAnchorPosition2("section");
 eval(nom).style.top = resultat.y+25+ycorrection;
 eval(nom).style.left = resultat.x+140;
 }
 else
 {
  resultat = new getAnchorPosition2("section");
  document.getElementById(nom).style.top = resultat.y+25+ycorrection+2;
  document.getElementById(nom).style.left = resultat.x+140;
 }
}


