
function popup() {
    openFormatWindow('/share/webapps/registration/email-format.html','format','menubar=no,scrollbars=auto,width=350,height=360');
}

function openFormatWindow(theURL,winName,features) {
	var openWindow = null;
	
	if(openWindow==null || openWindow.closed) {
		openWindow = window.open(theURL,winName,features);
			if(openWindow.document.forms[0]) {  // if ther's already stuff in the window
				openWindow.focus();
			} else {
				openWindow.window.location=theURL;
			}
			openWindow.focus();
	}
}

function openWhatsThis(anchor) {
	url = "/share/webapps/registration/access_whatsthis.html#"+anchor;
	openFormatWindow(url,'whatsThis','menubar=no,scrollbars=yes,width=450,height=450');
}



var MSECS_PER_YEAR = 365.2422 * 24.0 * 60.0 * 60.0 * 1000.0;

function verifyDOB(f) {
    var dobYear;
    var dobMonth;
    var dobDate;
    
    for(var i = 0; i < f.length; i++) {
        var e = f.elements[i];
	if (e.name == "dateOfBirth/year") {
	    dobYear = e;
	} else if (e.name == "dateOfBirth/month") {
	    dobMonth = e;
	} else if (e.name == "dateOfBirth/date") {
	    dobDate = e;
	}
    }
    
    var year = dobYear.options[dobYear.selectedIndex].value;
    var month = dobMonth.options[dobMonth.selectedIndex].value - 1;
    var date = dobDate.options[dobDate.selectedIndex].value;
    
    var dob = new Date();
    dob.setFullYear(year,month,date);
    
    var now = new Date();
    var underAge = (now.getTime() - dob.getTime()) < (MSECS_PER_YEAR * 13);
    if (underAge == false) {
	return confirm("The child's age you have entered...");
    }
    return true;
}

function doWidthCheck() {
	var wantedWidth = 850;
	var wantedHeight = 800;     
	
	if (document.layers){
		 var browseWidth=window.outerWidth;
		 var browseHeight=window.outerHeight;
		 
	}
	if (document.all){
		var browseWidth=document.body.clientWidth;
		var browseHeight=document.body.clientHeight;
	}
	
	var screenWidth		=	(screen.width - wantedWidth) / 2;
	var screenHeight	=	(screen.height - wantedHeight) / 2;
	
	if(browseWidth < wantedWidth && browseHeight < wantedHeight) {
		window.resizeTo( wantedWidth, wantedHeight);
		window.moveTo(screenWidth,screenHeight);
	}
}
