var check;
var previousURL;

function isNotOfAge(thisURL) {

var ageIdentifier = null;
var ageIdentifier = getCookie("ageIdentifier");
previousURL = thisURL;

	if ( ageIdentifier == null ) {
	writeCookieSurvey('pageIdentifier', previousURL, 240);
	window.location.href = "/sopranos/roadtorespect/agegate.shtml";
	}
}

function hasCookie() {
var ageIdentifier = getCookie("ageIdentifier");

	if ( ageIdentifier != null ) {
	window.location.href = "/sopranos/roadtorespect/index.shtml";
	}
}

function checkAge() {

	/* the minumum age you want to allow in */
	var min_age = 17;

	/* change "age_form" to whatever your form has for a name="..." */
	var year = parseInt(document.age_form.year.options[document.age_form.year.selectedIndex].value);
	var month = parseInt(document.age_form.month.options[document.age_form.month.selectedIndex].value) - 1;
	var day = parseInt(document.age_form.day.options[document.age_form.day.selectedIndex].value);

	var theirDate = new Date((year + min_age), month, day);
	var today = new Date;

	today = today.getTime();
	theirDate = theirDate.getTime();

	if ( today - theirDate < 0) {
		alert("You are not eligible to enter this site.");
		check = "tooyoung";
		return false;
	} else {
		writeCookieSurvey('ageIdentifier', 'yes', 240);
		return true;
	}
}

function sendUser() {

previousURL = getCookie("pageIdentifier");

if ( previousURL == null || previousURL == "" ) {
previousURL = "/sopranos/roadtorespect/index.shtml";
}

	if ( check == "tooyoung" ) {
	location.reload(true);
	} else {
	window.location.href = previousURL;
	}

}