(function($){	
	$.avbypass = {
		checkToken: function(){
			console.log('checkToken');
			var urlString = window.location.href.toString();
			var split = urlString.split("?avToken=");
			console.log(urlString);
			console.log(split);
			
			console.log('checktoken called with this url - ' + urlString)
			if(split.length > 1){
				$.ajax({
					type: "GET",
					url: "/ValidateToken.aspx",
					cache: false,
					dataType: "xml",
					data: { 
						avToken: split[1]
					},
					success: function(response) {
						
						
						console.log($(response).find('status').text());
						if($(response).find('status').text() == "valid"){
							var _mclogin = $('#frm-verify-age');
							var _form = _mclogin.find('form');
							$('#frm-verify-month').val(1);
							$('#frm-verify-day').val(1);//edeaf0
							$('#frm-verify-year').val(1911);
							$('#frm-verify-state').val('or');
							_form.submit();
						}
					},
					error: function() {
						alert("sorry an error occured with avbypass");
					}					
				});
			}else{
				$.keystone.writeLog("no avtoken");
			}
		}
			
	}
})(jQuery);
