
	defaultOverseasAddress = "";
	default_dob_dd = "dd";
	default_dob_mm = "mm";
	default_dob_ccyy = "yyyy";
	
	var d = new Date();
	var curr_date = d.getDate();
	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();
	
	$(document).ready(function(){
		
		$($.date_input.initialize);
		
		
			
		//DOB VALIDATION					
		$("#dob_dd").focus(function(){
				if($(this).val() == default_dob_dd)$(this).val("");
		});
		
		$("#dob_dd").blur(function(){
			if($(this).val() == ""){
				$(this).val(default_dob_dd);	
			}else if(!isInteger($(this).val())){				
				alert("Oops! the 'dd' part of your date of birth must be between 1 and 31...");
				$(this).val(default_dob_dd);
			}else if(($(this).val() < 1) || ($(this).val() > 31)){
				alert("Oops! the 'dd' part of your date of birth must be between 1 and 31...");
				$(this).val(default_dob_dd);
			}
		});		
		
		$("#dob_mm").focus(function(){
				if($(this).val() == default_dob_mm)$(this).val("");
		});
		
		$("#dob_mm").blur(function(){
			if($(this).val() == ""){
				$(this).val(default_dob_mm);	
			}else if(!isInteger($(this).val())){
				alert("Oops! the 'mm' month part of your date of birth must be between 1 and 12...");
				$(this).val(default_dob_mm);
			}else if(($(this).val() < 1) || ($(this).val() > 12)){
				alert("Oops! the 'mm' month part of your date of birth must be between 1 and 31...");
				$(this).val(default_dob_mm);
			}
		});	
		
		$("#dob_ccyy").focus(function(){
				if($(this).val() == default_dob_ccyy)$(this).val("");
		});
		
		$("#dob_ccyy").blur(function(){
			if($(this).val() == ""){
				$(this).val(default_dob_ccyy);	
			}else if(!isInteger($(this).val())){
				alert("Oops! the 'yyyy' part of your date of birth must be your year of birth (a number)...");
				$(this).val(default_dob_ccyy);
			}else if($(this).val() == curr_year){
				alert("Oops! it looks like you've entered this year - we need the year you were born...");
				$(this).val(default_dob_ccyy);
			}else if($(this).val() > curr_year){
				alert("Oops! that year is in the future! We need the year you were born...");
				$(this).val(default_dob_ccyy);
			}
		});			
						
	});

function isInteger(s) {
	return (s.toString().search(/^-?[0-9]+$/) == 0);
}


