var isExplorer = false, isNetscape = false, isExplorerMSIE5 = false;
	
	if(navigator.appName.indexOf("Explorer") > -1){
		isExplorer = true; //alert("Explorer");	
		if(navigator.appVersion.indexOf("MSIE 5") > -1)
			isExplorerMSIE5 = true;	
	}else if(navigator.appName.indexOf("Netscape") > -1){
		isNetscape = true; //alert("Netscape");
	}else{
		isExplorer = true; // Opera,Mac lets see if they work on explorer settings
	} 
	function isDate(p_mm,p_dd,p_yyyy){
		var the_date = new Date(p_mm + "/" + p_dd + "/" + p_yyyy);
		return (the_date.getMonth() + 1 == p_mm && the_date.getDate() == p_dd && the_date.getFullYear() == p_yyyy);
	}
	function isAgeLegal(p_mm,p_dd,p_yyyy){
		var the_date = new Date(p_mm + "/" + p_dd + "/" + p_yyyy);
		var l_date = new Date();
		
		var differentYears 	= l_date.getFullYear() - the_date.getFullYear();
		var differentMonths = l_date.getMonth() - the_date.getMonth();
		var differentDays 	= l_date.getDate() - the_date.getDate();
		
		different  			= new Date();
		different.setTime(Math.abs(l_date.getTime() - the_date.getTime()));
		var timedifference 	= Math.abs(l_date.getTime() - the_date.getTime());
		var leapyear 		= Math.floor((timedifference / (1000 * 60 * 60 * 24 * 365))/4);
		var dayseval 		= Math.floor(timedifference / (1000 * 60 * 60 * 24)) - leapyear;
		var yeareval 		= Math.floor(dayseval/365);
		return (yeareval >= 18);
	}
	function validateForm(p_frm){
		var l_errormessage 	= "";
		var l_focusfield	= "";
		var req_legal_age = 18;
			
		if (!isDate(p_frm.month.options[p_frm.month.selectedIndex].value,p_frm.day.options[p_frm.day.selectedIndex].value,p_frm.year.options[p_frm.year.selectedIndex].value)){
			l_errormessage += "You have entered an invalid date of birth\n";
			if (!l_focusfield) 
				l_focusfield = "day";
		}
	
		if (!isAgeLegal(p_frm.month.options[p_frm.month.selectedIndex].value,p_frm.day.options[p_frm.day.selectedIndex].value,p_frm.year.options[p_frm.year.selectedIndex].value)){
			l_errormessage += "You must be at least 18 years of age\n";
		}
		
		if (l_errormessage != ""){
			alert(l_errormessage);
			return(false);
		}else{
			p_frm.action="/age-verified";
				
			p_frm.submit();
			return(true);
		}	
	}
