$(document).ready(function(){
	
	/* Activate if site has PNG's*/
	$("body").pngFix();
	
	
	//Activate if site has search
	$('#search').emptyonclick();
	$('#searchoncontact').emptyonclick();
	
	
	/*Activate if site has tag search
	$("#search").autocomplete("/ajax/autocompleter_tags.php", {
		width: 260,
		selectFirst: false
	});
	*/
	
	if ($("input[name='BuyOther']:checked").val() == 'Other') {
		$("#buyOthertext").attr("disabled", false);
		$("#buyOthertext").removeClass('disabled');
	} else {
		$("#buyOthertext").attr("disabled", true);
		$("#buyOthertext").addClass('disabled');
	}
	$("input[name='BuyOther']").click(function(event){
		if ($("input[name='BuyOther']:checked").val() == 'Other') {
			$("#buyOthertext").attr("disabled", false);
			$("#buyOthertext").removeClass('disabled');
		} else {
			$("#buyOthertext").attr("disabled", true);
			$("#buyOthertext").addClass('disabled');
		}
	 });
	
	
	if ($("input[name='SeeexpressionOther']:checked").val() == 'Other') {
		$("#seeexpressionOthertext").attr("disabled", false);
		$("#seeexpressionOthertext").removeClass('disabled');
	} else {
		$("#seeexpressionOthertext").attr("disabled", true);
		$("#seeexpressionOthertext").addClass('disabled');
	}
	$("input[name='SeeexpressionOther']").click(function(event){
		if ($("input[name='SeeexpressionOther']:checked").val() == 'Other') {
			$("#seeexpressionOthertext").attr("disabled", false);
			$("#seeexpressionOthertext").removeClass('disabled');
		} else {
			$("#seeexpressionOthertext").attr("disabled", true);
			$("#seeexpressionOthertext").addClass('disabled');
		}
	 });
	 
	 if ($("input[name='mostexpression']:checked").val() == 'Other') {
		$("#mostexpressionOthertext").attr("disabled", false);
		$("#mostexpressionOthertext").removeClass('disabled');
	} else {
		$("#mostexpressionOthertext").attr("disabled", true);
		$("#mostexpressionOthertext").addClass('disabled');
	}
	$("input[name='mostexpression']").click(function(event){
		if ($("input[name='mostexpression']:checked").val() == 'Other') {
			$("#mostexpressionOthertext").attr("disabled", false);
			$("#mostexpressionOthertext").removeClass('disabled');
		} else {
			$("#mostexpressionOthertext").attr("disabled", true);
			$("#mostexpressionOthertext").addClass('disabled');
		}
	 });
	
	 setdate();
	    
	$("select[name='birthdatey']").change(function(event){
		setdate();
	 });
	 
	 $("select[name='birthdatem']").change(function(event){
		setdate();
	 });
	 
	 $("select[name='birthdated']").change(function(event){
		setdate();
	 });
	 
	 
	 
	
	
});

function setdate(){
	$selecteddate = new Date($("select[name='birthdatey']").val(),$("select[name='birthdatem']").val()-1,$("select[name='birthdated']").val());
	 
	 $today = new Date();
	 $calcyears = ($today - $selecteddate) / 1000 / 3600 /24 /365;
	 
	 if ($calcyears < 16 && $calcyears > 12) {
		$("#age").attr("disabled", false);
		$("#age").removeClass('hidden');
	} else {
		$("#age").attr("disabled", true);
		$("#age").addClass('hidden');
	}
}

