function update(id, url){
	$("#" + id).load(url);
}

function validateAge(form_day, this_day, form_month, this_month, form_year, this_year){
	if( (form_year < (this_year - 18) ) || (form_year <= (this_year - 18) && form_month < this_month) || (form_year <= (this_year - 18) && form_month <= this_month && form_day < this_day) ){
		return true;
	}
	$("#age-error").html('You are under age.');
	return false;
}

function show_window(width, height, url){
	window.open(url, 'Terms and conditions', 'width='+width+',height='+height+',scrollbars=yes,status=no,menubar=no,directories=no,resizable=yes,toolbar=no,location=yes');
}

function toggle(id){
	if($("#div-faq"+id).css("display") == "block"){
		collapse(id);
	}
	else{
		expand(id);
	}
}
function expand(id){
	//$("#a-faq"+id).attr("href", "javascript:collapse("+id+");");
	$("#div-faq"+id).slideDown("slow", function(){ $("#img-faq"+id).attr("src", "/assets/css/images/btn-faq-down.jpg"); });
	//document.getElementById("faq"+id).style.display = 'block';
}

function collapse(id){
	//$("#a-faq"+id).attr("href", "javascript:expand("+id+");");
	$("#div-faq"+id).slideUp("slow", function(){ $("#img-faq"+id).attr("src", "/assets/css/images/btn-faq.jpg") });
	//document.getElementById("faq"+id).style.display = 'none';
}

$(document).ready(function(){
	$(".a-faq").click( function (event){
		var temp_id = $(this).attr("id");
		var id = temp_id.substr("a-faq".length,temp_id.length);
		toggle(id);
		event.preventDefault();
	});
});
