<!--
function change() {
    document.scout.ok_url.value='http://www.ecscouts.org.uk/JoinConfirm.html?'+ document.scout.submit_to.value;
}
function run() {
	days = new Date();
	date = days.getDate();
	gmonth = days.getMonth();
	gyear = days.getFullYear();
	dd = document.scout.day.options[document.scout.day.selectedIndex].value;
	mm = document.scout.month.options[document.scout.month.selectedIndex].value;
	yy = document.scout.year.value;
    if (isNaN(yy) || (yy<1)) {
        alert("Sorry, the following errors were found:\n\n- Invalid Year Entry. Enter YYYY.");
        document.scout.year.value = "19";
        document.scout.year.focus();
	}
	YearDiff  = gyear  - yy;
	MonthDiff = (gmonth+1) - mm;
    DayDiff   = date   - dd ;

    switch (gmonth) {
    	case "03" :       
			if(((yy % 4 == 0) && (yy % 100 != 0)) || (yy % 400 == 0)){
				DayCorrection = 29; break;
			}
			else {
				DayCorrection = 28; break;
			}
		case "05" :
        case "07" :
		case "10" :
		case "12" :
        	DayCorrection = 30; break;
		default :
			DayCorrection = 31;  break;
    }

    if (DayDiff < 0){
        MonthDiff -= 1;
    	DayDiff = (DayCorrection + DayDiff);
    }

    if (MonthDiff < 0){
    	YearDiff = (YearDiff - 1);
    	MonthDiff = (12 + MonthDiff);
    }

	returnString = "You are " + YearDiff + " years ";
	switch (MonthDiff) {
    	case 0 : returnString +="old exactly"; break;
		case 1 : returnString += "& " + MonthDiff + " month old"; break;
		default : returnString += "& " + MonthDiff + " months old"; break;
	}
	returnString += getSection(YearDiff, MonthDiff);
	document.scout.age.value=returnString;
}

function getSection(age, mage){
    section =". Your section is ";
    if((age >=6) && (age <8)){
        section+="Beavers.";
		document.scout.beaver.checked = true;
    }
    else if((age >=8) && ((age<=10) && (mage<6))){ 
        section+="Cubs.";
		document.scout.cub.checked = true;
    }
	else if((age >=8) && (age<10)){ 
        section+="Cubs.";
		document.scout.cub.checked = true;
    }
    else if(((age >=10)&&(mage>=6)) && (age<14)){
        section+="Scouts.";
		document.scout.scout.checked = true;
    }
	else if((age >10)&&(age<14)){
        section+="Scouts.";
		document.scout.scout.checked = true;
    }
    else if((age >=14) && (age<18)){
        section+="Explorer Scouts.";
		document.scout.explorer.checked = true;
    }
    else if((age >=18) && (age<26)){
        section+="Scout Network/Adult.";
		document.scout.network.checked = true;
    }
    else if(age >=26){
        section+="Adult.";  
    }
    else {
        section=". No section is currently avaliable.";
    }
    return section;
}
// End -->
