
jQuery.noConflict();



jQuery(document).ready( function(){
	
	// All
	jQuery("#show-settings-link").css("display", "none");
	jQuery("a[href='index.php?page=akismet-stats-display']").parent().hide();
	//jQuery("a[href='admin.php?page=gigpress-options']").parent().hide();
	// Features table
	jQuery("#compare thead tr th:eq(1),#compare tfoot tr th:eq(1),#features .name").css('display','none');
	jQuery("#footer-credits #credit").html("Powered by <a href='http://bandpress.org'><img src='http://static.bandpress.org/files/2009/11/footer-logo-white.png' alt='BandPress.org' style='margin:0 3px;vertical-align:text-bottom;' /></a>");
	
	//Dashboard
	if (location.pathname == '/wp-admin/' || location.pathname == '/wp-admin/index.php' ) {
		jQuery("#dashboard_quick_press, #dashboard_incoming_links, #yoast_db_widget").css("display", "none");
		
	}
	
	// Supporter 
	if(location.pathname == '/wp-admin/supporter.php'){
		jQuery(".supporterlist:lt(2)").hide();
		jQuery("#compare").css('margin-top','10px');
		jQuery("#compare").appendTo('.wrap');
		jQuery("#compare").before('<h2>Features</h2>').css('width','500px');
		jQuery("#compare thead tr th:eq(1),#compare tfoot tr th:eq(1),.name").css('display','none');
	}
	
	// Profile
	if (location.pathname == '/wp-admin/profile.php' ) {
		jQuery(".form-table:first tr:first").css("display", "none");
		jQuery("table.form-table:eq(4) tr:gt(0)").hide();
		jQuery("table.form-table:eq(5) tr:eq(0)").hide();
		jQuery("h3:eq(5)").html('Password');
	}
	
	//Import
	if (location.pathname == '/wp-admin/import.php') {
		jQuery("#icon-tools ~ h2 ~ p:first").html("If you have posts or comments in another system, BandPress can import those into this blog. To get started, choose a system to import from below:");		
	}

	//Plugins
	if (location.pathname == '/wp-admin/plugins.php') {
		jQuery("#icon-plugins ~ h2 ~ p:first").html("Plugins extend and expand the functionality of BandPress. Once a plugin is installed, you may activate it or deactivate it here.");		
	    //jQuery(".subsubsub li:gt(0)").hide();
		jQuery(".second > .desc").html('');
		jQuery("p.error").css({
			'background-color': '#FFEBE8',
			'margin-top': '50px'
		});
	}	
	
	// Blog Icons
	if (location.pathname == '/wp-admin/themes.php'  &&  location.search   == '?page=blog-icons' ) {
		jQuery(".postbox-container:eq(0) .postbox:gt(0)").hide();
		jQuery(".postbox-container:eq(1) .postbox").hide();
		jQuery(".wrap > h2").html("Favicon Options");
		jQuery(".wrap > h2").after('<p>Upload your favicon if you already have one or <a href="http://tools.dynamicdrive.com/favicon/">create a favicon</a>.</p>');
	}
	
	//Gig Press
	if (location.pathname == '/wp-admin/admin.php'  &&  location.search   == '?page=gigpress/gigpress.php' ) {
		jQuery("#show_related ~ br ~ p").html("You can link any show to a BandPress post, useful for show recaps, tour journals, uploading pictures, and allowing user comments.");		
	}
	
	// Simpler CSS
	if (location.pathname == '/wp-admin/themes.php'  &&  location.search   == '?page=simpler-css/simpler-css.php' ) {
		jQuery(".wrap > h2:first").html("Custom CSS");		
	}	
	
	//Widgets 
	if(location.pathname == '/wp-admin/widgets.php') {
		jQuery(".wrap:eq(1)").hide();
	}
	
	//Page
	if(location.pathname == '/wp-admin/page.php') {
		jQuery("#media-buttons > a:nth-child(3)").addClass("add_media");
		jQuery("#postaiosp > h3:first").html('<span>Search Engine Optimization</span>');
		jQuery("#page-links-to > h3:first").html('<span>Page Links To External Link</span>');
		jQuery("#postaiosp > h3:first").addClass('hndle');
		jQuery("#page-links-to").addClass('closed');
		jQuery("#page_template option:eq(1),#page_template option:eq(2)").hide();
		jQuery("#postaiosp > a:first").css("display","none");
		jQuery("#ejunkiewpplugin_sectionid").hide();
		jQuery("#ping_status").parent("p label").hide();
		jQuery("#pagecommentstatusdiv .inside p:eq(2)").hide();
		jQuery("#page-links-to .inside p:eq(3)").hide();
		jQuery('#authordiv').hide();
		
	}
	
	//Page New
	if(location.pathname == '/wp-admin/page-new.php') {
		jQuery("#comment_status").attr("checked","");
		jQuery("#ping_status").attr("checked","");
		jQuery("#ping_status").parent("p label").hide();
		jQuery("#pagecommentstatusdiv .inside p:eq(2)").hide();
		jQuery("#media-buttons > a:nth-child(3)").addClass("add_media");
		jQuery("#postaiosp > h3:first").html('<span>Optional - Search Engine Optimization</span>');
		jQuery("#postaiosp > h3:first").addClass('hndle');
		jQuery("#page-links-to > h3:first").html('<span>Optional - Page Links To External Link</span>');
		jQuery("#page-links-to").addClass('closed');
		jQuery("#page_template option:eq(1),#page_template option:eq(2)").hide();
		jQuery("#postaiosp > a:first").css("display","none");
		jQuery("#ejunkiewpplugin_sectionid").hide();
		jQuery("#page-links-to .inside p:eq(3)").hide();
		jQuery('#authordiv').hide();
	}
	
	// Post 
	if(location.pathname == '/wp-admin/post.php' || location.pathname == '/wp-admin/post-new.php') {
		jQuery('#authordiv').hide();
		jQuery("#media-buttons > a:nth-child(3)").addClass("add_media");
		jQuery("#postaiosp,#page-links-to").css("display","none");
		jQuery("#ping_status").parent("p label").hide();
		jQuery("#ejunkiewpplugin_sectionid  > h3:first").html('<span>Shop Item</span>');
		jQuery("#ejunkiewpplugin_sectionid em").css("color","red");
		//jQuery("#ejunkiewpplugin_sectionid").addClass('closed');
		jQuery("#p75-thumbnail-posting  > h3:first").html('<span>Thumbnail</span>');
		jQuery("#postexcerpt .inside > p").html('Excerpts are optional hand-crafted summaries of your content that can be used in your Featured or Blog section');
	}
	
	if(location.pathname == '/wp-admin/post-new.php') {
		var bpPostType = '<p><lable for="bp_post_type">Select Post Type:</lable> <select id="bp_post_type">';
			bpPostType = bpPostType + '<option>Blog</option>';
			bpPostType = bpPostType + '<option>Bio</option>';
			bpPostType = bpPostType + '<option>Newsletter</option>';
			bpPostType = bpPostType + '<option>Photos</option>';
			bpPostType = bpPostType + '<option>Playlist</option>';
			bpPostType = bpPostType + '<option>Shop</option>';
			bpPostType = bpPostType + '<option>Gig</option>';
			bpPostType = bpPostType + '</select></p>';
			jQuery("#title").before(bpPostType);
	        //default
	        var sel = 'Blog';
	        jQuery("#ejunkiewpplugin_sectionid").hide();
	        updateCats(sel);
	        //select
			jQuery("#bp_post_type").change(
			  function () {
			    val = jQuery(this).val();
			    switch(val)
			    {
			    case 'Blog':
			      jQuery("#ejunkiewpplugin_sectionid").hide();
			      jQuery("#p75-thumbnail-posting").show();
			      sel = val;
			      break;
			    case 'Bio':
			      jQuery("#ejunkiewpplugin_sectionid").hide();
			      jQuery("#p75-thumbnail-posting").show();
			      sel = val;
			      break;
			    case 'Newsletter':
			      jQuery("#ejunkiewpplugin_sectionid").hide();
			      jQuery("#p75-thumbnail-posting").hide();
			      sel = val;
			      break;
			    case 'Photos':
			      jQuery("#ejunkiewpplugin_sectionid").hide();
			      jQuery("#p75-thumbnail-posting").hide();
			      sel = val;
			      break;
			    case 'Playlist':
			      jQuery("#ejunkiewpplugin_sectionid").hide();
			      jQuery("#p75-thumbnail-posting").show();
			      sel = val;
			      break;
			    case 'Shop':
			      jQuery("#ejunkiewpplugin_sectionid").show();
			      jQuery("#p75-thumbnail-posting").show();
			      sel = val;
			      break;
			    case 'Gig':
			    	window.location = "/wp-admin/admin.php?page=gigpress/gigpress.php"
			    }
                updateCats(sel)
			  }
			);
	}
	
    function updateCats(sel){
		jQuery("#categories-all label.selectit,#categories-pop label.selectit").each(function (i) {
				   var val = jQuery(this).html();
				       val = val.replace(/<(.)*>/,"");
				       val = val.replace(/^\s+|\s+$/g,"");
				       if(val == sel){
		                         jQuery(this).children().attr("checked",true);
				       } else {
				         jQuery(this).children().attr("checked",false);
				       }
				});
    }
	
	// Tools
	if(location.pathname == '/wp-admin/tools.php') {
		jQuery("#gears-msg1 > h3").html("Turbo: Speed up BandPress");
		jQuery("#gears-msg1 > p:eq(0)").html("BandPress now has support for Gears, which adds new features to your web browser.<br /><a style='font-weight: normal;' target='_blank' href='http://gears.google.com/'>More information...</a>");
		jQuery("#gears-msg1 > p:eq(1)").html("After you install and enable Gears, most of BandPressâ€™ images, scripts, and CSS files will be stored locally on your computer. This speeds up page load time.");
	    jQuery("#gears-msg2 > p:eq(0)").html("Gears is installed on this computer, but is not enabled for use with BandPress.");
	}
	
	
	// Setting General
	if(location.pathname == '/wp-admin/options-general.php' &&  location.search   == '') {
		jQuery("label[for='blogname']").html("Band Name");
		jQuery(".description").html("In a few words, explain what this website is about.");
		//jQuery(".setting-description:first").html("In a few words, explain what this website is about.");
	}
	
	// Fate Free Shopping
	if(location.pathname == '/wp-admin/options-general.php' &&  location.search   == '?page=e-junkiewpplugin.php') {
		jQuery(".wrap table table tr:eq(6)").hide();
		jQuery(".wrap > form > h2:first").html("Shopping Cart Settings");
		jQuery("input[name='update_EJWPPluginSettings']").attr("value","Update Shopping Cart Settings");
	}

	//wp-signup.php
	if(location.pathname == '/wp-signup.php') {
		jQuery("label[for='password'] ~ p:first").css("visibility","hidden");
		jQuery("label[for='password']").before("<br /><br />");
		jQuery("label[for='password']").css("display","inline");
		jQuery("label[for='blogname']").html("Website Domain:");
		jQuery("label[for='blog_title']").html("Band Name:");
		jQuery("#blogname").css("width","400px");
		jQuery("#blogname").css("text-align","right");
		jQuery("#privacy").css({'visibility' : 'hidden', 'height' : '20px'});
		//jQuery("label[for='blog_public_on'] ").css("visibility","hidden");
		//jQuery("label[for='blog_public_off'] ").css("visibility","hidden");
		//jQuery("label[for='blog_title'] ~ p:first").css("display","none");
		jQuery(".suffix_address ~ strong:first").css("display","none");
		// disable after save
		jQuery(".submit.submit").click(function () { 
		      //jQuery(".submit.submit").attr("disabled", true);
		      jQuery(".submit.submit").val("Creating account...");
		});
		
		
		jQuery("#container #top").css('height','125px')
		// Replace sign up page with coming soon and email subscription form
		//jQuery(".mu_register").html('<form style="padding:3px;text-align:center;" action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open(\'http://feedburner.google.com/fb/a/mailverify?uri=bandpressorg\', \'popupwindow\', \'scrollbars=yes,width=550,height=520\');return true"><p>Enter your email address:</p><p><input type="text" style="width:140px" name="email"/></p><input type="hidden" value="bandpressorg" name="uri"/><input type="hidden" name="loc" value="en_US"/><input type="submit" value="Subscribe" /></form>').css({"width":"500px","background":"#fff","padding":"20px 100px"}).prepend("<h2 style=\"text-align:center;\">We're not quite there yet.<br /> We'll let you know as soon as we are ready.</h2>");
	}
	
	if(location.pathname == '/wp-signup.php' || location.pathname == '/wp-activate.php') {
		//jQuery("#access").css("display","none");
	}
	
	//Photo Gallery
	if (location.pathname == '/wp-admin/admin.php' &&  location.search   == '?page=nextgen-gallery'   ) {
		jQuery("#dashboard_primary,#ngg_gd_lib,#ngg_lastdonators").css("display","none");
		jQuery(".ngg-wrap > h2:first,.hndle > span").html("Photo Gallery");
	}
	
	// Contact Form
	if(location.pathname == '/wp-admin/tools.php'  && (location.search   == '?page=contact-form-7/admin/admin.php' ||  location.search   == '?page=contact-form-7/admin/admin.php&contactform=1&message=saved')) {
		jQuery(".wpcf7 > h2").html("Contact Form");
		jQuery(".donation,table:eq(3), table:eq(4), table:eq(5)").css("display","none");
	}
	
	// Upload 
	if (location.pathname == '/wp-admin/media-upload.php') {
		jQuery("#tab-nextgen > a").html("Photo Gallery");
	}
	
	// Link
	if (location.pathname == '/wp-admin/link-add.php' || location.pathname == '/wp-admin/link.php') {
		jQuery("#linkxfndiv,#linkadvanceddiv").hide();
		jQuery("#descriptiondiv p:first").html('This will be shown when someone hovers over the link, or optionally below the link.');
		jQuery("#namediv p:first").html('Example: Nifty band websites');
		jQuery("#addressdiv p:first").html('Example: <code>http://BandPress.org/</code> don\'t forget the <code>http://</code>');
	}
	// Categories
	if (location.pathname == '/wp-admin/categories.php') {
		var bpCats = ["Bio","Blog","News","Featured","Newsletter","Photos","Playlist","Shop","Video"];
		jQuery("a.row-title").each(function (i) {
		   var text = this.innerHTML.replace(/^\s+|\s+$/g,"");
		   text = text.replace(/—\s\s/g,"");
		   if(jQuery.inArray(text, bpCats) > -1){
		     jQuery(" ~ div.row-actions", this).css('visibility','hidden');
		     jQuery(this).attr('href','#');
		     jQuery(this).parent().siblings(".check-column").children().css('visibility','hidden');
		   }
		});
    }	
});
