//Insert custom privacy link in the footer
x$("#xg_foot .right a:nth-child(3)").after("  |  <a href='/page/she-writes-privacy-policy'>She Writes Privacy</a>");
//Insert id to right column
x$("#xg_module_account").parent().attr("id","right_column");

//JS that relabels "Location" "Category" on group pages
//This can be installed in the analytics box of your network
//Can't make this change in the language editor since the Location label is used for other features.
//Changes the Location label on the group display page
x$(".xg_widget_groups_group #xg_body .xg_span-12 .xg_module .xg_module_body .xg_span-8 .pad5 p").each(function() {
  var text = x$(this).html();
  text = text.replace("Location:","Category:");
  x$(this).html(text);
});

//Changes the Location label on the group create page
x$(".xg_widget_groups_group #xg_body .pad5 fieldset.nolegend dl dt label").each(function() {
  var label = x$(this).html();
  label = label.replace("Location","Categories");
  x$(this).html(label);
});

//Inserts the custom header navigation menu to the right of the SheWrites network logo
/*
var header_navigation = "<ul id='header_navigation' class='nav_lvl1'></ul>";
x$("#xg_sitename").after(header_navigation);
x$("#header_navigation").load('/html_includes/header_nav.php');
*/

//Appends a continue link after every feed entry (Blog RSS feed)
x$(".xg_widget_main_index_index .module_feed .xg_module_body").each(function() {
    href = x$(this).find("h3 a").attr("href");
    html = '<a href="'+href+'">continue...</a>';
    x$(this).append(html);
});

//Restyles the Blog RSS feed on the mainpage
var counter = 1;
x$("#xg_layout_column_2 .module_feed .xg_module_body").each(function(){
  var entry_footer_html = "<div id='entry_footer"+counter+"' class='rss_entry_footer'></div>";
  x$(this).append(entry_footer_html);

  var entry_icon_html = "<div id='entry_icon"+counter+"' class='rss_entry_icon'></div>";
  x$(this).prepend(entry_icon_html);

  //Figure out what's the url for this entry's blog post so we can call load() on this url
  x$("#entry_icon"+counter).parent().attr("id","rss_blog_entry"+counter);
  x$("#entry_icon"+counter).parent().attr("class","rss_blog_entry");
  var blog_entry_location = x$("#rss_blog_entry"+counter+" h3 a").attr("href");

  //load() the blog entry creators profile icon
  //var blog_entry_location = x$(this).filter("h3 a").attr("href");
  x$("#entry_icon"+counter).load(blog_entry_location+" .xg_blog_detail img.photo");
  
  //load() the blog entry's create by and create data info
  x$("#entry_footer"+counter).load(blog_entry_location+" .xg_blog_detail .byline li:nth-child(1)");

  counter++;
});

var blog_module_footer = x$(".xg_widget_main_index .module_blog .xg_module_foot").html();
if(blog_module_footer != null) {
blog_module_footer = blog_module_footer.replace("/profiles/blog/list","/profiles/blog/list?promoted=1");
x$("#rss_blog_entry1").parent().after(blog_module_footer);
}

x$("div.xg_widget_main_admin_tracking p.buttongroup input.button").hover(function(){
  x$(this).before("<span id='custom_warning' style='margin-right:10px;'>Saving is permanent, make sure you have a backup of any changes!</span>"); 	
},
function(){
  x$(this).parent().children("#custom_warning").fadeOut();
});





