function SetCookie(cookieName,cookieValue,nDays) {
	 var today = new Date();
	 var expire = new Date();
	 if (nDays==null || nDays==0) nDays=1;
	 expire.setTime(today.getTime() + 3600000*24*nDays);
	 document.cookie = cookieName+"="+escape(cookieValue)
	                 + ";expires="+expire.toGMTString() + '; path=/';
}
 
function submitForm() {

	
	if($('#dob_year').val() > 1990)
	{
		alert('Age not legal');
	}
	else
	{
		SetCookie('ofAge', '1', 2);
		SetCookie('culture', 'en-us', 2);
		$('form').submit();
	}

	return false;
}

$(document).ready(function() {
	var dob_fields = $('.age_form input.input_text');
	dob_fields.css('color', '#666666');
	dob_fields.focus(function() {
		if ((this.value == 'DD') || (this.value == 'MM') || (this.value == 'YY')) {
			$(this).css('color', '#000000');
			this.value = '';
		}
	});
	dob_fields.blur(function() {
		if (!this.value.match(/[0-9]*/)) {
			this.value = '';
		}
		if (this.value.length == 3) {
			this.value = '';
		}
		if (this.value == '') {
			if (this.name == 'dob_day') {
				this.value = 'DD';
			} else if (this.name == 'dob_month') {
				this.value = 'MM';
			} else {
				this.value = 'YY';
			}
			$(this).css('color', '#666666');
		}
		
	});
	
	if($(window).height() < 775){
    	
    	$('#footer').css('top', '625px');
    	
    } else {
    	
    	$('#footer').css('top', '');
    	
    }
	
	$(window).resize(function() {
	    //console.log("window is being resized: " + $(window).height());
	    if($(window).height() < 775){
	    	
	    	$('#footer').css('top', '625px');
	    	
	    } else {
	    	
	    	$('#footer').css('top', '');
	    	
	    }
	    
	});
	 
});
