var prfiorighref = '';

function productfinder_overview(groups, age, weight, activity) {
 var overview = jQuery('#productfinder_overview');
 var detail = jQuery('#productfinder_detail');
 var loading = jQuery('#productfinder_loading');
 if(!prfiorighref) prfiorighref = jQuery('#print').attr('href');
 jQuery('#print').attr('href', prfioverviewhref = prfiorighref + "&groups=" + groups + "&age=" + age + "&weight=" + weight + "&activity=" + activity);

  overview.hide();
  detail.hide();
  loading.show();
  
  overview.load('index.php', {type:111, groups: groups, age: age, weight: weight, activity: activity}, function(resp, status, xhr) {
    overview.fadeIn();
    loading.hide();     
    if (status == 'error') {
      overview.html("Loading Error: " + xhr.statusText);     
    }
  });
}

function productfinder_detail(id) {
 var overview = jQuery('#productfinder_overview');
 var detail = jQuery('#productfinder_detail');
 var loading = jQuery('#productfinder_loading');
 var print = jQuery('#print');
 jQuery('#print').attr('href', prfiorighref + "&product=" + id);

  overview.hide();
  detail.hide();
  loading.show();

  detail.load('index.php', {type:111, product: id}, function(resp, status, xhr) {
    detail.fadeIn();
    loading.hide();
    if (status == 'error') {
      detail.html("Loading Error: " + xhr.statusText);     
    }    
  });
}

function productfinder_back() {
 jQuery('#print').href = prfioverviewhref;
  jQuery('#productfinder_overview').show();
  jQuery('#productfinder_detail').hide();
  jQuery('#productfinder_loading').hide();
}
