function thememakers_expand_archive_year(year,post_type){
    var data = {
        action: "get_years_archive_links",
        year: year,
        post_type:post_type
    };
    //send data to server
    jQuery.post(ajaxurl, data, function(response) {
        jQuery(".tmk_archive_year_"+year+" a.archive_arrow").text("-");
        jQuery(".tmk_archive_year_"+year+" a.archive_arrow").attr("href","javascript:thememakers_close_archive_year("+year+",'"+post_type+"');void(0);")
        jQuery(".tmk_archive_year_"+year).append('<ul>'+response+'</ul>');
    });
}

function thememakers_close_archive_year(year,post_type){
    jQuery(".tmk_archive_year_"+year+" a.archive_arrow").text("+");
    jQuery(".tmk_archive_year_"+year+" a.archive_arrow").attr("href","javascript:thememakers_expand_archive_year("+year+",'"+post_type+"');void(0);")
    jQuery(".tmk_archive_year_"+year+" ul").remove();
}


function thememakers_expand_archive_month(month, year,post_type){
    var data = {
        action: "get_monthes_archive_links",
        month:month,
        year: year,
        post_type:post_type
    };
    //send data to server
    jQuery.post(ajaxurl, data, function(response) {
        jQuery(".tmk_archive_month_"+year+"_"+month+" a.archive_arrow").text("-");
        jQuery(".tmk_archive_month_"+year+"_"+month+" a.archive_arrow").attr("href","javascript:thememakers_close_archive_month("+month+","+year+",'"+post_type+"');void(0);")
        jQuery(".tmk_archive_month_"+year+"_"+month).append('<ul>'+response+'</ul>');
    });
}

function thememakers_close_archive_month(month, year,post_type){
    jQuery(".tmk_archive_month_"+year+"_"+month+" a.archive_arrow").text("+");
    jQuery(".tmk_archive_month_"+year+"_"+month+" a.archive_arrow").attr("href","javascript:thememakers_expand_archive_month("+month+","+year+",'"+post_type+"');void(0);")
    jQuery(".tmk_archive_month_"+year+"_"+month+" ul").remove();
}


function thememakers_expand_archive_week(week,month, year,post_type){
    var data = {
        action: "get_weeks_archive_links",
        week:week,
        month:month,
        year: year,
        post_type:post_type
    };
    //send data to server
    jQuery.post(ajaxurl, data, function(response) {
        jQuery(".tmk_archive_week_"+year+"_"+month+"_"+week+" a.archive_arrow").text("-");
        jQuery(".tmk_archive_week_"+year+"_"+month+"_"+week+" a.archive_arrow").attr("href","javascript:thememakers_close_archive_week("+week+","+month+","+year+",'"+post_type+"');void(0);")
        jQuery(".tmk_archive_week_"+year+"_"+month+"_"+week).append('<ul>'+response+'</ul>');
    });
}

function thememakers_close_archive_week(week, month, year,post_type){
    jQuery(".tmk_archive_week_"+year+"_"+month+"_"+week+" a.archive_arrow").text("+");
    jQuery(".tmk_archive_week_"+year+"_"+month+"_"+week+" a.archive_arrow").attr("href","javascript:thememakers_expand_archive_week("+week+","+month+","+year+",'"+post_type+"');void(0);")
    jQuery(".tmk_archive_week_"+year+"_"+month+"_"+week+" ul").remove();
}


