cutechart_current_type='all_cutesters_tiled';
cutechart_current_filter='';
function change_chart(obj,page,cat,filter) {
  var type=$(obj).attr('id');
  // For id's of the "next page" and "previous page"
  var type=type.replace(type.match(/_page.*$/),'');
  if ($(obj).attr('title'))
    $(document).attr('title',"Cute Charts: "+$(obj).attr('title')+" at CuteNotCute.com");
  load_chart(type,page,cat,filter);
  return false;
}
function change_cat(cat) {
  return load_chart(cutechart_current_type,1,cat,cutechart_current_filter);
}
function load_chart(type,page,cat,filter) {
  var type;
  cutechart_current_type = type;
  cutechart_current_page = page;
  cutechart_current_cat = cat;
  cutechart_current_filter = filter;
  // The query string
  var page = page ? "&page="+page : page='';
  var cat = cat ? "&cat="+cat : '';
  var filter = filter ? "&filter="+filter : '' ;
  var query_string = "?type="+type+page+cat+filter;
  var url="ajax/chart.php"+query_string;
  //  Webmechs fix(due to <base> tag for images
  //  url = "http://"+location.hostname+location.pathname.replace('cutecharts.php','')+"/"+url;
  $("#charts_wrapper").html("Loading...");
  $("#charts_wrapper").load(url);
  return false;
}
