jQuery(function($){var current_page='';$('#question1 .yes-button').click(function(){current_page='question1';loadPage('question2','yes')});$('#question1 .no-button').click(function(){current_page='question1';loadPage('question2','no')});$('#question2 .yes-button').click(function(){current_page='question2';loadPage('question3','yes')});$('#question2 .no-button').click(function(){$.cookie('time_wasted','1',{expires:365});$('#main-content .toptext').html('');current_page='question2';loadPage('question3','no');});$('#question3 .yes-button').click(function(){current_page='question3';loadPage('main-content','yes');});$('#question3 .no-button').click(function(){current_page='question3';loadPage('main-content','no');});$('.iWantToTryItAnywayButton').click(function(){current_page='question3';loadPage('main-content','yes');});var page_cache=$.cookie('page_cache');var time_wasted=$.cookie('time_wasted');if(!page_cache){loadPage('question1','');}else{var d=page_cache.split('|');loadPage(d[0],d[1]);}
if(time_wasted)
$('#main-content .toptext').html('');function loadPage(page,answer)
{if(current_page){postAction(current_page,answer);}else{postAction(page,answer);}
if(current_page!=''){$('#'+current_page).remove();$('#'+current_page+'-page-nav').addClass('hidden');}
if(page=='main-content'){$('div#questions').remove();$('#'+page).removeClass('hidden').show();$('.copy').show();}else{$('#main-content').addClass('hidden').hide();$('#'+page).removeClass('hidden').show();$('.copy').hide();}
$('#'+page+'-page-nav').removeClass('hidden');$('#'+page+' #'+answer+'-content').removeClass('hidden');$.cookie('page_cache',page+'|'+answer,{expires:365});}
function postAction(action,value){if(matches=action.match(/^question(\d+)/)){action=matches[1];value=value.substr(0,1);$.post('action.php',{aid:action,av:value,pid:pageId||0});}}});
