<!--
// for volonteer bug
var form_filled = false;

var dtCh= "/";
var minYear=1930;
var maxYear=2000;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var dtCh='/';
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	
	for (var i = 1; i <= 3; i++)
		if (strYr.charAt(0)=="0" && strYr.length>1) 
			strYr=strYr.substring(1)

	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	
	if (pos1==-1 || pos2==-1)
		return false
	if (strMonth.length<1 || month<1 || month>12)
		return false
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month])
		return false
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)
		return false
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false)
		return false
	
	return true
}

function offre_in_red ()
{
	var offre = document.getElementById ("offre");
			
	offre.style.color 		= "#FF0000";
	offre.style.fontWeight	= "bold";
			
	window.location.href 	= '#';	
}

function good_validation ()
{
	var form = window.document.forms[0];

	if (! validation ())
		return false;

	if (form.i_adomos_form && form.i_adomos_form.value == 1 && form.i_revenu.value)
	{
		if (! adomos_validation ())
			return false;
	}
	
	download ();
	
	return false;
}

function validation ()
{
	var form = window.document.forms[0];

	if (! form.e_email.value)
	{
		alert ('Vous devez entrer vos coordonnées !');
		return false;
	}

	if (! check_e_prefix (form.e_email.value))
	{
		alert ('Vous devez entrer une adresse email valide !');
		return false;
	}

	if (form.i_extra_form.value)
	{
		if (! form.p_cp)
			return true;
		
		if (! form.p_cp.value || ! form.p_cp.value ||
		    ! form.i_birthday_d[form.i_birthday_d.selectedIndex].value ||
			! form.i_birthday_m[form.i_birthday_m.selectedIndex].value ||
			! form.i_birthday_y[form.i_birthday_y.selectedIndex].value ||
			! (form.c_sex[0].checked || form.c_sex[1].checked))
		{
			alert ('Vous devez entrer vos coordonnées !');
			return false;
		}

		if (form.i_ads_form.value == 4)
		{	
			if (form.t_portable)
			{
				if (! form.t_portable.value)
				{
					alert ('Vous devez entrer votre numéro de téléphone !');
					return false;
				}
	
				if (! check_t_prefix (form.t_portable.value))
				{
					alert ('Vous devez entrer un numéro valide !');
					return false;
				}
			}
		}
		
		if (form.p_cp)
		{
			if(form.c_locale.value == 'fr' || form.c_locale.value == 'FR') {
				if (! form.p_cp.value || form.p_cp.value.length != 5 || ! check_i_prefix (form.p_cp.value))
				{
					alert ('Vous devez entrer un code postal valide !');
					return false;
				}
			} else {
				if (! form.p_cp.value || form.p_cp.value.length < 2)
				{
					alert ('Vous devez entrer un code postal valide !');
					return false;
				}	
			}
		}

		var birthday = form.i_birthday_m.value + "/" + form.i_birthday_d.value + "/" + form.i_birthday_y.value;
		if(! isDate(birthday))
		{
	 	    alert('Vous devez saisir une date de naissance valide !');
	 	    return false;
		}
	}

	if (form.i_ads_form && form.i_ads_form.value)
	{
		if ((form.i_ads_form.value == 1) && ! (form.i_ads[0].checked || form.i_ads[1].checked))
		{
			offre_in_red ();

			alert ('Choisir "oui" ou "non" pour télécharger nos Logiciels Gratuits !');
			return false;
		}

		if ((form.i_ads_form.value == 2) && ! form.i_ads[0].checked)
		{
			offre_in_red ();

			alert ('Choisissez "oui" pour télécharger et utiliser nos Logiciels Gratuits.');
			return false;
		}

		if ((form.i_ads_form.value == 3) && ! form.i_ads.checked)
		{
			return false;
		}
	}

	return true;
}

function download ()
{
	var form = document.forms[0];

	if (is_msie () && is_xp () && form.c_software && form.c_software.value)
	{
		var url = '/cgi-bin/download/direct/contact.cgi?c_software=' + form.c_software.value +
				  '&i_campaign=' + form.i_campaign.value + 
				  '&e_email=' + form.e_email.value +
          '&c_locale=' + form.c_locale.value +
				  '&x_randuid=' + form.x_randuid.value + '&i_sleep=3';

		if (form.i_birthday_d)
		{
			url += '&i_birthday_d=' + form.i_birthday_d[form.i_birthday_d.selectedIndex].value +
				   '&i_birthday_m=' + form.i_birthday_m[form.i_birthday_m.selectedIndex].value +
				   '&i_birthday_y=' + form.i_birthday_y[form.i_birthday_y.selectedIndex].value;
		}
		
		if (form.p_cp)
		{
			url += '&p_cp=' + form.p_cp.value;
		}
		
		if (form.c_sex)
		{
			if (form.c_sex[0].checked)
			{
				url += '&c_sex=' + form.c_sex[0].value;
			}
			if (form.c_sex[1].checked)
			{
				url += '&c_sex=' + form.c_sex[1].value;
			}		 
		}
		
		if ((form.i_ads_form.value == 1 || form.i_ads_form.value == 2) && form.i_ads)
		{
			if (form.i_ads[0].checked)
			{
				url += '&i_ads=' + form.i_ads[0].value;
			}
			if (form.i_ads[1].checked)
			{
				url += '&i_ads=' + form.i_ads[1].value;
			}		 
		}
					
		if ((form.i_ads_form.value == 3) && form.i_ads)
		{
				url += '&i_ads=' + form.i_ads.value;
		}

		window.open (url, 'Download', 'toolbar=0,location=no,directories=0,status=0, scrollbars=no,resizable=0,width=1,height=1,top=0,left=0');

		window.focus ();
	}

	// for volonteer bug
	form_filled = true;

	form.submit ();

	return false;
}

function switch_submission ()
{
	var form = document.forms[0];
	
	if (form.i_ads)
	{
		if (form.i_ads.checked)
			form.x_submit.disabled = true;
		else
			form.x_submit.disabled = false;
	}
}

function init ()
{
	var form = document.forms[0];
	
	if (form.i_ads && form.i_ads_form && form.i_ads_form.value == 3)
	{
		if (form.i_ads.checked)
			form.x_submit.disabled = false;
		else
			form.x_submit.disabled = true;			
	}
}

window.onload=init;
//-->